📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

How to Never Hit Your Claude Session Limit Again

Nate Herk | AI Automation24:50

Transcription

If you use Claude, this video is going to save you money today. Hitting session limits has been a huge issue lately across the entire community. So, today I'm going to show you everything I know about how to make sure you don't hit your limit. I'm going to show you guys a custom token dashboard that I built. I'm going to show you guys custom skills that I've built to help you manage your session limits. I'm going to show you the best free tools that help you reduce the amount of tokens you're sending. And I'm going to show you Enthropic's actual best practices for making sure you don't hit your limit. So, no matter where you use Claude, I'm going to save you money in this video. So, let's not waste any time and get straight into it.

So let's just start at the top here with what is context. Context is basically everything that Claude Code can see at one time. That includes the system prompt, your full conversation, every tool call, every tool output, every file that Claude has read, every skill or MCP server or agent in your project. It's basically all of that kind of stuff. Think of it like Claude's current working memory.

Now Claude Code gives us a 1 million token context window, which is a ton. But before you even type anything in there, you're already burning like 8,000ish because of just startup overhead. So things like your system prompts or your ClaudeMD or your, you know, context files or like I said, MCP tools skills, things like that. And honestly, it could be way more than that 8,000. When I first found out about this, I realized that I actually had like 62,000 tokens just off of a fresh session. So if you haven't already, go into a fresh session, do slash context, and see what you're sitting at before you even send off anything. And that might tell you to delete some stuff or move some things around based on that number that you see because otherwise it could be a lot of invisible tokens that you don't even know are being spent.

And real quick, there's one super important thing that you guys have to understand about how tokens work. And this one thing alone has saved people hundreds and thousands of tokens. So I'm going to insert a clip real quick.

So as I've been optimizing my own token management, I think that what's really important to realize first is how tokens actually work. Because once you realize how Claude uses tokens, it makes it very clear how you should actually reverse engineer the way that you work in order to use less tokens. So a token is the smallest unit of text that an AI model reads and charges you for. It's roughly one token is one word, but that's not explicitly true. Kind of just a good baseline. So every time that you send a message, Claude rereads the entire conversation from the beginning. And all of those are tokens that it's charging you for. So message one, it will read it, then it will read its reply, and then message two, and then the reply all the way up to your latest prompt. And it does that every single time. And I think that alone is a huge light bulb moment for a lot of people. This means as you're having a conversation with Claude, your cost is compounding, not just adding, it's exponentially growing. Meaning message one might cost 500 tokens, message 30 costs 15,000 because it's rereading everything before it. One developer actually tracked a 100 plus message chat and found that 98.5% of all the tokens were just spent rereading the old chat history in the session. Like that's a huge waste. Now yes, the argument has to be made that well it needs the context and it needs to understand what we're doing. But still 98.5% is crazy. So take a quick look at this graphic here. Along the x-axis we have message number and as it increases you can see that we have our per message cost and our cumulative tokens increasing. But it's not linear. It's basically each message is rereading all of the past ones, and it has to count that in. So message one could be 500. Message 30 could be 15,500, which is 31 times more. And then after 30 messages, you might already be at almost a quarter million cumulative tokens.

All right, cool. Glad you guys know that. Now, let's get back to the video. Which leads us into context rot. And in my mind, I basically think of context rot as a fancy word for AI dementia. Because this basically happens as your session grows and the model's performance starts to degrade because its attention gets spread across every single token, every single message that has been sent. And basically, it starts to get really distracted. It starts to forget things. It starts to contradict itself and like edit files without reading them first. And it gets very vague and just noticeably worse. And the statistics actually show us that retrieval accuracy drops from 92% at 256,000 tokens all the way down to 78% at a million tokens. So even if you can fill up your a million token context window, the model is going to be measurably worse at finding what it needs inside of that window. And now if you think about that, as the model starts to get worse, your token efficiency is going way down because you might have to spend 500,000 tokens for example to get an output that could have taken you 200,000 tokens if the model was performing the way it should be. So try to avoid context rot at all costs across your sessions.

Okay, so next we have auto compaction. Now this will automatically kick in, hence auto compaction around 95% of the way through your window. But all of the community has basically agreed that that's way too late. And I 100% agree because when it auto compacts, you only keep about 20 to 30% of the original detail. So you're losing a ton of important context and the model is doing that compaction at its absolute least intelligent point because obviously the auto compaction fires at like the peak of context rot. So imagine you're packing for a trip. If you were to pack the night before, you'd have time to think and you'd grab all the right stuff and you probably wouldn't forget anything because you'd make a list and you'd check it. But if you're frantically stuffing your bag because you woke up 5 minutes before you have to go, you're probably going to forget your charger, your toothbrush, things like that, and that's basically auto compaction at 95%.

So, the solution would just be manual compaction. I like to do this about 60% of my way through my context window if I'm at like the 250,000 model, which definitely beats auto compaction at 95% every single time. However, there is something that I like to do which I do a lot more often compared to just manually compacting and I'm going to cover that in just a minute here. And by the way, a lot of these diagrams that you might be seeing right here are from Anthropic's article and I thought that they were just really good. So, wanted to chuck them in here.

But anyways, speaking of Anthropic's article, this next one was in here, this next kind of like section. And I really liked the way they put it. So, basically they said after every single time that Claude responds to you, you basically have five options. The first one being to continue, which means you just respond, you send another message. And it's very natural and it's easy to get in this loop of just continuing. And then you have slash re which lets you jump back to a previous message and drop everything after it. So that's very cool. You also could slash clear, start completely fresh. You could slash compact to summarize the session and replace the history with that summary. Or you could shoot off messages to a sub agent. So basically delegating the work to a fresh context window and then you get back some sort of end result.

Real quick guys, I know that we're about to cover a ton of information in this video. So, I put all of this that we're about to talk about in a full resource guide that you can access for completely free. The link for that will be down in the description. Join my free school community and that's where you'll be able to get this doc, like I said, for completely free and every single other free resource that I've dropped with all my YouTube videos. So, I'll see you guys over there. Let's get back to the video.

So, let's kind of dive into some of these because once you start to understand which ones you should use in which scenario, it could be a game changer for you. So, slash re, which is the number one habit that Anthropic recommends. Now, I've been doing this a lot manually, not using the actual slash re feature, but I'm definitely going to start using this feature because basically you can double tap escape or you can run /re and it lets you jump back to any previous message in your session and everything at that point after gets dropped, which is obviously huge for the context. And it's a lot more powerful than you may think because most of the time when Claude does something wrong, and I do this a lot myself admittedly, I will just say something like, "That didn't work. Try this instead." And then Claude will try something else. And a lot of times that works. So you think, "Okay, there's nothing wrong with what I just did." But if you think about it, that failed attempt, that broken code, whatever it did wrong, the wrong approach, all of that is still sitting in your context and it's still being read every time and it's just polluting your future responses. Now, I do think that there's an argument to be made about the fact that if you leave stuff like that, it's able to read through and it's able to learn and it's able to not make that same mistake again. But I think there's different ways that you can essentially teach Claude not to make the same mistake twice that is more effective or more efficient with your tokens than just, you know, leaving it in there. Maybe you just have a decision log or maybe you just, you know, prompt it better next time, things like that. So rewinding is better because now your context is clean. And when you do /re, there's also a summarize from here option in that menu which basically creates you a handoff message, which is, you know, a note from Claude's future self to its past self saying, "Here's what we figured out. Do it this way."

Okay. So now let's talk about compact and clear. So the rule of thumb kind of from like a documentation standpoint would be if you're starting a new task do /clear and if you're continuing the same task do /compact. And honestly I kind of disagree. I don't use /compact at all anymore. What I actually do is essentially my own version of it. Um, if I'm running Opus with 1 million token context window, if I cross around 120,000 tokens, so about 12%, then I will just say to Claude, "Hey, give me a full summary of everything that we've done and the current status of what we're about to do next." And then I just take that summary and I do a slash clear, paste it in, and I keep going. So, I basically just get to reset, and it feels like I didn't reset because I already have all that context. It already, you know, it points to any plan files or decision files or task lists that were created. And that's also very key. If you're losing all that conversation history, you need to make sure you're storing data somewhere. So, like I said, tracking sheets, activity logs, task lists, things like that. That way, even if you reset a session, it doesn't feel like you reset. It's kind of just like if you want to close out of all your Chrome tabs, but you still have like all of your bookmarks that you can get to really quickly. And yeah, that's just kind of the way in my mind for some reason that I think about it. But this one habit alone, if you can actually make that shift and start to do it, it has probably made the most noticeable difference on my actual session limit filling up.

So what I did is I actually built a skill for this. So right here, you guys can see I've got, you know, a long conversation right here. We've got about 224,000 tokens out of the window already been taken up. So I just type in slash session handoff as you see. And now what happens is it basically will go through the whole process of reading everything, analyzing it and giving me the important stuff that I need to know and it spits out this output. It shows where it started decisions locked and what shipped. It shows key files for the next session. It shows the running state verification deferred and open questions and then pick up from here. So basically now I copy this whole output. I do a /clear and then I just paste in that output and I run it. And now this project is basically completely reoriented on what it needs to do. It says, "Okay, I'm ready. Here are all the files I need to read. Here's where we left off. Give me the next task." And now I have a completely fresh context window. So also this skill will be attached in the free school community. Just the free school community has everything that I ever share ever. So just hop in there.

All right. Then we have sub agents. So this is kind of the last main core concept. Each sub agent will get its own fresh context window. It does its own work. It does its own research. It synthesizes results. And then it sends back basically an output to your main session. So if you think about it this like a research intern, if you wanted a research intern to dig through like 50 articles, you wouldn't sit there and watch him or her do it and you wouldn't read the articles as well. You would just say, "Hey, just let me know when you have like a summary or when you have the information I need." And so you're not wasting your headspace with all that extra fluff. You're just getting what you want back. Now, you can just explicitly say things like, "Spin up a sub agent to verify this. Spin up a sub agent to review your codebase and summarize me this." And another cool thing is each time you make a sub agent, they can be using a cheaper model. So spin me up a sub agent to summarize this and make sure that sub agent is using Haiku. And what ends up happening is that sub agent task was so much cheaper than if Opus would have done it. And the performance and quality is about the same. The key there is knowing which tasks to actually be able to delegate.

Okay, so let's move into some other practical tips. So this first one, which sounds really obvious and like why would you say that Nate? That's so obvious. But it's it's huge. Um, it's watching your session limit. Meaning, if you're in the new desktop app, you can see how much session limit you have left. Just watch it constantly. If you have two monitors, have one open on the other tab so you can always watch it. Just being able to actually peek at it every once in a while. It will change the way that you think about the prompt you might send off or should you spin up that agent team or not, you know, things like that. And just be strategic about it. If you're getting close to the end of your session and it's been a long session, go take a walk or take that opportunity to grab a snack or something like that. And on the flip side, if you've got like 50% of your session left and it's going to reset in like an hour or half an hour, then abuse it. You know, try to make that thing hit the limit. Try to spin up agent teams. Try to work on a heavy codebase that you've been meaning to get to. Try to do things that you know are going to eat a lot of your tokens. So, be strategic about when you're doing little productivity workflows or things or when you're doing some deep coding or deep building.

Okay, so this next one's pretty cool. Basically the idea of converting everything to markdown. Markdown is so much faster and so much cheaper for AI models, huge token reduction. So like for HTML to markdown, you're getting like 90% fewer tokens. For PDF to markdown, you're getting like 65 to 70% tokens reduction. For DOCX files to markdown, you're getting about 33% token reduction. So this means you can get roughly three times more content into the same context window. So like a 40-page PDF could actually take up the same amount of space as a 130-page markdown file. And you can just use a tool like Docling or many others to convert these files in seconds because the tokenizers process text really really efficiently. And PDFs and docs and HTML have all of this layout and metadata and formatting noise that the model doesn't need. All the model needs is the content of that doc which is typically just the text. Now, if you need OCR and if you need like vision or something, that's a different story. But if it's text-based, just give Claude the text.

All right. This next one is to use slash by the way or slash btw. This basically opens up a quick overlay for side questions that don't actually enter your conversation history. So, if you're deep into a project and you need to ask a quick question about this project, just do /btw, type the question, and it keeps that context clean, but you can still get your question answered.

Okay. Obviously, this next one is about plan mode, which is huge. Boris Churney, the creator of Claude Code, starts every single session in plan mode. I do the same thing. I'm basically Boris Churney. But the whole idea is if you use tokens upfront to become clear on the plan before you start building, you're not going to have to correct it. And ultimately, it's going to be cheaper in the long run when it comes to, you know, being efficient with your tokens. So that's why I pour effort into the plan first. Get it right and then let Claude one-shot the implementation because it understands what it needs to do and it understands what you want. So, I use things like Ultra Plan all the time or Superpowers all the time. And I will link videos that I made about both of those right up here. I would definitely recommend you check out that Superpowers video first.

All right. And this next one, you know that we couldn't get through a token video without talking about ClaudeMD discipline. So, keep this file under 200 lines, roughly 2,000 tokens, because it loads every single session. So, if it's bloated, you're going to pay for that bloat every single conversation. You only get so much space. So, don't cram everything in there. Only put in there the stuff that you actually need and only the stuff that Claude needs in order to actually do the job well. You can also do things like moving specialized instructions into context files that get routed to or skills that get routed to and that way they only load on demand when they actually are needed. And you could use a Claude ignore file to exclude folders or files that you don't want Claude to actually read from which could be a big big play if you've got like a a massive repo.

All right, as I'm sitting here editing the video, there's one more thing I realized I wanted to say, which was that output tokens cost more than input tokens. So, a lot of people might think that you could say, "Hey, Claude, be super concise and just give me, you know, one sentence responses rather than paragraphs, and that would save you tokens." And in theory, yes. But in the grand scheme of things, that's not what's actually going to be the, you know, deciding factor between if you're hitting your limit or not because there's so many output tokens that are being spent without you even really seeing in your files and things like that. So, you know, there might be I I saw this this caveman plugin that people have been using. I actually saw someone do an experiment and tested how much it really saves tokens and it turns out it wasn't actually as much as people thought because once again, there's so many more output tokens than just what Claude actually gives you back in the window. So, I think it's important to understand that output tokens cost more than input tokens, but just simply saying like be concise isn't really going to move the needle. So, just wanted to throw that out there, too.

So another super important thing is just actually knowing where your tokens are going because that will kind of reverse engineer your brain to think about how you can save them better. So, this is a token dashboard that I built. I'm going to make this repo public and you guys will be able to go access it for completely free. Just join my free school community. The link for that will be down in the description and you'll be able to find this in there and get set up. But basically just shows us things like our sessions, our turns, our input tokens, output tokens, cache read, and cache create, which is important to understand. And if you don't understand what these mean, just look right here. They're pretty simple. But anyways, we can see over the past 7 days or past 30 days what's actually been going on with our token usages across models, across different projects, and across different tools that are being called. And it should give you some interesting insights because right here you can see in my Herk 2 project which is kind of like my executive assistant second brain. You can see I have way more input tokens than output tokens. Now obviously output tokens are more expensive but still this should signal to me that there's something going on here. Like why are all my other projects significantly more output than input but over here I've got, you know, 2 million more input. Why do I think this is because I recently had it read everything and help me reorganize things and help me, you know, like figure out the best way to optimize that project. So, I know that's why, but it's important to go see this kind of stuff.

Now, what else is cool is you can go look at your actual prompts. So, in here, I can see what prompts have actually taken the most tokens, and I can look at this and understand, okay, what did I do here? Did I need to clear my session earlier? Why did I eat up so many tokens here? And how do I make sure this doesn't happen again? So, for example, if I want to open up this project right here, and I can open up this prompt and go to the session, we can see everything that I actually did in here. We can see all the tool calls. So we can see what happened and I could analyze this or even have Claude Code analyze this for me to figure out why this took so many tokens. The sessions tab also shows us all of our different sessions and how many turns and how many tokens. We also have projects so I can see by project how many tokens I'm using and how many sessions I've had. And then I've got a skills section which this really isn't working. It's not exactly super easy to get the tokens per call, but you can see you can at least see how many times your different skills have been invoked. And then also a tips section. Now I haven't really worked too much AI into here, but that would kind of be the goal. But it's going to show you, hey, this file was opened 181 times. This file was opened 166 times. This bash command ran 67 times in the past 7 days. So you might be able to identify patterns that you're not even noticing are happening. So anyways, like I said, GitHub repo in the free school community. All you have to do is take the URL, give it to Claude Code, and say, "Hey, help me set this up."

All right. So before we get into some bigger philosophy stuff about why I don't even think you need to use the 1 million token window model, I want to drop some stats on you guys. So real quick, stat one. A developer ran an analysis on GitHub of 18,000 thinking blocks across 7,000 sessions. Thinking depth dropped 67% as sessions got longer, and edit without reading went from 6% all the way up to 34%. So basically, the longer the session, the lazier and sloppier Claude gets. I know we know this, but that stat really makes it stick.

Okay, stat two. One user went from spending $345 bucks a month on tokens to $42,000 a month. And the output quality stayed completely flat. So, same work, same result, but because of the token habits, I don't know what happened to this poor guy, but the cost increased so so much and the quality didn't even bump up. So, bad context management.

Stat three, the retrieval accuracy thing that I mentioned earlier. 92% at 256k tokens drops to 78% at 1 million. So just because you can fill a million tokens doesn't mean that you ever should.

Which leads very nicely into the next point about why I barely use it. So when people hear 1 million, they think that they have a million tokens to play with and then they start getting wasteful. They stop using sub agents. They stop being intentional. They offload everything into one giant session because they think they have room and because the progress bar, you know, depending on where you use Claude Code, is only halfway. So I might as well just keep going. But the rules of how AI models work have not changed. Bigger window doesn't mean better output. It just means more room for context rot and the more room for the model to get distracted and more room for, you know, all this kind of stuff. That 1 million is just insurance. It's not a goal to fill it at all. Really, the first like, you know, 0 to 20% of your session is prime time. And that's when the ClaudeMD is the freshest. That's when the model is the most primed. When I use Opus with a million context, I never ever go above like 120k tokens or about 12%. And that's not necessarily because if you get to 200k, it's going to be horrible. It's just because like in my mind, I told myself, "Okay, 120K, that's my number. I'm going to get in the habit of always just clearing and just get in this habit of, you know, storing things and having tracker sheets and just doing all these best practices so that I know I'm always just handling my session well." And by the way, on this whole 120K token thing, I mean, take it a little bit with a grain of salt because what's going to happen is there might be times when you're working on a big coding project or you're, you know, using hyperframes to edit a video and you're going to go past 120 and you don't want to stop at mid-run because it's in the middle of outputting a bunch of tokens. But to me, that's just kind of my baseline. And if you guys are wondering where I got that, it's because when we only had 200,000 tokens in the context window, I was basically always clearing and compacting. When I got to about 60% which was about 120,000 tokens. So I've always just kind of kept that as the baseline of when I get to that point, I'm going to try to do what I can to reset, write back memories, write back progress, and then keep going on a fresh model.

You can also do things like session chaining. So if you have a big project, you don't have to do everything in one session. Chain them together. Have one for discovery where you can have Claude read through PDFs and read through the codebase and, you know, just give you a nice summary doc. And then you can move all of that information into a planning session where it reads that and it creates a plan. And then you take that finished plan and you move that into your execution session. So I think you guys get the point. It's kind of like an assembly line. Each session has a specialized task. So like I said, it's really just important to start building these habits. So if you're just starting out, maybe just stick with the 200k context window for a little bit. Learn the discipline, learn how to be intentional, and then you can graduate to 1 million if you even need it. You might even realize that you don't even need it. Because I think that the more space you have, it just invites worse habits. Like if you're trying to lose weight, but you always have cookies sitting on your desk. You're just going to be tempted all the time to grab more cookies. So why not just throw the cookies away if you don't need them?

Now, there are also lots of other frameworks that other people have already figured out that you can just put into your project. So I'm going to link this tweet in the description of this video. It's got 10 different GitHub repos to spend 60 to 90% less tokens in Claude Code. I'm not going to go over all of these here. I'm going to run through them real quick. But what's important to keep in mind is it's not like you want to put all 10 of these into a project and just let it run because that's not really going to work. Each one of these does a different thing. They they they tackle context management and token reduction in different ways. So the key is analyze them, maybe even feed them all into your project and say, "Hey, based on what we're doing here in this specific project with this specific end goal, which one of these repos would probably help us out the most?" Now, if any of these seem particularly interesting to you guys, let me know in the comments and I'll make a full deep dive tutorial on it. But for now, let's just take a look real quick. We have Rust token killer, which is a CLI proxy that filters terminal output before it hits your context. We have context mode, which sandboxes raw tool output into SQLite instead of dumping it into the context. So, we've seen some really nice statistics here with context mode. We've got code review graph. We have token savior. Here's the caveman one that I was talking about that makes Claude talk like a caveman. We've got Claude token efficient which is one ClaudeMD file that keeps responses terse. We've got token optimizer MCP. We've got Claude token optimizer another token optimizer and Claude context. So once again you don't need all 10. Pick two or three based on your workflow. Here's some little bit of a decision tree or some guidelines on how to use them. But like I said, the best way to do it is give Claude Code these repos and have it explain in natural language what each one's doing and which one would fit your specific project best. So let me know if you guys want me to deep dive on any of those, but I thought this would be a cool resource to check out. The link will be in the description of this YouTube video.

And the last thing I wanted to leave you guys with is if you have a bad session, if you feel like Claude's gone off the rails, but maybe you're not even, you know, near that context rot sort of area, but you're just feeling like you're repeating things or whatever, just clear it or just open up a new one. Just sometimes just open up a new one and just start fresh. Both for your sanity, but also for that Claude session sanity. So that is what I've got for you guys today on managing your session limits better than 99% of people using Claude Code. If you do these things consistently, I guarantee you, you will get more out of your Claude Code subscription than a lot of people will. So, now I think you're ready to dive deeper into those 18 hacks that I've talked about, and you can do so by watching this video that I will put right up here. And I hope to see you guys over there. But if you enjoyed this one and you learned something new, please give it a like. It helps me out a ton. And as always, I appreciate you guys made it to the end of the video and I will see you in the next.