Feature Request: Add cumulative cache token counts to status line input
Summary
The status line input JSON currently provides cumulative values for total_input_tokens and total_output_tokens, but only provides per-turn values for cache tokens via current_usage.cache_read_input_tokens and current_usage.cache_creation_input_tokens.
This inconsistency makes it impossible to display accurate cumulative cache usage in custom status lines.
Current Behavior
The status line input includes:
{
"context_window": {
"total_input_tokens": 21043, // ✅ Cumulative
"total_output_tokens": 11318, // ✅ Cumulative
"context_window_size": 200000,
"used_percentage": 42,
"remaining_percentage": 58,
"current_usage": {
"cache_read_input_tokens": 15000, // ❌ Per-turn only
"cache_creation_input_tokens": 5000 // ❌ Per-turn only
}
}
}
Meanwhile, Claude Code internally tracks cumulative cache values (visible in .claude.json):
lastTotalCacheReadInputTokenslastTotalCacheCreationInputTokens
Requested Enhancement
Add cumulative cache token fields to the status line input:
{
"context_window": {
"total_input_tokens": 21043,
"total_output_tokens": 11318,
"total_cache_read_input_tokens": 1163037, // 🆕 Cumulative
"total_cache_creation_input_tokens": 202145, // 🆕 Cumulative
"context_window_size": 200000,
"used_percentage": 42,
"remaining_percentage": 58,
"current_usage": {
"cache_read_input_tokens": 15000,
"cache_creation_input_tokens": 5000
}
}
}
Use Case
Custom status lines that want to display session-wide cache usage alongside input/output tokens. For example:
14:32 [Opus 4.5] myrepo • in:21k out:11k cache:1.3m (42%) [main +2]
Currently, the cache: value can only show the last turn's cache usage, which is inconsistent with how in: and out: display cumulative totals.
Environment
- Claude Code version: 2.1.29
- Platform: Linux (WSL2)
Additional Context
The data already exists internally (lastTotalCacheReadInputTokens, lastTotalCacheCreationInputTokens in project config), it just needs to be exposed in the status line input JSON.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗