How to reduce Claude Code token usage
Claude Code sends your whole session again on every turn: the system prompt, your CLAUDE.md and memory files, the conversation, and every tool result still in context. Most of the tokens are that repeated part, stored in and read back from the prompt cache. So the biggest savings come from loading less on every turn, clearing context between tasks, and asking for shorter answers.
Updated 2026-10-21
Where a turn’s tokens go#
Every request Claude Code sends is made of four kinds of tokens. Fresh input is text the model has not seen in this session. A cache write stores the start of the request so the next turn can reuse it. A cache read is that reused part, billed at a small fraction of the fresh input price. Output is what the model writes back, its thinking included.
We ran the same 27 coding tasks in Claude Code 2.1.292 on Claude Sonnet 5.5, three full sessions a side: once with a full-size test memory as it was, and once after MinniMemoryMCP sorted it. Before MinniMemoryMCP touched anything, the run looked like this:
| Token kind | Tokens | Share of all tokens |
|---|---|---|
| Fresh input | 216 | under 1% |
| Cache write | 626,130 | 18% |
| Cache read | 2,931,482 | 82% |
| Output | 16,181 | under 1% |
Almost nothing was fresh input. Most of the tokens were the same session being read back on every turn. Anything that loads on every turn is paid for again on every turn, so that is the first thing to shrink.
Eight things that cut token usage#
1. Keep CLAUDE.md short#
Your CLAUDE.md files, and every file they import with @path, load at the start of each session and stay in context for every turn. Anthropic’s memory docs suggest keeping each CLAUDE.md under 200 lines. Keep the rules the agent needs on every turn, and move the rest into files it opens only when a task needs them. The memory guide shows how.
2. Clear between tasks#
/clear starts a fresh session. Use it when you switch to unrelated work: old context is sent again with every message that follows. Run /rename first if you want to come back to it with /resume.
3. Compact with a focus#
/compact replaces the conversation with a summary. Tell it what to keep, for example /compact keep the failing test and the plan. Compacting a big session is itself a big request, so when you do not need the history, /clear is cheaper.
4. Ask for shorter answers#
Output is the most expensive kind of token. Ask for the result, not a narration of how the agent got there. When we tested answer-style rules on their own, the average answer fell from 1,006 to 422 output tokens, 58.1% fewer.
5. Read less#
A whole file read into context stays there for the rest of the session. Ask the agent to search first and read only the part it needs. A specific prompt ("add input checks to the login function in auth.ts") leads to fewer reads than a broad one ("improve this codebase").
6. Match the model to the job#
Routine edits run fine on a smaller model. Switch with /model, and lower the thinking effort for simple work with /effort: thinking is billed as output.
7. Turn off what you are not using#
Run /context to see what fills the context window. Disable MCP servers you are not using with /mcp. A hook that adds text to every prompt adds it to every turn.
8. Send noisy work to a subagent#
Test runs, logs and documentation lookups produce long output. A subagent keeps that output in its own context and hands back a short summary, so your main session does not carry it.
Doing the first fix automatically#
Keeping memory small pays on every turn, and it is the fix people skip: splitting a memory file by hand takes time, and it has to be redone as the memory grows. MinniMemoryMCP does the split for you. It sorts your CLAUDE.md, MEMORY.md and the files they import into a small part that loads on every turn and files Claude opens only when a task needs them.
$ npx -y minnimemory install- Ask Claude to run
minnimemory init. It reads your memory and shows the plan: what stays, what moves, and the tokens loaded on every turn before and after. - Ask it to apply the plan. Claude runs the command with your approval, after the originals are backed up.
- If you change your mind,
undoputs every file back byte for byte.
On our full-size test memory, the part loaded on every turn went from 12,511 to 6,699 tokens, and every line was kept. The three sessions cost $2.31 before and $1.68 after, 27.4% less. A blind grader marked 74 of 81 answers correct before and 72 of 81 after.
It runs on your computer with no AI model, no account and no network. The docs have every command.
How to check it worked#
Run /usage at the end of a session. Its Session block lists input, output, cache read and cache write tokens with an estimated cost. Compare the same kind of task before and after a change, not two different days of work.
Our own method is in the Evidence section: the same tasks, run with and without the change, with every answer graded blind.