Repository navigation
Conversation
…name Both statusline scripts guessed the context limit from the model display name, defaulting to 200k unless it contained "1M". Current models (e.g. "Opus 5.5") no longer carry the window size in their name, so 1M-context sessions rendered against a 200k limit. Claude Code already sends the real limit and usage on stdin under context_window (context_window_size, current_usage, used_percentage). The Python fast path read keys that do not exist (total_tokens, used_tokens) so it never fired, and the bash script did not read context_window at all. Both now use the reported values and keep the name-based guess only as a fallback for older Claude Code versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The statusline context bar shows a 200k limit for 1M-context sessions on current models.
Both
scripts/statusline.pyandscripts/statusline.shwork out the limit from the model display name, assuming 200k unless the name contains "1M". Current models report names likeOpus 5.5, with no window size in them, so a 1M session renders asx/200k.Claude Code already sends the real values on stdin:
Changes
statusline.py: the stdin fast path readtotal_tokens/used_tokens, which Claude Code doesn't send, so it never ran. It now readscontext_window_sizefor the limit, and input + cache-creation + cache-read tokens fromcurrent_usagefor usage, falling back toused_percentage. The empty-bar fallback inmain()also usescontext_window_size.statusline.sh: adds the same stdin fast path before the session-file scan, and the empty-bar fallback usescontext_window_size.context_window.Testing
Ran both scripts with a real payload from a 1M Opus 5.5 session, a payload with no usage yet, and a payload with no
context_window:main(py / sh)0/200k/0/200k9.6% (95k/1M)/9.5% (95k/1M)0/200k/0/200k0/1M/0/1Mcontext_window(older Claude Code)0/200k/0/200k0/200k/0/200kThe 9.5% vs 9.6% difference comes from
bctruncating instead of rounding, which predates this change.I didn't touch
CHANGELOG.md, since its entries are written under release version headings.🤖 Generated with Claude Code