The statusline's 🧠 block (context window usage) displays misleading information on long sessions.
Problem
The percentage calculation uses context_window.total_input_tokens which is a cumulative session counter — it never resets, even after Claude Code's "compact" operation.
This means:
- On long sessions, the percentage grows unbounded (I've seen 1000%+)
- After compact, it still shows high usage even though context was cleared
- The displayed number doesn't represent actual context window utilization
Expected behavior
The block should show current context window usage — how much of the model's context limit is currently occupied.
Technical details
In statusline.ts, the calculation:
const percentage = Math.round((inputTokens / contextLimit) * 100);
Uses cumulative total_input_tokens rather than current context consumption.
Also note: the fallback path in data-loader.ts has clamping (Math.min(100, ...)), but the primary hook path doesn't, allowing >100% display.
Workaround
Currently filtering out this block entirely via sed in my statusline script.
The statusline's 🧠 block (context window usage) displays misleading information on long sessions.
Problem
The percentage calculation uses
context_window.total_input_tokenswhich is a cumulative session counter — it never resets, even after Claude Code's "compact" operation.This means:
Expected behavior
The block should show current context window usage — how much of the model's context limit is currently occupied.
Technical details
In
statusline.ts, the calculation:Uses cumulative
total_input_tokensrather than current context consumption.Also note: the fallback path in
data-loader.tshas clamping (Math.min(100, ...)), but the primary hook path doesn't, allowing >100% display.Workaround
Currently filtering out this block entirely via sed in my statusline script.