Checking Token Usage & Catching Context Inflation

By Engineering Team•October 11, 2026•3 min read

Managing token allocation and context inflation matters for both execution speed and API cost. If Claude’s context window fills with extraneous data, downstream turns in the same session get slower and more expensive.

1. Check Token Usage Inside the CLI

Claude Code tracks token spend per session. Ask it directly inside the active chat:

  • “Show my current session token usage and estimated cost.”
  • “How many tokens are currently loaded into your active context window?”

A session summary looks roughly like:

Session Metrics:

Tokens In: 45,201 (Input context, templates, CLAUDE.md)
Tokens Out: 2,150 (Generated code, terminal feedback)
Total Cost: ~$0.14

If “Tokens In” jumps by tens of thousands after a single simple prompt, Claude read something much larger than the question warranted — a log file, a build artifact, or a data folder.

2. Catch Over-Reading in Real Time

Watch the tool-call output as each prompt runs:

  • A long-running read/search — a file-search or multi-file read that keeps running well past what the question should need usually means Claude is scanning an un-indexed or irrelevant directory.
  • A wall of file reads — several tool calls in a row reading compiled or generated output (.dart_tool/, build/, a committed node_modules/) means something is picking up machine-generated junk that should be excluded, not source.

3. Debug and Fix Context Inflation

If token usage is too high, work through this checklist:

Audit what Claude actually sees

Ask directly:

List the largest files currently loaded into your active chat context.

Use /compact or Restart

A long-running conversation carries its entire history forward, so every new message in it gets progressively more expensive to send.

  1. Soft reset — compress the session history in place: /compact.
  2. Hard reset — clear the conversation entirely (/clear), or exit and start a fresh session when the current one has drifted far from the task at hand.