Claude Code Token Saving Guide
/cost, Prompt Cache, CLAUDE.md, and settings.json
The same task can cost 3k tokens for one user and 30k for another. The difference is usually not the model, but conversation habits, tool usage, and project setup. This guide breaks down the main token sinks in Claude Code and how to control them.
// Why 10x Happens
1. Why the Same Task Can Cost 3k or 30k Tokens
In Claude Code, token usage is usually driven less by model capability and more by workflow quality. How you ask, what Claude reads, what extensions are enabled, and how long a session grows all affect the bill.
Your real input is not just your latest prompt. It also includes system prompt, CLAUDE.md, MCP / Skills / Plugins metadata, conversation history, tool outputs, and the current user message.
// Where Tokens Go
2. Understand Where Claude Code Tokens Go
| Layer | What it contains | Typical issue |
|---|---|---|
| System | System prompt, CLAUDE.md, MCP / Skills metadata | Fixed overhead grows silently |
| History | All previous conversation messages | Gets more expensive over time |
| Tools | Read, Grep, Bash outputs | Most likely to spike suddenly |
| Current | Your current message | Usually the smallest part |
Tool output and session history are usually the biggest hidden multipliers.
Prompt Cache
When the leading prefix is unchanged, Claude can reuse cached computation. That is why stable CLAUDE.md, stable model choice, and short idle gaps matter.
Read /cost Correctly
/cost
input
output
cache read
cache writecache read going up is usually good. cache write going up without a clear reason usually means you are rewriting large prefixes.
// Input Habits
3. Input Habits That Quietly Waste Tokens
Raw logs and giant diffs
Do not paste thousands of lines of logs if only a handful of lines matter. Filter first, then ask Claude.
grep -E "FATAL|Exception|^\s+at\s" crash.log
tail -100 build.log
git diff --statVague prompts
Ask for the exact directory, file, module, or function you care about instead of requesting a general project exploration.
Drip-feeding requirements
If you already know the full goal, say it upfront. Multi-turn accumulation is one of the easiest ways to pay repeatedly for the same context.
Breaking cache by accident
Long resumes and frequent model switching are common cache killers.
// Claude Work Style
4. Claude's Work Style Also Changes Token Usage
Read the minimum needed
For targeted edits, prefer Grep to find the line, then read only the nearby context instead of the entire file.
Plan mode is situational
Planning first is worth it for uncertain, cross-module work. For small and obvious edits, it often adds overhead.
Use subagents for noisy tasks
Repository-wide scanning tasks are often better delegated so their heavy read results do not pollute the main session.
/compact vs /clear
/compact only pays off if you are about to continue the same task for multiple more turns. For unrelated work, use /clear.
// Infra Tax
5. Infrastructure Can Silently Burn Tokens Every Turn
Block generated and build output
{
"permissions": {
"deny": [
"Read(**/node_modules/**)",
"Read(**/dist/**)",
"Read(**/build/**)",
"Read(**/.next/**)",
"Read(**/generated/**)",
"Read(**/*.generated.*)"
]
}
}MCP and Skills overhead
Every enabled capability adds metadata to the system side of the prompt. Keep only what you actively use.
Keep CLAUDE.md lean and stable
Put coding rules and operational conventions there, not timestamps, sprint status, dynamic TODOs, or long historical notes.
// Checklist
6. Practical Claude Code Token Saving Checklist
| Action | Why it helps |
|---|---|
| Learn /cost first | You need visibility before optimization |
| Filter logs and long outputs | Cuts tool-side blowups |
| State full requirements upfront | Reduces history repetition |
| Grep first, then local Read | Avoids importing irrelevant files |
| Use plan mode only when needed | Avoids unnecessary planning cost |
| Delegate noisy scans to subagents | Keeps the main session clean |
| Deny generated/build reads | Prevents accidental huge context loads |
| Remove unused MCPs and Skills | Shrinks fixed prompt overhead |
| Keep CLAUDE.md stable | Improves prompt cache hit rate |
// Summary
Summary
Claude Code token efficiency comes down to four themes: cleaner input, narrower reads, lighter context, and slimmer infrastructure.
The /cost number is not just a bill. It is also a signal of which engineering habits are helping or hurting you.
Need Claude Code relay setup first?
Set up Claude Code first, then come back and optimize your token usage
View Claude Code Setup Guide