Status line does not refresh after /compact

Resolved 💬 6 comments Opened Mar 18, 2026 by megalord Closed May 24, 2026

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

  1. Configure a custom status line command that displays context_window.used_percentage:

``json
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
}
}
``

  1. Have a conversation until a significant portion of the context window is used (e.g., 50%+)
  2. Run /compact
  3. 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.

View original on GitHub ↗

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