Safeguard
Developer Tools•

Reducing Claude Code token use: the habits that matter most

Clear between tasks, pick the right model, trim MCP overhead and move procedures into skills. A checklist from Anthropic's cost guidance, with the reasons.

Safeguard Security Team
3 min read

Claude Code costs scale with context size, because it sends your whole conversation with every request. The habits that save the most are clearing between unrelated tasks, matching the model to the job, keeping CLAUDE.md short, and delegating noisy work to subagents or hooks.

Why long sessions get expensive

Anthropic's cost page explains that with prompt caching, history is re-read at the cached rate, so a one-line question in a session open all day still draws usage for the whole conversation. The first message after a break longer than the cache lifetime misses the cache and reprocesses the full context. Other drivers are scheduled tasks firing while idle, subagents, and compaction, since compacting a large context is itself a large request.

Checklist

  1. Clear between tasks. /clear starts fresh and costs nothing. Use /rename first if you want to find the old session, then /resume.
  2. Guide compaction. /compact accepts instructions about what to keep, or put a short compact instructions section in CLAUDE.md.
  3. Choose the model. The docs say Sonnet handles most coding tasks and costs less than Opus, and to reserve Opus for complex architectural decisions. A switch to Opus also applies to subagents that inherit the session model.
  4. Trim MCP overhead. Run /context to see what takes space, and disable unused servers with /mcp. Command line tools like gh are more context efficient than an MCP server because they add no per-tool listing.
  5. Move procedures out of CLAUDE.md. Keep it under 200 lines and put workflows in skills, which load only when used.
  6. Offload noise. A hook can filter a huge log down to the error lines before Claude sees it.
  7. Delegate verbose work to subagents so only a summary returns.
  8. Write specific prompts. "Add input validation to the login function in auth.ts" beats "improve this codebase".
  9. Plan first for complex work. Plan mode, reached with Shift+Tab, proposes an approach for approval and avoids expensive rework.

Thinking tokens

Extended thinking is on by default, and thinking tokens bill as output tokens. For simpler tasks, lower the effort level with /effort or in /model. The docs note you cannot turn thinking off on some newer models, which always use extended thinking.

Measure it

/usage shows session token use and, on plans, a breakdown that attributes usage to skills, subagents, plugins and MCP servers and flags behaviors such as long context or cache misses when they reach 10 percent of recent usage. The figures are approximate and local to the machine.

A team note

Put the first three habits in your onboarding doc. They cover most avoidable spend, and they need no tooling.

Quick check

Does /clear cost anything?

No. The documentation says that when you want a fresh start, clearing costs nothing, while compacting reads the whole conversation.

Why did my first message after lunch use so much?

It likely missed the prompt cache after a long pause, so the full context was reprocessed.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.