Short version: Claude meters tokens, not messages — and every turn resends the entire conversation. So the question “how do I save tokens” is really the question “how do I stop paying to re-send context that does not change this answer.”
Everything below is a documented lever, in rough order of payoff. Most are Claude Code; the last few apply to claude.ai. None of them make Claude worse at the job.
The short list
| # | Move | Where | Why it pays |
|---|---|---|---|
| 1 | /clear between unrelated tasks |
Claude Code | Costs nothing, drops everything |
| 2 | Trim CLAUDE.md to under 200 lines |
Claude Code | Rides on every single request |
| 3 | Run Sonnet, not Opus, by default | Both | Several times cheaper per token |
| 4 | Lower thinking effort on simple work | Both | Thinking bills as output tokens |
| 5 | Disable MCP servers you are not using | Claude Code | /context shows the bill |
| 6 | Filter noisy command output with a hook | Claude Code | Tens of thousands of tokens → hundreds |
| 7 | Delegate verbose operations to subagents | Claude Code | Output stays out of your context |
| 8 | Use a code index instead of grep-and-read | Claude Code | One call replaces several file reads |
| 9 | Keep the prompt cache warm | Both | Cache reads bill at a fraction |
| 10 | Plan first, course-correct early | Both | Re-work is the most expensive token |
| 11 | Kill idle background turns | Claude Code | They fire with your full context |
| 12 | Put reference material in a Project | claude.ai | Cached, so re-use is nearly free |
| 13 | Batch related questions into one message | claude.ai | One context, several answers |
| 14 | Compress requests automatically | Both | The part you should not do by hand |
Why usage climbs faster than your activity
Claude is stateless. Each request carries the whole conversation, and each time Claude uses a tool it sends another request carrying that batch of tool results. A one-line question at hour three of a session pays for every file, diff, and answer behind it.
Prompt caching softens this — repeated history bills at the cached rate — but “cheaper” is not “free”, and the cache expires. On a subscription the cache lifetime is one hour. It drops to five minutes once you are drawing on usage credits, and five minutes is also the default on an API key or a cloud provider. Come back from lunch and your first message reprocesses everything at full price.
That is the whole mechanism. Now the levers.
1. Clear between tasks, compact within them
/clear is the cheapest command in Claude Code. It drops the conversation and
costs nothing. Use it the moment you switch to unrelated work — stale context
is charged on every message that follows it.
/compact is the other tool, and it is not free: it reads the conversation it
summarizes, so compacting a large context is itself a large request. Use it
when you need continuity, not as a habit.
When you do compact, say what to keep:
/compact Focus on the failing test and the schema changes
You can make that permanent in CLAUDE.md:
# Compact instructions
When you are using compact, please focus on test output and code changes
Run /rename before you clear, and /resume gets you back later.
2. Put CLAUDE.md on a diet
CLAUDE.md loads at session start and stays in context for the whole session.
Every line of it is re-sent with every request — including the forty lines about
your PR review checklist, while you are debugging a CSS bug.
Anthropic’s guidance is blunt: aim to keep CLAUDE.md under 200 lines. Move workflow-specific instructions into skills, which load on demand when invoked and cost nothing when they are not.
A skill can also prevent reads. A “codebase-overview” skill that describes your architecture and key directories saves the exploration that Claude would otherwise pay for in file reads.
3. Match the model to the job
Sonnet handles most coding tasks and costs meaningfully less than Opus. Reserve
Opus for architecture and multi-step reasoning. Switch mid-session with
/model, set a default in /config, and for simple subagents put
model: haiku in the subagent’s configuration.
One caveat worth internalizing: session and all-model weekly limits are
cross-model. Switching to a cheaper model stretches the budget; it does not
reset the meter. (The model-family caps — “You’ve hit your Opus limit” — are the
ones a /model switch actually escapes.)
4. Turn thinking down when thinking is not the job
Extended thinking is on by default because it genuinely helps on hard problems. It is also billed as output tokens, and the default budget can run to tens of thousands of tokens per request.
Four ways to spend less on it:
/effort— lower the effort level for the current session./model— the picker exposes the same setting./config— disable thinking entirely, where the model allows it.MAX_THINKING_TOKENS=8000— a hard budget, on models with a fixed budget.
Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead. Fable 5 always thinks and cannot be turned off.
5. Audit MCP with /context
MCP tool definitions are deferred by default now — only tool names and server instructions enter context until Claude actually calls a tool. That fixed the worst of it, but servers still cost something, and they add up.
Run /context to see what occupies the window right now, and /mcp to disable
servers you are not actively using. Where a CLI exists — gh, aws, gcloud,
sentry-cli — prefer it: Claude can run it directly, and it adds no per-tool
listing to your context at all.
6. Filter noisy output before Claude sees it
The single largest avoidable cost in most sessions is command output. A 10,000 line test log becomes 10,000 lines of context, and it stays there for the rest of the session.
A PreToolUse hook can rewrite the command before it runs. Anthropic’s own
example filters test output to failures only, and describes the result as
reducing context from tens of thousands of tokens to hundreds:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/filter-test-output.sh" }
]
}
]
}
}
The script checks whether the command is a test runner and, if so, pipes it
through grep -A 5 -E '(FAIL|ERROR|error:)' | head -100. Full source is in the
cost documentation.
7. Send verbose work to a subagent
Running the test suite, fetching documentation, processing a log file — anything whose output is large and whose conclusion is small belongs in a subagent. The verbose output lives and dies in the subagent’s context; only the summary comes back to your conversation.
The inverse of this is worth knowing too. Agent teams use roughly 7× the tokens of a standard session when teammates run in plan mode, because each teammate carries its own context window. If you use them: keep teams small, run Sonnet teammates, keep spawn prompts tight, and shut teammates down when their work is finished. Each one keeps consuming tokens until it exits.
8. Give Claude a map instead of a search box
Exploring an unfamiliar codebase by grep is expensive: a search, then several candidate files read in full, then usually the wrong one. Structural navigation replaces that with one call.
Anthropic ships code intelligence plugins for typed languages, which give real “go to definition” instead of text search. We built Crux, an SCIP code index, for the same reason — and measured it: 90% correct answers versus grep’s 58%, at 47% less cost per correct answer across real Django and SymPy sessions.
9. Keep the cache warm, and watch the misses
Cache reads bill at a fraction of fresh input, so a warm cache is one of the larger silent savings in a long session. Two things break it: idling past the cache lifetime, and rewriting the conversation.
/usage now reports this directly:
Prompt cache (main): 14 requests · 91% of input tokens from cache · 2 misses
Claude Code counts a request as a miss when it reprocesses more than 5% and at
least 2,000 tokens of what it could have read from cache. If misses account for
10% or more of your recent usage, the /usage breakdown flags it as a behavior.
Practical version: work in bursts rather than trickling messages across a whole afternoon, and on Pro or Max take the “resume from a summary” offer when you reopen a large session after a long break.
10. Stop paying for the wrong direction
The most expensive tokens in any session are the ones spent building the wrong thing.
- Plan mode (Shift+Tab) makes Claude explore and propose before it edits.
- Escape stops a run the moment it heads somewhere wrong.
/rewind, or a double-tap of Escape, restores conversation and code to a checkpoint. - Specific prompts beat vague ones on cost, not just quality. “Add input validation to the login function in auth.ts” reads one file. “Improve this codebase” reads all of them.
- Verification targets — a failing test, expected output, a screenshot — let Claude check its own work instead of handing you something to reject.
11. Find the turns you did not ask for
A session can burn usage while you are in a meeting. Each of these starts a turn and sends your full context:
- Scheduled tasks, firing on their interval whether or not you are there.
- Cross-session messages from another of your sessions, delivered as a new
turn. Set
crossSessionInboundtoholdto queue them instead. - Goal check-ins while background work is pending — up to three idle
check-ins per goal.
CLAUDE_CODE_GOAL_CHECKIN_MINUTES=0turns them off. - Agent teammates, until they exit.
/usage attributes recent usage to skills, subagents, plugins, and individual
MCP servers, with d and w toggling 24-hour and 7-day views. /insights
goes further: it analyzes up to 200 recent sessions on this machine and writes
an HTML report to ~/.claude/usage-data/report.html describing where your
friction actually is.
12–13. On claude.ai: Projects and batching
Two levers matter most in the chat product.
Projects cache their contents. Documents uploaded to a Project are cached, so only new or uncached portions count against your limits when you query them again. If you reference the same specification, codebase, or paper repeatedly, it belongs in a Project — not pasted into each new chat.
One well-built message beats five thin ones. Anthropic’s own best-practice guidance is to plan the ask, include the whole relevant snippet in a single message, and batch similar requests together. Every round trip re-sends the conversation, so five follow-ups cost five full contexts. What drives usage on claude.ai, per Anthropic: message length, attachment size, current conversation length, tool use such as Research and web search, model choice, effort level, and artifact creation.
Settings → Usage shows your five-hour session bar and your weekly bars. If you want the full picture of which wall you are hitting and when it resets, we wrote that up separately: Claude usage limits, explained.
14. The lever you should not pull by hand
Every item above is manual hygiene. It works — and it is a tax on your attention, forever, on every session.
The mechanical part of it can be automated. Most tokens a coding agent sends are context the model did not need for this request: a file it already read verbatim, a diff superseded three turns ago, instructions repeated in full every time. Deciding that per request is a machine’s job.
That is what Halv does. It sits on your machine in front of every request — same model, same CLI, same subscription — and rewrites the context before it leaves: duplicated files and stale history removed, error signals and anything that changes the answer kept, and a pass-through whenever a request cannot be compressed safely. A live meter shows exactly how many tokens each session avoided sending. It works with Claude Code, and with Codex, Kimi and GLM on their own plans.
Roughly half the usage, for the same work. The five-hour window stays five hours; you just fit about twice as much into it.
Try it free — no card required.
The 60-second version
If you do nothing else this week:
/clearwhen you change tasks.- Cut
CLAUDE.mdto the essentials, move the rest into skills. - Set Sonnet as your default; reach for Opus deliberately.
- Run
/contextonce and disable every MCP server you did not miss. - Add the test-output hook.
- Run
/usageand look at what the attribution says. It is rarely what you expected.
FAQ
How do I reduce token usage in Claude Code?
Keep the context small — every turn resends the whole conversation. /clear
between unrelated tasks, keep CLAUDE.md under 200 lines, disable unused MCP
servers, lower thinking effort on simple work, default to Sonnet, and delegate
verbose operations to subagents. To do the same thing automatically,
Halv compresses every request on your machine before it
reaches the model — roughly half the usage on the plan you already pay for.
Does /clear or /compact save more tokens?
/clear. It costs nothing. /compact has to read the conversation it
summarizes, so compacting a large context is itself a large request. Compact for
continuity; clear when the task changes.
How do I see what is using my Claude context?
/context for the current window, /usage for session tokens plus attribution
by skill, subagent, plugin, and MCP server. On claude.ai: Settings → Usage.
Does switching from Opus to Sonnet save tokens? It saves usage. The token count is the same; Opus just draws several times more per token. Session and weekly all-model limits are cross-model, so it stretches the budget rather than resetting it.
Does turning off extended thinking save tokens?
Yes — thinking bills as output tokens, and default budgets reach tens of
thousands of tokens per request. Use /effort, /config, or
MAX_THINKING_TOKENS. Fable 5 always thinks.
Why does my Claude usage keep climbing when I am not typing? Scheduled tasks, cross-session messages, goal check-ins, and live agent teammates all start turns on their own — each sending your full context. Cache expiry does the rest.
How big should CLAUDE.md be? Under 200 lines. Everything else belongs in a skill that loads on demand.
Do MCP servers waste tokens?
Less than they used to — tool definitions are deferred by default — but they
still cost. Prefer CLI tools like gh and aws where they exist, and disable
servers you are not using.
Can I cut Claude Code token usage automatically instead of by hand? Yes. Halv runs on your machine in front of every request and rewrites the context before it leaves — duplicated file reads and stale history removed, error signals and anything that changes the answer kept, and an untouched pass-through when a request cannot be compressed safely. Same model, same CLI, same subscription, roughly half the usage. It also works with Codex, Kimi and GLM.
Sources
Every figure above comes from Anthropic’s official documentation, checked August 2026:
- Manage costs effectively — hooks, subagents, agent-team multipliers, MCP overhead, background usage
- Usage limit best practices — claude.ai batching, Projects, caching
- How do usage and length limits work?
- Prompt caching in Claude Code — cache lifetime and invalidation
- Skills and subagents
- Agent teams
Related reading: Claude usage limits, explained and, if you also run Codex, how to save tokens in ChatGPT.