Claude Code is a powerful AI coding assistant, but long sessions can burn through tokens fast. More tokens mean higher costs and reaching usage limits sooner. They can also make responses slower and less focused. The good news is that a few habits can cut your token usage in Claude Code a lot without slowing you down.
Why token usage grows in Claude Code
Every message you send includes the whole conversation so far. That covers your earlier prompts, every file Claude read, command output and its own replies. Context builds up quickly, so the twentieth message in a session costs far more than the first. Saving tokens is mostly about keeping the context small and relevant.
1. Use /clear between unrelated tasks
Finished a bug fix and moving on to a new feature? Run /clear. Old context doesn’t help the new task, and you’d pay for it again on every message. This is the simplest and most effective habit.
2. Compact long sessions with /compact
When you need to continue a task but the history is long, run /compact. Claude replaces the conversation with a short summary. You can tell it what to keep:
/compact keep the API changes and the failing test names3. Check what is using your context
Run /context to see what fills the context window: system tools, MCP servers, memory files and messages. Run /cost to see token usage for the current session. You can’t reduce what you don’t measure.
4. Keep CLAUDE.md short
CLAUDE.md loads at the start of every session, so every line in it costs tokens every time. Keep only the rules Claude really needs, like build commands, conventions and key constraints. Move long documentation into separate files and point to them.
5. Point Claude to the exact files
“Fix the login bug” makes Claude search the codebase. “Fix the redirect in @src/auth/login.php after a failed password” goes straight to the right file. Naming specific files with @ saves search calls and file reads.
Tip
The more specific your prompt, the fewer files Claude has to open. One extra sentence of detail often saves thousands of tokens.
6. Paste only the relevant output
Don’t paste a 2,000-line log. Paste the error and the few lines around it. The same goes for test output: run the single failing test instead of the whole suite.
7. Choose the right model for the job
Not every task needs the most powerful model. Use /model to switch to a lighter, cheaper model for renames, small edits and simple questions. Keep the top model for architecture, tricky debugging and large refactors.
8. Plan before editing
For bigger changes, use Plan mode (Shift+Tab) so Claude proposes an approach before it writes any code. Fixing a plan costs a few tokens. Undoing a wrong implementation costs many.
9. Disable MCP servers you don’t use
Each connected MCP server adds its tool definitions to your context. Use /mcp to review them and turn off the ones you don’t need for the current project.
10. Stop Claude early when it drifts
If Claude heads in the wrong direction, press Esc to interrupt it right away instead of letting it finish. Then correct course with a clear instruction. Every extra step down the wrong path adds tokens you’ll pay for again.
Quick reference
| Situation | What to do |
|---|---|
| Switching to an unrelated task | /clear |
| Long session, same task | /compact |
| Unsure where tokens go | /context and /cost |
| Simple edit or question | Lighter model via /model |
| Large change | Plan mode (Shift+Tab) |
| Unused integrations | Turn off with /mcp |
FAQ
Does a longer conversation really cost more?
Yes. Each new message includes the earlier context, so cost per message grows as the session gets longer.
Will /clear delete my code changes?
No. It only resets the conversation. Your files stay as they are.
Is /compact better than /clear?
Use /compact to continue the same task with less history. Use /clear when you’re starting something unrelated.
Conclusion
Saving token usage in Claude Code isn’t about doing less. It’s about giving Claude only what it needs. Clear context often, be specific and match the model to the task. You’ll spend less, reach limits less often and get sharper answers.
Before you go
Key takeaways
- Run
/clearwhen you switch tasks and/compactin long sessions. - Keep
CLAUDE.mdshort: it is loaded every session. - Name exact files with
@and paste only the relevant output. - Use a lighter model for simple work and Plan mode for big changes.
- Turn off unused MCP servers and press Esc as soon as Claude drifts.
Comments