commit 0852c31aa482966f30a2b0899dffe508342c0e00
parent 2017cde0c613f9521095caedf9b934c87b9c6149
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 15:59:10 -0400
umtool: Settings → Generation edits triage first (the judge, the threshold, the escalations a day); docs/triage.md (R6)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/umtool/components/articles/PolicyPanel.tsx b/umtool/components/articles/PolicyPanel.tsx
@@ -31,6 +31,8 @@ export default function PolicyPanel({
const [policy, setPolicy] = useState(initial);
const [today] = useState(initialToday);
const [caps, setCaps] = useState(() => Object.fromEntries(CAP_KEYS.map((k) => [k, String(initial.generation.caps[k])])));
+ const triOf = (t: PolicyView["generation"]["triage"]) => ({ model: t.model, strong: String(t.strong), weak: String(t.weak), cap: String(t.maxEscalationsPerDay) });
+ const [tri, setTri] = useState(() => triOf(initial.generation.triage));
const [status, setStatus] = useState<{ ok: boolean; text: string } | null>(null);
const [busy, setBusy] = useState(false);
const g = policy.generation;
@@ -46,6 +48,7 @@ export default function PolicyPanel({
if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`);
setPolicy(body.policy);
setCaps(Object.fromEntries(CAP_KEYS.map((k) => [k, String(body.policy.generation.caps[k])])));
+ setTri(triOf(body.policy.generation.triage));
setStatus({ ok: true, text: `saved ${what}` });
} catch (e) {
setStatus({ ok: false, text: (e as Error).message });
@@ -156,6 +159,38 @@ export default function PolicyPanel({
</Button>
</form>
+ <div className="micro pt-1">triage first</div>
+ <form
+ className="flex flex-wrap items-center gap-x-4 gap-y-1"
+ data-policy-triage=""
+ onSubmit={(e) => {
+ e.preventDefault();
+ save({ triage: { ...g.triage, model: tri.model, strong: Number(tri.strong), weak: Number(tri.weak), maxEscalationsPerDay: Number(tri.cap) } }, "triage");
+ }}
+ >
+ <label className="flex items-center gap-1.5">
+ <span className="text-[var(--color-dim)]">judge</span>
+ <select aria-label="triage model" className={`${field} font-mono`} value={tri.model} disabled={busy} onChange={(e) => setTri({ ...tri, model: e.target.value as "local" | "extractor" })}>
+ <option value="local">local ({g.models.local})</option>
+ <option value="extractor">extractor ({g.models.extractor})</option>
+ </select>
+ </label>
+ <label className="flex items-center gap-1">
+ <span className="text-[var(--color-dim)]">escalate on</span>
+ <input aria-label="triage strong flags" className={`${field} num w-10`} inputMode="numeric" value={tri.strong} onChange={(e) => setTri({ ...tri, strong: e.target.value })} />
+ <span className="text-[var(--color-dim)]">strong or</span>
+ <input aria-label="triage flags of any strength" className={`${field} num w-10`} inputMode="numeric" value={tri.weak} onChange={(e) => setTri({ ...tri, weak: e.target.value })} />
+ <span className="text-[var(--color-dim)]">any</span>
+ </label>
+ <label className="flex items-center gap-1">
+ <span className="text-[var(--color-dim)]">escalations a day</span>
+ <input aria-label="triage escalations a day" className={`${field} num w-12`} inputMode="numeric" value={tri.cap} onChange={(e) => setTri({ ...tri, cap: e.target.value })} />
+ </label>
+ <Button size="sm" type="submit" disabled={busy}>
+ Save triage
+ </Button>
+ </form>
+
<div className="micro pt-1">API key</div>
<div className="flex items-center gap-2" data-key-file-exists={policy.keyFile.exists ? "yes" : "no"}>
<code className="font-mono text-[11px]">{policy.keyFile.path}</code>
diff --git a/umtool/docs/triage.md b/umtool/docs/triage.md
@@ -0,0 +1,72 @@
+# Triage first
+
+A recurring report can run a cheap pass before its sweep. The pass flags what is
+worth researching. Only what it flags reaches the better model with tools.
+Release R6 of the umtool redesign; the plan is `plans/umtool-redesign.md`, "R6".
+
+## Where it runs
+
+| Shape | What a tick does |
+|---|---|
+| **Watch** | Fetch, then triage what is new in scope. At or above the threshold, an API sweep of the flagged recordings, as a new article `<watch>-<date>`. Below it, nothing: the tick ends with its triage log, $0 API. |
+| **Series** with *Triage first* | Fetch the window, triage, then sweep the flagged recordings as the edition (no date bound, so a late transcript is in). Below the threshold the edition is quiet. |
+| **Living report** with *Triage first* | Fetch, triage, then R4's refresh reads the flagged recordings (no second fetch). Below the threshold, no change. |
+
+Create one at **Create → A recurring report**: pick **Watch**, or tick
+**Triage first** on a series or a living report. Set the terms, the digest
+topics and the threshold there.
+
+## The tiers
+
+| Tier | What | Cost |
+|---|---|---|
+| 0 | Code. Recordings new since the last triage **by id** (an old recording whose transcript landed late is new), that match the terms (aliases too) or carry a matching digest topic tag. The first run counts new by upload date. | $0 |
+| 1 | The local model (or `models.extractor`) judges each candidate's matching windows: the sweep pipeline's window judge. A line is a flag only when the code finds it verbatim in the window and in the transcript's cues. Score 3 is a strong flag, 2 a weak one; 1, off topic, invented or not relevant is dismissed, with why. | $0 local |
+| 2 | Only at or above the threshold: an API sweep restricted to the flagged ids, within the caps and the day's escalation cap. | metered |
+
+The default threshold is one strong flag, or three flags of any strength.
+
+## What you see
+
+- **`/series/<id>`** — a watch's **Found** list (each escalation's article and
+ board), the **Triage** table (every run, escalated or not, the spend per
+ tier), the precision of your marks and a suggested threshold.
+- **`/series/<id>/triage/<k>`** — one run: the tiers, the candidates, each flag
+ with its line on the reader surface and the judge's reason, each dismissal
+ with why, what escalated. Keys: `j`/`k` move, `y` right, `x` wrong, `u`
+ unmark, `b` open the flags as a board.
+- **The run page** of an escalated sweep (`/research/runs/<article>/<n>`) — its
+ first step is **triage first**, linking the run.
+- **The Inbox** — a watch that escalated is a **Worth researching** card (Your
+ call). Its action opens the board: an R2 case of the flags, each quote **by
+ triage**, whose hand-offs make an article or a video. The card goes once the
+ board has a hand-off or every flag of the run is marked.
+
+A suggested threshold is only a suggestion. The schedule keeps its own until
+you change it.
+
+## Where things live
+
+| Path | Writer |
+|---|---|
+| `reports/.triage/<schedule>/<k>/triage.json`, `trace.jsonl` | the editor's `report-draft {"task":"triage"}` job |
+| `reports/.triage/<schedule>/seen.json` | the same job (only when a run completes) |
+| the schedule's tick line `triage` | the editor's tick |
+| `REPORTS_ROOT/.umtool/triage/<schedule>.json` (marks) | umtool |
+| `REPORTS_ROOT/.umtool/research/<case>/case.json` (the board) | umtool, never the editor |
+
+## Settings
+
+`settings.generation.triage` (SETTINGS.md): the judge (`local` or `extractor`),
+`strong` and `weak`, `maxEscalationsPerDay`, `maxCandidates`. Settings →
+Generation edits them. A schedule may carry its own threshold.
+
+## From the command line
+
+```sh
+pnpm ops report-schedule --json '{"action":"create","shape":"watch","topic":"Co-host watch","channels":["demo-channel"],"terms":"co-host","cadence":"daily 06:00","dryRun":true}'
+pnpm ops report-draft --json '{"task":"triage","article":"co-host-watch","question":"Who co-hosts?","channels":["demo-channel"],"terms":"co-host"}' --wait
+```
+
+A flag on a co-host's line is a speaker check, not a finding: a board's quote
+says **Speaker not checked** until you check it.
diff --git a/umtool/lib/articles/generation.ts b/umtool/lib/articles/generation.ts
@@ -230,7 +230,7 @@ export async function readPolicy(): Promise<PolicyView> {
// What umtool may write of `generation`. The key file's path is not here: the
// panel shows it, and the editor's own settings page sets it.
-const POLICY_KEYS = ["routes", "models", "caps", "cacheTtl"] as const;
+const POLICY_KEYS = ["routes", "models", "caps", "cacheTtl", "triage"] as const;
/** Write the policy through the editor's settings action. Answers the policy as read back. */
export async function writePolicy(patch: Record<string, unknown>): Promise<PolicyView> {