Skip to content

[FEATURE] Include session compact count in statusline JSON input #16512

Description

@rso42

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions