Skip to content

feat(usage): rebuild Usage as a cost cockpit with a rhythm heatmap - #317

Merged
bubbleptr merged 1 commit into
mainfrom
feat/usage-cockpit-rhythm
Sep 16, 2026
Merged

bubbleptr merged 1 commit into
mainfrom
feat/usage-cockpit-rhythm

Conversation

@bubbleptr

Copy link
Copy Markdown
Owner

Summary

  • Usage page rebuilt cost-first: period selector, 4 KPI tiles (sparkline + period-over-period delta), daily cost line with crosshair, weekday × hour rhythm heatmap (local time), rank rows by project / model / tool / skill.
  • New shared/ui primitives PiLineChart / PiSparkline / PiHeatmap; PiKpi gains a footer slot. PiBarChart and the old token trend / annual heatmap code are deleted.
  • Aggregation read model rewritten in usage-aggregation.ts with tests (period windows, deltas, daily cost, ranks, weekday×hour grid with injected clock, rank-based levels).
  • Browser mock now answers list_sessions, so /usage renders under bun run dev:mock.
  • Decision record: .scratch/usage-redesign/DECISION.md (chosen Cockpit + Rhythm; rejected Ledger / Digest / Calendar / Drill and why).

Screenshots

Light and dark verified in the browser mock at 1440×960; KPI deltas wrap under the value, empty heatmap cells stay visible in dark mode.

Test plan

  • bunx tsc --noEmit
  • bun run test — 137 files / 1494 tests green (before the last two CSS tweaks; the 43 affected files re-run green after)
  • Playwright screenshots of /usage in dev:mock, light + dark, no console errors

Known follow-ups

  • Daily buckets are UTC while the rhythm grid is local time; unify in a follow-up.
  • README / AGENTS.md still describe Pace as an observation GUI; positioning update is a separate change.

🤖 Generated with Claude Code

…ythm heatmap

Replace the token-centric dashboard (stacked token trend, model donut,
annual token heatmap) with a cost-first layout decided from the
/proto/usage exploration: period selector (7D/30D/90D/All), four KPI
tiles with sparkline and period-over-period delta, a daily cost line with
crosshair tooltip, a weekday × hour rhythm heatmap in local time, and
rank rows by project / model / tool / skill.

- entities/session/usage-aggregation: new read model (splitUsagePeriod,
  summarizeUsage, usageDelta, aggregateDailyCost, rank*ByCost,
  aggregateWeekdayHourCost, rankLevels); old token/heatmap helpers removed
- shared/ui: add PiLineChart + PiSparkline and PiHeatmap; PiKpi gains a
  footer slot and lets long stacked deltas wrap; PiBarChart removed
  (nothing else used it); registered on /design with tests
- dev mock: serve list_sessions so /usage renders under bun run dev:mock
- docs: self-built-ui ledger and design usage rules updated; decision
  record in .scratch/usage-redesign/DECISION.md

Co-Authored-By: Claude <noreply@anthropic.com>
@bubbleptr
bubbleptr merged commit bc885d6 into main Sep 16, 2026
@bubbleptr
bubbleptr deleted the feat/usage-cockpit-rhythm branch September 16, 2026 17:58
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.

1 participant