Guide · Less context, longer sessions
How to save tokens in Claude Code
Eight habits that keep Claude's context small, so your sessions last longer, cost less and stay sharp.
Last updated
CLAUDE.md) is sent again with every new turn. A 20,000-token log you pasted early on is paid for on every later message. So most savings come from one idea: keep big things out of the conversation. 1See where the tokens go
/context
Shows how full the context is and what's using it: system prompt, tools, memory files, and the conversation itself. Check it before you guess.
2One task, one session
/clear
When a task is done, clear the conversation before starting the next one. Old files and output from the last task only add cost and can distract Claude.
3Compact long tasks, and say what to keep
/compact keep the decisions, file paths and open to-dos
If a task is still going, /compact replaces the conversation with a summary. Telling it what matters keeps the summary useful.
4Keep CLAUDE.md short
CLAUDE.md is loaded at the start of every session, so every line costs tokens every time. Keep only what Claude can't work out for itself. See CLAUDE.md best practices.
5Point at the exact files
| Costs more | Costs less |
|---|---|
| Find where the footer is and add the version. | Add the version to the footer in @src/app/app.html. |
Typing @ and a path adds that file directly. Without it, Claude searches and reads several files to find the right one.
6Trim output before Claude sees it
Don't paste a whole log. Ask for, or paste, only the part that matters:
npm run build 2>&1 | tail -20 grep -n "ERROR" app.log | head -50
7Hand big reads to someone else
When a job means reading a lot (a whole folder, a long log, many search results), let something else read it and send back only the answer:
- A subagent: ask Claude to "use a subagent to find where X is handled". It searches in its own separate context and returns a short report.
- Gemini via MCP: Gemini reads the files on its own quota, and Claude only gets the summary. See the setup guide.
8Plan first, and match the model to the job
For bigger changes, switch to plan mode (press Shift+Tab until it shows) and agree on the plan before any code is written. Redoing work that went the wrong way is the most expensive kind of token use. For small, simple tasks, switch to a smaller, cheaper model with /model.