Add exchange/turn count to statusline JSON data
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I often get caught up in what I'm building and lose track of how deep I am
into a session. By the time I notice degraded response quality, I've already
burned through context. There's no visible indicator of how many exchanges
have occurred — token count and cost don't map intuitively to "time to
compact or start fresh." A simple exchange counter in the statusline data
would give me the at-a-glance signal I need to manage sessions proactively.
Proposed Solution
The statusline JSON currently exposes total_input_tokens, total_output_tokens, cost, and context_window.used_percentage — but no exchange count (number of user-to-assistant round trips).
This is the most intuitive signal for when to compact or start a new session. Currently requires a Stop hook + counter file workaround to track it.
Adding total_exchanges or turn_count to the statusline JSON would be a small addition to the session state with high value for session management.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
Example scenario:
- I'm working on a large Python project with Claude Code
- After 30+ exchanges, context quality degrades and responses get less accurate
- With this feature, I could see
total_exchanges: 32in my statusline script - This would save me time because I'd know exactly when to /compact or start fresh, instead of guessing based on token count
Additional Context
Currently working around this with a Stop hook that increments a counter file in /tmp/,
read by a statusline script. Works but fragile — counter file is session-keyed by
session_id and lives outside Claude's awareness. A native total_exchanges field in the
statusline JSON would be trivial to implement (session state already tracks messages)
and eliminate the workaround entirely.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗