[FEATURE] Expose context breakdown by component in statusline API
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
The statusline API currently provides total token usage but doesn't break down context consumption by component. Adding this breakdown would enable real-time monitoring of context efficiency.
Proposed Solution
Expose the same component breakdown that /context command shows:
{
"context_window": {
"context_window_size": 200000,
"current_usage": {
"input_tokens": 50000,
"cache_creation_input_tokens": 10000,
"cache_read_input_tokens": 5000
},
"breakdown": {
"system_prompt": 5000,
"system_tools": 8000,
"mcp_tools": 12000,
"memory_files": 3000,
"custom_agents": 2000,
"messages": 20000
}
}
}
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
This would enable statusline scripts to:
Visualize context composition - Show how much space MCP tools, system prompt, and messages consume
Alert on bloat - Warn when MCP tools exceed a threshold (e.g., >25% of context)
Optimize dynamically - Help users decide when to disable MCP servers based on real-time data
Track message growth - Show conversation tokens separately from static overhead
[■■■■■■■■■■■■■■■■■■■■■■■■■■■■|□□□□□□□□□□□□] 70%
sys:5k | tools:8k | mcp:12k | msgs:115k | 60k free
Additional Context
I found few issues related but not getting this high level view imo.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗