Every time you send Claude a message, it reads the whole conversation again. Your question is the smallest part of what it reads, and in a long session most of your usage goes on that re-reading.
In Claude Code, a conversation can now grow to almost a million tokens before anything gets summarised. Each file read, search or command is a round trip that carries the whole conversation. In a 900,000-token conversation, a task with 50 rounds of tool calls re-reads 45 million tokens before Claude writes anything new. The same task in a 150,000-token conversation re-reads 7.5 million.
A Pro plan has a five-hour limit and a weekly limit, shared by chat, Cowork and Claude Code, and both count those tokens: a one-line question in a session that’s been open all day still draws usage for the whole conversation. (On the API, the 900,000-token version costs about $9 (NZ$16) on Opus 5.5.) The prompts in grey boxes are ready to copy.
What you need to know first
My lab Inside the Context Window shows each of these in action.
Models read and write in tokens, pieces of words (in English, a token is about three quarters of a word). The context window is how much the model can hold at once: a million tokens for the current models, about eight novels.
The model doesn’t remember anything between two messages. Each time, the app sends it everything again: its instructions, its tools, the whole conversation so far, then your new message. In Claude Code, each round of tool calls is one more request like that. So a message costs more the longer the conversation is.
When a request starts with exactly the same text as one Claude processed a few minutes ago, Anthropic’s servers reuse that work. That’s prompt caching, and cached content counts less against a plan’s limits (on the API, a cached token on Opus 5.5 costs a twentieth of a fresh one). The match is exact, from the top: change one layer and everything under it is processed again.
- Instructions and toolsClaude Code's own instructions and the tools Claude can use.
- Project contextCLAUDE.md and memory, loaded when the session starts.
- The conversation so farEvery message, answer, file read and command output.
- Your new message
The cache also expires. On a plan, Claude Code asks for an hour for your main conversation. Come back later and the first message reads the whole conversation as fresh input, so it counts as much as dozens of messages with the cache warm.
Effort is how hard Claude thinks before it answers. The current models always think, and effort sets how much. Thinking counts as output, the expensive kind (five times the price of input on the API).
On a Pro plan: the short list
Pro is the smallest paid plan, at $20 (about NZ$36) a month. Max gives five times as much usage, and Ultra ten. These are the changes that stretch a Pro plan furthest, roughly in order.
- Make Sonnet 5.5 your default model. Claude Code starts on Opus 5.5, and Anthropic says Opus costs several times more per turn, while Sonnet “is the right choice for the large majority of coding work”. Pick Opus at the start of a session when the task needs it, or let Sonnet consult it with the advisor (below).
/clearbetween tasks, and compact earlier with/autocompact 500k. Compacting is when Claude summarises the conversation and carries on from the summary.- Keep effort at medium (the default) for routine work, and raise it for the hard bug.
- Give the reading to a Haiku subagent: a separate Claude with its own context, which hands back a summary.
- Start the five-hour window on purpose. It starts with your first message and resets five hours later, so a quick question at 8am gives you a fresh window at 1pm.
- Check
/usageonce a week. It shows what eats your usage, andfapplies the fixes it can. - Leave Fable 5.2 and fast mode off. On a Pro plan, both are paid with usage credits, real money on top of the subscription. If you turn usage credits on, set a monthly spend limit.
- When you hit the limit, Claude Code can wait for the reset and carry on by itself (
/rate-limit-options). If you hit it every day, that’s what Max is for.
The first two go in your user settings, ~/.claude/settings.json:
{
"model": "sonnet",
"autoCompactWindow": 500000
}
In chat and Cowork
You get fewer controls than in Claude Code, so habits do the work.
- Start a new chat for a new subject. An old conversation is re-read with every message, even when nothing in it helps anymore. On paid plans Claude can search your past chats, so you can point at an earlier one instead of continuing it.
- Put the documents you reuse in a project. Anthropic says project content is cached and counts less each time it’s used again.
- Keep project instructions short. They’re sent with every message.
- Put related questions in one message: one re-read instead of three.
- Ask for changes to a draft rather than a fresh one. Claude edits faster than it regenerates.
- Say when you only need a quick answer. In Cowork, Claude will happily make a report you didn’t need.
- Lower the effort for simple questions.
- Turn off connectors a task doesn’t need. Anthropic calls them token-intensive.
- Run a task once by hand before you schedule it. A scheduled task repeats its mistakes on every run.
Long chats summarise themselves near the limit (with code execution on), and that uses more of your limit too. Settings > Usage shows where you are in both windows.
When a chat has gone on too long, carry what matters into a new one:
We're about to move to a new chat. Write a handover I can paste into it: the goal, what we decided and why, what's still open, and the facts and numbers we'll need. Under 300 words, and no story of how we got here.
A prompt for a new project's instructions
Help me write the instructions for this project. Ask me up to five questions about what it's for, who the work is for, the tone I want and what you should never do. Then write the instructions in under 150 words, because they're sent with every message.In Claude Code: set the task up well
Anthropic’s own best practices put one thing first: give Claude a way to check its work (a test, a build, a linter, a screenshot to compare against). With a check, Claude loops on its own instead of saying it’s done and leaving you to find out.
Users report that login fails after the session times out. Look at the token refresh in src/auth/, write a failing test that reproduces it, then fix it. Run the auth tests after, and keep going until they pass. Show me the command you ran and its output.
For anything bigger than a small fix, Shift+Tab into plan mode first: Claude reads and proposes, and you correct the plan before it changes any files. Fixing a plan is much cheaper than fixing the code that came out of a bad one.
If you’ve corrected Claude twice on the same thing and it’s still wrong, /clear and write a better prompt with what you’ve learnt. A third correction adds a third wrong attempt to the conversation.
Three more: a spec interview, a goal, a proof
For a feature you haven’t thought through, let Claude ask the questions, then build from SPEC.md in a fresh session, with a clean context and a written definition of done:
I want to add rate limiting to the public API but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md.For long runs, /goal sets a condition (/goal all tests in tests/auth pass and lint is clean) that a separate model checks after every turn.
When Claude says it’s done, /code-review reviews the diff in a fresh subagent that never saw the conversation. Or just ask:
Prove to me this works. Compare the behaviour on main and on this branch, and show me the output.Keep the context small
With a 1M window, Claude Code compacts at about 967,000 tokens, so most sessions never compact and every request carries everything.
/clearbetween unrelated tasks. It costs nothing, and/renamefirst lets you/resumethe session later./autocompact 500kmakes the automatic pass run earlier. At 500,000 to 600,000 tokens a long session re-reads about 40% less than with the default, and still compacts rarely. Much lower and Claude spends its time compacting./compactat a natural break, saying what to keep:/compact keep the failing test and the fix we agreed on. The best times are the end of a task and just before you step away for longer than the cache lasts, never the middle of a task./rewind(or Esc twice) when Claude heads the wrong way. Arguing with it keeps the wrong path in the conversation for the rest of the session. Rewinding drops it and goes back to a point that’s already cached.
What compaction costs, and when to do it
Compaction isn’t free. Claude Code sends one request that reads the whole conversation and writes a summary of it. With the cache warm, the reading comes from the cache, so it costs about one more message plus the summary. With the cache cold, it reads everything as fresh input.
The summary also keeps less than you’d think. Claude Code re-reads CLAUDE.md, the plan Claude wrote in plan mode and up to five of the files it touched, but whatever you said in the chat becomes a summary. A rule that must survive goes in CLAUDE.md.
Good times to compact:
- At the end of a task, when the next one needs the same background. If it doesn’t,
/clearis free. - Before you step away for longer than the cache lasts. The first message back then re-reads a short summary instead of the whole conversation.
/usagesuggests exactly that, and Claude Code can do it on its own for a long session left idle (idleCompactionturns that off).
Bad times:
- In the middle of a task. You lose the detail you need right now.
- After a wrong turn.
/rewindback to before it instead: it drops the dead end and keeps the cache. The same menu can also summarise just part of the conversation (“Summarize from here”). - On a session that’s already gone cold, if the work is done. Compacting it costs one full re-read, the same as your next message would.
Don’t break the cache mid-task
These actions throw away part or all of the cache in Claude Code:
| Action | What happens | Instead |
|---|---|---|
Switching model with /model |
The whole conversation is processed again on the new model | Pick the model at the start |
opusplan (Opus to plan, Sonnet to build) |
Every switch in or out of plan mode is a model switch | The advisor, below |
| Fast mode on or off | It has its own cache, so the first switch re-reads everything at twice the usual price | On at the start, or not at all |
| Piling up screenshots | Past a limit, the oldest are dropped and everything after them is re-read | Fewer, smaller ones |
Changing effort, editing files, rewinding and starting subagents all keep the cache. So does connecting an MCP server (a plug-in that gives Claude tools for another service).
The fine print on the cache
Changing effort keeps the cache on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 and later. MCP servers keep it because Claude Code loads their tools on demand. Editing CLAUDE.md keeps it too, but the edit only applies after the next /clear, /compact or restart.
Subagents and compaction get a five-minute cache even on a plan, and past your plan’s limit, on usage credits, the main conversation drops to five minutes too. (With an API key it’s five minutes, unless you set promptCacheTtl to 1h.)
/usage shows the cache hit rate for the session, and from v2.1.260 the likely cause of the last miss.
CLAUDE.md, skills and hooks
CLAUDE.md is the instructions file Claude Code loads at the start of every session, so it’s part of every request. Anthropic suggests keeping it under 200 lines. Its test for each line: could Claude find this by reading the code, and would it actually go and look? If both answers are yes, leave the line out.
What belongs there is what the code can’t tell Claude. That’s the exact commands to build, test and lint, the folder that looks dead but isn’t, the decisions made outside the repo, and anything you’ve had to correct twice. Your personal preferences go in CLAUDE.local.md, kept out of git.
A skill is a set of instructions for one kind of task, in .claude/skills/<name>/SKILL.md. Only its name and description sit in every session, and the rest loads when it’s used. Workflows (a release, a migration, a review) belong in skills, not in CLAUDE.md.
A hook is a script Claude Code runs before or after a tool, whatever Claude thinks. Rules with no exceptions belong there, because Claude can’t talk itself out of a hook.
When you correct Claude, make it stick:
Update CLAUDE.md so you don't make that mistake again. One line, and only if you couldn't have found it by reading the code.
Cheaper models for the reading
Sonnet 5.5 costs half as much as Opus 5.5, and Haiku 5.5 a fortieth. So the reading (searching, running tests, going through logs) can happen on Haiku, and only the summary lands in your main conversation.
A subagent starts cold: it doesn’t share your cache and reads what it needs from scratch. Claude Code’s built-in search agent, Explore, runs on Opus on a subscription, so delegating a search doesn’t make it cheaper by itself. To actually use a cheaper model, make your own agent:
Create a subagent in .claude/agents/scout.md that runs on Haiku at low effort, with only the Read, Grep, Glob and Bash tools. Its job is to find files, symbols and log lines, and to run test suites. It returns only paths, line numbers and the lines that matter, with no commentary. Its description should tell you to use it for searches and commands with a lot of output.
CLAUDE_CODE_SUBAGENT_MODEL=haiku makes Haiku the default for agents that don’t name a model. Keep Haiku’s jobs under 100,000 tokens, and keep it on reading. Back-and-forth and small changes stay in the main conversation.
The advisor works the other way round: a cheaper main model calls a stronger one at decision points, like before it commits to a plan or when an error keeps coming back. /advisor opus with Sonnet 5.5 as the main model is the cheapest way on a Pro plan to get Opus where it matters. It doesn’t break the cache, but each call has the advisor read the whole transcript uncached (at 400,000 tokens, that’s 400,000 fresh tokens of Opus), so it goes well with an earlier /autocompact.
When to spend more
Lower effort and a cheaper model both cost something: Claude thinks less, so it misses more. That’s fine for a rename and a false economy on a subtle bug, where the second attempt and your correction come on top. Anthropic’s best practices suggest /effort high or xhigh for a bug in code you don’t know, a flaky test or a schema change, low for quick back-and-forth, and max only for the really hard problems. Changing effort keeps the cache, so raise it for the hard step and drop it after. If Sonnet has failed twice on the same thing, a fresh session on Opus costs less than a third attempt. Count the finished task, not the message.
Auto mode
Auto mode lets Claude work without asking permission for each command. A second model checks each shell command and network call, and blocks what goes beyond what you asked for (a force push, curl | bash, a production deploy). It isn’t a sandbox, though. For personal use, add Claude Code’s own sandbox (/sandbox). For work, I’d put it in a container too (how I’d build the cage).
Setting up auto mode without the friction
From a security point of view, I like that the checker sees your messages and Claude’s commands but not what the tools returned. Instructions hidden in a web page or a file Claude read (prompt injection) can’t argue with it.
Most of the friction comes from the checker not knowing what’s yours. By default it trusts the working folder and the repo’s remotes, so a push to your company’s other repos gets blocked.
- Run
/auto-mode-setup. It drafts a description of your environment from the project and your recent sessions, and saves it to~/.claude/settings.json. - Keep
"$defaults"in every list you edit, or your rules replace the built-in ones instead of adding to them. - For an action that should always ask, add a
permissions.askrule such asBash(git push *). For one that must never run,permissions.deny, such asRead(./.env). /fewer-permission-promptsreads your past sessions and allows the read-only commands you approve all the time.
Claude Code ignores autoMode in a repo’s .claude/settings.json, so a repo you clone can’t give itself permissions. After three blocks in a row, or 20 in a session, auto mode goes back to asking. Running /auto-mode-setup again usually fixes more than approving each block.
What runs while you’re away
A /loop, a scheduled task or a /goal waiting on background work sends the whole conversation every time it fires, and so do messages from your other sessions. Give a loop its own short session rather than your long working one.
For scripts, claude -p runs one prompt and exits. Give it limits (--max-turns 20, and --max-budget-usd 2 on the API), and try a batch job on three files before you run it on three hundred.
Habits you can drop
Some habits from older models now cost tokens for nothing.
- Capitals and IMPORTANT. If a rule needs shouting, it needs a hook, or a shorter
CLAUDE.md. - “Think hard”, “be thorough”, “step by step”. Effort sets the depth now. For one hard question,
ultrathinkin the prompt asks for a deep think on that turn only. - “Keep going” and “don’t be lazy”. Use
/goal, or a hook that won’t let Claude stop until the tests pass. - Subagents for a better answer. Same model, same brain, plus the cost of starting cold.
- Your architecture in
CLAUDE.md. Claude can read the code.
Let Claude review its own sessions
/insights reads up to 200 of your recent sessions on that machine and reports where things went wrong: misunderstood requests, buggy code, the corrections you keep making. It spends tokens to do it. For one project, you can just ask:
Use a subagent on Sonnet to read my last 20 sessions for this project in ~/.claude/projects/ and list the mistakes that keep coming back: commands that failed the same way, rules I had to repeat, files read twice, fixes I had to ask for more than once. For each one, propose the cheapest fix and where it belongs: a hook or a deny rule if it must never happen, one line in CLAUDE.md if it's a convention, a skill if it's a workflow. Don't change anything yet.
The subagent keeps the transcripts out of your own session. Then put each fix where it holds.
Prune while you add
Every line of CLAUDE.md is read on every request, and instructions written for an older model can make a newer one worse:
Read CLAUDE.md and every skill in this project. List the lines that Claude could work out from the code, that repeat each other, that shout (capitals, IMPORTANT), or that were written for older models. Propose a shorter version and tell me how many lines it saves. Don't change anything yet.Sources
- Anthropic, Best practices for Claude Code, Claude Code docs
- Anthropic, Manage costs effectively, Claude Code docs
- Anthropic, How Claude Code uses prompt caching, Claude Code docs
- Anthropic, Model configuration, Claude Code docs
- Anthropic, Explore the context window, Claude Code docs
- Anthropic, Subagents, Claude Code docs
- Anthropic, Escalate hard decisions with the advisor tool, Claude Code docs
- Anthropic, Permission modes and Configure auto mode, Claude Code docs
- Anthropic, Pricing and Prompt caching, Claude API docs
- Anthropic, Plans and pricing
- Anthropic, Models, usage, and limits in Claude Code, Claude Help Center
- Anthropic, Usage limit best practices, Claude Help Center
- Anthropic, How do usage and length limits work?, Claude Help Center
- Anthropic, Best practices and tips, Claude Cowork product guide
- Hong, Troynikov and Huber, Chroma, Context Rot: How Increasing Input Tokens Impacts LLM Performance, July 2025