Feature: Token/context usage indicator in the session composer (status bar)
Is your feature request related to a problem?
Yes. There is currently no visible indicator of how much of the model's context window a session has consumed. Users have no way to know:
- How many tokens the current conversation has used,
- How close they are to the model's context limit,
- Whether a compaction is about to happen.
The app already has auto-compaction (added in v0.11.194), but it triggers silently in the background. From the user's perspective, old context simply "disappears" with no warning and no progress signal leading up to it. For long working sessions this makes it hard to plan: you don't know whether to start a fresh session, summarize manually, or keep going.
Describe the solution you'd like
A token usage indicator in the session composer area. Two suggested placements (either or both):
1. Status bar below the input box (preferred)
┌─────────────────────────────────────────────┐
│ [composer input] │
│ │
│ ████████████░░░░░░░░░ 128,000 / 200,000 │
└─────────────────────────────────────────────┘- Shows
used / limittokens for the active model's context window. - Progress bar fills as the session grows.
- Color shifts as usage approaches the limit:
< 70%→ neutral / muted70–90%→ warning (yellow)> 90%→ error (red), optionally with a hint likeAuto-compaction soon
2. Compact text in the status bar (minimal alternative)
ctx 128k / 200k · 64%A single-line status string, no progress bar. Useful if a full bar is considered too noisy.
Behavior details
- Updates after each assistant turn (and optionally while streaming).
- Reads the model's context limit from the existing
limit.contextfield in the model definition (already present in the custom LLM provider schema — seecloud/share-with-your-team/custom-llm-provider.mdx). - Recomputes when the user switches models in the picker (different models have different limits).
- When auto-compaction runs, the indicator resets/refreshes to reflect the new (compacted) context size, with a brief visual cue that compaction happened.
Data dependencies (what already exists)
- ✅ Per-model context limit:
limit.contextin model definitions (custom provider schema). - ✅ Auto-compaction hook:
experimental.session.compactingplugin hook exists (see@opencode-ai/pluginHooks). - ❓ Token usage per message: needs a source. Options:
- The LLM response
usagefield (most providers returnprompt_tokens/completion_tokens). - A local tokenizer estimate if the provider does not return usage.
- This is the main piece that needs a decision from the team.
- The LLM response
Alternatives considered
TUI plugin via
session_prompt_rightslot — The OpenCode TUI plugin system exposes asession_prompt_rightslot (right of the session input box) and a SolidJS-based renderer. However, the OpenWork desktop app appears to render its own Electron/React UI layer and does not obviously render TUI slots, so a TUI plugin would only help terminal users, not desktop users. (Worth confirming — see open question below.)Fork and patch the desktop UI — Possible but high-maintenance; loses upstream updates. Prefer an official feature.
Status in the right-side extension panel — Not viable: the extension panel surface does not expose a plugin hook for injecting custom UI components; plugins can only add tools and hooks, not render desktop UI.
Open questions for the team
- Does the desktop app render TUI plugin slots, or is the desktop UI a separate React layer that ignores TUI plugins? (This decides whether the feature could even be prototyped as a plugin before merging into core.)
- Where does the engine currently expose per-turn token usage? Is it surfaced to the client/UI layer, or only consumed internally for compaction decisions?
- Preferred placement: in-composer progress bar vs. standalone status bar string?
Additional context
- The model picker is already "model-aware" (v0.11.181: "model pickers model-aware with provider icons and per-model reasoning controls"), so a context-size-aware indicator fits the same mental model.
- This is a common pattern in other agent tools (Claude.ai shows context usage; Cursor shows it; ChatGPT shows it for custom GPTs). Users coming from those tools expect this signal.
Source: different-ai/openwork