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_percentage on stdin is derived from the most recent API response.
  • refreshInterval re-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." /compact is 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 /compact is precisely the moment one wants to see the new value.

Repro

  1. Work a session up to, say, 70% context.
  2. Run /compact.
  3. Observe the status line — still shows ~70% (or whatever the pre-compact value was), despite /context reporting a much lower number.
  4. 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, previously refreshInterval: 3 (removed after confirming it has no effect on this)

Related

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗