Skip to content

agent pane: the Context card and the context ring show Claude Code's /context breakdown - #24303

Merged
teamleaderleo merged 3 commits into
feat-cmux-nextfrom
sp-context-card
Oct 22, 2026
Merged

teamleaderleo merged 3 commits into
feat-cmux-nextfrom
sp-context-card

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

The Inspector's Context card and the composer context ring's details now show what fills a Claude Code chat's context window, not just used and free. Leo asked:

"i feel like having a teensy bit more of the card type thing with fuller info in the session sidebar would be nice? like just make our context circle have a bit more stuff"

and earlier, for the Inspector: "every item must do something on click".

Leo-ask: ask-af4ecbf18f

What changes

When acpmux reports Claude Code's /context (summary.contextBreakdown, added by #24223), both surfaces draw the same card (ContextBreakdownView in inspector/ContextSection.tsx):

  • the total line stays as it was: "43% used" and "171.4k / 400k";
  • the bar is split into one segment per used category plus the autocompact buffer. Free space is the track;
  • one row per category shows a square swatch, the name as Claude Code gives it (not translated), tokens and share of the window. Used categories come largest first, then the buffer, then the deferred categories dimmed with "—" for share (they take no room until they load), then Free space;
  • MCP tools N, Memory files N and Skills N are folds. A click lists their items: an MCP tool by its short name with its server, a memory file by its file name with its full path, a skill by name, each with its tokens. Only the folds take a click, and only the folds hover. The swatches and item rows aren't buttons and don't look like buttons.

Colors come from the theme. Each used category is a step of var(--agent-accent) mixed toward transparent, largest first. The buffer and deferred categories are tints of the text color. Nothing is orange or opaque, and the ring popover keeps its glass.

Without a breakdown (Codex, other harnesses, or a Claude Code too old to answer), the Inspector keeps its used/free rows and the ring keeps its old popover content (bar, tokens, setup/conversation parts). The ring stays where it was; only its popover's content changes.

contextBreakdown() validates defensively. It returns nothing for a non-object, for no maxTokens or for no categories array. It drops categories that lack a name or a known kind, clamps negative or non-numeric counts to 0 and caps shares at 1. It also drops malformed MCP tool, memory file and skill rows.

This PR carries #24223's webview plumbing at its reviewed head 2ac8840 (AcpmuxContextBreakdown in model.ts; direct.ts reading contextBreakdown through contextBreakdownOf, keeping the rest of a combined info update; and its session-start test), byte-identical except reconnectMcp, so it doesn't wait on #24223's Rust side. Whichever lands second merges cleanly.

Gallery

Three Inspector variants. Only the first ships; the other two are gallery fixtures, not settings:

  • agent-pane.chat-inspector / context-breakdown (shipped): accent steps, largest first. It reads as one color family on the glass, like the rest of the panel, and the bar still shows the parts apart.
  • context-breakdown-hues: each category a hue rotated from the accent, the closest to Claude Code desktop's palette. It reads faster, but it brings colors the theme doesn't have.
  • context-breakdown-mono: every category in the full accent. It's the quietest, but the bar no longer says which part is which.

Ring popover: agent-pane.context-ring / breakdown and breakdown-memory-open.

Not in this PR

Account usage limits (session and weekly percentages with reset times) need acpmux to send usageLimits, which a sibling lane is adding. They'll come in a follow-up PR on top of this card.

Size: the diff is about 1,060 lines. 396 of those are the three new strings' 21-locale catalog entries, and about 70 are #24223's plumbing and test.

Observed / Not run

  • Observed: scripts/web-lint.sh (Oxlint, Oxfmt, type check, layer checks, catalog keys) passed, and scripts/cmux-next/prepush-gate.py reported no new violations.
  • Not run locally (no builds on this Mac): bun test. The new webviews/test/chat-inspector-context-breakdown.test.tsx covers the ordering, shares, dropping of malformed input, MCP name shortening, the folds opening and closing on click, the Inspector fallback without a breakdown, and the ring popover with and without one. It runs in this PR's CI. Gallery captures come from the gallery advisory run.

Changelog

  • Added: the agent chat's Context card and the composer's context ring details show what fills a Claude Code chat's context window by category, with its MCP tools, memory files and skills.

🤖 Generated with Claude Code

Agent session: cosmic-gray

…/context breakdown

Leo: "i feel like having a teensy bit more of the card type thing with fuller
info in the session sidebar would be nice? like just make our context circle
have a bit more stuff"

The Inspector's Context and the composer context ring's details draw a Claude
Code chat's /context (acpmux contextBreakdown): the bar split by category in
steps of the theme accent, a row per category with tokens and share (deferred
ones dimmed with no share, free space last), and MCP tools, Memory files and
Skills folds that list their items. Without a breakdown both keep what they
drew before. Carries the contextBreakdown plumbing of #24223 (model.ts,
direct.ts) unchanged, so either lands first.

Leo-ask: ask-af4ecbf18f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16037-16c2-7a73-b063-2e37ed40b9c4&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 22, 2026
@cursor

cursor Bot commented Oct 22, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review b9261c5: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr24303 -f ref=sp-context-card -f platform=macos -f backend_mode=local

Gallery before/after for b9261c5: 16 states rendered, 6 images differ, 1558 more touched states not rendered. Images are in the run's artifact, not on this public PR.

gh run download 39744905281 -R manaflow-ai/cmux -n gallery-advisory-24303-b9261c5395e5b16e6780d5c205415a556a6c9e5d (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.chat-inspector/context-breakdown Apple System Colors Light new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-breakdown Apple System Colors new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-breakdown-hues Apple System Colors Light new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-breakdown-hues Apple System Colors new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-breakdown-mono Apple System Colors Light new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-breakdown-mono Apple System Colors new 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/full Apple System Colors Light unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/full Apple System Colors unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/environment-folders Apple System Colors Light unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/environment-folders Apple System Colors unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-connectors-open Apple System Colors Light unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/context-connectors-open Apple System Colors unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/changes-breakdown Apple System Colors Light unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/changes-breakdown Apple System Colors unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/changes-all Apple System Colors Light unchanged 0% own ChatInspector.gallery.tsx
agent-pane.chat-inspector/changes-all Apple System Colors unchanged 0% own ChatInspector.gallery.tsx
agent-pane.composer/new-chat Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/new-chat Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/side-session Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/side-session Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-open Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-open Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-failing Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-failing Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-draft Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-suggest-draft Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-reasoning Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/new-chat-reasoning Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/agent-home Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/agent-home Apple System Colors unchanged 0% own Composer.tsx
agent-pane.composer/agent-home-path Apple System Colors Light unchanged 0% own Composer.tsx
agent-pane.composer/agent-home-path Apple System Colors unchanged 0% own Composer.tsx

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Passes: CI passes on b9261c5395.

CI passes on b9261c5395 (run 39753727058 attempt 1).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on 77873a0 to compare; do not merge until green; see lane-rules

Tour of b9261c5395 (run): no media. The tour did not run: only webview code changed (13 path(s)), which the gallery advisory run checks in Linux Chromium on the pull request (its artifact holds any captures); add the media-tour-mac label, then re-add media-tour, to tour it on a Mac.

direct.ts, model.ts and the session-start test now match #24223 at
2ac8840 (its review fixes): an info update keeps its title and Claude
Code's facts when it also carries the breakdown, and the update's breakdown
goes through contextBreakdownOf. reconnectMcp stays with #24223.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16037-16c2-7a73-b063-2e37ed40b9c4&host=cosmic-gray
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-zingl created for this PR by the cmux coordinator.

@blacksmith-sh

blacksmith-sh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Found 11 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp390x87i3/summary-fail.json (live):/summary-fail.json (live): View Logs
/tmp/tmpbat709tv/summary-missing.json (live):/summary-missing.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
convention violations found (ERROR lines above)./
convention violations found (ERROR lines above).
View Logs
nightly cmux-tui resolve/nightly cmux-tui resolve View Logs
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules)/
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules)
View Logs
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules) (job='web-bundles')/
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules) (job='web-bundles')
View Logs

...and 1 more test failures. View all on Blacksmith

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The breakdown's bar read --acpmux-context-free, which only the Inspector's
Context wrapper set, so in the composer ring's details the track was
transparent. The breakdown sets it itself (Codex review P2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16037-16c2-7a73-b063-2e37ed40b9c4&host=cosmic-gray
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex xhigh, correctness first): SHIP at b9261c5

Reviewer: Codex (gpt, xhigh) via acpmux on big-red, read-only, static review of the full PR diff.

  • First pass at 2373e3e: SHIP with one P2. The ring popover's breakdown bar read --acpmux-context-free, which only the Inspector wrapper defined, so the free-space track was transparent there.
  • Fixed in b9261c5 (.acpmux-context-breakdown sets the variable itself). Follow-up at b9261c5: SHIP, no findings. "Only the stated CSS change differs from the reviewed head."
  • It checked: contextBreakdown() validation (no NaN or Infinity widths, shares clamped, unknown kinds dropped), fallbacks unchanged without a breakdown, React keys and state, CSS scoping, which elements take clicks, the tests under bun with jsdom, tsc types, and the xcstrings JSON (3 keys × 21 locales).

@teamleaderleo teamleaderleo added the ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds label Oct 22, 2026
@teamleaderleo
teamleaderleo merged commit dd09d76 into feat-cmux-next Oct 22, 2026
@teamleaderleo
teamleaderleo deleted the sp-context-card branch October 22, 2026 11:15
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

teamleaderleo added a commit that referenced this pull request Oct 25, 2026
After each Claude Code turn acpmux asks get_context_usage and sends the
trimmed answer as session_info_update _meta.acpmux.contextBreakdown, kept in
the session detail's contextBreakdown (the shape #24303's Context card reads).
A failover or a replaced agent's late answer drops or ignores it.
_acpmux/mcp/reconnect sends Claude Code's mcp_reconnect for a server the chat
lists; the agent pane may relay it for a chat in its scope.

Rebased onto feat-cmux-next as one commit: the web plumbing #24303 already
landed is not repeated; this carries the daemon side, reconnectMcp and the
pane's failover drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16c8c-54ec-71b2-a0fa-125d1404dd72&host=big-red
teamleaderleo added a commit that referenced this pull request Oct 26, 2026
* acpmux: Claude Code's /context breakdown and MCP reconnect

After each Claude Code turn acpmux asks get_context_usage and sends the
trimmed answer as session_info_update _meta.acpmux.contextBreakdown, kept in
the session detail's contextBreakdown (the shape #24303's Context card reads).
A failover or a replaced agent's late answer drops or ignores it.
_acpmux/mcp/reconnect sends Claude Code's mcp_reconnect for a server the chat
lists; the agent pane may relay it for a chat in its scope.

Rebased onto feat-cmux-next as one commit: the web plumbing #24303 already
landed is not repeated; this carries the daemon side, reconnectMcp and the
pane's failover drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16c8c-54ec-71b2-a0fa-125d1404dd72&host=big-red

* acpmux: rustfmt the context and reconnect lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16c8c-54ec-71b2-a0fa-125d1404dd72&host=big-red

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant