Status line context % does not refresh after /compact until next assistant turn
Resolved 💬 3 comments Opened Apr 19, 2026 by vadimmarmer Closed Apr 22, 2026
Summary
After running /compact, the context-% indicator shown in the status line continues to display the pre-compact value. It only updates once the next assistant turn produces a fresh API response.
Expected
/compact materially changes the context size, so the status line should reflect the post-compact value immediately (or at least on the next refreshInterval tick, if one is configured).
Actual
context_window.used_percentageon stdin is derived from the most recent API response.refreshIntervalre-runs the script on a timer, but passes the same stdin JSON snapshot each tick — it does not force fresh token accounting.- Documented refresh triggers are: "after each new assistant message, when the permission mode changes, or when vim mode toggles."
/compactis not listed, and the docs are silent on whether compaction should trigger a refresh. - Net effect: the percentage stays stuck at the pre-compact value until the user sends another message, which is misleading because
/compactis precisely the moment one wants to see the new value.
Repro
- Work a session up to, say, 70% context.
- Run
/compact. - Observe the status line — still shows ~70% (or whatever the pre-compact value was), despite
/contextreporting a much lower number. - Send any message; the status line updates on the resulting assistant turn.
Suggested fix
Treat /compact as a status-line refresh event, and/or update context_window.* stdin fields immediately after compaction (not only on the next API response).
Environment
- Claude Code CLI, Opus 4.7 (1M) session
- macOS 15.4 (Darwin 25.4.0), zsh
- Status line: custom
bash ~/.claude/statusline-command.sh, previouslyrefreshInterval: 3(removed after confirming it has no effect on this)
Related
- Docs: https://code.claude.com/docs/en/statusline
- #44794 (different status-line bug: percentage intermittently disappears)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗