[BUG] /context header and category breakdown disagree after session restart + mid-session model switch
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
/context shows two mutually contradictory accountings in the same panel:
- Header:
357.8k / 1.0M tokens (36%) - Category table: Messages alone =
691.6k (69.2%); all categories sum
to 711.5k used + Free space 288.5k (28.8%) = exactly 1.0M.
The table is internally consistent, the header is internally consistent,
but they can't both be true (36% used vs 71.2% used). The progress bar
follows the table (~70% filled), not the header.
Full breakdown shown:
| Category | Tokens | Usage |
|---------------|--------|-------|
| System prompt | 3.9k | 0.4% |
| System tools | 12.1k | 1.2% |
| Memory files | 2.5k | 0.2% |
| Skills | 1.4k | 0.1% |
| Messages | 691.6k | 69.2% |
| Free space | 288.5k | 28.8% |
The ~2:1 ratio (691.6k vs 357.8k) suggests one number is the raw stored
transcript and the other is the auto-compacted working set, rendered
together without reconciliation.
What Should Happen?
Header, progress bar, and category table agree on one number for
context usage.
Error Messages/Logs
Steps to Reproduce
- Run a long session (multi-day, heavy tool use) on a model with a
1m window until context runs low.
- Restart the machine / IDE and resume the same session.
- Switch models mid-session via
/modelto a different 1M-context variant
(claude-fable-5[1m]).
- Run
/context.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.156 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Environment
- Claude Code: 2.1.156 (Claude Code)
- Interface: VS Code extension (panel), version 2.1.170
- OS: Windows 11
- Model at time of bug: claude-fable-5[1m] (switched mid-session from a
claude-opus-4.8[1m])
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗