Skip to content

Live context gauge below the input box + honest busy-line token count#10

Merged
bajajra merged 1 commit into
mainfrom
bun-migration
Jul 21, 2026
Merged

Live context gauge below the input box + honest busy-line token count#10
bajajra merged 1 commit into
mainfrom
bun-migration

Conversation

@bajajra

@bajajra bajajra commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

The busy status line accumulated input + output across requests — and since every request re-bills the whole history as input, the figure ballooned quadratically and read like context usage when it was actually cumulative billed traffic.

  • Bottom-right context gauge under the input box, visible idle and while working: context 84.2k / 1.00m (8%) — the last request's real prompt size (uncached + cache-read + cache-write, i.e. what the model actually holds) vs the model's window from the registry. The ceiling re-resolves at turn start so mid-session /model switches track; resumes seed from the estimate; compaction snaps it to the post-compact size.
  • Busy line now shows ctx 84.2k — live context growth per request — instead of the misleading cumulative figure.
  • Cumulative billed totals remain in /status and /lens, labeled as what they are.

Test plan

  • cd ts && bun test — 124 tests, 0 fail
  • Live-verified in tmux against the mock: idle footer shows context 149 / 200.0k (0%) after one turn (99 uncached + 40 cache-read + 10 cache-write)

🤖 Generated with Claude Code

The busy status line showed CUMULATIVE input+output across requests —
input re-bills the whole history every request, so the figure ballooned
quadratically and read like context usage when it was billed traffic.

- Busy line now shows 'ctx 84.2k' — the LAST request's real prompt size
  (uncached + cache-read + cache-write), i.e. what the model holds.
- New bottom-right gauge under the input box, both idle and busy:
  'context 84.2k / 1.00m (8%)' — live size vs the model's window from
  the registry (re-resolved at turn start so /model switches track).
- Updates from real usage events; resumes seed from the estimate;
  compaction snaps it to the post-compact size.
- Cumulative billed total remains available in /status and /lens where
  it's labeled correctly.

Live-verified in tmux against the mock (149/200k after one turn —
99 uncached + 40 read + 10 written).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bajajra
bajajra merged commit 46339bc into main Jul 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant