Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit dc679890aee00a5c58ecf4f11f0c66622535c1a8
parent 6ed278e34fd3aafa97dcafcafebc6561e8afae1f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 23:41:23 -0400

plans: umtool redesign — the epic plan (research, decisions, pieces), phase by phase

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aplans/umtool-redesign.md | 351+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 351 insertions(+), 0 deletions(-)

diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md @@ -0,0 +1,351 @@ +# umtool redesign — research, decisions, pieces (epic, phase by phase) + +## Context + +umtool grew one feature at a time: the song deck, then report videos, benches, articles and sites, then in-app generation (r27/r28). Surveyed 2026-10-13 against the live :3050 and the code: + +- **Too many places, no single model.** + - Nav: home · browse · decisions · articles · mix · find · song▸. + - Articles live in two lists (`/articles`, `/sites`). Projects live in `/browse`, and an article's video is a separate project page. + - Two creation entries share nothing: `NewProjectMenu` and `/articles/new`. + - Song-only tools (mix, find) are top-level. Faces and trims are reachable only through deep links. `/drafts` is dead. + - There are five header implementations. +- **The decision list is noise and misses the decisions that matter.** Live: 797 decisions, 518 "blocking", and **483 of them are `claim-unadjudicated` in `quartering-diet`, a finished video.** The generation-era decisions sit outside `openDecisions()`: + - research proposals; + - a finished iteration that has not been made current; + - failed iterations; + - r28's drafted fields. +- **Running work is half-visible.** Editor-side generation jobs never reach the front door. +- **Research has no home.** The interactive loop (`/ask`, `/sweep`) runs only inside Claude Code. Agent sweeps run unattended: + - their `turns.jsonl` trace is written, but nothing shows it; + - coverage (matched / read / partial) exists only as prose; + - collected quotes exist only for songs (`lib/shortlist.ts`). +- **The design system is thin.** + - The palette is GitHub-dark (`#0b0e12`, `#58a6ff`, `#3fb950`) and disconnected from the Archilyzer brand (warm ink `#0c0a08`, the Found-line mark, Signal teal, Plex/Archivo). + - There are two primitives; 49 files hand-roll controls. + +**Goal:** a simpler UI where any function is two clicks away, the decisions the operator has to make come first, and **research is first-class**: transparent, operator-driven, useful with or without media generation. + +**Rulings (operator, 2026-10-13):** +- **The unit is the *piece*.** An article plus the video project(s) made from it is one item with one page; standalone projects are pieces too. +- **Interleave with release 28.** Phases off r28's surfaces go now; the piece page and Create/Settings wait for r28 on `main`. +- **Song tooling moves into Tools.** +- **Full visual refresh**, designed with the frontend-design skill and signed off on a canvas before code. +- **Research tools are first-class**, beside media generation. + +## Design direction (frontend-design brief; the P0 canvas tests and may revise it) + +**Subject.** umtool is the Archilyzer operator's studio: research a transcript archive of streamers, rule on evidence, turn findings into articles and videos. One user, keyboard-first, long sittings. +**The app's single job:** put the next call in front of the operator with its evidence within reach. + +**Concept: the desk and the reader.** The tool chrome is a warm-ink desk. Anything a *source* said (transcripts, quotes, posts, article bodies under review) is shown on a **reader surface**: a pale, slightly green-grey screen, like an archive's microfilm reader rather than cream paper. +- **Encoded truth:** paper is the record, ink is our work. A quote can never be mistaken for our claim about it. +- **This is the one aesthetic risk.** It is justified by long reading sessions, and it is the clearest line between evidence and editorialising. + +**Palette.** Named roles; the hexes are starting points, to be checked with the dataviz skill's validator for contrast and colour-blindness on both surfaces: + +| Role | Start | Rule | +|---|---|---| +| Ink | `#0c0a08` | Desk background (the brand's dark base) | +| Desk | `#17140f` | Rail, panels | +| Seam | `#2b251d` | Hairlines | +| Bone | `#ece4d6` | Text on ink | +| Reader | `#dfe5e1` | Source surface (text `#141210`) | +| Signal | `#3fc1b0` | The ONE interaction colour (brand teal): focus, the lit line, primary action | +| Meter | `#a59bd8` | Measurement only (counts, coverage, loudness) | +| Verdicts | moss / ochre / brick | Judgements only. Keep the `globals.css` "colour means something" rule | + +**Type.** Fonts are vendored OFL with `next/font/local` (no network; the brand slice hit `fonts.gstatic` failures). + +| Role | Face | Where | +|---|---|---| +| Display | **Archivo**, expanded width (the brand wordmark face) | Place and piece titles and the Inbox's one big count only | +| UI | **IBM Plex Sans** | 13–14px, dense | +| Reader | **Source Serif 4** (opsz) vs **IBM Plex Serif** | Transcripts, quotes, article bodies; the canvas decides | +| Data | **IBM Plex Mono**, tabular | Timecodes, ids, counts | + +**Layout.** A left rail holds the places, pinned pieces, and a **Running** list at its foot with live spend. The centre is the work column. On the right, a **reader pane** opens wherever anything cited is focused: the same component in Inbox, Research, an article, or the claim bench. Benches go full-screen and collapse the rail. + +``` +┌rail──────┬ centre ─────────────────────────┬ reader (pale) ──────────┐ +│ Inbox 7 │ RESEARCH "ferret sanctuary" │ Ferret Rescue · 2025-03 │ +│ Research │ 412 matches · 97 recordings │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ +│ Work │ read 37 of 97 · full coverage │ …the county said no to │ +│ Tools ▸ │ ▌▸ 1:02:14 the county wants… │ ▌▸ the permit until the │ +│ Settings │ 1:07:40 we're five months… │ groundbreaking which… │ +│──────────│ 0:12:03 sanctuary fund is… │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ +│ RUNNING │ │ [pin to board] [copy ⧉] │ +│ sweep i2 │ │ ░░░░░░▮░░░░ 1:02:14/4:10│ +│ $0.41 ▪▪ │ │ │ +└──────────┴──────────────────────────────────┴─────────────────────────┘ +``` + +**Signature: the lit line.** The brand's Found-line mark becomes the interaction model. +- Every list is a stack of lines: inbox cards, research hits, transcript cues, clips. +- The focused line is *lit*: a Signal edge, Bone text, and the play-head notch. The others sit dim. +- `j`/`k` glide the head (about 120 ms). This is the app's only motion; with reduced motion it is instant. +- In a transcript, the cited cue is literally the lit line among dim ones: the logo, enacted by the data. + +**Quiet supporting device: the cite thread.** A hairline bar showing where a cited second sits in its source (a quote at 1:02:14 of a 4-hour VOD). It is information, not decoration. + +**Copy.** Sentence case, literal, active. Buttons name the result ("Approve draft", "Mark done", "Pin to board"). No lead paragraphs. Errors say what to fix. + +## Target information architecture + +**Rail, every page (one `AppShell`):** Inbox · **Research** · Work · Tools · Settings · **[+ Create]**, plus the **⌘K jump** to any piece, case, place or create action. + +| Place | URL | What it is | +|---|---|---| +| **Inbox** | `/` | The decisions, grouped and ranked: **Your call** (research proposals and failed runs → review gates: drafts, iteration ready → blocking on active pieces → notes) → **Ready to finish** → quiet info, collapsed. Each card: piece · what · count · ONE primary action · park/mute. Running jobs live in the rail. `/?from=` → `/create?from=` (a redirect `has` rule). | +| **Research** | `/research`, `/research/<case>`, `/research/archive`, `/research/runs/<article>/<n>` | See below. | +| **Work** | `/work` | Every piece in one list. Facets: stage, kind, site, lifecycle, search. Accepts the old `/browse`, `/articles` and `/sites` query keys. | +| **Site** | `/sites/<site>` | Kept as a page: its workspace files (`?ws=&rel=`), report-video grid, takes. Linked from Work's site facet. | +| **Piece** | `/articles/<id>`, `/sites/<site>/<report>` (article-rooted; the MCP/notes addresses); `/projects/<path>` (project-rooted) | Header: title · site · **stage stepper** (Research → Article → Video → Deliver; song: Spec → Cuts → Done) · lifecycle · ⋯. A **Next** card. Tabs: Overview · Article · Iterations · Cut · Media · Build · Deliver · Sources · History (song: Overview · Cuts · Spec · Cover · Notes). | +| **Benches** | `/projects/<path>/{clip,claim}/<id>`, `…/narration`, `…/takes`, `…/review` | One bench shell: ← piece · N of M · prev/next · key legend · verdict bar · reader pane. Fits 1366×768. | +| **Create** | `/create` | "What are you making?": research a question (opens a case) · an article from a question or a board · a video from an article, board, recording or sweep report · a song. Policy shown as a chip. | +| **Tools** | `/tools`, `/tools/{find,mix,song/<mode>,faces,trim/<set>,sources,bench}` | Song piles, find, mix, faces, trims, sources, r28's verdict bench. | +| **Settings** | `/settings/generation`, `/settings/system` | Generation policy, routes, models, caps and key. System: doctor, index rebuild/prune, storage move-out/tiers (CLI-only today). | + +### Research, first-class +1. **Ask bar + scope.** + - A query with phrase/regex/near hints. Scope chips: channels/groups, dates, state, media type, posts. + - Source: the local corpus, a published site, or the hub. + - **Before running**, show what the scope holds: "3 channels · 2,140 videos · 2019–2026 · transcripts 81% · captions 19%". +2. **Results as lit lines.** + - Grouped by recording, with a timecode and cite thread per hit. + - Facets: channel, year histogram, track (transcript vs captions), state. + - An honest header: "412 matches · 97 recordings · full coverage". When a cap is hit: "Partial — not reached: X, Y". +3. **Reader pane.** + - The transcript window with the hit lit, ±expand. + - Play local media, or fetch the clip through the editor (`fetch_clip`'s route). + - Copy citation in the house format; date, state and track shown. +4. **Reading log.** Each hit is read, skipped or unread; the header reads "read 37 of 97". This is the sweep discipline's coverage rule, made visible for the human too. +5. **Board (a case).** + - Pin a hit as a **snapshot quote**: verbatim text, cite, note, claim line (the shape of `lib/shortlist.ts` `Pick`). Sections and order. + - Export as cited markdown in the house format. + - Hand off: **Draft an article from this board**, **Start a video from this board**. + - Stored umtool-side under `REPORTS_ROOT/.umtool/research/<case>/`, never in the corpus. A case becomes the Research stage of a piece. +6. **Archive inventory** (`/research/archive`): what the archive can and can't answer. A channels × years heatmap with gaps (`channel_coverage`), transcript/captions/none, video states. Built with the dataviz skill. +7. **Transparent agent runs.** + - Run a sweep from the same scope and watch it step by step: scope → enumerated N (the ids) → batches k/n with each extractor's lines → findings → quote checks (kept / dropped, with the reason) → cost per step. + - Past runs replay from the trace. + - Agent findings land in the same board shape, so human and agent research meet in one place. + +**Mechanism:** +- Add `"yt-dlp-transcript-mcp": "workspace:*"` to `umtool/package.json`, and use `createCorpusTools` (`mcp/src/callTool.ts`) in-process and server-side. It is the same read-only tools Claude Code uses (`search_transcripts`, `enumerate_matches`, `get_transcripts`, `get_post`, `get_thread`, `channel_coverage`, `list_channels`, `list_tags`) with the same caps (`MCP_POLICY`), already used by `editor/app/api/ops/report-draft/route.ts`. +- `channel_coverage` needs the editor (it proxies `GET /api/ops/coverage`). Alternatively call `common/controller/channelCoverage.ts` directly when umtool has the corpus on disk. + +## Data and engine rules (from the code review) + +- **Piece ids are namespaced:** `a:<site>/<report>` (site may be `articles`) and `p:<projectId>`. `resolveTarget` is ambiguous on two-segment ids (`lib/annotations/targets.mjs:139`). Research cases are `c:<case>`. +- **Linking a project to an article, in order:** + 1. each iteration's `projectDir` (`iteration.json`), with `current.video` choosing the Cut tab's project; + 2. the manifest's `article` key; + 3. a slug match (`lib/articles/links.mjs`). + + Only (3) can raise `link-ambiguous`. Today every generated article shows its own `…/i1` as "possible" (`links.mjs:84-99`). A `projectDir` outside `REPORTS_ROOT` is shown as "not reachable here". +- **Lifecycle:** + - Values are `active | parked | done`; `shipped` is already a derived song state (`lib/project-types.ts:35`). + - Stored in `REPORTS_ROOT/.umtool/lifecycle.json`, keyed by piece id. The walk skips dot-dirs (`walk.mjs:105`). It is state, not cache. + - "Looks done" signals, which only ever suggest: + - a song's derived `shipped`; + - a final mp4 (`buildStateOf`, `report.mjs:437`) plus a `share-*` batch (`deliver.mjs listBatches`); + - a published article with `report.video.src` or `current.video`. +- **Decisions API stays one row per decision.** + - `GET /api/browse/decisions` keeps `items[]` ungrouped and never drops rows. New fields are additive: `piece`, `category`, `group`, `action`, `lifecycle`, `hidden`. Grouping and hiding happen in the UI. + - Reason: the MCP reads `items[]`, filters `open-note`/`unreadable-notes`, uses `project` as the notes target, and needs `href` to end in `note=<id>` (`mcp/src/archivalTools.ts:306-321,393-410`). `lib/hrefs.ts` must keep `?note=` last. +- **Decision sources from disk, without the editor:** + - **Iterations** come from `readArticleIterations` (`lib/articles/generation.ts:338`). `iteration-ready` means done, not current, and newer than current; `iteration-failed` is a failed run. Spend comes from iteration `usage` joined on `jobId`. + - **Research proposals** come from common's `readResearchState` (`common/lib/report/draft/research/state.ts:93`); a waiting one has status `proposed`. Not `readResearch()`: that POSTs to the editor, which can rewrite `proposals.json`. + - **There is no "waiting on a cap" state.** The daily cap refuses at start and per-job caps end the run. The "spend" category is research proposals plus failed runs. + - **Drafts** come from r28 `draftsView()` (`umtool/lib/report/drafts.mjs`). Add `drafts.review.json`, `narration.review.json` and `*-draft.json` to `reportSignature` (`lib/projects/report.mjs:493-510`), or the decision cache never refreshes after an approve. + - `verdict-proposed` (r28 M8) is deferred until M8 is built. +- **Running list:** + - Source: the editor's `GET /api/ops/jobs?active=1`. Call it without `kind` (research acquisitions use other kinds) and filter in umtool. + - Give `askEditor` a timeout and a ~2 s memo (`generation.ts:76` has none). + - Distinguish "editor unreachable" from "WORKER_TOKEN not set" (the editor returns 503). + - `ActivityItem` gains `queued`. + - Add `/api/ops/jobs` to `e2e/fixtures/editor-stub.mjs`. +- **Pieces list cost:** the article side re-reads every `report.json` per request (`sites.ts:127-158`). Use a 10–30 s memo, cleared on writes like `clearLinksCache`. Live, warm: `/` 0.89 s, `/api/browse/decisions` 0.27 s. +- **Redirects:** + - Use `redirects()` in `next.config.ts` (`node_modules/next/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/redirects.md`). It runs before the filesystem and passes the query through. + - One table in `umtool/redirects.mjs`, imported by both the config and `e2e/redirects.spec.ts` (`maxRedirects: 0`). + - Reserved `/browse/<tool>` rules go before `/browse/:path*`. `/:mode(sort|salvage|verify|keeps)` → `/tools/song/:mode`. `/bench` → `/tools/bench`. + - **307 (`permanent: false`) until P6**, because browsers cache 308s forever. +- **LastPage/ResumeChip:** + - `DEFAULT_PAGE` → `/work` (`lib/last-page.ts:21`). + - The chip shows `res.url`, the address after the redirect. + - `/projects` and `/tools/song` get index pages, so the parent walk lands somewhere real. + +## Phases + +Each phase: its own branch from `main` (or the current integration branch), gates green, merged, and rolled out live (umtool rebuild + restart). At most three parallel Opus lanes. Every shared hotspot has ONE owning lane per phase: `globals.css`, `AppShell`, `app/page.tsx`, `lib/activity.ts`, `editor-stub.mjs`, `redirects.mjs`. + +``` +NOW (beside r28) AFTER r28 IS ON main +P0 design ─► P1 foundation ─┬─► P3 inbox/work/tools/URLs ─┬─► P2b jobs+drafts ─► P4a-1 ─► P4a-2 ─► P4a-3 ─► P4b ─► P6 + P2a engine ────┘ ├─► P5 create+settings (after P3) + └─► R1 research: search+reader+inventory ─► R2 boards ─► R3 transparent runs (after r28) +``` + +### P0 — Design (no app code; operator sign-off gates P1) +- Use the frontend-design skill: + 1. brainstorm against the direction above; + 2. critique each part against generic defaults and record what changed and why; + 3. build the canvas; + 4. screenshot it at 1366×768 and 1440×900; + 5. critique again and take one thing away. +- Choose the hexes with the dataviz validator, on both surfaces. +- Screens, with real data: Inbox · Research (results + reader + reading log) · Research board · Archive inventory · a transparent run · Work · Piece Overview · Piece Media (drafts review) · Clip bench · Create. +- Include the lit line's motion study and the reader-serif decision. +- Also produce the URL map and the redirect table. +- Deliverable: `~/reports/umtool-redesign/canvas.html`, published as a private Artifact for review. + +### P1 — Foundation (avoids every r28-touched file) +- Tokens and the vendored fonts in `umtool/app/globals.css` (Tailwind v4 `@theme`; keep `source(none)` and the `@source` list). +- Primitives in `components/ui/`, server-safe cva like `button.tsx`/`badge.tsx`: + - Panel, Card, Tabs (link-driven), Table, Field/Input/Select, Dialog (native `<dialog>`), Stepper, Kbd, EmptyState, Toolbar; + - **LitList** (the signature: roving focus, `j`/`k`, the play-head notch); + - **ReaderPane**, **CiteThread**. +- `AppShell` with the rail. + - `BrowseHeader` becomes a thin wrapper over it, same props, until P6: it has 22 users, including r28's `ReportProject`, `NarrationPage` and `app/bench/page.tsx`. + - The hand-rolled headers in `app/page.tsx`, `app/mix/page.tsx`, `components/Deck.tsx` and `app/articles/[report]/compare/page.tsx` move onto it. + - Keep `<header>`, `.micro`, `[data-nav-group=song]` and `aria-current`, so about 0 specs break. The rail keeps today's entries until P3. +- `lib/hrefs.ts` (one builder per URL shape, `?note=` last), `e2e/urls.ts`, and an empty `umtool/redirects.mjs` wired into `next.config.ts`. +- A restyle pass onto the primitives, **excluding** r28-touched files: `IterationsTab`, `NewArticleForm`, `ResearchSlot`, `NarrationReview`, `OnscreenSection`, `ReportProject`, `StructureEditors`, `ChainPanel`, `app/articles/page.tsx`, plus everything new on `r28/integration` and `r28/surfaces`. + +### P2a — Engine: pieces, lifecycle, grouping (lib + API; parallel to P1) +- `lib/pieces.ts`: namespaced ids, the three-step linking, and a memo. +- `lib/lifecycle.ts`, plus `POST /api/pieces/lifecycle` and `GET /api/pieces`. +- Decision fields: `category`, `group`, `action`, `lifecycle`, `hidden`. Grouping and ranking are pure functions with unit tests. +- Disk sources: `iteration-ready`, `iteration-failed`, `research-proposal`, `link-ambiguous`, `looks-done`. +- The CLI `umtool inbox` prints the grouped list. +- Must not edit `generation.ts`'s `askEditor` or `editor-stub.mjs`; those belong to P2b. + +### R1 — Research: search, reader, inventory (after P1; parallel to P3) +- Add the `yt-dlp-transcript-mcp` dependency. +- `lib/research/corpus.ts` over `createCorpusTools`, with the source picker. Routes: + - `/api/research/{scope,search,window,coverage}`; + - search runs `enumerate_matches` once; it never pages (the coverage rule). +- `/research`: ask bar, scope preview, LitList results with facets, ReaderPane, copy citation, play/fetch (the editor's fetch-window route, as `fetch_clip` does). +- `/research/archive` inventory. +- The reading log, stored per case or per scratch session. + +### P3 — Inbox, Work, Tools, URLs (after P1 + P2a) +- `/` becomes the Inbox. + - The dashboard panels become Inbox cards when actionable; otherwise their content goes to `/settings/system`. + - `dashboard.spec` is rewritten. +- `/work` replaces the `/browse`, `/articles` and `/sites` lists. `/sites/<site>` stays a page. +- Tool pages move to `/tools/*`. `app/[mode]` goes. +- **`/browse/<path>[/…]` → `/projects/<path>[/…]` moves here** (r28 never touches `app/browse/[...path]`, and its hard-coded `/browse/${id}/review` keeps working through the redirect). +- The rail becomes Inbox · Research · Work · Tools · Settings · +Create. Create and Settings link to their current homes until P5. ⌘K palette. +- Blast radius: about 12 specs (about 17 `toHaveURL` checks, 9 href assertions, `projects.spec.ts:264`'s RESERVED_BROWSE list). Old `goto()`s ride the redirects. + +### P2b — Jobs and drafts (after r28 on `main`) +- The editor jobs list goes into `lib/activity.ts` (timeout, memo, 503 vs unreachable), the Running list and the stub route. +- `drafts-unreviewed` decisions plus the `reportSignature` addition. + +### P4a — The piece page (after r28 on `main`), three slices +- **P4a-1:** + - the `PieceView` frame: header, stepper, Next card, tabs; + - `ReportProject`'s 14 sections moved unchanged into tabs; + - `OnscreenSection` (2144 lines) parked whole in the Build tab until P4b; + - an `e2e/urls.ts` `section(project, name)` helper. About 15 specs and 80 tests open a project page and expect every section on it. +- **P4a-2:** the article-rooted merge. + - The iteration's `projectDir` feeds the Cut tab, and the `ArticlePage` tabs become Article/Iterations. + - The `PolicyPanel` becomes a chip linking to Settings. + - A project linked to an article renders as that article's piece. +- **P4a-3:** song pieces (`SongProject`, `CutPage`). + +### P5 — Create and Settings (after P3 and r28; parallel to P4a) +- `/create`: one shell over the existing writers. + - `POST /api/articles/generate`, for an article from a question. + - `POST /api/projects/new` → `scaffoldReportVideo` (`lib/projects/scaffold.mjs`), for a video from a recording or a report. + - The chain, `/api/articles/chain`, for a video from an article. + - "Research a question" opens a case. +- `/settings/generation`: `PolicyPanel`, caps, models, the extractor (r28 `ExtractorSelect`). +- `/settings/system`: thin APIs over `lib/doctor.ts`, `umtool index --rebuild|--prune` and `umtool storage move-out|move-back|deliverables`, with plan-then-confirm on anything destructive (the `DeletePlan` pattern). +- Specs: `projects.spec.ts:551` (`[data-new-project]`), `article-new.spec`. + +### R2 — Research boards (after R1; the hand-offs land with P5) +- `/research/<case>`: + - pin from results or the reader as a snapshot quote; + - sections, order, notes, claim lines; + - export as cited markdown; + - re-verify quotes against the current transcript, and flag drift (the en/en-orig hazard in memory). +- Hand-offs: + - an article from a board: a `report-draft` sweep seeded with the board's cites, or the exported markdown as the first iteration's input (verify which the editor accepts); + - a video from a board: scaffold a timeline from the cites. + +### R3 — Transparent agent runs (after r28; it touches common's report-draft tasks) +- In common, `sweep-agent.ts` and `sweep-pipeline.ts` write a structured `trace.jsonl` beside `turns.jsonl`. Events: + - `scope`; + - `enumerate {n, ids, partial, unreached}`; + - `batch {k, ids, lines}`; + - `finding`; + - `check {quote, ok, reason}`, which includes the dropped quotes that are invisible today; + - `cost {usd, step}`. +- `iteration.json` gains `coverage {matched, read, partial, unreached}`. +- `/research/runs/<article>/<n>` shows the live step view while running (polls the trace) and replays when done. Old runs fall back to a `turns.jsonl` projection. +- Agent findings appear as a board, and a run can be started from a case's scope. + +### P4b — Benches and Media (after P4a) +- The bench shell for clip, claim, narration, takes and review, with the ReaderPane. `ClipBench` (3059 lines) keeps its internals. +- The **Media** tab: + - every drafted field with provenance and approve/reject; + - absorbs r28's `DraftsReview`/`ReviewPage`/`DraftPanel`/`YoutubeSection`; + - on-screen (moved out of Build), narration, and "Draft with <model>" / "Draft everything" per section. +- One `JobProgress` for chain and editor jobs. + +### P6 — Cleanup, docs, audit +- Redirects become 308. +- Delete `/drafts`, `BrowseHeader`, the dashboard panels and dead components. +- Rewrite `umtool/docs/`: dashboard, browse, decisions, sites, projects and README become inbox, research, work, piece, tools and settings. +- Update the umtool URLs and button names in `AGENTS.md` and `plans/FACTS.md`, and the notes addressing. +- A screenshot audit of every page against the canvas. + +## Constraints on every phase +- **External contracts:** + - `/?from=<slug>/<id>` (editor `VideoPanel.tsx`/`VideoNavStrip.tsx`); + - `/api/browse/decisions`, `/api/notes`, `/api/notes/context` (MCP); + - note targets `sites/<site>/<report>` and the bare project id; + - every old page URL is in `redirects.mjs`. +- **House rules:** + - no `loading.tsx`, no `not-found.tsx`, no `useSearchParams()`; + - static segments win over catch-alls; + - buttons disabled until hydrated; + - delete is plan-then-confirm; + - no lead paragraphs, terse literal copy; + - kind-id literals only in `lib/projects/` and `components/projects/`; + - every human-piloted audit is app-like (fits 1366×768, one question per item, keys). +- **Research rules:** + - read-only on the corpus; + - every fetch goes through the editor (never `yt-dlp` by hand); + - citations in the house format (`mcp/src/instructions.ts`, `authoringRules.ts`); + - Candace channels stay local-only and never appear in anything published; + - the X archive is never put on a site. +- **e2e:** keep `data-testid` names when components move. Each phase fixes the specs it breaks and adds its own: `inbox`, `work`, `research`, `board`, `run-trace`, `piece`, `create`, `redirects`. The research specs run on the fixture corpus (`LocalSource` over the e2e public dir). +- **Memory gate:** `free -m` ≥ 6 GB before a build or e2e, one `next build` at a time. Scratch goes in the job dir, not `/tmp`. +- **Records:** `plans/umtool-redesign.md` in the repo (this plan, plus a Record per phase). No session links anywhere; commits end with `Co-Authored-By` only. + +## Verification (every phase) +- `pnpm --filter umtool typecheck`, then the unit tests (`node --test` over `umtool/lib/**/*.test.mjs`, `umtool/report-to-video/*.test.mjs`; common's tests for R3). +- A capped umtool build (`systemd-run -p MemoryMax=5G`), then the full `pnpm --filter umtool run e2e`, detached with `setsid nohup` and a log monitor. +- Screenshots of the phase's pages at 1366×768 and 1440×900 on live data, compared with the P0 canvas, plus a keyboard-only pass (lit line, focus visible, reduced motion). +- After rollout (rebuild + restart :3050): + - curl every row of `redirects.mjs`; + - `/?from=` lands in Create; + - the MCP `notes` tool still lists and replies; + - from P2a on, report the Inbox's actionable count against today's 518 "blocking"; + - from R1 on, run a research query against the local corpus and check the counts against the MCP `enumerate_matches` for the same scope. + +## Record + +### Status + +| Phase | Branch | State | +|---|---|---| +| P0 design | — (`~/reports/umtool-redesign/canvas.html`) | in progress | +| P2a engine | `ux/p2a` | in progress | +| P1, R1, P3 | — | wait for P0 sign-off | +| P2b, P4a, P5, R3, P4b, P6 | — | wait for r28 on `main` |