Preflight Checklist
Problem Statement
The statusline JSON input provides session metadata and context_window data, but there's no way to know how many times the current session has been compacted. Users building custom statuslines must resort to file-based workarounds using SessionStart hooks with "matcher": "compact", which creates a race condition: the statusline renders before the hook writes, so the compact count is always stale until the next render.
Proposed Solution
Include compact count in the statusline JSON input:
{
"session_id": "...",
"session_compact_count": 2,
"context_window": { ... }
}
This would be consistent with how context_window.current_usage is already provided, and eliminates the race condition since data comes from the same source.
Alternative Solutions
No response
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Displaying compact count in the statusline (e.g., ⚡⚡ for 2 compacts) helps users understand:
- How long/complex their session has been
- When they're working in a heavily-compacted session where older context may be summarized
- Session health at a glance alongside context usage
Additional Context
Related to #15184 which requests autocompact settings. This request is for compact count - complementary but distinct data.
Preflight Checklist
Problem Statement
The statusline JSON input provides session metadata and context_window data, but there's no way to know how many times the current session has been compacted. Users building custom statuslines must resort to file-based workarounds using SessionStart hooks with "matcher": "compact", which creates a race condition: the statusline renders before the hook writes, so the compact count is always stale until the next render.
Proposed Solution
Include compact count in the statusline JSON input:
{
"session_id": "...",
"session_compact_count": 2,
"context_window": { ... }
}
This would be consistent with how context_window.current_usage is already provided, and eliminates the race condition since data comes from the same source.
Alternative Solutions
No response
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Displaying compact count in the statusline (e.g., ⚡⚡ for 2 compacts) helps users understand:
Additional Context
Related to #15184 which requests autocompact settings. This request is for compact count - complementary but distinct data.