[Bug] Context usage percentage inconsistency between statusline data and /context command

Resolved 💬 5 comments Opened Jan 24, 2026 by DanielStormApps Closed Mar 1, 2026

Context usage percentage inconsistency between statusline data and /context command

Description

The context_window.used_percentage value passed to the statusline hook showed >64% (causing red indicator), but running /context immediately after showed only 55% usage (110k/200k tokens).

Observed behavior

  1. Statusline displayed red context bar (triggers at 64%)
  2. /context command showed 55% usage
  3. Red indicator eventually disappeared on its own

Expected behavior

The context_window.used_percentage value passed to statusline hooks should match the percentage calculated by /context.

Possible causes

  • Different calculation methods between statusline data and /context
  • Race condition where statusline receives stale/estimated values
  • Statusline percentage might include pending response tokens while /context shows post-response actuals

Statusline implementation

https://github.com/DanielStormApps/claude-code-statusline

The statusline simply reads and displays the value from context_window.used_percentage without any additional calculation:

context_used_percentage=$(echo "$input" | jq -r '.context_window.used_percentage')

Environment

  • Model: claude-opus-4-5-20251101
  • Context: 200k tokens
  • Auto-compact: disabled

Repro

Difficult to reproduce on demand - occurred during normal conversation with multiple tool calls.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗