Skip to content

Show each thread's token usage next to its status icon #17

Closed

Description

@tannerpolley

Goal

Show each thread's token use (and context or usage amount) at the right of its row, next to the spinning status icon, so you can see at a glance how much a thread has used. Claude Code's CLI shows this; Codex reports the same data.

Owner request (2026-10-12).

What exists today

  • Codex data. thread/tokenUsage/updated (CodexAdapterV2.ts ~4404–4440) sets live tokenUsage on the provider turn, and the final turnTokenUsage is set at ~5892.
  • Claude data. Each assistant message.usage sets live tokenUsage (ClaudeAdapterV2.ts ~7102–7130), and the final normalized figure is at ~5962.
  • Contracts. ThreadTokenUsageSnapshot / TurnTokenUsage (providerRuntime.ts), ProviderThread.contextUsage, turn tokenUsage / turnTokenUsage (orchestrationV2.ts ~1012, ~1088–1122).
  • Only the context meter in the open thread reads it (apps/web/src/lib/contextWindow.ts). The thread shell that sidebar rows use has no token field, and the Usage page has no per-thread breakdown.

Proposed

  • Add a small per-thread usage summary to the thread shell: tokens for the latest turn, and total or context fill. The server keeps it up to date from events it already has. Send it at a throttled rate; T3 must not send more websocket traffic per token.
  • Show it as a compact number (for example 48k) in the sidebar row's usage column (Sidebar rows in fixed columns: location, role, provider, model, effort, name, time, work, usage #19), and optionally in the chat header. The tooltip breaks it down into input, cached, output and context %.
  • Decide whether to show tokens or an estimated cost or quota share. Subscription users care more about a share of their 5-hour or weekly quota than about dollars.

Performance is non-negotiable (AGENTS.md): no per-token pushes, and no repainting animation. Only Codex and Claude are in scope. Mobile is out of scope.

Activity

  1. tannerpolley commented on Oct 13, 2026

    @tannerpolley
    OwnerAuthor

    Owner decision (2026-10-13): the compact number next to each thread's status icon is the latest turn's tokens. Context fill and thread totals go in the tooltip.

  2. tannerpolley commented on Oct 14, 2026

    @tannerpolley
    OwnerAuthor

    Merged to main in fb389ff (4 commits), after one independent Opus review, two fix rounds, a re-verification and a live sandbox check.

    • Columns (Sidebar rows in fixed columns: location, role, provider, model, effort, name, time, work, usage #19): Projects-view rows, child rows and native subagent rows share one column definition: caret · location · role · provider · model · effort · name · time · work · usage. The caret column is reserved on rows without children. Each level indents by one fixed 12px step. On a narrow sidebar the columns drop in the order usage, effort, model. Activity keeps its cards, and search rows keep their layout. The tree guides, hidden-task counts and classic style (Codex-style sidebar off) are kept.
    • Sandbox check: measured on a live orchestrator → child → native-subagent tree. Leading columns line up within each depth (+12px per level); count, time and status line up across all depths. Times are compact ("6s", "3m") and don't overlap the status mark. Titles are 12px.
    • Default 16rem sidebar: model, effort and usage are hidden, and the title keeps about 11 characters. At 20rem: model. At 24rem and wider: model, effort and usage (for example "Haiku 5.5 · Med · … · 145k").
    • Usage (Show each thread's token usage next to its status icon #17): the number is the latest turn's tokens; the tooltip shows input, cached, output, context fill and thread total. The server keeps a small per-thread summary (fork migration 11), sent to clients at most every 5 s during a turn and immediately on turn start or completion. That's about 190 bytes per thread. A Claude turn that ends without a final result keeps its partial count.
    • Tests: about 181 focused tests; tsc-rs is clean for server, web, contracts and client-runtime.

    Ships in the next build after v2.12.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequested improvement or new capability.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions