[BUG] /context command header shows 0k tokens while breakdown shows ~108k tokens

Resolved 💬 8 comments Opened Jan 25, 2026 by YuriNachos Closed Mar 6, 2026

What's Wrong?

When running the /context command in Claude Code, the header shows incorrect token usage:

glm-4.7 · 0k/200k tokens (0%)

However, the detailed breakdown below shows actual token usage:

⛁ System prompt: 2.3k tokens (1.1%)
⛁ System tools: 13.6k tokens (6.8%)
⛁ MCP tools: 3.4k tokens (1.7%)
⛁ Custom agents: 243 tokens (0.1%)
⛁ Memory files: 825 tokens (0.4%)
⛁ Skills: 613 tokens (0.3%)
⛁ Messages: 88.7k tokens (44.3%)
⛶ Free space: 45k (22.7%)
⛝ Autocompact buffer: 45.0k tokens (22.5%)

Total estimated usage: ~108k tokens (should be shown as 54%, not 0%)

The header value 0k/200k (0%) doesn't match the breakdown data. This makes it difficult to quickly see actual context usage at a glance.

What Should Happen?

The /context header should display the actual total token usage shown in the breakdown section, approximately:

glm-4.7 · 108k/200k tokens (54%)

Or, if there's a specific reason for showing 0k in the header, this should be documented.

Steps to Reproduce

  1. Start a new Claude Code session in any project directory
  2. Run several requests to build up context (messages, tools, etc.)
  3. Run the /context command
  4. Observe the header shows 0k/200k tokens (0%)
  5. Observe the breakdown section shows actual token usage (~108k)

Note: This happens consistently across sessions. The breakdown data is accurate, but the header doesn't reflect it.

Claude Model

  • Sonnet (default) / glm-4.7

Is this a regression?

  • I don't know - Only recently started monitoring context usage closely

Claude Code Version

2.1.19 (Claude Code)

Platform

  • API Platform: Anthropic API (with custom base URL)
  • Operating System: macOS (Darwin 25.2.0)
  • Terminal: Terminal.app / VS Code integrated terminal

Additional Information

This inconsistency makes it challenging for:

  1. Statusline tools to display accurate context usage
  2. Users to quickly gauge their actual context window usage
  3. Developers building integrations that rely on context data

The breakdown section appears to be calculating correctly, so this seems to be a display/aggregation issue in the header calculation rather than a fundamental data problem.

Related to potential issues with context_window data in statusline JSON (issues #13783, #129).

Would be helpful if:

  • The header accurately reflects the breakdown total
  • Or documentation explaining the difference between "current message context" (0k) vs "session context" (108k)

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗