Skip to content

feat: history view (1-week default) + rename to claude-dashboard.py#6

Open
dgjlindsay wants to merge 5 commits into
mainfrom
doug/history-view
Open

feat: history view (1-week default) + rename to claude-dashboard.py#6
dgjlindsay wants to merge 5 commits into
mainfrom
doug/history-view

Conversation

@dgjlindsay

@dgjlindsay dgjlindsay commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a HISTORY view to the dashboard with a Win3.1-style Live / History menu bar, and renames the script to match the project.

Live / History tabs

  • A menu bar in the title row: Live / History with the accelerator letter underlined (SGR-4) and the active tab highlighted.
  • Press L (Live) / H (History) or click a tab — deterministic select, not a toggle.

History view

  • Same three charts + a 4th ("Model mix · effective tokens", stacked by model: opus=blue, sonnet=green, haiku=amber, fable=purple, unknown=grey) over a configurable window — default 168h (1 week) — with an auto-scaled bucket and a day-by-day X-axis.
  • A panel row below the charts: SUMMARY scoped to the window (with a $ cost estimate = effective tokens × --price-per-mtok, default 5.0 = Opus 4.8 input, and a cache-hit rate) beside an ACTIVITY heatmap (effective tokens by local weekday × hour, colour-ramped less→more, per-day totals).
  • On a screen too small for both inline, the panels move to popups: S = summary, M = heatmap (mirrors the live view's s/e/w degradation).
  • No active-sessions / allowance panels in history.
  • Click a bar to break that slice down by session (day-aware span).
  • q/esc unwinds popups → history → live; L jumps straight back to Live.

Other

  • Menu tabs plus footer H history/L live, S summary/M heatmap (popup mode), and ⌃C to exit spans are all clickable.
  • Renamed claude-cache-monitor.pyclaude-dashboard.py (log + refs updated).

Config

--history-hours (168) · --history-bucket-minutes (override auto-scale) · --price-per-mtok (5.0).

How

  • collect() now takes (window, bucket, num_buckets, track_models, track_heatmap) so one scan feeds both views and builds the model-mix + heatmap data (extra keys the live aggregation loops ignore → live untouched); history is collected on demand, cached, refreshed on --interval and on resize.
  • Render reads an active-view context (VIEW_WINDOW/VIEW_BUCKET/VIEW_DAILY) so the chart axis, bucket-popup span, and summary label follow the current view.
  • render_chart gained series_of/legend_str to stack arbitrary pre-coloured series (model series aren't in the fixed CO palette).
  • styled() adds optional background + underline to rgb(); view_tabs()/_menu_cell() build the menu bar + click hit segments; process_input routes __live__/__history__ and the L/H keys deterministically.

Commits (separable for review/rollback)

  1. history view core (charts + day-axis + summary + cost + cache-hit + drill-down) + rename
  2. model-mix 4th chart
  3. activity heatmap
  4. heatmap inline beside summary + S/M popup fallback
  5. Win3.1 Live / History menu tabs (underlined accelerators, deterministic L/H)

Verified

Single-frame renders of live / history (inline + popup tiers); tab + footer hit columns land on their labels; underline/highlight SGR correct per mode; bar drill-down; S/M/e + L/H key routing; small-terminal height + width fallbacks fit (or fall back to the too-small notice); --history-bucket-minutes override; footer-span click parsing.

🤖 Generated with Claude Code

dgjlindsay and others added 5 commits June 26, 2026 11:53
History view (press H, or click "H history" in the footer):
- same 3 charts over a configurable window (--history-hours, default 168 =
  1 week) with an auto-scaled bucket and a day-by-day X-axis
- SUMMARY scoped to the window + a $ cost estimate (effective tokens ×
  --price-per-mtok, default 5.0 = Opus 4.8 input) and a cache-hit rate
- no active-sessions / allowance panels (per request); click a bar to drill
  into that slice by session
- collected on demand, cached, refreshed on --interval and on resize

collect() now takes (window, bucket, num_buckets) so one scan feeds both views.
Footer "H history"/"H live" and "⌃C to exit" spans are clickable.

Renamed claude-cache-monitor.py -> claude-dashboard.py (matches the project);
log file and references updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a 4th always-on chart to the history view stacking effective tokens by
model (opus=blue, sonnet=green, haiku=amber, fable=purple, unknown=grey) with a
per-model legend — "what did the week run on".

- collect(track_models=True) accumulates per-bucket {model: eff} under an extra
  "models" key (skipped by the fixed-key aggregation loops, so live is untouched)
- render_chart gains series_of/legend_str to stack arbitrary pre-coloured series
  (model series aren't in the fixed CO palette)
- chart_block(model_chart=True) appends the 4th chart; plan_layout sizes the
  history view for 4 charts; bars stay click-to-drill-down

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Press M in the history view (or click "M heatmap") for a full-page activity
heatmap: effective tokens by local weekday (Mon..Sun) × hour-of-day (0..23),
colour-ramped less→more, with per-day totals. M / q returns to the charts.

- collect(track_heatmap=True) builds the 7×24 grid in the same history scan
  (module global HIST_HEAT); no extra pass
- render_heatmap() draws the full page; footer M/H/⌃C spans are clickable
- process_input gains show_heatmap (key m, footer span); q/esc unwinds
  heatmap → history → live
- footer "⌃C to exit" is now clickable everywhere (quits) — consistency

Help overlay updated for the model-mix chart, the heatmap, and the new keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per review: the activity heatmap was a full-page M toggle; move it into the
history view's main layout instead — rendered as a panel beside the SUMMARY
(hjoin). When the width can't hold both or the charts would drop below the
minimum bar height, both panels fall back to popups: S = summary, M = heatmap
(mirrors the live view's s/e/w degradation).

- render_heatmap (full page) -> heatmap_content()/heatmap_panel() reused by the
  inline panel and the popup
- plan_layout(history) decides inline vs popup (width + chart-height budget);
  render_frame draws SUMMARY | ACTIVITY side by side when inline
- render_panel_popup gains "hsummary"/"heatmap"; process_input maps S/M to them
  in history (s/e/w stay live-only); removed the show_heatmap full-page mode
- footer shows "click a bar" when inline, "S summary · M heatmap" when popped

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the implicit H-toggle with an explicit menu bar in the title row:
a highlighted active tab, the L/H accelerator letter underlined (SGR-4).
Tabs and the L/H keys are now deterministic (select, not toggle):
H -> History, L -> Live. Tabs are clickable; footer span in history is
now "L live".

- styled(): rgb() plus optional background + underline
- view_tabs()/_menu_cell(): the menu-bar tabs + click hit segments
- render_frame: brand + tabs left, context + clock right; tab hits mapped
- process_input: __live__/__history__ deterministic; H/L keys select
- help text + README + module docstring updated

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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