Status line not refreshed after `/compact` slash command
Summary
After running /compact, the status line continues to display the pre-compact context size, even though the conversation has actually been compacted. /context correctly shows the new (much smaller) context size, but the status line stays stale until something else triggers a re-render.
Reproduce
- In a session where context has grown large (e.g. 200k+ tokens; status line indicates high % usage)
- Run
/compact - Observe:
/contextcorrectly reports the new (smaller) context size — e.g. 54k/1m, 5% - Status line still shows the pre-compact percentage / token counts
- Toggling
/statusline(or any subsequent message that triggers a re-render) refreshes it correctly
Expected
The status line should re-render after /compact completes, since the context window the status line reports on has changed materially.
Why this matters
The status line is the at-a-glance signal for "do I need to compact / wrap up". If it doesn't refresh after a compaction, users have to run /context to verify the compact actually freed space — which defeats the point of having a real-time status line.
This is especially confusing for users who run /compact proactively to free headroom: the status line lying about post-compact state can lead them to compact again unnecessarily, or to assume the compact silently failed.
Workaround
Toggle /statusline after every /compact, or send any message that triggers a status-line re-render.
Suspected cause
The status line input pipeline (the JSON object passed to statusline.sh containing context_window.used_percentage, context_window.total_input_tokens, etc.) does not appear to be re-evaluated after /compact rewrites conversation history. A status-line refresh hook tied to the post-compact event would resolve it.
Environment
- Platform: macOS (Darwin 24.6.0)
- Model:
claude-opus-4-7[1m](Opus 4.7, 1M context) - Status line: custom shell script at
~/.claude/statusline.sh, readingcontext_window.used_percentagefrom stdin (so the staleness has to come from upstream — the script is purely reactive)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗