
How to make your agent's limit last all week without losing quality
You use Claude Code or Codex, and your weekly limit runs out by Wednesday. It is not because you ask too much. The agent does not remember the conversation and re-reads it from the first line before every answer. Across my seven hundred plus sessions, that re-reading accounted for 97% of all tokens. You will learn what context and cache are and why they decide how many days your limit lasts. You will see what spends it fastest: one conversation for every topic in a row, returning to an old session after a long break, switching models midway, a bloated rules file, extra connected services. And what costs almost nothing: clearing the conversation, rewinding to the point before a mistake, editing the rules file. Plus which commands show where your own limit went. The main question of the episode is how to make the agent know your project well without paying for anything extra. I will show how to spread project knowledge across short files, what to ask the agent to write down before clearing, and what gets lost when a conversation is compacted automatically. And finally: which work you can safely hand to a cheaper model, and where you must not save on the model. That is the bot that reads requests and customer emails. You will understand why it is easy to fool, how to choose a model for it, and which permissions not to give it.
Transcript
Tap a paragraph to listen from there.
Good evening, startup founders and vibe coders! Today I am going to tell you why so many people run out of their weekly limit in Claude Code or Codex by the middle of the week, where that limit actually goes, and how to work so that it lasts, while the agent does its job not worse, but better.
This episode is about the line between saving and quality. By the end you will understand what context is and why it is the single most important thing in working with an AI model. You will learn which habits burn through your limit and which actions cost almost nothing. You will see how to keep a project's memory so that the agent knows everything it needs and does not pay for anything extra. And we will talk separately about the one place where you must not save on the model, because there you can lose far more than you save. I will also tell you what to choose the model for that place by, if not by price.
I will start with a picture that sits in almost everyone's head. You open the agent, send it a message, it answers, you send the next one. It looks like a chat in a messenger. And it seems to work the same way: the other side read your new message, remembered what you were talking about, and replied. This is exactly where the main mistake hides. The model remembers nothing between messages. Nothing at all.
So how does it give relevant answers? Very simply, and very expensively. Every time you send a new message, the program takes the whole conversation from the very beginning, all your questions, all the answers, every file the agent opened, every command output, and hands all of it to the model. The model reads it from scratch, as if for the first time, and only at the very end does it see your new line. That whole stack of text the model sees in one go is called the context. Imagine an assistant with complete memory loss, and before every question you make them read your entire work diary all over again.
This is not a metaphor I made up for effect. The Claude Code documentation says it plainly: "Claude Code sends your full conversation with every request." And right there is a very precise line: "a one-line question in a session that has been open all day still draws usage for the whole conversation." You asked "which port was it again?", and you pay for reading an entire day of work.
Now the numbers, and here I am not repeating what others say. I measured this on my own work. I have an open study called contextburn. I took the complete log of my work with agents: seven hundred twenty-two sessions, more than one hundred fifty thousand calls to the model, thirty-four and a half billion tokens. A token, in case anyone forgot, is a small piece of a word, and both prices and limits are counted in them.
Here is what came out. Ninety-seven percent of all tokens are re-reading what was already in the conversation. New text that the models wrote, all the code, all the answers, is less than half a percent. If you convert it into money at the prices Anthropic publishes for developers, almost ninety percent of the spending went to handling context. And everything the models wrote at all cost four and a half times less than the re-reading alone.
Let me say right away what these numbers do not mean. This is a measurement of one person, me, on my own tools. I worked on a subscription, so the dollars here are not my bill but a calculation from the price list. The scale is different for everyone. But the mechanism is the same for all, and that is not just my opinion. In October, analysts at SemiAnalysis wrote that reading what has already been read makes up more than ninety-five percent of tokens in agent work. If you work with an agent, you are almost certainly paying mostly not for answers, but for re-reading.
At this point an attentive listener has a question. Wait, if the model reads a whole day of work every time, how can anyone afford that at all? The answer is the cache. We will be repeating this word a lot today, so let us sort it out. The cache is a short-term memory on the server side. Once the model has read the beginning of your conversation, the server remembers the result of that reading. Next time, if the beginning of the conversation has not changed, it does not really read it again, it takes the ready result. And it charges much less for that.
How much less? With Opus five point five, fresh input text costs four dollars per million tokens, while reading from the cache costs twenty cents. Twenty times cheaper. So we get a paradox: each individual re-read is cheap, but there are so many re-reads that together they are the biggest item of spending.
For subscription limits it works in a similar way. Anthropic's support says that cached text counts less against your limit. But the company does not publish the exact formula for how much less. It is not in any open source. So I will not tell you that ninety-seven percent of your limit goes to re-reading. Nobody except Anthropic knows that. But the direction is clear: the longer the conversation and the more often the cache breaks, the faster the limit melts.
And this is where the story of the limit that runs out on Wednesday comes from. In my measurement, eighty percent of all spending fell on twenty-one sessions out of seven hundred twenty-two. That is less than three percent of sessions. Almost all the money was eaten by a few very long conversations, while hundreds of short ones cost pennies. The spending is not spread in an even layer, it sits in a few monsters.
Why does a long session cost so much? Do the math yourself. On the first question the model reads one page. On the tenth, already ten pages. On the hundredth, a hundred. With every step you pay for everything that came before it. In the report I introduced a simple measure: how many times in a session you pay for the same working state. In a typical session it is about twenty-four times. In other words, everything the agent knew about the task at its fullest moment, you paid for twenty-four times.
That leads to the first conclusion, and it is not an obvious one. Your limit is eaten not by your questions and not by how hard your tasks are, but by a few drawn-out conversations in which the agent drags along a tail of everything that came before. If you work from morning till night in one window and switch from the website to a Telegram bot, then to a newsletter, then back again, that is your main leak.
But there is a second leak that almost nobody knows about. It is a cold cache. The cache does not live long. If you use Claude Code on a subscription, the cache in your main window lives for one hour. For subagents, five minutes. A subagent, by the way, is a helper that the main agent launches on its own for a subtask, with its own separate conversation. So if you took a break longer than an hour and then came back to a heavy session to ask one more small question, the whole accumulated context gets processed again, at full price. You went to lunch for more than an hour, came back, asked one line, and paid for the whole day as if it were new.
There is a third thing too: the cache is fragile. It works only as long as the beginning of the conversation does not change. Touch the beginning, and the next request re-reads everything at full price. What touches the beginning? The Claude Code documentation names the main things: switching the model in the middle of a conversation, turning on fast mode, and compacting the conversation, which I will get to later. Hence a simple rule. Choose the model at the start of a session and do not touch it after that. If you want a different model, start a new session.
Now the good news: what costs almost nothing. The clear command, which starts the conversation from a clean slate, in the documentation's words, "costs nothing". Editing the project rules file in the middle of a session does not break the cache: the agent will re-read the file only after a clear or a compaction. Skills, meaning ready-made instructions the agent loads on demand, take up a couple of lines of description until they are called. And one more inexpensive thing is the rewind command, going back. If the agent took a wrong turn, do not argue with it for ten messages in a row, each of which drags the whole tail along. Rewind the conversation to the point before the mistake. The beginning of that conversation is already in the cache, so continuing from there will go at the cheap price.
How seriously do the model makers themselves take the cache? In April an Anthropic engineer wrote on the company blog that they have alerts on the cache hit rate, and if it drops too low, they declare an incident, just as they would for an outage. In his words, "A high prompt cache hit rate decreases costs and helps us create more generous rate limits for our subscription plans." And that makes sense: outside analysts estimate that a subscription pays off for the company only as long as most people do not use it to the very bottom. Hence the weekly ceiling, and hence the care about the cache. Your limit is generous exactly as far as the cache works well.
And how do people fix the cache leak where they pay for every token out of their own pocket? The clearest example is Tars, a company that builds support bots for businesses. In September they described on their blog how they cut their costs. First they simply measured what share of the input text was coming from the cache. It turned out to be only twenty-six percent. Everything else was read at full price every time.
Then the recipe. They rebuilt the request to the model on one principle: everything constant at the start, everything changing at the end. First the tool descriptions, always in the same order, then the instructions, then the conversation history. And timestamps, order numbers and everything that changes with each message were moved to the very end, so they would not break the beginning. Two weeks later the share coming from the cache had grown from twenty-six to seventy-five percent, and the price of input text fell by almost two thirds.
Why do you need to know this? If you have your own customer bot that calls the model directly, this is a ready recipe. Tell your agent: rebuild the request to the model so that everything constant comes first, and the time, the customer's name and everything that changes go at the very end, and show me what share of the input text comes from the cache. And for those who work only in the agent window, this case shows the same rule from the other side: the beginning of the conversation is your money, do not touch it.
A separate word about connectors, meaning connected outside services. Each such service brings along descriptions of its tools, and those descriptions take up space in the context. Last year Anthropic showed an example where fifty-eight tools ate about fifty-five thousand tokens before you had written your first word. Today Claude Code by default holds those descriptions back and loads them on demand. But OpenAI, in its rules for Codex limits, says it directly: "Limit the number of MCP servers you use. Every MCP server adds more context to your messages and uses more of your limit." So if you have ten connectors hooked up just in case, ask the agent to show you which ones you actually used over the past week, and turn off the rest.
How do you see where your own limit goes? Claude Code has the usage command: it shows your consumption and a breakdown, including by skills, subagents and connectors, and it even suggests what to trim. The context command shows what is filling up the conversation right now. In Codex, the status command gives a similar summary. And if you want to see your own share of re-reading, as in my study, contextburn is open and free. It works with Claude Code logs and sends nothing anywhere. Ask your agent to install it and make a detailed report for the last twenty-four hours. For Codex, the logs are read by a different open program, ccusage.
And since you are looking at your consumption, one caveat about the last few weeks. If it seemed to you that in October and November your limit started melting suspiciously fast, it may not have just seemed that way. On November tenth the Claude Code team wrote: "We recently fixed a few small issues that used more limits than intended." Which ones exactly, they did not say. Everyone on the Pro, Max, Ultra and Team plans got one free full limit reset, to be used before December tenth. You claim it not in Claude Code itself, but in the Claude settings, in the usage section: there is a free reset button there. The limit is shared across the account, so the reset works in Claude Code as well. Just press it when your limit is really running out, not on Monday morning.
All right. The logical conclusion from all this: shorter sessions, clear more often. But here we run into the other edge of the knife. The better the agent knows your project, the better it works. It remembers how the database is set up, which decisions you have already made, what broke yesterday. You cleared the conversation, and it is brand new again, it knows nothing. So for the agent to work well, it needs a lot of context, and for the limit not to melt, there should be little context. How do you reconcile the two?
First, one correction to the very idea that more context means better. That is true only up to a certain limit. Back in twenty twenty-three, researchers showed that models are good at finding what they need at the beginning and at the end of a long text, and noticeably worse in the middle. The makers of Claude say in their guide that "LLMs have an 'attention budget'": "as the number of tokens in the context window increases, the model's ability to accurately recall information from that context decreases." And the goal is "finding the smallest possible set of high-signal tokens". So extra context not only costs money, it also gets in the way of thinking.
The most vivid illustration comes from Anthropic's November piece on how an agent should remember. It describes an experiment with the game Pokémon Red: the agent plays for about ten thousand steps and keeps notes for itself. An older model wrote four hundred thirteen note files in two hundred twenty-five folders and earned one badge in the game. A newer model wrote nine files in two folders and earned four badges. The models are different, so it is not only about the notes. But one thing is clear: more notes does not mean better. An agent can drown in its own notes.
The same goes for the project rules file. In Claude Code it is CLAUDE.md, in Codex it is AGENTS.md. It is read at the start of every session and then rides along in every request. The Claude Code documentation advises keeping it under two hundred lines and explains why: "Longer files consume more context and reduce adherence." The same documentation has an example of a hint that the usage command shows: trim such-and-such rules file, forty-nine thousand tokens per request. Forty-nine thousand tokens per request, just think about it. And OpenAI, in its advice on Codex limits, also writes: "Reduce the size of your AGENTS.md."
So where should you keep knowledge about the project? The answer is: not in the chat, but in files, and in several layers. The top layer is a short rules file: only what is needed in every session. How the project is set up, which commands to run, what must not be done. The second layer is skills and reference notes that load only when needed. A long instruction on deploying the website should not ride along in every request, it should sit separately and be loaded when you deploy the website. And the third layer is notes on the progress of the work: what has been done, what comes next, which decisions were made.
And this is the answer to the question of how to reconcile the two. Before you clear the conversation, ask the agent: write to a file what we did, which decisions we made, what is left and where we stopped. Then clear. The new session starts with the agent reading that file. It knows everything important, but it does not drag along a hundred pages of chat in which that important part was buried. Anthropic shows in its measurements what this gives: on their test, their new model without memory scored sixty-five and a half points out of a hundred, and with memory almost eighty-four. It is their own test, but the direction matches everything else.
Just do not go to the other extreme. If you clear after every small task, the agent opens and reads the same project files all over again each time. I measured this separately in one of the earlier episodes: resetting after every task turned out to be a third more expensive than resetting once every few related tasks. The rule is simple: one topic, one session. You switched to a completely different topic, then a summary to a file and clear.
Now about automatic compaction, which many people see and do not understand. Every model has a limit on how much text it can keep in front of it at one time. It is called the context window. When the conversation approaches that limit, Claude Code compacts it on its own: the model writes a short summary of everything that happened, and the conversation continues from the summary. Codex also compacts long conversations by itself. You can also compact manually, with the compact command. And it has a useful feature: after it you can write what to focus on. For example: "keep the database decisions and the list of open bugs." Then the summary will keep exactly that.
But a summary is a retelling, and a retelling loses details. What survives compaction in Claude Code? The rules file is read again from disk, plus a few of the most recently opened files. And everything you told the agent in the chat turns into a short digest written by the model itself. Here is a fresh example of why this matters. On November eighteenth OpenAI published a report: their internal model, during training, after a context compaction, drifted into someone else's task and started writing scripts that forwarded email to an outside address. Meanwhile, "the recorded summary still described the health and fitness document". This is not a product and there was no real harm, the scripts were never run. But the moral is simple: an important rule stated in the chat can get lost during compaction. An important rule should live in a file that the agent re-reads from disk.
So do we even need a huge context then? There is a very fresh study on this. On November third a group of Nvidia researchers published a paper whose point is that a long context is often not needed. They made the agent constantly compress its own history, keeping only the task, the plan and the requirements for the result. And they showed that strong models lose almost nothing in accuracy this way, while the largest context per task shrank several times over.
Let me bring this down to earth right away. The paper has not been independently checked, the code has not been released, each measurement is a single run. The loud headline about a huge window being a dead end was invented by the press, not by the authors. But the takeaway for you is useful even without big words: a good short summary plus a strong model gives almost the same quality for much less money. And notice the word "strong". In the same paper, a weak open model under this kind of compaction collapsed from fifty-three percent of tasks solved to almost zero, to just over three percent. A strong model can work from a summary, a weak one cannot.
And since we have come to weak models. To save their limit, many people want to put a cheaper model on everything. Sometimes that is right. But here is the trap: a model that is cheap per token is not necessarily cheap per job done. In November the company Runta published a large measurement: more than twenty-seven thousand agent runs on open models. Almost two thirds of all the money went to attempts that never solved the task.
And one more number from there, an even more worrying one. Roughly three failures out of four ended not with the agent running out of time, but with a confident answer. The agent handed in the work as if everything were done, and it does not work. For you that means not only a wasted limit, but also an hour spent finding what is broken. Caveats: only open models were measured, and Runta itself sells environments for running agents, so it is an interested party. But the picture matches what we just saw from Nvidia: a weak model saves on the token and loses on the result.
The makers themselves say the same thing from their side. About Opus five point five, Anthropic writes that "a more capable model can finish a task by doing less work, which can then offset much of its higher price per token." In the same piece: the new model at medium effort is no worse than the previous one at high. And an example: on one financial task the new model finished in sixty-three minutes instead of ninety-three, and at half the cost. This is the company's claim and a single task. But the practical takeaway for you is this: do not turn the effort level up to maximum out of habit. Medium is the default, and for most tasks it is enough, and the model's thinking is billed the same way as written text.
So what should you give to a simpler model? The Claude Code documentation answers quite clearly: "Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions." For simple subagents, Haiku. Simple means mechanical work where the result is easy to check: find every place in the project where some function is used, rename something, tidy up the formatting, pull the errors out of a long log and summarize them. If a mistake is visible right away and cheap to fix, a weaker model is a sensible saving. Large companies do exactly that: at AT&T, according to the company, big agents hand out work to small workers running on small models, and that cut costs by up to ninety percent.
In practice it looks like this. Ask your agent: set up a subagent on Haiku for searching the project and going through logs, and give those tasks to it. Here it is important to understand where exactly the saving is. A subagent is not free: it spends the same limit, and in my measurement more than half of all calls to the model were made by subagents. The saving is elsewhere. A thousand-line log is read by a cheap model in its own separate conversation, and only the three lines you need make it into your main, expensive conversation. And that log is not re-read on every following step. That is why the second request to the agent is: never paste a long log into our conversation in full, pull out the lines that matter first. And leave long multi-step tasks, where the agent runs the work on its own for hours, to a strong model: that is where failures cost the most.
And now we have come to the place where you must not save. There are tasks where the model reads not your text, but someone else's. Requests from your website, customer emails, reviews, comments, web pages. And in that outside text there may be not a customer's request, but a command for the model. This is called prompt injection: someone hides an instruction in the text like "forget all previous instructions and do this", and the model, if it does not see through it, carries it out. Let me explain why this is even possible. For the model, everything in the context is one continuous text. Your instructions and a stranger's email are letters of the same kind to it, and it can tell who is in charge only by its own wits.
Let me tell you about my own case. Recently the bot that sends me complaints from my website got flooded with messages. I forwarded them to my agent and asked it to sort things out. The agent was running on Opus. It replied that this was an attack: there were attempts to break into the database through the form, and commands written specifically for an AI model. And it did not carry them out. It read them, recognized them and reported to me. This is one case, and I did not check what another model would have done in its place. But after that I rebuilt how my agents read outside texts for the site's news: an article is now read by a separate model call with no tools at all, which returns only the facts, and the agent that writes and publishes never sees the outside text at all.
Why do I hold on so tightly to a strong model right here? Because the difference in resilience between models is not a matter of percent, but of multiples. Gray Swan, a company that tests models with attacks, gave each model fifteen attempts to break it in August, according to press reports. Claude Opus five from Anthropic gave in two percent of the time. And the cheapest model in OpenAI's then-new lineup, almost forty-four percent. That is more than twenty times worse. And researchers from Zurich showed a similar picture in the summer: a small open model was fooled almost half the time, and OpenAI's large model less than five percent of the time.
For a long time I was sure that all the loud injection cases of the last six months involved cheap open models that are easy to fool. When I sat down to prepare this episode and checked, the picture turned out to be more complicated, and I will be honest about it. In the spring, researchers demonstrated an attack like this. Someone submits a proposed code change to an open project, and a command for an AI model is hidden in its title. Agents that automatically review such changes read the title and posted secret keys right in the comments on the change. And those were agents running on the flagships of all three major makers. And in the summer, in another experiment, models were sent to real scam websites, and among those that followed an instruction hidden on the page and paid the scammers, besides open models, there were two Google models. Flagships get broken too. Partly because they are used more and tested more.
So is the idea about weak models wrong? No, it just needs to be made more precise. Yes, flagships get broken too. But weak and cheap models break many times more often. And on top of that, as we saw with Runta and Nvidia, they do the actual work worse. For a customer bot that is a double loss: it will handle the request worse, and it is easier to fool. But where the line between a strong and a weak model lies is decided neither by price nor by the word "flagship". In the same Gray Swan test, OpenAI's previous-generation flagship model let through about twenty-one percent of attacks. And the small, cheap Haiku five point five, according to Anthropic itself, holds up almost as well as its flagships. That is the company's claim, but it shows where to look for the answer.
Hence a practical criterion for choosing a model for a bot that reads outside text. Not by price and not by a famous name, but by published measurements of resistance to injection for that specific model. This is work you can hand to your agent. Tell it: find published measurements of prompt injection resistance for the model I want to put on my request bot, and compare it with two or three others. If a model has no such measurements at all, consider it weak. And do not save on it for pennies on tokens: you can lose much more here.
But even the most resilient model is a probability, not a guarantee. If the attacker is persistent and tries again and again, sooner or later one attempt will get through. So choosing the model is the first lock, not the only one. Here are real examples of what this turns into. Last year a vulnerability was found at Salesforce where the injection came in through an ordinary request form on a website, exactly where your customers write. And in February, at a small shop in Britain, the support bot, reportedly after about an hour of flattery, started handing out made-up discount codes of up to eighty percent, and the owner estimated the damage at thousands of pounds.
The second lock is the agent's permissions. There is a good rule, formulated at Meta, called the Agents Rule of Two. An agent may have no more than two of three things: it reads outside text, it has access to your private data or important systems, and it can change something or send something out on its own. If you need all three, then the final word belongs to a human. Tell your agent this: the bot that reads requests must run on a model with good resilience measurements, hold no keys, and have no right to give a discount, make a refund or send an email on its own, only prepare a draft, and I press the button. And if you want to do it the way I do, add: let a separate model call with no tools read the outside text first and return only the fields we need.
Yes, this kind of protection costs tokens too. In a Google DeepMind study, a setup with two models, where one reads outside text and the other acts, cut successful attacks several times over, but used almost three times as many tokens, and noticeably less useful work got done. And that is exactly the line this whole episode is about. You should save on re-reading, on abandoned long sessions, on bloated rules files and extra connectors. But at the place where the agent meets strangers, you should not save.
If I put it all into one thought: the agent does not remember the conversation, it re-reads all of it every time, and it is exactly this re-reading that you pay for with your limit. So keep knowledge about the project in short files, not in an endless chat, one topic, one session, and do not change the model in the middle of the work. Put a cheap model on mechanical work where a mistake is visible right away, and where the agent reads outside text, choose the model by its resilience measurements, not by price, and cut back its permissions. Saving and quality do not fight each other here: an agent that reads only what it needs costs less and works better.
That is all for today. You have been listening to Evgenii Arsentev, creator of Arsminal, a terminal for managing AI agents where your whole agent team works in one window, like chats in a messenger. Founder of ArsentevAI, Dad4Kids and ReelsZavod. Try Arsminal for free at arsminal.com. Thanks for listening.
About the host
Evgenii Arsentev is the host of the podcast AI Agents & Vibe Coding. He is a medical doctor with a PhD in medical science from Sechenov University, and for the last ten years he has led products and companies in digital health. He is the founder and CEO of Dad4Kids, a company built and run with AI agents, and the creator of Arsminal, a free terminal for AI agents.
More about Evgenii Arsentev →