[BUG] The context usage percentage displayed in the statusLine (via stdin) does not match the "Context remaining" percentage shown in the right-side UI.

Resolved 💬 3 comments Opened Jan 29, 2026 by goelo Closed Feb 2, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The context usage percentage displayed in the statusLine (via stdin) does not match the "Context remaining" percentage shown in the right-side UI.

What Should Happen?

Expected Behavior

If the statusLine shows 61% usage, the right-side UI should show approximately 39% remaining (100% - 61% = 39%).

### Actual Behavior

  • StatusLine (stdin context_window.used_percentage): 61%
  • Right-side UI ("Context low"): 10% remaining

These numbers don't add up (61% + 10% ≠ 100%).

### Technical Analysis

After investigating the source code:

StatusLine data source (stdin):
```javascript
// From stdin JSON passed to statusLine
context_window.used_percentage // Returns 61%

Right-side UI calculation (cli.js):
// percentLeft calculation
Math.round((contextWindowSize - currentTokens) / contextWindowSize * 100)
// Returns 10%

It appears these two values are computed differently or use different token counts, causing the inconsistency.

Environment

  • Claude Code version: 2.1.20
  • OS: macOS
  • StatusLine plugin: claude-hud v0.0.6

Screenshots

[Opus 4.5] ██████░░░░ 61% | ⏱️ 1h 33m Context low (10% remaining) · Run /compact

Left shows 61% used, right shows only 10% remaining - these should be consistent (61% + 39% = 100%).

Error Messages/Logs

Steps to Reproduce

### Steps to Reproduce

  1. Use Claude Code with a custom statusLine (e.g., claude-hud plugin)
  2. Have a conversation until context usage becomes significant
  3. Observe the statusLine progress bar showing one percentage (e.g., 61%)
  4. Observe the right-side UI showing a different "Context remaining" percentage (e.g., 10%)

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.20 (Claude Code)

Platform

Other

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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