Status line does not refresh after /compact
Description
When using a custom statusLine command (configured in settings.json), the status line does not refresh after running /compact. The displayed token usage remains at the pre-compact value until the next assistant message is returned.
Steps to Reproduce
- Configure a custom status line command that displays
context_window.used_percentage:
``json``
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
}
}
- Have a conversation until a significant portion of the context window is used (e.g., 50%+)
- Run
/compact - Observe the status line — it still shows the pre-compact token usage
Expected Behavior
The status line should refresh immediately after compact completes, reflecting the reduced token usage.
Actual Behavior
The status line retains the stale (pre-compact) value. It only updates when a new assistant message is returned (i.e., after the user sends the next message).
Analysis
The status line command is event-driven and triggers only on:
- New assistant message
- Permission mode change
- Vim mode toggle
/compact does not emit any of these events, so the status line is never re-invoked.
The PostCompact hook exists but runs in a subprocess and cannot force a UI refresh.
Suggested Fix
Emit a status line refresh event after compact completes (at the PostCompact timing), so the status line command is re-invoked with updated context_window data. This would also benefit auto-compact scenarios.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗