Reduce Claude Code token usage: what actually works
· 6 minute read
Where Claude Code's tokens go, and the fixes that cut them. If you want to reduce Claude Code token usage, start here: most of the bill is not your prompt. It's everything Claude Code sends back to the model on every turn: the conversation so far, CLAUDE.md, tool listings, and the files it read along the way. Anthropic's own levers are the place to start. A code graph is one more lever, and this post is clear about where it fits.
Why does Claude Code use so many tokens?Link to Why does Claude Code use so many tokens?
Claude Code sends your full conversation with every request. Each time it uses a tool, it sends another request carrying those tool results. Anthropic's cost guide puts it plainly: token costs scale with context size. Prompt caching means that repeated history is re-read at the cached rate, not the full rate, but it still counts. A one-line question in a session that has been open all day still pays for the whole day.
Four things fill that context:
- Re-sent history. Every earlier message and tool result rides along on the next turn.
- CLAUDE.md. It loads at session start and stays in context for every request, whether or not today's task needs it.
- MCP tools. Each connected server adds its name and instructions, and full tool definitions once Claude uses one.
- File reads. Exploring an unfamiliar codebase means searches and reads, and every result joins the history above.
How do I check my Claude Code token usage?Link to How do I check my Claude Code token usage?
Run /usage. The Session block shows input, output, cache reads and cache writes by model, plus a prompt cache line showing how much input came from cache. On Pro, Max, Team and Enterprise plans it also attributes recent usage to skills, subagents, plugins and individual MCP servers, and suggests fixes such as trimming a large CLAUDE.md.
Run /context to see what's taking up space in the current window right now. Between the two you can see the split: history, instructions, tools and file contents.
How to reduce Claude Code token usageLink to How to reduce Claude Code token usage
Start with the levers Anthropic documents. They cost nothing and apply to every repo.
- Clear between tasks.
/clearstarts fresh when you switch to unrelated work, so stale context stops riding along./compactwith instructions keeps what matters when you want continuity. - Keep CLAUDE.md under 200 lines. Anthropic recommends it. Move workflow-specific instructions into skills, which load only when invoked.
- Trim MCP servers. Disable the ones you aren't using with
/mcp. - Match the model and effort to the job. Sonnet handles most coding tasks for less than Opus, and
/effortlowers thinking on simple work. - Write specific prompts. "Add input validation to the login function in auth.ts" reads far less than "improve this codebase".
- Push verbose work to subagents and hooks. Test runs and log parsing can stay out of the main conversation.
- Be deliberate with agent teams. Anthropic says they use about 7× the tokens of a standard session when teammates run in plan mode.
Where a code graph fitsLink to Where a code graph fits
The remaining cost is exploration: working out how the code connects before Claude can answer or edit. That's the part Graphify targets.
Graphify builds a graph of your code locally with tree-sitter. Building that code graph costs zero model tokens. Claude Code then asks the graph structural questions (what calls this, what breaks if it changes, how does A reach B) instead of reconstructing the answer from searches and reads. A query answer is capped at 2,000 tokens by default.
It helps on cross-file questions in a large or unfamiliar repo. It does not help on a small repo, a single-file edit, or a file you already know. Claude still reads the file it's about to change.
Setup takes three commands. The last one matters:
pip install graphifyy
graphify install # registers the skill for Claude Code (the default)
graphify claude install # adds the CLAUDE.md section and hooks that make Claude Code use the graphThen run /graphify . in the repo. (In Codex the command is $graphify instead of /graphify.) Without graphify claude install, Claude Code has a graph but no reason to reach for it. At least one public tester missed that step. The Claude Code integration page walks through it.
Do MCP servers increase Claude Code token usage?Link to Do MCP servers increase Claude Code token usage?
They can, but less than many people expect. Anthropic's docs say MCP tool definitions are deferred by default: only tool names and server instructions enter context until Claude actually uses a tool. Servers you leave connected still add that listing to every request, and every tool result joins the history. So disable servers you don't use, and prefer a CLI where one exists. Anthropic notes that tools like gh add no per-tool listing at all.
Can a plugin really reduce Claude Code token usage by 90%?Link to Can a plugin really reduce Claude Code token usage by 90%?
You'll see plugins report big savings. How much any tool saves depends on the repo, the kind of questions you ask and how it's set up, so it's worth reading how a number was measured before you expect it on your own code.
Public tests of Graphify show that spread, and they're worth reading in full:
- Constantin Ponfick ran 11 questions on FastAPI, with and without Graphify. Files inspected fell 14.6%, while input tokens rose 49.5% and cost rose 9.5%. Graph help was biggest on broad test and change-impact questions. (Constantin's Blog)
- The Gray Cat, in one run on YouTube, measured about 18% fewer tokens with Graphify ($5.16 down to $4.29), but the run was slower, and two of three graph queries missed.
- Issue #985 reports Claude Code alone using the same or fewer tokens on common queries. It's still open.
Two token regressions that users found are fixed:
- Issue #580 traced extra tokens to an installer instruction telling the assistant to read GRAPH_REPORT.md before anything else, which cost about 12–25k tokens per question. PR #891 (16 May 2026) removed it. On the PR's test question, the patched setup matched Claude Code alone at 30k tokens, with 1 tool call instead of 4.
- Issue #3435 measured about 651,000 tokens of repeated hook reminders across 87 transcripts. v0.9.87 (12 October 2026) bounded the nudge per session. If you're on an older version, upgrade.
The one accuracy number we publish is in BENCHMARKS.md: on ERPNext, key-fact coverage went from 70.8% to 82.0% across six questions. That's coverage, not tokens.
So the honest answer is to measure your own repo. Run /usage on a few real cross-file questions with the graph and without it. The token reduction glossary entry covers the terms, and Graphify vs Claude Code covers how the two work together.
Where to startLink to Where to start
Do Anthropic's levers first: clear often, keep CLAUDE.md short, trim servers, write specific prompts. If your repo is large and your questions span files, add a code graph and check /usage before and after.
Syed Fahad and the Graphify team