[BUG] Approx. 20k missing tokens in context limit
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?
I am trying to understand how my context limit is full when the context command + my statusline that draws that information both show at least ~10% capacity.
<img width="1881" height="424" alt="Image" src="https://github.com/user-attachments/assets/5f4b272a-037e-46cf-b66b-3f77c3ea3fe2" />
You can see here that I have been notified by the application that I have 2% context remaining. (Bottom right, red text). However, my statusline is reporting I have at least 10% remaining - and the /context command confirms this, I am using 177k and should have at least 23k remaining, far more than 2%.
In addition, the context command is showing that actually the "free space" entry is at 41K tokens, double that which is expected from the usage.
However, when I attempted to continue this chat I got blocked by a "context limit full" warning - despite the /context command showing I have 23k tokens of context remaining:
<img width="1075" height="407" alt="Image" src="https://github.com/user-attachments/assets/adbfb66f-6fff-4bb9-86d4-243b399fce19" />
In addition, on a new session you can see that the /context command, statusline, AND "free space" entry all seem to match up:
<img width="1889" height="464" alt="Image" src="https://github.com/user-attachments/assets/b7c2e638-29bd-4e05-ba29-f2d619f7f7bc" />
What Should Happen?
Claude Code should let me use up to the full 200k tokens authentically. It should report the context usage accurately and without mistakes. Either /context needs to be updated to accurately track token usage or the application warning system does.
Error Messages/Logs
Steps to Reproduce
Load up Claude Code and fill your context. When you receive the application warning message for "Context Low" then run /context and see if the figures line up.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.84
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗