dashboard: two-meter run header — live context-window % + cumulative $ cost #967

Closed
opened 2026-05-08 12:15:53 +00:00 by claude-desktop · 2 comments
Collaborator

User story

As an operator under a hard monthly budget, I want every run to show a live context-window % bar (per turn) and a cumulative $ cost counter (per run) at the top-right of the run header, so I can interrupt runaway tasks before they burn budget or hit context limits.

Context

Token meter (#952) ships per-task usage. Cost rate table (#953) ships per-task USD. This ticket binds both into the run header chrome and adds the context-window bar (which neither prior ticket covered explicitly).

Acceptance criteria

  • <RunHeaderMeters> component, mounted in: planner drawer header, monitor detail header, agent timeline header.
  • Meter 1 — context window: bar showing tokens_in_current_context / model_context_window. Color tiers: <50% neutral, 50–90% warn, >90% error. Tooltip lists per-tool token attribution (Read X / Bash Y / system Z) — see follow-up ticket.
  • Meter 2 — cumulative cost: $ figure (3 sig figs). Color tiers per a configurable soft budget. Tooltip breaks down by model / provider when mixed.
  • Compaction events render as discrete pill markers on the context-window bar.
  • Both meters update live via the SSE usage_delta and result events; coalesced ≤4 Hz.
  • Mobile: meters collapse into the drawer's status bar instead of the header.

Out of scope

  • Per-tool token attribution chart (separate follow-up).
  • Budget enforcement / auto-cancel.

Dependencies

  • Depends on #952 (live token meter foundation).
  • Depends on #953 (cost rate table).

References

## User story As an operator under a hard monthly budget, I want every run to show a live **context-window %** bar (per turn) and a cumulative **$ cost** counter (per run) at the top-right of the run header, so I can interrupt runaway tasks before they burn budget or hit context limits. ## Context Token meter (#952) ships per-task usage. Cost rate table (#953) ships per-task USD. This ticket binds both into the run header chrome and adds the context-window bar (which neither prior ticket covered explicitly). ## Acceptance criteria - [ ] `<RunHeaderMeters>` component, mounted in: planner drawer header, monitor detail header, agent timeline header. - [ ] **Meter 1 — context window**: bar showing `tokens_in_current_context / model_context_window`. Color tiers: <50% neutral, 50–90% warn, >90% error. Tooltip lists per-tool token attribution (Read X / Bash Y / system Z) — see follow-up ticket. - [ ] **Meter 2 — cumulative cost**: $ figure (3 sig figs). Color tiers per a configurable soft budget. Tooltip breaks down by model / provider when mixed. - [ ] Compaction events render as discrete pill markers on the context-window bar. - [ ] Both meters update live via the SSE `usage_delta` and `result` events; coalesced ≤4 Hz. - [ ] Mobile: meters collapse into the drawer's status bar instead of the header. ## Out of scope - Per-tool token attribution chart (separate follow-up). - Budget enforcement / auto-cancel. ## Dependencies - Depends on #952 (live token meter foundation). - Depends on #953 (cost rate table). ## References - Augment Code's argument for per-tool cost surface: https://www.augmentcode.com/guides/ai-agent-loop-token-cost-context-constraints - `phuryn/claude-usage` dashboard reference: https://github.com/phuryn/claude-usage
Collaborator

🤖 Auto-assigned to dev (heuristic: area:dashboard + body 1769 bytes (≤ 2 KB) — code role). Reply /unassign to reroute.

🤖 Auto-assigned to **dev** (heuristic: area:dashboard + body 1769 bytes (≤ 2 KB) — code role). Reply `/unassign` to reroute.
Collaborator

🦵 @charles kicked the queue — re-running implement on @dev.

🦵 @charles kicked the queue — re-running implement on @dev.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
charles/claude-hooks#967
No description provided.