Status line shows ~200k context remaining when using 1M context window model
Bug Description
When selecting Opus 4.6 with 1M context (claude-opus-4-6[1m]), the status line shows left:199.9k instead of reflecting the 1M token window.
Root Cause
This is in my custom status line script (statusline-command.sh). The window_tokens variable is hardcoded to 200000 for all models:
case "$raw_model" in
*sonnet*) display_model="sonnet-4.6"; window_tokens=200000 ;;
*opus*) display_model="opus-4.6"; window_tokens=200000 ;;
*haiku*) display_model="haiku-4.5"; window_tokens=200000 ;;
*) display_model="$raw_model"; window_tokens=200000 ;;
esac
The left value is then calculated as:
remaining_tokens=$(( window_tokens - total_in ))
So it always computes remaining tokens against a 200k window, even when the model is using the 1M context window (claude-opus-4-6[1m]).
How Context Window Size Is Determined
The status line reads context data from Claude Code's stdin JSON via jq:
context_window.used_percentage— percentage of context usedcontext_window.total_input_tokens— total input tokens consumedcontext_window.total_output_tokens— total output tokens consumed
These fields come from the Claude Code harness (provided to the status line command via stdin). However, the max context window size is not provided as a field — it is inferred in the script by matching the model name. The script currently does not distinguish between 200k and 1M variants of the same model.
Purpose
The status line displays [ctx:X% | used:Xk | left:Xk] to give the user a live view of how much context window capacity remains, so they know when they're approaching the limit and context compression will kick in.
Expected Fix
The model name matching should detect the 1M context window variant (e.g., model ID containing [1m] or 1m) and set window_tokens=1000000 accordingly.
Environment
- Claude Code version: 2.1.80
- OS: macOS 26.3 (arm64)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗