Add context_breakdown to statusline hook JSON input
Summary
The statusline hook currently receives context_window.used_percentage and total_input_tokens/total_output_tokens, but not the per-category breakdown that /context displays (system prompt, system tools, memory files, skills, messages, autocompact buffer, free space).
Exposing this breakdown in the statusline JSON would let external monitoring tools (menu bar widgets, dashboards, IDE plugins) show actionable context health, e.g. warning a user that their messages are dominating context vs. their tools/skills budget.
Proposed JSON addition
{
"session_id": "...",
"context_window": {
"used_percentage": 13,
"total_input_tokens": 133200,
"context_window_size": 1000000,
"breakdown": {
"system_prompt_tokens": 6000,
"system_tools_tokens": 10500,
"memory_files_tokens": 354,
"skills_tokens": 761,
"messages_tokens": 115600,
"autocompact_buffer_tokens": 33000,
"free_tokens": 833800
}
}
}
Why
/contextalready computes this. Cost of also emitting it to the statusline is near-zero.- Without it, third-party tools can only show a single % bar, not show where context is going (which is what actually helps users decide to compact, trim memory, or prune skills).
Use case
Building a macOS menu bar widget (https://github.com/sudomakeit25/claude-usage-widget) that monitors Claude Code usage. Would let the widget show a stacked context bar per active session.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗