Status line context percentage doesn't match /context after /compact
Description
The status line context_window.current_usage data doesn't update after running /compact, causing the displayed context percentage to be significantly higher than the actual context usage shown by /context.
Steps to Reproduce
- Use Claude Code until context reaches ~70-80%
- Run
/compactto compact the conversation - Check status bar percentage vs
/contextoutput
Expected Behavior
After /compact, the status line should show the same (or similar) context percentage as /context.
Actual Behavior
- Status bar shows: 72% ctx
/contextshows: 45% (90k/200k tokens)
The /context command correctly shows the reduced context after compaction, but the status line continues displaying the pre-compaction percentage.
/context Output (after compaction)
Context Usage
90k/200k tokens (45%)
⛁ System prompt: 3.9k tokens (1.9%)
⛁ System tools: 15.8k tokens (7.9%)
⛁ MCP tools: 14.1k tokens (7.0%)
⛁ Memory files: 1.3k tokens (0.7%)
⛁ Messages: 10.1k tokens (5.0%)
⛶ Free space: 110k (54.9%)
⛝ Autocompact buffer: 45.0k tokens (22.5%)
Status Line Configuration
Using a custom status line script (as recommended in docs) that calculates:
current=$(echo "$input" | jq -r '
if .context_window.current_usage then
(.context_window.current_usage.input_tokens // 0) +
(.context_window.current_usage.cache_creation_input_tokens // 0) +
(.context_window.current_usage.cache_read_input_tokens // 0)
else 0 end
')
pct=$((current * 100 / size))
This follows the documented approach but current_usage appears to retain pre-compaction values.
Environment
- Claude Code version: 2.0.76
- Model: Opus 4.5
- OS: Windows 11 (Git Bash)
- Account: Claude Max
Additional Context
The 27 percentage point discrepancy (72% vs 45%) suggests current_usage fields are not being reset/recalculated when the conversation is compacted. The data passed to the status line script appears stale.
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗