[Bug] Statusline JSON token counts don't match /context - possible calculation error
Bug Description
There appears to be a calculation discrepancy between the token counts provided in the statusline JSON current_usage fields and what the /context command reports. The statusline JSON is missing approximately 12k tokens (~6%) compared to /context.
Steps to Reproduce
- Run
/contextcommand and note the percentage (e.g., 60%) - Check statusline which calculates from JSON fields:
input_tokens + cache_read_input_tokens + cache_creation_input_tokens + output_tokens - Observe the discrepancy
Observed Behavior
| Source | Percentage | Tokens |
|--------|------------|--------|
| /context | 60% | 120k/200k |
| Statusline JSON | 54% | ~108k |
| Discrepancy | 6% | ~12k missing |
/context Breakdown
System prompt: 3.1k (1.6%)
System tools: 18.3k (9.2%)
MCP tools: 16.5k (8.2%)
Custom agents: 475 (0.2%)
Memory files: 10.3k (5.2%)
Messages: 25.8k (12.9%)
Autocompact buffer: 45.0k (22.5%)
The /context also lists Skills and slash commands separately (~18-20k tokens total), but these don't appear in the main percentage breakdown. It's unclear if/how these are being counted.
Expected Behavior
The statusline JSON current_usage fields should sum to the same total as /context reports (excluding the autocompact buffer which we add separately).
Questions for Investigation
- Are Skills/slash command definitions included in
current_usage? - Is there a calculation difference between how
/contextand statusline JSON count tokens? - Which components are included/excluded from each?
Environment
- OS: macOS Darwin 25.2.0
- Model: claude-opus-4-5-20251101
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗