Skip to content

Feature: show how full each agent's context window is - #79

Merged
DevMando merged 7 commits into
mainfrom
feature/desktop-context-bar
Sep 25, 2026
Merged

DevMando merged 7 commits into
mainfrom
feature/desktop-context-bar

Conversation

@DevMando

Copy link
Copy Markdown
Owner

Summary

Each tab now shows how full its agent's context window is, in the strip under the message box:

Context ▰▰▰▰▰▱▱▱▱▱▱▱ 41% of 32k tokens              ⎇ ● main

The bar and the percentage turn from green to yellow to red as the window fills. That's the cue to run /compact before the model starts losing the earlier part of the conversation, which small local models do quickly.

What changed

  • Meter in the status strip: it sits left of the git branch chip, and every split pane has its own, since context is per agent. The strip now shows whenever either item has something to display; before, it showed only for git repositories.
  • What it measures: the size of the last request against the model's configured context window. Every request resends the whole conversation, so that's where the next one starts. It turns yellow at 60% and red at 85%, and a full window also shows ⚠ so the warning doesn't rely on color alone.
  • Cloud models: these manage their window server-side, so they show the token count only (~17k tokens in context), without a bar.
  • Details on hover: the tooltip gives the exact count ("13k of 32k tokens") and suggests /compact. Screen readers announce it as "Context window 41 percent full, 13k of 32k tokens".
  • Colors checked in every theme: each theme's green, gold and red are lifted just enough to stay readable. The percentage, which is text, clears 4.5:1 against the background. The bar clears 3:1 against its empty track, so the filled part is always easy to tell apart. Measured before this change, the raw colors missed even 3:1 in W98 - Y2K and Solarized Light, and the filled part would have been nearly the same color as the empty part in most themes.

Why this was done

The only context signal Desktop had was the per-reply summary line ([~27k in, 611 out]) and a session-wide total in the header. Neither says how close the agent is to running out of room. The CLI gained the same meter in DevMando/MandoCode#101, and this brings Desktop in line.

How it was tested

  • A new theme test checks every theme at every level (25 themes × 3 levels), so a future theme with a weak color fails the test instead of shipping. The full Desktop test suite passes.
  • Worth a manual check in the app before merging: send a message on a local model and confirm the meter appears after the reply, then switch themes and confirm it recolors.

Notes

  • While a plan runs, the meter reflects the last plan step's request, which is smaller than the chat's own context. The CLI meter behaves the same way.
  • The math comes from the engine's ContextMeter, already on the pinned engine commit; this PR doesn't move the pin.
  • Changelog: entry added under [Unreleased] → Added.

DevMando and others added 7 commits September 24, 2026 15:29
The strip under the input box now shows how full the agent's context
window is, left of the git chip: a bar against the configured context
length for local models, and the token count alone for cloud models,
which manage their window server-side. "Used" is the last request's
prompt tokens. A full window adds a warning glyph, so the state never
rests on color alone, and the tooltip points at /compact.

The fill takes the level's theme color (green, gold, red), lifted per
theme until it clears WCAG's 3:1 non-text floor against both the page and
the empty track. Measured across all 25 themes, the raw colors missed 3:1
against the page in W98 - Y2K and Solarized Light, and a dim-colored track
sat within 1.0-1.5:1 of the fill in most themes. A test sweeps every theme
and level.

The git chip now hides its own panel, and the strip shows when either
part has something to show.

Depends on the engine's ContextMeter (DevMando/MandoCode
feature/cli-live-ui); the submodule points at that branch until it merges.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The percentage now stands on its own in the fill color, semibold, instead
of "(54%)" after the token counts. Because it is text in that color, the
fill is lifted to the 4.5:1 text floor against the page (from the 3:1
non-text floor), and the bar and the percentage share the one color. The
theme sweep asserts the new floor in every theme and level. The meter
also gets an accessible name for screen readers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
"Context" now names the bar, which alone could read as any progress, and
the counts read "13k of 32k tokens" instead of "13k / 32k".

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
One phrase, led by the colored percentage. The used count is 41% of the
window, and the exact figure stays in the tooltip and accessible name.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The engine branch was rebased onto its changelog entry, so the commit
recorded earlier is no longer on any branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@DevMando
DevMando merged commit f1db7bc into main Sep 25, 2026
1 check passed
@DevMando
DevMando deleted the feature/desktop-context-bar branch September 25, 2026 00:32
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