Custom statusline not refreshed after /compact command
Bug Description
When using a custom statusline command (configured via settings.json), the status line display is not refreshed after running the /compact command. The context usage indicator (e.g., 🧠 Context: [45k/200k]) continues to show the pre-compact values until the next user input or assistant response triggers a re-render.
Expected Behavior
After /compact compresses the conversation context, the statusline should immediately reflect the reduced token usage (e.g., [45k/200k] → [12k/200k]).
Actual Behavior
The statusline retains the stale pre-compact values. It only updates when the next command or response is processed.
Steps to Reproduce
- Configure a custom statusline command in
~/.claude/settings.json:
``json``
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline-command.sh"
}
}
- Have an active session with significant context usage (e.g., 45k+ tokens)
- Run
/compact - Observe the statusline — context values remain unchanged
- Send any message — statusline now shows the updated (reduced) values
Root Cause Analysis
The custom statusline command is passive — it only runs when Claude Code invokes it via stdin with the current session JSON. The /compact event does not trigger a statusline re-render, so the displayed values become stale until the next render cycle.
Environment
- Claude Code: v2.1.63
- OS: macOS 26.3 (Darwin 25.3.0)
- Platform: darwin arm64
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗