Status line doesn't refresh context tokens after /clear
Description
Custom status line showing context window usage (total_input_tokens, total_output_tokens) doesn't update after running /clear. The old token counts persist until the next message exchange, even though the context has been cleared.
Steps to Reproduce
- Configure a custom status line in
~/.claude/settings.jsonthat displays context token usage:
``json``
{
"statusLine": {
"type": "command",
"command": "input=$(cat); total_input=$(echo \"$input\" | jq -r '.context_window.total_input_tokens'); total_output=$(echo \"$input\" | jq -r '.context_window.total_output_tokens'); context_size=$(echo \"$input\" | jq -r '.context_window.context_window_size'); total_tokens=$((total_input + total_output)); percentage=$((total_tokens * 100 / context_size)); printf \"Context: %d/%dk (%d%%)\" \"$total_tokens\" \"$((context_size / 1000))\" \"$percentage\""
}
}
- Have a conversation that accumulates tokens (e.g., 50k+ tokens used)
- Run
/clearto clear the conversation - Observe that the status line still shows the old token count/percentage
Expected Behavior
After /clear, the status line should immediately refresh and display the reset token counts (close to 0 or whatever the new baseline is after clearing).
Actual Behavior
The status line retains the old token values from before the clear. It only updates after the next message exchange.
Environment
- Claude Code CLI
- macOS
- Status line configured with
type: "command"
Additional Context
The status line documentation states it updates "when conversation messages change." The /clear command does change the conversation (by clearing it), so it should trigger a status line refresh with the updated context window values.
🤖 Generated with Claude Code
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗