Skip to content

feat(web): context window popout gets a breakdown bar and cached input rate - #171

Merged
badcuban merged 3 commits into
mainfrom
worktree-context-breakdown-bar
Aug 22, 2026
Merged

badcuban merged 3 commits into
mainfrom
worktree-context-breakdown-bar

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

The context window card only showed a single used-percentage number, even though Claude reports a full breakdown of what fills the window and both providers report cache statistics we were discarding.

The popout now renders a stacked bar with a collapsible largest-first legend (free space always last). Claude threads get the real per-category breakdown from the SDK's context usage report; deferred tool categories are filtered out server-side since they are excluded from the used total and made the rows sum past the header. Codex has no composition data, so it renders a single used-vs-free segment through the same path. Both providers get a cached-input rate row, backed by the Codex adapter now sourcing its cumulative token fields from session-wide totals instead of the last turn (nothing rendered those fields before).

Two robustness rules came out of live testing: a category-less context report from a freshly resumed Claude process is ignored, so it cannot replace the last rich snapshot with a bare one until real data arrives, and every displayed number truncates at its shown precision instead of rounding (96,632 reads 96.6k, never 97k; a 99.97% cache rate reads 99.9%, never 100%).

Adds eight categorical color tokens in light and dark. Layout verified down to 320px in both themes.

…t rate

The composer's context window card now shows a stacked bar of what fills
the window, with a collapsible largest-first legend. Claude sessions get
the real per-category breakdown from the SDK's context usage report
(deferred tool categories are excluded since they are not part of the
used total); Codex shows a single used-vs-free segment. Both providers
get a cached-input rate line derived from session input totals, with the
Codex adapter's cumulative fields now sourced from session-wide totals
instead of the last turn.

A category-less context report from a freshly resumed Claude process is
ignored so it cannot replace the last rich snapshot with a bare one, and
all displayed numbers truncate at their shown precision instead of
rounding, so 96,632 reads 96.6k (never 97k) and a 99.97% cache rate
reads 99.9% (never 100%).
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
threadlines Skipped Skipped Aug 22, 2026 7:51am

Request Review

@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Aug 22, 2026
…er rounds up

Merging main brought the agents panel width test, which the one-decimal
token format broke: 'model · effort · 48.1k tokens' overflowed the 330px
meta line by 3px. Meta lines now use a compact variant that drops the
k-range decimal but still truncates (48,999 reads 48k, never 49k); the
context window popout keeps full one-decimal precision.
@badcuban
badcuban merged commit 33f5ae4 into main Aug 22, 2026
15 checks passed
@badcuban
badcuban deleted the worktree-context-breakdown-bar branch August 22, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant