commit a15a58b7d51c14ad82603435c35f7b0390dc858a
parent 328eb8a75c07b40394dbc722de9ed918a75cbdbb
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 16:26:14 -0400
plans: umtool redesign — R6 triage first, as shipped (record, gates so far); [Unreleased] bullets
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 142 insertions(+), 1 deletion(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -10,6 +10,10 @@
- **Recurring reports.** umtool's Create has **A recurring report**: a topic, its scope (channels, or a research board's), a cadence (daily, weekly on a day, or every N days, at a time) and a shape — a **Living report** (one article kept current: each tick fetches what is new and updates it, the new iteration left for review unless "Make each update current without review" is on) or a **Series** (a new dated article each tick, "Co-host updates · week of 2026-10-12", over whole days — from the day after the last edition through the day before the tick, so weekly on Monday covers the Monday to Sunday before it and no day is read twice; a window nothing matches is a *quiet* edition — recorded, no article, $0; a Tick now with nothing new to cover makes no edition and says when the next one starts). **Plan the schedule** says the first tick, the model and the cap before anything is made. A series has its own page (the cadence chip "weekly · next Mon 06:00", Pause/Resume, **Tick now**, Edit cadence, Delete, the editions newest first, the tick log with each tick's spend); a living report wears the same chip in its article's head. Work has a **Recurring** facet; the Inbox puts a finished edition under Review and a failed or cap-held tick under Your call (**Tick now** / **Raise cap**). `umtool schedule list | show <id>` prints them. Needs a restart of umtool and of the editor.
- **The research board's `e`, `n` and `m` no longer lose the field.** Pressed while a move was still saving, the field took the focus and then lost it when the board redrew, and what was typed next landed on the board as commands (`s` toggled the speaker check, `x` asked to remove the quote). The field now takes the focus once the board has redrawn, and no key acts until it does.
- **The editor keeps the schedules.** A new `report-schedule` lane ticks each recurring report when its window comes — one `report-tick` job at a time, never two of one schedule, never on an idle boot; a window missed while the editor was down is caught up by ONE tick. Hold it with `pnpm ops lane '{"lane":"report-schedule","held":true}'` (`settings.reportSchedule.held`); a tick in flight finishes, and Tick now still runs. Drive it with `pnpm ops report-schedule` (`list`, `create` — with `dryRun` the plan —, `update`, `pause`, `resume`, `delete` — the plan unless `confirm: true` —, `tick-now`). Each tick first fetches what is new through the editor's own paced actions (Refresh's stage 1: the channels' syncs and posts, then a local build — never a deploy); a platform that is held or cooling down is skipped and said on the tick, not a failure. A living report's tick is a Refresh: no change costs nothing, an update is left for review (or made current with "make each update current"), and a refresh or sweep the cap holds is a Your call card.
+- **Triage first: a cheap pass flags what is worth researching, and only that reaches the sweep.** A recurring report can now be a **Watch** — no article until something is found — or a living report or series with **Triage first**. Each tick fetches what is new, then triages it: the recordings new since the last triage **by id** (an old recording whose transcript landed late counts as new) that match the terms or carry a matching digest topic tag are judged by the **local model** (the sweep pipeline's window judge over their matching windows only; `draft:local`, behind the GPU arbiter, $0) or, if you choose, by the extractor. A line becomes a **flag** only when the code finds it word for word in the window and in the transcript's cues; strong (it answers the question) or weak (it bears on it). Everything else is **dismissed with why**: not relevant, a mention only, off topic, not verbatim (an invented line is kept beside its reason). At or above the threshold (default one strong flag, or three of any strength) the tick escalates: an API sweep restricted to the flagged recordings — a watch's as a new article `<watch>-<date>`, a series' as its edition, a living report's as its Refresh's update — within the caps and a new **day's escalation cap**; below it the tick ends with its triage log and no API spend (a series' edition is quiet). Needs a restart of the editor and umtool.
+- **`pnpm ops report-draft --json '{"task": "triage", "article": "<schedule>", "question", "channels", "terms"?, "topics"?, "threshold"?, "ids"?}'`** runs the step on its own. A run lives in `reports/.triage/<schedule>/<k>/` (`triage.json`: the candidates, each flag and dismissal, the decision, the spend per tier; `trace.jsonl`), and `seen.json` beside it is what the next run counts as known, written only when a run completes. A sweep that escalates a triage names it (`"triage": "<schedule>/<k>"`), and its trace's first line after the start is the triage's tiers; a refresh takes `"ids"` (the update reads those). `pnpm ops report-schedule` creates a watch (`"shape": "watch"`) and takes `triageFirst`, `topics` and `threshold` `{strong, weak}`. New settings `generation.triage` (SETTINGS.md): the judge (`local` or `extractor`), `strong`, `weak`, `maxEscalationsPerDay` (default 3), `maxCandidates` (default 40); Settings → Generation edits them.
+- **umtool shows the tiers.** Create's **A recurring report** offers **Watch** and **Triage first** (with its topics and its threshold, said in the plan). Each run has a page, `/series/<id>/triage/<k>`: tier 0's candidates and why, each flag with its line on the reader and the judge's reason, each dismissal with why, whether it escalated and to what, the spend per tier. `y` / `x` marks the lit flag right or wrong (`u` unmarks), `b` opens the flags as a board. A watch's page lists what it **found**, every triage run, the precision of your marks and a **suggested threshold** (a suggestion: the schedule keeps its own). The escalated sweep's run page starts with a **triage first** step linking the run.
+- **Worth researching.** A watch that escalated is a **Your call** card in the Inbox with its flags and what the sweep kept; **Open the board** opens an R2 research case of the flags, each quote **by triage**, whose hand-offs make an article or a video. umtool makes the board (it is the only writer of boards; the editor never writes one), and the card goes once the board has a hand-off or every flag of the run is marked.
- **umtool's benches are one shell.** The clip bench, the claim bench, the narration script, the takes and the drafts review share one frame that fits 1366×768 with no rail: a top bar (← the piece, which bench, **N of M**, ‹ prev / next ›, the keys), the work, a **verdict bar** asking ONE question with its consequence before you choose, and the source on the reader at the right. On the clip bench the transcript is the reader — the cited cue lit, its cite thread, **Copy citation**, **Play clip** — and a clip that ends mid-sentence asks "Extend c04 to the end of the sentence? It would end at 4:31:21 (+12.1 s), covering all of c05." with **Extend to 4:31:21** (or **Fetch to …** past what is fetched) and **Keep the cut here** (lockEnd) before the walk's **Yes, confirmed** / **No, note what is wrong**. The claim bench's context is its reader (`j`/`k` move the lit cue and seek the player) and **Save ruling** its verdict bar, saying what is still missing. Narration asks about the card in hand (`j`/`k`, `a` approve, `r` reject with its note); takes about the take being listened to (`n`/`p`, `l` like, `m` maybe, `x` no). Needs a restart of umtool.
- **A report video's Media tab is one surface for every drafted field.** Each field is a line — its words, **where it came from** (the draft file, when, by what model, which attempt was kept, and the rule a refused attempt broke: "attempt 2 of 2 chosen · attempt 1 failed: ✕ text in quotation marks"), its review — with **Approve draft** and **Reject** (a note), the drafts kept aside with **Use this**, grouped by section (cut, on-screen, teaser, flips, threads, narration, YouTube), each headed by its **Draft with <model>**; **Approve all N**, **Draft everything** (the draft-all chain, on the model chosen) and section chips above. `j`/`k` light a field, `a` approves it, `r` rejects it. The on-screen panel moved here from Build, whole. A release-25 narration (no mark in the manifest) shows its `narration-draft.json` attempts too. Needs a restart of umtool.
- **The drafts review is a bench: `/projects/<p>/review`.** The same field list, walked one field at a time: the verdict bar asks about the lit field ("Approve the drafted on-screen text of m01? A final build refuses it until it is approved."), the reader shows the clip it is drawn over with its cited cue lit. The Iterations tab's **Narrate**, media drafts and **Draft everything** are now a **Media drafts →** link to the iteration's video's Media tab.
diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md
@@ -441,7 +441,7 @@ edition reviewed with the operator before the schedule is left on.
| P4b benches + Media | `ux/p4b` → `main` `e66dd702` | LIVE 2026-10-14 (umtool ktVxkFBl…) |
| R4 refresh | `ux/r4` → `main` `08fee8e1` | LIVE 2026-10-14 (editor nFiNyOdI…, umtool -HUqAEPA…) |
| R5 recurring reports | `ux/r5` → `main` `0bf4aacd` | LIVE 2026-10-14 (editor 379S-Sk9…, umtool vWDhtigj…) |
-| R6 triage first | `ux/r6` | in progress |
+| R6 triage first | `ux/r6` | shipped on the branch (record below) |
| Co-host pilot | — | after R6 (operator-approved) |
| P6 cleanup, docs, audit | — | after P4a-3, P4b, R4–R6 |
@@ -2828,3 +2828,140 @@ schedules, the lane armed and not held; a dry-run of the co-host series (`the-qu
2026-10-18 ("Co-host updates · week of 2026-10-12"), $5 a tick, and stores nothing; `/create` offers "A recurring
report"; `/work?recurring=1` 200. No schedule exists until the operator (or the pilot, with the operator) makes one.
+
+### R6, as shipped
+
+**What.** Triage first: a cheap pass that flags what is worth researching, and only what it flags reaches the
+better model with tools. A `report-draft` STEP `triage` (tier 0 code, tier 1 the local window judge, the
+threshold), wired into R5's tick as `TickSteps.triage` — a schedule's `triageFirst` (living, series) and R5's
+reserved third shape, **watch** (no article until something is found) — with umtool's tiers, marks and the
+Worth researching card.
+
+- **The step** (`common/lib/report/draft/triage/`; the editor's side `controller/reportTriage.ts`):
+ - **A run** is `reports/.triage/<owner>/<k>/` — `triage.json` (`archilyzer-triage` v1: the question, scope,
+ terms, topics, threshold, `since`, tier 0, tier 1, the escalation, `cost {tier0, tier1}`, warnings) and
+ `trace.jsonl` — and `reports/.triage/<owner>/seen.json` is the ids the owner's last COMPLETED run saw. A
+ dot-directory of the article store (`idDirs` never lists it). The owner is the schedule's id. ONE writer:
+ the job (the run is created queued under the article store's lock, numbered 1, 2, …).
+ - **Tier 0** (`tier0.ts`, code, $0): the scope is scanned once with enumerate's "any recording" regex (the
+ set this run SAW); new = not in `seen.json` **by id** — an old recording whose transcript lands late is new
+ (R5's late-transcript gap, closed); with no last run, new = uploaded on or after `since` (the tick passes the
+ cadence's length back). Candidates: new recordings matching the terms (R4's `deltaCandidates` with `known` =
+ the ids seen; aliases as enumerate has them) OR carrying a digest topic tag that matches a topic (the build's
+ digest, read through `get_video_metadata`'s "Topic tags"); with neither terms nor topics, every new one.
+ `maxCandidates` (default 40) — the rest are cut and left OUT of the next `seen`, so they stay new.
+ - **Tier 1** (`judge.ts`): the sweep pipeline's window judge (`EXTRACT_SYSTEM`/`EXTRACT_SCHEMA`, its
+ `windowsOf`/`chunksOf`/`locate`) over the candidates' MATCHING windows only (get_transcripts around the
+ terms and topics; a caller's own `windows`; a recording put forward by a digest tag that no word matched is
+ read from its opening), at most 3 chunks and 3 flags a recording. A flag is a line `locate` finds verbatim
+ in the window AND R2's word check (`checkWordsInWindow`) finds in the transcript's cues near that second;
+ score 3 on topic = strong, 2 = weak. Dismissed, each with its reason: a window not relevant (`judge`), a
+ line not verbatim — the invented line kept beside it — or not in the cues (`verbatim`), off topic or a
+ mention only (`score`), nothing to read (`read`). The judge's model is `settings.generation.triage.model`:
+ `local` (`models.local`, on `draft:local` through the GPU arbiter — `gpuGatedFetch` — ollama unloaded at the
+ end, $0) or `extractor` (`models.extractor`, on `draft:api`, metered, its usage rows task `triage`).
+ - **The decision** (`escalationOf`): strong flags ≥ `strong` OR flags of any strength ≥ `weak` (0 turns a
+ rule off); default one strong or three. The step only SAYS it; the tick escalates.
+ - **The trace** gains `{t: "triage", owner, k, candidates, flagged, dismissed, escalated, why, cost, model}`,
+ `cost.tier`, and `check` stage `triage`; a triage run's own trace has its scope, tier 0's enumerations, one
+ `batch` per read batch with the judge's lines, a `check` per flag and dismissed line, the triage line and the
+ tier-1 cost. A sweep that escalates a triage names it (`report-draft {…, "triage": "<owner>/<k>"}`, kept as
+ `scope.triage`) and `runOnIteration` writes the triage line right after the run's start.
+ - **`report-draft {"task":"triage", "article": <owner>, question, channels, terms?, regex?, topics?,
+ threshold?, since?, ids?, windows?, maxCandidates?, model?}`**; the answer's `iteration` is the run's number
+ and `triage: {owner, k}`; the log ends `@@report-draft {…, triage: {k, status, candidates, flagged,
+ dismissed, escalate, why, usd}}`. A refresh takes `ids` (R6: the update reads exactly those, even when the
+ delta found nothing else). COMMANDS.md regenerated.
+ - **`settings.generation.triage`** `{model: local | extractor, strong: 1, weak: 3, maxEscalationsPerDay: 3,
+ maxCandidates: 40}` (SETTINGS.md, settings.json.example regenerated); umtool's Settings → Generation edits it.
+- **The tick** (`controller/reportTick.ts`; `triageStep(draft)` the real step, awaited, a cancelled tick cancels
+ it). Living or series with `triageFirst`, and every watch: fetch → triage → (escalate) → the shape's step on
+ the FLAGGED ids only:
+ - **watch** — stage 1 over the scope; below the threshold `no-change`, $0 API, the triage on the line; at or
+ above it an API sweep restricted to the flagged ids (`generateEdition` with `ids` and the triage ref — no
+ date bound, so a late transcript is in; no window check) as a new article `<watch>-<YYYY-MM-DD>` titled
+ "<topic> · <date>".
+ - **series** — the window, stage 1 over it, the triage over the SCOPE by id; below the threshold the edition
+ is quiet (its window covered, the triage's reason); above it the edition sweeps the flagged ids.
+ - **living** — stage 1, the triage, then R4's refresh with `ids` and `fetch: false` (no second fetch); below
+ the threshold `no-change`. Its first tick (no report yet) is its first sweep, as in R5 (triage applies from
+ the next tick).
+ - **The day's escalation cap** (`escalationCapRefusal`): escalations ticked on the UTC day across every
+ schedule (`tick.triage.escalated`) ≥ `maxEscalationsPerDay` → the tick is `held-by-cap` (R5's tick-held
+ card) with the flags kept (`triage.capped`). The tier-2 sweep is also held to the policy's caps as any sweep.
+ - The tick line gains `triage` (`TickTriage`: owner, k, status, candidates, flagged, dismissed, escalated,
+ why, the flagged ids, the top five flags, `usd {tier1, tier2}`); the tick's `usd` is tier 1 + tier 2.
+- **The schedule**: `OFFERED_SHAPES` gains `watch` (stored like a series, `.series/<id>/series.json`, no
+ editions); `triageFirst`; `scope.topics`; `triage.threshold` (a schedule's own); create's plan names the
+ triage (model, provider, threshold, the day's cap, terms, topics); a watch's delete plan keeps its articles and
+ its triage runs. `pnpm ops report-schedule` takes `triageFirst`, `topics`, `threshold`.
+- **umtool**:
+ - **Create → A recurring report** offers **Watch** ("No article until something is found: each tick triages
+ what is new, and only what it flags is researched.") with its terms, digest tags and threshold ("Escalate on
+ [1] strong or [3] any"), and **Triage first** on a living report or a series; the plan says "triage first on
+ <model> ($0): escalates on 1 strong or 3 weak · at most 3 escalations a day; no article until one does".
+ - **The triage page** `/series/<id>/triage/<k>` (`components/series/TriageView.tsx`; a living report's runs
+ too, under its id): the question and the run's facts in the head, the run picker, **Open as a board** (`b`,
+ the one filled action); ONE lit list — the flags (strong first) then the dismissals — each flag's line in the
+ reader serif with its recording, second and reason, strength and mark badges; beside it the three tiers
+ (Tier 0 · code, Tier 1 · local model or extractor, Tier 2 · sweep — each with its spend; tier 2 links the
+ escalated sweep's run page and its findings, or says "not escalated: $0 API" or the cap that held it), the
+ escalation line, the lit item's detail (the line on the reader with its cite and window, "why: …", **Right**
+ `y` / **Wrong** `x` / **Unmark** `u`), the candidates with why each was one, and the schedule's precision and
+ suggested threshold.
+ - **The series page**: a watch shows **Found** (each escalation's article, its top flag, its board and its
+ triage run, the spend) instead of editions; every schedule that triages shows the **Triage** table (each
+ run: when, candidates · flagged · dismissed, escalated or below and why, tier 1 and tier 2 spend), its
+ threshold, the precision of the marks and the suggested threshold; the tick log links each tick's triage.
+ - **The run page** (R3): an escalated sweep's first step is **triage first** (its tiers in the facts, the
+ flagged ids, a link to the triage run).
+ - **Marks** (`lib/research/triage-marks.mjs`): `REPORTS_ROOT/.umtool/triage/<schedule>.json`, umtool's own
+ (one writer, serialised, temp + rename, a file that does not parse never overwritten). Precision = right /
+ marked; the suggestion (`suggestThreshold`, common): weak flags right under 25% → let weak flags alone not
+ escalate, under 60% → one more weak, 80% and up → one fewer; strong flags under 50% → one more strong; fewer
+ than 3 marks of a kind → "mark N more". A suggestion only: nothing writes the schedule's threshold.
+ - **The board** (`lib/research/triage.ts` `openTriageBoard`): an R2 case of the run's flags, each `by:
+ "triage"` (the slip says **by triage**), in **Strong flags** / **Weak flags**, the judge's reason as the
+ claim line, the case's `triage {schedule, k}` (the side panel's **From triage**). Its id is the escalation's
+ article (so the board's article hand-off adds an iteration to it), else `<schedule>-t<k>`. A second open adds
+ what is new and never touches the operator's claims, notes, sections or order.
+ - **Inbox kind `worth-researching`** (Your call, add-only; `lib/inbox/schedules.mjs`): a watch's tick that
+ escalated and made its article — the flags (the first two, with their reasons) and how many findings the sweep
+ kept; **Open the board**. It goes once the board has a hand-off or every flag of the run is marked. The
+ watch's articles are its own: no iteration cards, not Work rows (`editionOf`).
+- **ONE WRITER OF THE CASE FILES: umtool.** The editor's tick never writes a case: it records the escalation on
+ its tick line and the triage run. umtool makes the board the first time it reads an escalated watch tick (the
+ Inbox's read, `ensureTriageBoards` — idempotent; a failure leaves the card on the triage page) or when the
+ operator presses **Open as a board**.
+- **Docs**: `umtool/docs/triage.md` (P6a's rewrite of `umtool/docs/` may link it from its recurring page).
+- **Not built (said so)**: a watch has no Work kind of its own (it is listed as a series); the run page shows the
+ tiers as one step with a link, the flags and dismissals in full are on the triage page; a living report's
+ first tick does not triage.
+
+**Commits** (`ux/r6`, from `main` `165a4ee2`):
+
+| sha | what |
+|---|---|
+| `077c36d1` | common, editor: the triage step (types, store, tier 0, judge, the run), `controller/reportTriage.ts`, report-draft's `triage` task and keys, a sweep's triage ref, a refresh's `ids`, `settings.generation.triage`, the watch shape and `triageFirst` on the tick, the day's escalation cap, the tick line's triage; `triage.test.ts` (8), `reportSchedule.test.ts` (+4), `_reportRefresh.test.ts`; COMMANDS.md, SETTINGS.md |
+| `a2b20f96` | umtool: Create's Watch and Triage first, the triage page and its API, the series page (Found, Triage, precision), the run page's triage step, marks, the board, Inbox `worth-researching`; the stub's triage and escalation; `triage-first.spec`, editor `report-draft.spec` (+1) and `ops-api.spec` (+1); `lib/research/triage.test.ts` (3), `triage-marks.test.mjs` (1), `inbox/schedules.test.mjs` (+1) |
+| `e0f072ca` | Settings → Generation edits triage first; `umtool/docs/triage.md` |
+| `73f2078c` | the digest tags field is not named for topics; the stub escalation's report claims carry ids |
+| `9d85ca8d` | the precision panel says "no flag marked yet" once; the run page's triage link; Digest tags on a watch's scope |
+| (this commit) | this record, `[Unreleased]` bullets |
+
+**Gates.**
+
+| Gate | Result |
+|---|---|
+| repo-wide `tsc --noEmit` | clean at `a2b20f96` (repo-wide); common, editor, mcp at `077c36d1`; umtool and common at every later commit |
+| common `pnpm --filter yt-dlp-transcript-common test` (`SETTINGS_FILE` at the primary's, read only) | **4156/4156** (+12: `triage/triage.test.ts` 8 — tier 0 by id with a late transcript, by date with no last run, digest topics, the cap left new; the judge over given windows with a stubbed model — a strong and a weak flag, an invented line dismissed as not verbatim, a mention only, a window not relevant, a line the cues do not hold; the threshold; precision and the suggestion; a run end to end with its trace and `seen.json`, and the next run by id; a failed run keeps nothing seen — and `reportSchedule.test.ts` +4: a watch's plan and a tick below the threshold, an escalation as `<watch>-<date>` and the day's cap, triage first on a series and a living report, `triageStep` over stubbed calls) |
+| mcp `pnpm --filter yt-dlp-transcript-mcp test` | 365/365 |
+| editor unit `pnpm --filter editor test` | 304/304 (`_reportRefresh.test.ts`: a refresh's `ids`, a triage's keys and refusals, a sweep's triage ref) |
+| umtool unit (`node --test umtool/lib/*.test.mjs umtool/lib/*/*.test.mjs umtool/report-to-video/*.test.mjs`) | 860 tests, 858 pass, 2 skipped, 0 fail (new: `triage-marks.test.mjs` 1, `inbox/schedules.test.mjs` +1) |
+| `pnpm --filter umtool test` | **31/31** (+3: `lib/research/triage.test.ts` — the run view with its tick and tier 2, marks and precision, the board by umtool, idempotent, the Inbox's ensure) |
+| `pnpm run test:scripts` (reads the capped build) | 1012 tests, 1010 pass, 2 skipped, 0 fail |
+| `archilyzer docs cli --check`, `settings example --check` | clean (COMMANDS.md, SETTINGS.md, settings.json.example regenerated) |
+| capped umtool `next build` (corpus linked inside the heavy slot, `MemoryMax=5G`) | exit 0; compiled 16.0 s, 47.7 s wall, 1.50 GB max RSS; the link removed |
+| capped editor `next build` (heavy slot, `MemoryMax=5G`) | exit 0; compiled 29.1 s, 1:06 wall, 2.52 GB max RSS |
+| editor e2e `report-draft.spec` + `ops-api.spec` (detached, queued; `export/public` linked) | **25 passed**, 0 failed, 1.8 min — the two new: a watch over the fake models (the fake ollama started in the spec for the judge, $0; below the threshold, then a late transcript flagged strong and escalated to a sweep of it on the fake Anthropic) and a watch over HTTP (its plan; a tick with no build fails in its triage, saying so) |
+| umtool `triage-first.spec` + neighbours | run 1 (`a2b20f96`, with recurring, run-trace, board, inbox): 33 passed, 1 failed, 5 skipped — Create's "digest tags" field was named "topics", which `getByRole({name: "topic"})` also matched (`73f2078c`); run 2 (with recurring, create): 19 passed, 1 failed — the stub's escalation report's claims had no ids (`73f2078c`); run 3: **6/6** |