Skip to main content
Tips

practitioner tip

Track Token Usage with the /context Command

AIErudit angle: Context is the scarce resource every AI delivery workflow silently spends — system prompt, tools, MCP servers, agents, memory, and messages all compete for the same 200k window. Running /context to see the per-category breakdown is how you diagnose why an agent slows or forgets, and decide what to prune, compact, or restart.

context-windowtoken-usageclaude-codetips
Tip visual

Published: Feb 7, 2026 Updated: 2026-06-12

Original: https://wmedia.es/en/tips/claude-code-context-command-token-usage

Claude Code operates within a 200k token context window (expandable to 1M tokens on certain plans). Everything Claude needs to function — system prompt, tools, MCP servers, agents, auto memory files, skills, and your conversation — competes for that space. The /context command breaks down exactly how many tokens each component consumes, giving you full visibility into a resource that drains silently.

It's easy to overlook at first. You start adding MCP servers, custom agents, rules... and before you know it, a significant chunk of the context window is already pre-consumed before you type your first message. /context keeps you aware.

Result:

/context

Context Usage
claude-opus-4-5-20251101 · 51k/200k tokens (26%)

Estimated usage by category
  System prompt:     2.6k tokens  (1.3%)
  System tools:     17.6k tokens  (8.8%)
  MCP tools:          907 tokens  (0.5%)
  Custom agents:      935 tokens  (0.5%)
  Memory files:       302 tokens  (0.2%)
  Skills:              61 tokens  (0.0%)
  Messages:         30.5k tokens (15.3%)
  Free space:        114k        (57.0%)
  Autocompact buffer: 33k tokens (16.5%)

Setup

No setup needed. The command is available in any session.

1. Run the command

Type /context at any point during your session:

/context

2. Analyze the breakdown

The output shows consumption per category. Pay close attention to:

  • System tools and MCP tools: tool definitions load on every request. A few MCP servers can consume a significant percentage.
  • Free space: your actual working space. This is what's left for messages, file reads, and command outputs.
  • Autocompact buffer: a reserve Claude uses for automatic compaction when context fills up.

3. Act on what you see

If MCP tools consume too much, run /mcp to see per-server costs and disable those you don't need in this session. With Tool Search enabled (the current default), that category should already be a fraction of what it was: names and instructions only, with schemas deferred. If free space drops below 30%, consider using /compact or starting a fresh session.

Reference

CategoryWhat it includes
System promptClaude Code's internal instructions
System toolsBuilt-in tools (Read, Edit, Bash, Grep, Glob, etc.)
MCP toolsTool definitions from connected MCP servers
Custom agentsCustom agents defined in .claude/agents/
Memory filesCLAUDE.md and auto memory files
SkillsDescriptions of registered skills
MessagesYour conversation: prompts, responses, and tool results
Free spaceTokens available to keep working
Autocompact bufferReserve for automatic compaction (~16.5%)

Related: When each feature loads into context

Official docs: The context window

Part of the 10 habits to save tokens in Claude Code.