Problem Statement
Currently, users must always specify a session-id when using context-stats. This requires manually copying and pasting the session ID every time, which is tedious — especially when you typically just want to inspect the most recent session.
Additionally, there's no quick way to discover which sessions are available without digging through the data manually.
Proposed Solution
Two UX improvements:
-
Default to the latest session when session-id is omitted. If no session ID is provided, automatically resolve and use the most recently available session. This removes friction for the most common use case.
-
Add a command to list recent sessions. A new command (e.g., list-sessions) that shows all available sessions from the last N minutes, where N defaults to 5 but can be configured by the user (e.g., --minutes 10). The list should be ordered from most recent to oldest, and each entry should show how long ago (minutes/seconds) the last data was received.
Alternatives Considered
- Requiring users to always specify a session ID (current behavior) — works but adds unnecessary friction.
- Using an environment variable or config file to store a "default" session — more complex and still requires manual setup.
Use Cases
- A user finishes a Claude Code session and wants to quickly check the context stats without hunting for the session ID — they just run the command with no arguments and get the latest session's stats.
- A user has run multiple sessions recently and wants to pick one to inspect — they run the list command to see all sessions from the last few minutes, then choose the one they need.
- A user opens two Claude Code sessions, then wants to check context-stats for each. For the latest session, they simply omit the session ID to fetch the most recent one. For the first session, they run the list command to find the second-latest session's ID — no need to switch back to the Claude session to copy it.
Additional Context
These changes are purely additive and backward-compatible — users who already pass explicit session IDs would see no change in behavior.
Problem Statement
Currently, users must always specify a
session-idwhen using context-stats. This requires manually copying and pasting the session ID every time, which is tedious — especially when you typically just want to inspect the most recent session.Additionally, there's no quick way to discover which sessions are available without digging through the data manually.
Proposed Solution
Two UX improvements:
Default to the latest session when
session-idis omitted. If no session ID is provided, automatically resolve and use the most recently available session. This removes friction for the most common use case.Add a command to list recent sessions. A new command (e.g.,
list-sessions) that shows all available sessions from the last N minutes, where N defaults to 5 but can be configured by the user (e.g.,--minutes 10). The list should be ordered from most recent to oldest, and each entry should show how long ago (minutes/seconds) the last data was received.Alternatives Considered
Use Cases
Additional Context
These changes are purely additive and backward-compatible — users who already pass explicit session IDs would see no change in behavior.