tui: Workflow panel, rotating coaching notes, titles in the context browser - #786
tui: Workflow panel, rotating coaching notes, titles in the context browser#786iamtoruk wants to merge 1 commit into
Conversation
… list Phase-1 TUI additions, all reusing the parsed projects the dashboard already holds (no re-parse): - Workflow panel: a compact box in the grid beside Claude Agent Types showing Corrections (N% with count), First edit (median), Rework (top file basename x sessions) and Coverage (share of cost-bearing calls priced). Coverage is dropped when there is nothing to price so it never shows a hollow 100%. The panel hides when there is no signal at all (no user turns and no churn) and follows the existing half-width/stack responsive behaviour. - Footer coaching note: rotates one buildCoachingNotes line through the footer above the status bar, only when notes exist. - Context browser: the AI title is now the primary label with the short id demoted into the dim metadata cluster, columns kept aligned. Pure formatting/selection helpers are covered by tests.
ozymandiashh
left a comment
There was a problem hiding this comment.
Read through the panel and the tests, and traced the data path: computeWorkflowPanelData mirroring the report helpers (no re-parse), the coverage tally matching usage-aggregator's cost-bearing/unpriced shape (same <synthetic>/isExpectedFreeModel exclusions before findUnpricedModels, so the two figures agree by construction), and the null-coverage row dropping instead of rendering a hollow 100%. The sessionPrimaryLabel demotion of the id into the metadata cluster also reads much better at 100 columns. All solid.
Three things worth deciding before this lands, one of them cross-PR:
1. Merge-order collision with #863
#863 rewrites exactly this region of dashboard.tsx (427/177 churn): DashboardContent becomes an "eight panels retain source order" model with 1/2/3-column reflow and a 3/3/2 three-column arrangement, and InteractiveDashboard grows refresh/scroll state on the same lines this PR touches for noteTick. Whichever PR lands second has to re-place the Workflow panel as a ninth panel inside that ordering (3/3/3), re-anchor the tip line against the new scroll-offset handling, and re-resolve the WorkflowInsights pairing with ClaudeAgentTypes. Not an objection to either PR, but the two should be sequenced deliberately rather than left to whoever rebases last.
2. The rotation interval runs outside the dashboard view
coachingNote is computed only for view === 'dashboard', but the setInterval at the noteTick effect keeps firing (and re-rendering via setNoteTick) in optimize/compare/day views where the tip line is not rendered. Cheap, but it is a spurious full-frame repaint every 12s in views that #863 is busy making repaint-free. Gating the effect on the view (or clearing the interval when the tip is hidden) closes it.
Related nit: computeWorkflowPanelData (inside WorkflowInsights) and computeCoachingNotes (in the parent) each run scanUserCorrections + aggregateFileChurn + medianTimeToFirstEditMs over the full project set, so every data refresh pays the scan twice. Computing once and deriving both would halve it.
3. The rounds-to-zero convention: +1 for <1% (N)
Your own real-data example makes the case: "Corrections 0% (7)" asserts zero corrections and then counts seven of them in the same cell. <1% (N) fixes the contradiction and keeps the count honest. I would also apply it to the menubar rather than keeping its hide-on-zero behavior, since "hidden" and "0%" are different claims and neither matches "<1% with a nonzero count".
One more edge for whichever convention wins: formatCorrectionsValue uses Math.round, so 0.4% renders as 0% (N) today, while a genuine 0 with userTurns > 0 renders 0% (0). Under <1% (N) the first becomes <1% (N) and the second stays 0% (0), which reads exactly right.
Phase 1 for the terminal surfaces.
Workflow panel in the dashboard grid (paired with Claude Agent Types, existing responsive collapse): Corrections N% with count, First edit median, Rework top file with session count, Coverage N% priced. Reuses the workflow-insights functions over the already-parsed projects, no re-parse. Coverage computes null with no cost-bearing calls and the row drops entirely. Panel hides with no signal. Footer rotates one coaching note every 12s as a tip line, only when notes exist.
Context browser rows now lead with the captured title (untitled sessions read as untitled session), the 8-char id demoted into the dim metadata cluster with columns aligned; proven at 140 and 100 columns via pty drives on a real cache copy, with the real panel reading Corrections 0% (7) / First edit 6m / Rework sdk.py x15 / Coverage 95%.
18 new tests; typecheck green.
Wave-review note: surfaces currently differ on rounds-to-zero correction rates (app renders 0%, menubar hides, TUI renders 0% with count). Suggest settling one convention across the wave before merging, likely showing sub-1% as <1% (N).
Part of the phased surfacing wave; PRs only, no release.