Skip to content

feat(composer): show context and connectors next to the model picker - #6285

Open
m-froehlich wants to merge 1 commit into
different-ai:devfrom
m-froehlich:feat/composer-context-indicators
Open

m-froehlich wants to merge 1 commit into
different-ai:devfrom
m-froehlich:feat/composer-context-indicators

Conversation

@m-froehlich

@m-froehlich m-froehlich commented Oct 21, 2026 •

Copy link
Copy Markdown

What

Two quiet controls in the chat box, next to the model picker, behind composerContextIndicators:

  • Connectors: how many MCP servers are connected, a logo stack, and a list on click (connected servers
    first; the others dimmed, with their sign-in action or a short note).
  • Context: "Context: 34%" with a ring that changes colour as the window fills (neutral, amber from 70%,
    stronger amber shortly before the engine compacts). A click opens what fills it: a segmented bar and a row
    per category, with a switch between share of the window and share of the used context.

Everything is computed locally from what the app already holds. No model is asked.

Fixes #2724. Builds on the approach of #2902, which was closed unmerged and showed the total only.

How is this implemented?

Behind composerContextIndicators (cloud and self-hosted, off by default), declared in
packages/features/src/flags/composer-context-indicators.ts with an internal doc and screenshots in
docs/features/composer-context-indicators/. Safe to kill: the controls vanish and nothing else changes. No OpenAPI
or SDK files are committed; CI generates them.

  • Measured total, per engine. The usage the provider reports for the latest reply, with each engine's own
    overflow formula so the indicator and the compaction agree (v1 tokens.total, v2 the sum of all fields).
    The v2 adapter used to drop that usage block; it now keeps it and turns session.step.ended into a small
    event of its own (a sparse message.updated would overwrite the transcript row). A small store beside the
    transcript holds the latest figure per session.
  • Compaction ceiling, per engine. v1: limit.input - reserved, or limit.context - maxOutputTokens.
    v2: the smaller of the input limit and the context window, minus the configured buffer (tokens or a share such as
    20%), or max(15%, 16000) when none is set. The strong step starts 5% of the window before that ceiling.
  • Breakdown. Estimates (characters / 4) for messages, active skills, the skill list and tool definitions,
    scaled down if they exceed the measured total; the rest is shown as "system and other", so the rows always
    add up. v1 reads the engine's tool list; v2 reads GET /api/session/{id}/context.
  • Connectors. One row model feeds both the plus menu and the new list. The inventory loads when the
    session opens, with a passive read that skips the silent re-authentication.
  • Compaction handling. A v1 compaction summary and the end of any compaction clear the live figure; their
    usage is not the size of the context that follows.

Design rules (DESIGN.md)

P3 progressive disclosure (details only in popovers), P5 existing primitives (Popover, Button,
ConnectorLogo), S2 compact rows, S7 floating surfaces open upwards and fit, T5 quiet composer controls,
V2 and C5 amber and never red for a limit, colour never the only carrier (ring fill, numbers and text).

Evidence

Run as the desktop client (Electron) in a test profile, and against the real engines OpenCode v1.18.30 and v2.0.26
with a fake model that reports its usage as request characters / 4. Since then the branch was rebased onto current
dev, and the formulas were checked again by reading the sources of OpenCode v1.18.33 and v2.2.6 (total, ceiling,
buffer setting, entry types and the context endpoint). That check was not run against a live v2.2.6 engine.

  • Neutral, plain amber (73%) and strong step (81%, "Auto-compaction soon").
  • Used basis (shares add up to 100%), connectors list, unknown window (tokens only), after a compaction.
  • Dark theme, a window of about 470 by 420 pixels (short labels, popover fits).
18-desktop-dark-100k-neutral-12k-12pct 19-desktop-dark-100k-amber-73k-73pct 20-desktop-dark-100k-strong-step-80k6-81pct-window-basis 21-desktop-dark-100k-strong-step-80k6-81pct-used-basis 22-desktop-dark-100k-connectors-list 17-desktop-dark-narrow-short-unknown-window-12k 14-desktop-light-100k-19k5-20pct-after-compaction

Tests: 110 new tests in seven files (logic, formulas against recorded engine payloads, the v2 usage mapping,
the store, both controls in happy-dom). tsc --noEmit for apps/app and packages/features, code habits, prose
habits, app structure, i18n and features:check pass locally. The rest of pnpm check was not run locally, because
native modules cannot be built on my machine; CI will.

Known limits

  • v2 leaves no marker in the history it returns after a compaction, so after reopening a session that was
    just compacted, the indicator can show the pre-compaction size until the next reply.
  • On v1, the tools of MCP servers are not in the engine's tool list; the Tools row is marked partial and
    the rest stays in "system and other". On v2 the built-in tools cannot be listed and stay there; the row shows
    MCP tools only, when there are any.
  • The rows are estimates; only the total is measured. Characters / 4 was not compared with a real tokenizer.
  • Not shown on the new-task screen: there is no usage yet, and no runtime status for local servers.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Contributor screen: passed

Commit faad61ab18 · run

No hidden characters, dependency, database or obfuscation concerns.

Nothing else runs yet. A maintainer reviews the changes then comments /test to start the tests.

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-landing Ready Ready Preview, v0 Nov 21, 2026 9:30am UTC

Request Review

@m-froehlich

Copy link
Copy Markdown
Author

Ready for review; please run /test when you have a moment.

Two quiet controls in the composer row, behind composerContextIndicators
(declared off, cloud and self-hosted, with an internal doc):
- Connectors: how many MCP servers are connected, a logo stack, and a list
  with sign-in or a short note for the others.
- Context: "Context: 34%" with a ring that turns amber from 70% of the window
  and stronger amber shortly before the engine compacts. The popover shows the
  measured total, a segmented bar and a row per category (estimates marked),
  with a switch between share of the window and share of the used context.

Everything is computed locally. The v2 adapter keeps the usage OpenCode
reports (session.step.ended becomes session.usage.measured) and reads the
engine context; a small store beside the transcript holds the latest figure
per session. The compaction ceiling follows each engine, including the v2
buffer given as tokens or as a share.

Refs different-ai#2724
Builds on the approach of different-ai#2902.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@m-froehlich

Copy link
Copy Markdown
Author

@reachjalil this is rebased onto current dev, signed, and has no generated files. Whenever you next go through the external PRs, could you take a look? The head is faad61a. Thanks!

This branch was successfully deployed

1 active deployment
Preview – openwork-landing — faad61ab Deployed Nov 21, 2026 by vercel[bot]
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.

Feature: Token/context usage indicator in the session composer (status bar)

1 participant