commit 4f7829b4f51eefba6d26f5cf4e24341dadb309d1
parent 0d1d619078c34d0bc401070d476c2e560680e1e5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 15 Oct 2026 08:11:25 -0400
Merge r29/verdicts (M8 proposed verdicts, code) into r29/integration
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
34 files changed, 1522 insertions(+), 19 deletions(-)
diff --git a/COMMANDS.md b/COMMANDS.md
@@ -147,8 +147,9 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run)
| `import-post` | import-post imports ONE post by its URL into a posts channel of its platform: {"slug", "url"} — an X status (x.com/<handle>/status/<id>) or a Bluesky post (bsky.app/profile/<handle>/post/<id>, or its at:// URI). Read through the channel's own fetcher (gallery-dl for X, with the channel's login; the public AppView for Bluesky) as an import-post job on the platform's queue. Refused, before any job: a URL that is not a post, a channel that is not a posts channel of that platform or whose fetcher cannot read one post, a post the URL names as another account's, the platform held or cooling down. A post already archived is not read again; one the platform says is another account's is not written. The log ends with @@import-post {ok, slug, url, id, written, already?, post?, error?}. | `pnpm ops import-post --json '{"slug":"demo-x","url":"https://x.com/example/status/1700000000000000001"}' --wait` |
| `wayback-lookup` | wayback-lookup answers the Wayback Machine's captures of a page (its CDX API): {"url"} or a record's {"slug", "id"} (its metadata's page, else its availability check's, else the playlist's), "okOnly"?: only the captures that recorded a 200, "limit"?: 100 (at most 500) -> {url, found, captures: \[{timestamp, status, mimetype?, replayUrl}\]}, oldest first. One request through the editor's Wayback client, with archive.org's manners (one at a time, 2 s apart, 429s waited out). Read only. | `pnpm ops wayback-lookup --json '{"slug":"demo-channel","id":"dQw4w9WgXcQ","okOnly":true}'` |
| `find-copy` | find-copy looks for a copy of every gone recording (deleted or private) a report cites, and fetches the cited windows from it: {"article"} \| {"articles": true} \| {"siteId"}, "dryRun"?. Per recording, one at a time: the Wayback Machine (the newest capture of its page that recorded a 200), then archive.org (a mirror naming its YouTube id, an original video file preferred). Every copy's windows go to ONE fetch-windows job on the archive.org clip queue, the copy's URL as each window's page, so the clips land in the recording's own clips/ with the copy (wayback or archive.org, and its URL) in each window's provenance. A recording with no copy is left: its moments show their words only, marked "Source deleted". -> {recordings: \[{slug, id, gone, watchUrl, youtubeId, windows, tried: \[{from, found, url?, detail?, error?}\], copy?, outcome: fetch \| text-only \| error}\], items, stopped?, jobId?, refused?}. dryRun answers the lookups and starts nothing. | `pnpm ops find-copy --json '{"article":"demo-article","dryRun":true}'`<br>`pnpm ops find-copy --json '{"article":"demo-article"}' --wait` |
-| `report-draft` | report-draft runs a generation over an article's iteration as a report-draft job: {"task": "sweep" \| "revise-report" \| "revise-video" \| "research" \| a media draft, "article", ...} -> {jobId, iteration, warnings?}. A sweep takes "question" and "channels" (and "from"/"to"): a new iteration; a revision takes "iteration" (the one it revises) and "feedback": a new iteration. A media draft — "narrate", "cut", "onscreen", "teaser", "flips", "threads", "youtube" — takes "iteration" (a done one; "entries"? entry ids, "force"? re-drafts a field that is a draft already; narrate "cards"?) and is a step on it: it drafts fields of the iteration's video manifest, never one the operator wrote. "copyOf" N runs iteration N again on "model". "extractorModel" is an API sweep's extractor (a Claude model id; default settings.generation.models.extractor). "model" defaults to settings.generation's route for the task (one routed to code needs a model named). A Claude model runs on draft:api, capped at "maxUsd" (default by task, never above caps.max), and is refused when the day's API total has reached caps.daily; a local model runs on draft:local, through the GPU arbiter, and is unloaded when it ends. The corpus is "source" (a handle), "build" (a composed build), or the newest build holding the channels. `job cancel <id>` stops it. The log ends with @@report-draft {article, iteration, task, status, summary, usd, minutes}; --wait prints it. A research run takes "question" ("channels"? "from"/"to"?) and "autonomy" (propose \| limits \| auto; default settings.generation.research): it searches the corpus, the web and archive.org and proposes acquisitions (archive.org imports, videos, new channels — always on no site —, posts, transcription, persisting), each with its reason and evidence, enqueuing what its autonomy and the settings' caps allow through the editor's own actions; the rest waits in the iteration's proposals.json. A sweep with "iteration" N CONTINUES research run N: its question, over its channels and every channel a done acquisition wrote into, the sweep's parent N; refused while N still waits, unless "force" (what is done so far). "seed" (a new sweep's, on a Claude model) is cited markdown in the /sweep shape — umtool's research board: kept as the iteration's seed.md, the report starts from it, and the sweep verifies and extends it. "ids" (a sweep's) restricts it to those recordings: an enumeration reads only their pages and answers only their rows, a read of another is refused. A "refresh" re-fetches an iteration's scope and folds in what changed: "iteration" (default: the current report's) — its question, its recorded enumerations and every channel its citations touch. One job on draft:refresh: the editor's own sync / refresh-report / transcribe-bucket (what landed) per video channel and fetch-posts per posts channel (a platform held or cooling down is skipped; transcribe-bucket is skipped, and said, while transcription is paused or no worker is enabled), then a local build of the site holding them (never a deploy); the enumerations again (new and changed recordings) and every cited quote read again (changed words, en vs en-orig, a source gone); nothing changed ends no-change, $0 — or partial, naming what a capped search did not reach. Else, within the caps ("model", "maxUsd", "extractorModel"; past one it ends held-by-cap with the delta and the estimate), a sweep restricted to the new recordings and a revision of the report: a new refresh iteration, refresh.json beside it. "fetch": false skips the fetch and the build; "dryRun": true answers {plan} and writes nothing. Its log ends with @@report-draft {…, refresh: {status, newIds, changed, drifted, deleted, summary}}. | `pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","question":"What does she say about the shop?","channels":["demo-channel"]}' --wait`<br>`pnpm ops report-draft --json '{"task":"revise-report","article":"demo-article","iteration":1,"feedback":"Drop the second finding."}'`<br>`pnpm ops report-draft --json '{"task":"research","article":"demo-article","question":"Where did the shop story start?","autonomy":"propose"}' --wait`<br>`pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","iteration":1}'`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article"}' --wait`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article","dryRun":true}'`<br>`pnpm ops report-draft --json '{"task":"triage","article":"co-host-watch","question":"Who co-hosts?","channels":["demo-channel"],"terms":"co-host"}' --wait` |
+| `report-draft` | report-draft runs a generation over an article's iteration as a report-draft job: {"task": "sweep" \| "revise-report" \| "revise-video" \| "research" \| a media draft, "article", ...} -> {jobId, iteration, warnings?}. A sweep takes "question" and "channels" (and "from"/"to"): a new iteration; a revision takes "iteration" (the one it revises) and "feedback": a new iteration. A media draft — "narrate", "cut", "onscreen", "teaser", "flips", "threads", "youtube" — takes "iteration" (a done one; "entries"? entry ids, "force"? re-drafts a field that is a draft already; narrate "cards"?) and is a step on it: it drafts fields of the iteration's video manifest, never one the operator wrote. "copyOf" N runs iteration N again on "model". "extractorModel" is an API sweep's extractor (a Claude model id; default settings.generation.models.extractor). "model" defaults to settings.generation's route for the task (one routed to code needs a model named). A Claude model runs on draft:api, capped at "maxUsd" (default by task, never above caps.max), and is refused when the day's API total has reached caps.daily; a local model runs on draft:local, through the GPU arbiter, and is unloaded when it ends. The corpus is "source" (a handle), "build" (a composed build), or the newest build holding the channels. `job cancel <id>` stops it. The log ends with @@report-draft {article, iteration, task, status, summary, usd, minutes}; --wait prints it. A research run takes "question" ("channels"? "from"/"to"?) and "autonomy" (propose \| limits \| auto; default settings.generation.research): it searches the corpus, the web and archive.org and proposes acquisitions (archive.org imports, videos, new channels — always on no site —, posts, transcription, persisting), each with its reason and evidence, enqueuing what its autonomy and the settings' caps allow through the editor's own actions; the rest waits in the iteration's proposals.json. A sweep with "iteration" N CONTINUES research run N: its question, over its channels and every channel a done acquisition wrote into, the sweep's parent N; refused while N still waits, unless "force" (what is done so far). "seed" (a new sweep's, on a Claude model) is cited markdown in the /sweep shape — umtool's research board: kept as the iteration's seed.md, the report starts from it, and the sweep verifies and extends it. "ids" (a sweep's) restricts it to those recordings: an enumeration reads only their pages and answers only their rows, a read of another is refused. A "refresh" re-fetches an iteration's scope and folds in what changed: "iteration" (default: the current report's) — its question, its recorded enumerations and every channel its citations touch. One job on draft:refresh: the editor's own sync / refresh-report / transcribe-bucket (what landed) per video channel and fetch-posts per posts channel (a platform held or cooling down is skipped; transcribe-bucket is skipped, and said, while transcription is paused or no worker is enabled), then a local build of the site holding them (never a deploy); the enumerations again (new and changed recordings) and every cited quote read again (changed words, en vs en-orig, a source gone); nothing changed ends no-change, $0 — or partial, naming what a capped search did not reach. Else, within the caps ("model", "maxUsd", "extractorModel"; past one it ends held-by-cap with the delta and the estimate), a sweep restricted to the new recordings and a revision of the report: a new refresh iteration, refresh.json beside it. "fetch": false skips the fetch and the build; "dryRun": true answers {plan} and writes nothing. Its log ends with @@report-draft {…, refresh: {status, newIds, changed, drifted, deleted, summary}}. "verdicts" proposes a verdict for each UNRULED claim of a fact-check ("article"; "claims"? only those; "model"?, "maxUsd"?): the verdict bench's prompt, one claim per call, on a model in settings.generation.verdicts.models only (refused otherwise; none named: the first of them on the verdicts route). No iteration (iteration 0): the proposals go to the article's verdicts.proposed.json, never report.json; a claim the operator ruled, or whose proposal was reviewed, is not asked. Its log ends with @@report-draft {…, verdicts: {proposed, failed, skipped, promptVersion}}. | `pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","question":"What does she say about the shop?","channels":["demo-channel"]}' --wait`<br>`pnpm ops report-draft --json '{"task":"revise-report","article":"demo-article","iteration":1,"feedback":"Drop the second finding."}'`<br>`pnpm ops report-draft --json '{"task":"research","article":"demo-article","question":"Where did the shop story start?","autonomy":"propose"}' --wait`<br>`pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","iteration":1}'`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article"}' --wait`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article","dryRun":true}'`<br>`pnpm ops report-draft --json '{"task":"triage","article":"co-host-watch","question":"Who co-hosts?","channels":["demo-channel"],"terms":"co-host"}' --wait`<br>`pnpm ops report-draft --json '{"task":"verdicts","article":"demo-factcheck"}' --wait` |
| `research-approve` | research-approve settles a research run's acquisitions: {"article", "iteration", "ids"?: \["p01", …\], "approve"?: true \| false, "note"?} -> {outcomes: \[{id, status?, jobId?, note?, error?}\], research: {phase, autonomy, limits, spent, proposals, waitingOn: {approval, jobs}, continuedBy, autoContinue?}}. It first refreshes every enqueued acquisition from its jobs (all done: done; one failed: failed, naming it). approve: true runs each proposal through the editor's own action (past the run's autonomy and caps, never past a standing rule); false rejects it, note saying why. No ids: the run's state now. The phase is wait (approvals or jobs pending), ready (nothing pending: continue with report-draft {"task": "sweep", "iteration": N}) or continued. An `auto` run is continued by the editor itself once ready; autoContinue says how (continued by, held for a build, refused by a cap, and why). Refused while the run's job is going. | `pnpm ops research-approve --json '{"article":"demo-article","iteration":1,"ids":["p01","p03"],"approve":true}'` |
+| `verdict-review` | verdict-review settles one verdict proposal: {"article", "claim", "decision": "approve" \| "reject", "note"?} -> {proposal}. approve sets the claim's verdict to the proposal's (through the registry; refused when the claim was ruled meanwhile); reject leaves the claim unruled. Synchronous. | `pnpm ops verdict-review --json '{"article":"demo-factcheck","claim":"c04","decision":"approve"}'` |
| `bench-verdicts` | bench-verdicts runs the verdict bench as a bench-verdicts job: {"models": \["…"\], "run"?, "reports"?: \["<article>"\], "window"? (seconds, default 60), "windowMode"? ("seconds" \| "turn": the cited speaker's turn, bounded by the window), "maxUsd"? (default 5), "limit"? (a stratified sample, by the operator's verdict), "itemsFrom"? (an earlier run's exact items; no reports, window, windowMode or limit with it)} -> {jobId, run}. Every claim of the registry's fact-checks (or of "reports") with the operator's verdict and a citation with cues is asked of each model, one claim per call (the report's title, the claim's section, the claim, its quotes, the transcript in the window; never the findings or the verdict), and scored against the rulings. On draft:local when any model is local (through the GPU arbiter; unloaded at the end), else draft:api; the run stops at maxUsd, and an API run is refused past caps.daily. A "run" that exists continues with this call's models only (answered pairs are skipped; refused under another prompt version). Results stay local, in .generation/bench/verdicts/<run>/ (umtool's /tools/bench). The log ends with @@bench-verdicts {run, status, items, skipped, spentUsd, stopped?}. | `pnpm ops bench-verdicts --json '{"models":["claude-sonnet-5-5","qwen3:8b"],"maxUsd":5}' --wait` |
| `report-schedule` | report-schedule keeps a recurring report on a cadence the editor ticks: {"action": "list" \| "create" \| "update" \| "pause" \| "resume" \| "delete" \| "tick-now" \| "reset-triage" \| "learn" \| "unlearn" \| "promote-alias", …}. create takes {"shape": "living" \| "series", "topic", "question"?, "channels", "case"?, "from"?, "terms"?, "regex"?, "cadence" ({"kind": "daily" \| "weekly" \| "every", "at": "HH:MM", "dow"?, "days"?} or "weekly mon 06:00"), "tz"?, "article"? (living), "autoMakeCurrent"? (living), "model"?, "maxUsd"?, "dryRun"?} -> {plan, schedule?}: the plan names the first tick, the model and its cap. A living report is one article kept current: each tick fetches the scope (R4's stage 1) and refreshes it, the new iteration left ready (or made current with autoMakeCurrent); its first tick is its first sweep. A series makes an edition each tick: a new article <series>-<date> over the window since the last edition ("<topic> · week of <date>"); a window the terms (or, with none, any recording) do not match is a quiet edition: recorded, no article, $0. Ticks run as report-tick jobs, one at a time, never on an idle boot, held by the lane's gate (lane report-schedule); a window missed while the editor was down is ONE catch-up tick. A cap refusal ends a tick held-by-cap. update {"id", …} (a new cadence re-plans from now); pause / resume {"id"}; delete {"id", "confirm"?} answers the plan unless confirm is true; tick-now {"id"} -> {jobId} (refused while a tick of it is queued or running); --wait prints the tick's @@report-tick {json}. list {"id"?} answers the schedules with their chip, call and spend, and the lane. A tick whose scan hit a cap (or did not reach a channel) and found nothing ends partial, naming what it did not reach — never quiet. reset-triage {"id", "k"?, "confirm"?} discards a schedule's triage state (its runs from run k on, default all; seen.json, so the next run counts new from its since; the quiet editions they covered): the plan unless confirm is true; refused while a tick runs. learn {"id", "dryRun"?} runs the proposal pass now (R6.3: learned spellings): the triage model lists likely mis-hearings of each name in the terms; each must occur in scope (an uncapped count) and the judge must say, quoting the line, that it means the name, before it joins the candidate query as an escaped literal ("terms + N learned"); the answer is the plan (the names it asks about) and the job (a report-draft job on the triage model's lane); dryRun answers the plan only. A create of a schedule that triages, a change of its terms, and a tick a week after the last pass start one too. unlearn {"id", "spelling"} removes a learned spelling (never learned again). promote-alias {"id", "spelling", "site"?, "confirm"?} writes it as a search alias (global, or the site's), a new alias or a trigger on the one for that name: the plan unless confirm is true. | `pnpm ops report-schedule --json '{"action":"create","shape":"series","topic":"Co-host updates","channels":["demo-channel"],"cadence":"weekly mon 06:00","dryRun":true}'`<br>`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}'`<br>`pnpm ops report-schedule --json '{"action":"list"}'`<br>`pnpm ops report-schedule --json '{"action":"tick-now","id":"co-host-updates"}' --wait`<br>`pnpm ops report-schedule --json '{"action":"delete","id":"co-host-updates","confirm":true}'`<br>`pnpm ops report-schedule --json '{"action":"reset-triage","id":"co-host-updates"}'`<br>`pnpm ops report-schedule --json '{"action":"learn","id":"co-host-updates","dryRun":true}'`<br>`pnpm ops report-schedule --json '{"action":"promote-alias","id":"co-host-updates","spelling":"Gothics"}'` |
diff --git a/REPORT.md b/REPORT.md
@@ -59,7 +59,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f
| `id` | yes | The claim's id (letters, digits, `_ . : -`; at most 64): its anchor on the report page. Unique among the report's section, claim and entry ids, and none of the page's own anchors (`report-head`, `in-brief`, `found`, `claims`, `references`, `downloads`, `report-end`). |
| `title` | no | A short headline for the claim (plain text, e.g. a phrase it turns on), shown above its text. Absent = the text alone. |
| `text` | yes | The claim, as stated by the document under review (plain text). |
-| `verdict` | no | The ruling on the claim: `CORROBORATED`, `PARTLY`, `CONTRADICTED`, `NOT_FOUND`, `UNTESTABLE` (what each means: "The verdicts", below). A fact-check's claim may leave it out (not yet ruled); a sweep's carries none. |
+| `verdict` | no | The ruling on the claim: `CORROBORATED`, `PARTLY`, `CONTRADICTED`, `NOT_FOUND`, `UNTESTABLE` (what each means: "The verdicts", below). A fact-check's claim may leave it out (not yet ruled); a sweep's carries none. Only the operator sets it: a model's proposal is kept in the article's `verdicts.proposed.json`, never here. |
| `gist` | no | The claim's finding in one line (plain text, at most 240 characters), shown beside its title in the overview of what the check found. Absent = the title alone. |
| `flag` | no | A short mark on the claim (plain text, one line, at most 60 characters), shown as a pill on its card: e.g. that the document gives no source for it. Absent = none. |
| `sourceQuote` | no | The document's own sentence making the claim: `{ "citation": "<id>" }`, naming a `source` citation (its still is shown with the claim). |
@@ -135,6 +135,7 @@ An article made or revised by a model keeps each generation as an **iteration**,
- **Use this iteration** (umtool's Iterations tab) writes the article's `report.json` from a done iteration through the registry's writer: locked, validated, the article's `audience` and attached `video` kept. Nothing a generation runs writes the article's `report.json`; the next export records the change as the next Revision.
- Iterations are never published: compose, the homepage and the site history read only the article's own files.
- A directory with iterations and no `report.json` is an article **in the making**: the registry lists it neither as published nor as a draft until an iteration is made current.
+- **Verdict proposals** (release 29) are a sidecar, `verdicts.proposed.json` beside the article's `report.json` (`common/lib/report/verdictProposals.ts`): a model's proposed verdict, reason, model and prompt version per unruled claim, each `proposed`, `approved` or `rejected`. They are never in `report.json` (a claim's `verdict` is the operator's) and never published; approving one sets the claim's `verdict` through the registry.
- An iteration's video project is off the corpus disk, in `<settings.generation.projectsRoot>/<id>/i<n>/` (blank: `~/reports/articles`).
- `archilyzer reports iterations <id>` lists an article's iterations; `pnpm ops get iterations <id>` reads them from the editor.
diff --git a/SETTINGS.md b/SETTINGS.md
@@ -1004,6 +1004,7 @@ Report and video generation (release 27): where each task runs (`code` = Claude
| `flips` | `"local"` | A media draft: THEN/NOW pairs over the cut's clips. |
| `threads` | `"local"` | A media draft: the cut's threads and each clip's thread. |
| `youtube` | `"local"` | A media draft: the YouTube title and description. |
+| `verdicts` | `"local"` | Verdict proposals for a fact-check's unruled claims (`verdicts.proposed.json` beside the article; the operator approves or rejects each). Runs only on a model in `verdicts.models`: the first of them on this route (`api` or `local`), or the one a job names; `code` = none unless named. |
#### `generation.models`
@@ -1088,7 +1089,8 @@ Default:
"teaser": "local",
"flips": "local",
"threads": "local",
- "youtube": "local"
+ "youtube": "local",
+ "verdicts": "local"
},
"models": {
"api": "claude-sonnet-5-5",
diff --git a/common/controller/reportDraft.ts b/common/controller/reportDraft.ts
@@ -131,6 +131,8 @@ export const REPORT_DRAFT_BODY_KEYS = [
"since",
"maxCandidates",
"triage",
+ // release 29 M8: a `verdicts` job's claims (default: every unruled one).
+ "claims",
] as const;
// A seed's size: a board of a few hundred quotes, with room.
@@ -178,6 +180,8 @@ export type ReportDraftBody = {
maxCandidates?: number;
// A sweep's: the triage it escalates ("<owner>/<k>").
triage?: { owner: string; k: number };
+ // A verdicts job's (release 29 M8): the claims to propose for.
+ claims?: string[];
};
// A Claude model the price table knows: one of its ids, or a dated id of one
@@ -324,6 +328,17 @@ export function parseReportDraftBody(b: Record<string, unknown>): ReportDraftBod
if (!m) fail('"triage" names a triage run: "<owner>/<k>"');
out.triage = { owner: m![1]!, k: Number(m![2]) };
}
+ // Verdict proposals (release 29 M8): the article's current report, no iteration.
+ const claims = list("claims");
+ if (claims !== undefined) {
+ if (out.task !== "verdicts") fail('"claims" is a verdicts job\'s (the claims to propose for)');
+ if (!claims.every((c) => /^[A-Za-z0-9._:-]{1,64}$/.test(c))) fail('"claims" is a list of claim ids');
+ out.claims = [...new Set(claims)];
+ }
+ if (out.task === "verdicts") {
+ const extra = (["iteration", "copyOf", "feedback", "question", "channels", "from", "to", "seed", "cards", "entries", "force", "autonomy", "ids", "source", "build"] as const).filter((k) => out[k] !== undefined);
+ if (extra.length) fail(`a verdicts job reads the article's current report: it takes no ${extra.join(", ")}`);
+ }
if (out.task === REFRESH_TASK) {
const extra = (["question", "channels", "from", "to", "feedback", "copyOf", "seed", "cards", "entries", "force", "autonomy"] as const).filter((k) => out[k] !== undefined);
if (extra.length) fail(`a refresh takes its question and scope from the iteration it refreshes — not ${extra.join(", ")}`);
@@ -362,7 +377,7 @@ function kindOf(task: GenerationTask): Iteration["kind"] {
}
const capOf = (task: GenerationTask): "sweep" | "revision" | "narration" =>
- isStepTask(task) ? "narration" : task === "revise-report" || task === "revise-video" ? "revision" : "sweep";
+ isStepTask(task) ? "narration" : task === "revise-report" || task === "revise-video" || task === "verdicts" ? "revision" : "sweep";
export function expandHome(p: string): string {
return p === "~" ? os.homedir() : p.startsWith("~/") ? path.join(os.homedir(), p.slice(2)) : p;
@@ -474,6 +489,14 @@ export async function enqueueReportDraft(raw: Record<string, unknown>, deps: Rep
return refuse((e as Error).message);
}
}
+ if (body.task === "verdicts") {
+ try {
+ const { enqueueVerdictProposals } = await import("./reportVerdicts");
+ return await enqueueVerdictProposals(body, deps);
+ } catch (e) {
+ return refuse((e as Error).message);
+ }
+ }
if (body.task === REFRESH_TASK) {
if (body.dryRun) return refuse('a refresh\'s plan is planRefresh\'s ("dryRun": true at the ops route)');
try {
@@ -676,7 +699,8 @@ async function runReportDraft(
switch (body.task) {
case "refresh":
case "triage":
- // A refresh and a triage are their own jobs (./reportRefresh.ts, ./reportTriage.ts), never this one.
+ case "verdicts":
+ // A refresh, a triage and verdict proposals are their own jobs (./reportRefresh.ts, ./reportTriage.ts, ./reportVerdicts.ts), never this one.
throw new Error(`a ${body.task} runs as its own job`);
case "sweep":
input =
diff --git a/common/controller/reportVerdicts.ts b/common/controller/reportVerdicts.ts
@@ -0,0 +1,159 @@
+// `report-draft {"task": "verdicts", "article", "model"?, "claims"?, "maxUsd"?}`
+// — verdict proposals (release 29 M8) as an editor job, and the operator's
+// review of one (`verdict-review`).
+//
+// enqueueVerdictProposals refused unless the model is in
+// settings.generation.verdicts.models (verdictsModelOf),
+// the article is a fact-check, and (an API model) the
+// caps allow; then ONE `report-draft` job on the model's
+// lane: `draft:local` (every ollama call through the GPU
+// arbiter; ollama unloaded when the job ends) or
+// `draft:api` (metered, held to the revision cap and the
+// daily cap, its usage in the ledger as task `verdicts`).
+// The cues are the local corpus's (`diskCuesOf`), as the
+// bench reads them. No iteration is made: the answer's
+// `iteration` is 0. The log ends `@@report-draft {article,
+// iteration: 0, task: "verdicts", status, summary, usd,
+// verdicts: {proposed, failed, skipped}}`.
+// reviewProposal `pnpm ops verdict-review {article, claim, decision:
+// "approve" | "reject", note?}` (the editor's route and
+// umtool's article tab): approve sets the claim's verdict
+// through patchArticle, reject marks the proposal only
+// (lib/report/verdictProposals.ts).
+
+import { runManagedFunction, type StreamActionResult } from "../jobs/streamCommand";
+import { DRAFT_API_QUEUE, DRAFT_LOCAL_QUEUE } from "../lib/queueKeys";
+import { getSettings } from "../lib/settings";
+import { capFor } from "../lib/generationSettings";
+import { providerOf, unloadOllama } from "../lib/llm";
+import { diskCuesOf } from "../lib/report/convert-server";
+import { diskDateOf, diskTurnsOf } from "../lib/report/draft/bench/disk";
+import { benchReportsOf } from "../lib/report/draft/bench/index";
+import { usageOf } from "../lib/report/draft/tasks/run";
+import { proposeVerdicts, verdictsModelOf, VERDICTS_TASK, type VerdictsOutcome } from "../lib/report/draft/tasks/verdicts";
+import { reviewVerdictProposal, VerdictProposalsError, type ProposalReview } from "../lib/report/verdictProposals";
+import { isReportId } from "../lib/report/schema";
+import { appendGenerationUsage, dailyCapRefusal, dayUsage, utcDay, type GenerationUsageRow } from "./generationUsage";
+import { REPORT_DRAFT_JOB_KIND, REPORT_DRAFT_RESULT_MARKER, llmConfigOf, type ReportDraftBody, type ReportDraftDeps, type ReportDraftEnqueued } from "./reportDraft";
+
+export { VERDICTS_TASK };
+
+export async function enqueueVerdictProposals(body: ReportDraftBody, deps: ReportDraftDeps): Promise<ReportDraftEnqueued | { result: StreamActionResult & { ok: false } }> {
+ const refuse = (error: string) => ({ result: { ok: false as const, error } });
+ const paths = deps.paths;
+ const gen = (deps.settings ?? getSettings)().generation;
+ let model: string;
+ try {
+ model = verdictsModelOf(gen, body.model);
+ // A fact-check with report.json (benchReportsOf refuses anything else).
+ await benchReportsOf(paths, [body.article]);
+ } catch (e) {
+ return refuse((e as Error).message);
+ }
+ const provider = providerOf(model);
+ let maxUsd: number | undefined;
+ if (provider === "api") {
+ try {
+ maxUsd = capFor(gen.caps, "revision", body.maxUsd);
+ } catch (e) {
+ return refuse((e as Error).message);
+ }
+ const refusal = dailyCapRefusal(await dayUsage(paths.generationUsageFile, utcDay(deps.now?.())), gen.caps.daily);
+ if (refusal) return refuse(refusal);
+ }
+ const result = await runManagedFunction({
+ kind: REPORT_DRAFT_JOB_KIND,
+ queueKey: provider === "api" ? DRAFT_API_QUEUE : DRAFT_LOCAL_QUEUE,
+ paths,
+ fn: async (onLog, signal, setProgress, ctx) => {
+ const g = (deps.settings ?? getSettings)().generation;
+ if (provider === "api") {
+ // Again at the job's turn: jobs ahead in the queue may have spent the day.
+ const late = dailyCapRefusal(await dayUsage(paths.generationUsageFile, utcDay(deps.now?.())), g.caps.daily);
+ if (late) throw new Error(late);
+ }
+ onLog(`verdicts ${body.article} on ${model} (${provider === "api" ? `the Claude API, cap $${maxUsd}` : "the local model, through the GPU arbiter"})`);
+ let out: VerdictsOutcome | null = null;
+ try {
+ out = await proposeVerdicts(
+ { article: body.article, model, ...(body.claims?.length ? { claims: body.claims } : {}), ...(maxUsd !== undefined ? { maxUsd } : {}) },
+ {
+ paths,
+ cuesOf: diskCuesOf(paths.channelsDir),
+ turnsOf: diskTurnsOf(paths.channelsDir),
+ dateOf: diskDateOf(paths.channelsDir),
+ llm: llmConfigOf(g, paths, provider === "local" ? { onLog, signal } : undefined),
+ // Read again at the job's turn: a model unticked meanwhile is refused.
+ allowed: g.verdicts.models,
+ log: onLog,
+ progress: (done, total) => setProgress?.({ metric: "entries", initial: 0, target: Math.max(total, done), current: done }),
+ signal,
+ ...(deps.now ? { now: deps.now } : {}),
+ },
+ );
+ } finally {
+ if (provider === "local") {
+ await unloadOllama({ baseUrl: g.ollamaUrl || paths.ollamaUrl }, model).then(
+ () => onLog(`unloaded ${model} from ollama`),
+ (e) => onLog(`ollama unload failed: ${(e as Error).message}`),
+ );
+ }
+ }
+ if (provider === "api") {
+ const at = deps.now?.() ?? new Date();
+ const rows: GenerationUsageRow[] = Object.entries(out.byModel)
+ .filter(([, t]) => t.calls > 0)
+ .map(([m, t]) => {
+ const u = usageOf(t);
+ return {
+ at: at.toISOString(),
+ day: utcDay(at),
+ jobId: ctx.jobId,
+ article: body.article,
+ iteration: 0,
+ task: VERDICTS_TASK,
+ model: m,
+ inputTokens: u.inputTokens,
+ outputTokens: u.outputTokens,
+ cacheReadTokens: u.cacheReadTokens ?? 0,
+ cacheWriteTokens: u.cacheWriteTokens ?? 0,
+ usd: Math.round(u.usd * 10_000) / 10_000,
+ };
+ });
+ await appendGenerationUsage(paths.generationUsageFile, rows).catch((e) => onLog(`usage not recorded: ${(e as Error).message}`));
+ }
+ onLog(
+ `${REPORT_DRAFT_RESULT_MARKER}${JSON.stringify({
+ article: body.article,
+ iteration: 0,
+ task: VERDICTS_TASK,
+ status: out.status,
+ summary: out.summary,
+ usd: out.usd,
+ verdicts: { proposed: out.proposed.length, failed: out.failed.length, skipped: out.skipped.length, promptVersion: out.promptVersion },
+ })}`,
+ );
+ if (out.status === "cancelled" || signal.aborted) throw new Error("cancelled");
+ },
+ });
+ if (!result.ok) return { result };
+ return { result, iteration: 0 };
+}
+
+// ─── verdict-review ───
+
+export const VERDICT_REVIEW_BODY_KEYS = ["article", "claim", "decision", "note"] as const;
+
+/** The body, judged without touching the disk. */
+export function parseVerdictReviewBody(b: Record<string, unknown>): ProposalReview {
+ if (!isReportId(b.article)) throw new VerdictProposalsError('"article" is an article id');
+ if (typeof b.claim !== "string" || !/^[A-Za-z0-9._:-]{1,64}$/.test(b.claim)) throw new VerdictProposalsError('"claim" is a claim id');
+ if (b.decision !== "approve" && b.decision !== "reject") throw new VerdictProposalsError('"decision" is "approve" or "reject"');
+ if (b.note !== undefined && b.note !== null && typeof b.note !== "string") throw new VerdictProposalsError('"note" is text');
+ return { article: b.article as string, claim: b.claim, decision: b.decision, ...(typeof b.note === "string" && b.note.trim() ? { note: b.note } : {}) };
+}
+
+export async function reviewProposal(raw: Record<string, unknown>, deps: Pick<ReportDraftDeps, "paths" | "now">) {
+ const r = parseVerdictReviewBody(raw);
+ return reviewVerdictProposal(r, deps.paths, deps.now?.() ?? new Date());
+}
diff --git a/common/lib/generationSettings.ts b/common/lib/generationSettings.ts
@@ -18,7 +18,10 @@ export const MEDIA_STEP_TASKS = ["narrate", "cut", "onscreen", "teaser", "flips"
export type MediaStepTask = (typeof MEDIA_STEP_TASKS)[number];
export const isStepTask = (t: unknown): t is MediaStepTask => typeof t === "string" && (MEDIA_STEP_TASKS as readonly string[]).includes(t);
-export const GENERATION_TASKS = ["sweep", "revise-report", "revise-video", "narrate", "research", "cut", "onscreen", "teaser", "flips", "threads", "youtube"] as const;
+// `verdicts` (release 29 M8): verdict proposals for a fact-check's unruled
+// claims — no iteration, no step: a sidecar beside the article, and only on a
+// model in `verdicts.models` (the bench's bar).
+export const GENERATION_TASKS = ["sweep", "revise-report", "revise-video", "narrate", "research", "cut", "onscreen", "teaser", "flips", "threads", "youtube", "verdicts"] as const;
export type GenerationTask = (typeof GENERATION_TASKS)[number];
// The tasks every settings file since release 27 S6 routes.
const FIRST_TASKS: readonly GenerationTask[] = ["sweep", "revise-report", "revise-video", "narrate"];
@@ -30,10 +33,10 @@ export type GenerationRoute = (typeof GENERATION_ROUTES)[number];
const mediaRoutes = <R extends GenerationRoute>(r: R) => ({ cut: r, onscreen: r, teaser: r, flips: r, threads: r, youtube: r }) as const;
export const GENERATION_PRESETS = {
- code: { sweep: "code", "revise-report": "code", "revise-video": "code", narrate: "code", research: "code", ...mediaRoutes("code") },
- balanced: { sweep: "code", "revise-report": "api", "revise-video": "local", narrate: "local", research: "api", ...mediaRoutes("local") },
- api: { sweep: "api", "revise-report": "api", "revise-video": "api", narrate: "api", research: "api", ...mediaRoutes("api") },
- local: { sweep: "local", "revise-report": "local", "revise-video": "local", narrate: "local", research: "local", ...mediaRoutes("local") },
+ code: { sweep: "code", "revise-report": "code", "revise-video": "code", narrate: "code", research: "code", ...mediaRoutes("code"), verdicts: "code" },
+ balanced: { sweep: "code", "revise-report": "api", "revise-video": "local", narrate: "local", research: "api", ...mediaRoutes("local"), verdicts: "local" },
+ api: { sweep: "api", "revise-report": "api", "revise-video": "api", narrate: "api", research: "api", ...mediaRoutes("api"), verdicts: "api" },
+ local: { sweep: "local", "revise-report": "local", "revise-video": "local", narrate: "local", research: "local", ...mediaRoutes("local"), verdicts: "local" },
} as const satisfies Record<string, Record<GenerationTask, GenerationRoute>>;
export type GenerationPreset = keyof typeof GENERATION_PRESETS;
export const GENERATION_PRESET_NAMES = Object.keys(GENERATION_PRESETS) as GenerationPreset[];
@@ -178,6 +181,8 @@ export const GENERATION_ROUTES_FIELD_DOCS: FieldDocs<GenerationRoutes> = {
flips: "A media draft: THEN/NOW pairs over the cut's clips.",
threads: "A media draft: the cut's threads and each clip's thread.",
youtube: "A media draft: the YouTube title and description.",
+ verdicts:
+ "Verdict proposals for a fact-check's unruled claims (`verdicts.proposed.json` beside the article; the operator approves or rejects each). Runs only on a model in `verdicts.models`: the first of them on this route (`api` or `local`), or the one a job names; `code` = none unless named.",
};
export const GENERATION_MODELS_FIELD_DOCS: FieldDocs<GenerationModels> = {
diff --git a/common/lib/report/docs.ts b/common/lib/report/docs.ts
@@ -191,6 +191,13 @@ export function renderReportMarkdown(): string {
"registry lists it neither as published nor as a draft until an iteration is made current.",
);
out.push(
+ "- **Verdict proposals** (release 29) are a sidecar, `verdicts.proposed.json` beside the " +
+ "article's `report.json` (`common/lib/report/verdictProposals.ts`): a model's proposed " +
+ "verdict, reason, model and prompt version per unruled claim, each `proposed`, `approved` or " +
+ "`rejected`. They are never in `report.json` (a claim's `verdict` is the operator's) and never " +
+ "published; approving one sets the claim's `verdict` through the registry.",
+ );
+ out.push(
"- An iteration's video project is off the corpus disk, in " +
"`<settings.generation.projectsRoot>/<id>/i<n>/` (blank: `~/reports/articles`).",
);
diff --git a/common/lib/report/draft/tasks/index.ts b/common/lib/report/draft/tasks/index.ts
@@ -61,6 +61,8 @@ export { pickCorpusBuild, listCorpusBuilds, siteOriginOf, NoCorpusBuildError, ty
export { momentHref, rewriteLinks, rewriteMomentBases, slugResolver } from "./links";
export { checkQuotes, convertSweepText, dropFailedFindings, type QuoteProblem } from "./quotes";
export { projectDirOf } from "./project";
+// Release 29 M8: verdict proposals (a job of their own, no iteration: controller/reportVerdicts.ts).
+export { proposeVerdicts, verdictsModelOf, VerdictsRefusal, VERDICTS_TASK, type VerdictsDeps, type VerdictsInput, type VerdictsOutcome } from "./verdicts";
// umtool R4: the sweep's `ids` restriction (a general sweep option).
export { restrictEnumerateText, restrictTools } from "./restrict";
// umtool R3: a sweep's trace (trace.jsonl).
diff --git a/common/lib/report/draft/tasks/verdicts.test.ts b/common/lib/report/draft/tasks/verdicts.test.ts
@@ -0,0 +1,155 @@
+// Verdict proposals (release 29 M8): the task never writes a claim's verdict,
+// refuses a model that has not cleared the bar, skips what the operator has
+// ruled or reviewed; the sidecar survives makeCurrent; the operator's approve
+// sets the verdict through patchArticle. Temp stores and the synthetic corpus.
+//
+// Run with: node_modules/.bin/tsx --test lib/report/draft/tasks/verdicts.test.ts
+
+import { after, test } from "node:test";
+import assert from "node:assert/strict";
+import { mkdtempSync, readFileSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { cuesOf } from "../../../../testing/draft/corpus.mjs";
+import { startFakeAnthropic, toolTurn } from "../../../../testing/llm/fakeAnthropic.mjs";
+import { articleFile, writeArticle } from "../../registry";
+import { createIteration, makeCurrent, updateIteration, writeIterationFile } from "../../iterations";
+import { readVerdictProposals, recordVerdictProposals, reviewVerdictProposal, verdictProposalsFile, waitingProposals } from "../../verdictProposals";
+import { sanitizeGeneration } from "../../../generationSettings";
+import { PROMPT_VERSION, type BenchAsk } from "../bench/index";
+import { proposeVerdicts, verdictsModelOf, VerdictsRefusal } from "./verdicts";
+
+const RULED = path.join(import.meta.dirname, "../../../../testing/draft/reports/ruled.report.json");
+const ROOTS: string[] = [];
+after(() => {
+ for (const r of ROOTS) rmSync(r, { recursive: true, force: true });
+});
+
+const NOW = new Date("2026-10-15T12:00:00.000Z");
+const QWEN = "qwen3:8b";
+
+// The synthetic fact-check with r02, r04 and r07 unruled (r08 unruled, no citation).
+async function store() {
+ const root = mkdtempSync(path.join(tmpdir(), "verdict-proposals-"));
+ ROOTS.push(root);
+ const paths = { articlesDir: path.join(root, "reports"), exportIndexDir: path.join(root, ".export-index") };
+ const report = JSON.parse(readFileSync(RULED, "utf8"));
+ for (const s of report.sections) for (const c of s.claims) if (["r02", "r04", "r07", "r08"].includes(c.id)) delete c.verdict;
+ await writeArticle(report, { paths });
+ return { paths, id: report.id as string, file: articleFile(paths, report.id) };
+}
+
+const claimOf = (user: string) => /^Claim: (.*)$/m.exec(user)?.[1] ?? "";
+
+function stub(answer: (claimText: string) => unknown) {
+ const asked: { model: string; user: string; system: string }[] = [];
+ const ask: BenchAsk = async <T,>(system: string, user: string, _schema: object, model: string) => {
+ asked.push({ model, user, system });
+ return answer(claimOf(user)) as T;
+ };
+ return { ask, asked };
+}
+
+test("the model: only one in verdicts.models — the asked one, else the first on the route; none, or code, refused", () => {
+ const gen = (models: string[], route: "api" | "local" | "code") => {
+ const g = sanitizeGeneration({ verdicts: { bar: { agreement: 0.6, contradictedRecall: 0.5, notFoundRecall: 0.5 }, models } });
+ g.routes.verdicts = route;
+ return g;
+ };
+ assert.equal(sanitizeGeneration({}).verdicts.models.length, 0);
+ assert.throws(() => verdictsModelOf(gen([], "local")), /models is empty/);
+ assert.equal(verdictsModelOf(gen([QWEN, "claude-opus-5-5"], "local")), QWEN);
+ assert.equal(verdictsModelOf(gen([QWEN, "claude-opus-5-5"], "api")), "claude-opus-5-5");
+ assert.throws(() => verdictsModelOf(gen([QWEN], "api")), /runs on the api route/);
+ assert.throws(() => verdictsModelOf(gen([QWEN], "code")), /routed to Claude Code/);
+ assert.equal(verdictsModelOf(gen([QWEN], "code"), QWEN), QWEN);
+ assert.throws(() => verdictsModelOf(gen([QWEN], "local"), "claude-sonnet-5-5"), VerdictsRefusal);
+ // Every preset routes verdicts.
+ assert.equal(sanitizeGeneration({}).routes.verdicts, "local");
+});
+
+test("proposals: the unruled claims only, the bench's prompt, written to the sidecar — never a verdict on a claim; an unlisted model refused", async () => {
+ const s = await store();
+ const before = readFileSync(s.file, "utf8");
+ const { ask, asked } = stub((text) => ({ reason: `the window shows it: ${text.slice(0, 20)}`, verdict: text.includes("oven") ? "PARTLY" : "NOT_FOUND" }));
+ await assert.rejects(proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [], ask }), /models is empty/);
+ await assert.rejects(proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: ["claude-opus-5-5"], ask }), /has not cleared the verdict bench's bar/);
+ assert.equal(asked.length, 0);
+
+ const out = await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
+ assert.equal(out.status, "done");
+ assert.deepEqual(out.proposed, ["r02", "r04", "r07"]);
+ // The ruled claims are not asked; r08 has no citation.
+ assert.equal(asked.length, 3);
+ assert.ok(out.skipped.some((x) => x.claim === "r01" && x.reason === "ruled by the operator"));
+ assert.ok(out.skipped.some((x) => x.claim === "r08" && x.reason === "no citation"));
+ assert.ok(asked[0]!.user.startsWith("Report: "));
+ // report.json is untouched: not a byte.
+ assert.equal(readFileSync(s.file, "utf8"), before);
+ const f = (await readVerdictProposals(s.id, s.paths))!;
+ assert.deepEqual(f.proposals.r02, { verdict: "PARTLY", reason: f.proposals.r02!.reason, model: QWEN, promptVersion: PROMPT_VERSION, at: NOW.toISOString(), status: "proposed" });
+ assert.equal(waitingProposals(f).length, 3);
+ assert.equal(path.basename(verdictProposalsFile(s.paths, s.id)), "verdicts.proposed.json");
+});
+
+test("the sidecar survives makeCurrent; approve sets the verdict through patchArticle, reject leaves the claim; a reviewed proposal is never asked again", async () => {
+ const s = await store();
+ const { ask, asked } = stub(() => ({ reason: "shown", verdict: "CONTRADICTED" }));
+ await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
+ // A new iteration made current replaces report.json whole: the proposals stay.
+ const report = JSON.parse(readFileSync(s.file, "utf8"));
+ await createIteration(s.id, { kind: "sweep", model: QWEN, question: "What does the article get right?" }, s.paths, NOW);
+ await writeIterationFile(s.id, 1, "report.json", { ...report, title: "Retitled" }, s.paths);
+ await updateIteration(s.id, 1, { status: "done" }, s.paths, NOW);
+ await makeCurrent(s.id, 1, s.paths, NOW);
+ assert.equal(JSON.parse(readFileSync(s.file, "utf8")).title, "Retitled");
+ assert.equal(waitingProposals(await readVerdictProposals(s.id, s.paths)).length, 3);
+
+ // Approve r04: the claim's verdict is set, the proposal approved.
+ const ok = await reviewVerdictProposal({ article: s.id, claim: "r04", decision: "approve" }, s.paths, NOW);
+ assert.equal(ok.status, "approved");
+ const claimVerdict = (id: string) => JSON.parse(readFileSync(s.file, "utf8")).sections.flatMap((x: any) => x.claims).find((c: any) => c.id === id).verdict;
+ assert.equal(claimVerdict("r04"), "CONTRADICTED");
+ // Reject r07, with a note: the claim stays unruled.
+ const no = await reviewVerdictProposal({ article: s.id, claim: "r07", decision: "reject", note: "the window is too short" }, s.paths, NOW);
+ assert.deepEqual([no.status, no.note], ["rejected", "the window is too short"]);
+ assert.equal(claimVerdict("r07"), undefined);
+ // Twice: refused. No proposal: 404.
+ await assert.rejects(reviewVerdictProposal({ article: s.id, claim: "r04", decision: "approve" }, s.paths, NOW), /approved already/);
+ await assert.rejects(reviewVerdictProposal({ article: s.id, claim: "r01", decision: "approve" }, s.paths, NOW), (e: any) => e.status === 404);
+
+ // A rerun: r04 is ruled now and r07's proposal was rejected — only r02 is asked.
+ asked.length = 0;
+ const again = await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
+ assert.deepEqual(again.proposed, ["r02"]);
+ assert.equal(asked.length, 1);
+ assert.ok(again.skipped.some((x) => x.claim === "r07" && /rejected by the operator/.test(x.reason)));
+ // A reviewed proposal is never replaced by a record either.
+ const rec = await recordVerdictProposals(s.id, { r07: { verdict: "PARTLY", reason: "x", model: QWEN, promptVersion: PROMPT_VERSION, at: NOW.toISOString() } }, s.paths, NOW);
+ assert.deepEqual(rec, { written: [], kept: ["r07"] });
+
+ // A claim ruled by hand after its proposal: approving is refused, the verdict kept.
+ const r = JSON.parse(readFileSync(s.file, "utf8"));
+ for (const sec of r.sections) for (const c of sec.claims) if (c.id === "r02") c.verdict = "CORROBORATED";
+ await writeArticle(r, { paths: s.paths });
+ await assert.rejects(reviewVerdictProposal({ article: s.id, claim: "r02", decision: "approve" }, s.paths, NOW), /ruled already/);
+ assert.equal(claimVerdict("r02"), "CORROBORATED");
+});
+
+test("an API model: held to maxUsd before each call; the spend is the Meter's", async () => {
+ const s = await store();
+ const api = await startFakeAnthropic();
+ try {
+ for (let i = 0; i < 3; i++) api.push(toolTurn("answer", { reason: "shown", verdict: "PARTLY" }));
+ const out = await proposeVerdicts(
+ { article: s.id, model: "claude-opus-5-5", maxUsd: 0.015 },
+ { paths: s.paths, cuesOf, llm: { anthropic: { baseUrl: api.url, env: { ANTHROPIC_API_KEY: api.key } } }, allowed: ["claude-opus-5-5"] },
+ );
+ assert.equal(out.status, "capped");
+ assert.ok(out.proposed.length >= 1 && out.proposed.length < 3, `${out.proposed.length}`);
+ assert.ok(out.usd > 0 && out.usd <= 0.015);
+ assert.equal(api.requests.length, out.proposed.length);
+ } finally {
+ await api.close();
+ }
+});
diff --git a/common/lib/report/draft/tasks/verdicts.ts b/common/lib/report/draft/tasks/verdicts.ts
@@ -0,0 +1,196 @@
+// THE `verdicts` TASK (release 29 M8): proposed verdicts for a fact-check's
+// UNRULED claims, asked of a model that cleared the verdict bench's bar.
+//
+// It reads the article as the bench does — `unruledItemsOfReport` (the claims
+// with no verdict; each one's quotes and transcript window) — and asks each
+// claim with the bench's own prompt (`benchPrompt`, PROMPT_VERSION recorded on
+// every proposal), so a proposal is made exactly the way the model was
+// measured. One claim per call, sequential.
+//
+// What it writes: proposals, through the sidecar store
+// (../../verdictProposals.ts recordVerdictProposals — each as it lands).
+// What it NEVER writes: a claim's `verdict` (only the operator's review does,
+// through patchArticle). It REFUSES a model not in
+// `settings.generation.verdicts.models` (`allowed`: empty by default, so
+// nothing runs until the operator sets the bar and ticks a model). A claim the
+// operator has ruled is never asked; neither is one whose proposal the
+// operator has already approved or rejected.
+//
+// An API model is held to `maxUsd` (checked before each call against the
+// spend so far plus that call's estimate: past it the run ends `capped`).
+
+import { Meter, providerOf, StructuredAnswerError, structuredAnswer, type LlmConfig } from "../../../llm";
+import type { GenerationSettings } from "../../../generationSettings";
+import type { Paths } from "../../../paths";
+import type { CuesOf } from "../../convertShared";
+import { isVerdict } from "../../verdicts";
+import { readVerdictProposals, recordVerdictProposals, type NewProposal } from "../../verdictProposals";
+import {
+ benchPrompt,
+ benchReportsOf,
+ estimateCall,
+ LOCAL_PROMPT_CAP,
+ PROMPT_VERSION,
+ REASON_MAX,
+ unruledItemsOfReport,
+ VERDICT_ANSWER_SCHEMA,
+ type BenchAsk,
+ type BenchDropped,
+ type BenchSkipped,
+ type DateOf,
+ type TurnsOf,
+ type WindowMode,
+} from "../bench/index";
+
+export const VERDICTS_TASK = "verdicts" as const;
+const MAX_ANSWER_TOKENS = 1024;
+
+export class VerdictsRefusal extends Error {}
+
+/**
+ * The model proposals run on: the asked one, which must be in
+ * `verdicts.models`; else the first of them on the task's route (`api` or
+ * `local`). Refused when none is — nothing runs on a model the operator has
+ * not ticked.
+ */
+export function verdictsModelOf(gen: Pick<GenerationSettings, "verdicts" | "routes">, asked?: string): string {
+ const allowed = gen.verdicts.models;
+ if (!allowed.length) throw new VerdictsRefusal("no model has cleared the verdict bench's bar: settings.generation.verdicts.models is empty (tick a passing model on umtool's /tools/bench)");
+ if (asked) {
+ if (!allowed.includes(asked)) throw new VerdictsRefusal(`${asked} has not cleared the verdict bench's bar: settings.generation.verdicts.models is ${allowed.join(", ")}`);
+ return asked;
+ }
+ const route = gen.routes.verdicts;
+ if (route === "code") throw new VerdictsRefusal(`verdicts is routed to Claude Code (settings.generation.routes): name a model (${allowed.join(", ")})`);
+ const pick = allowed.find((m) => providerOf(m) === route);
+ if (!pick) throw new VerdictsRefusal(`no model in settings.generation.verdicts.models (${allowed.join(", ")}) runs on the ${route} route: name one, or route verdicts to ${route === "api" ? "local" : "api"}`);
+ return pick;
+}
+
+export type VerdictsInput = {
+ article: string;
+ model: string;
+ // Only these claims (default: every unruled one).
+ claims?: string[];
+ maxUsd?: number;
+ windowS?: number;
+ windowMode?: WindowMode;
+};
+
+export type VerdictsDeps = {
+ paths: Pick<Paths, "articlesDir" | "exportIndexDir">;
+ cuesOf: CuesOf;
+ turnsOf?: TurnsOf;
+ dateOf?: DateOf;
+ llm: LlmConfig;
+ // settings.generation.verdicts.models: the only models a proposal may run on.
+ allowed: readonly string[];
+ // The model, stubbed (tests; the bench's shape).
+ ask?: BenchAsk;
+ log?: (line: string) => void;
+ progress?: (done: number, total: number) => void;
+ signal?: AbortSignal;
+ now?: () => Date;
+ localCapTokens?: number;
+};
+
+export type VerdictsOutcome = {
+ status: "done" | "capped" | "cancelled";
+ article: string;
+ model: string;
+ promptVersion: string;
+ // The claims proposed for, in order.
+ proposed: string[];
+ failed: { claim: string; error: string }[];
+ skipped: BenchSkipped[];
+ dropped: BenchDropped[];
+ usd: number;
+ byModel: ReturnType<Meter["summary"]>["byModel"];
+ summary: string;
+};
+
+export async function proposeVerdicts(input: VerdictsInput, deps: VerdictsDeps): Promise<VerdictsOutcome> {
+ const { article, model } = input;
+ if (!deps.allowed.includes(model)) {
+ throw new VerdictsRefusal(
+ deps.allowed.length
+ ? `${model} has not cleared the verdict bench's bar: settings.generation.verdicts.models is ${deps.allowed.join(", ")}`
+ : "no model has cleared the verdict bench's bar: settings.generation.verdicts.models is empty",
+ );
+ }
+ const log = deps.log ?? (() => {});
+ const now = () => deps.now?.() ?? new Date();
+ const local = providerOf(model) === "local";
+ const localCap = deps.localCapTokens ?? LOCAL_PROMPT_CAP;
+ const [report] = await benchReportsOf(deps.paths, [article]);
+ const { items, skipped, dropped } = await unruledItemsOfReport(report!, {
+ cuesOf: deps.cuesOf,
+ ...(input.windowS !== undefined ? { windowS: input.windowS } : {}),
+ ...(input.windowMode ? { windowMode: input.windowMode } : {}),
+ ...(deps.turnsOf ? { turnsOf: deps.turnsOf } : {}),
+ ...(deps.dateOf ? { dateOf: deps.dateOf } : {}),
+ ...(input.claims?.length ? { claims: input.claims } : {}),
+ });
+ // A proposal the operator has reviewed is not asked again.
+ const prior = await readVerdictProposals(article, deps.paths);
+ const todo = items.filter((it) => {
+ const p = prior?.proposals[it.claim];
+ if (p && p.status !== "proposed") {
+ skipped.push({ key: it.key, report: article, claim: it.claim, reason: `its proposal was ${p.status} by the operator` });
+ return false;
+ }
+ return true;
+ });
+ log(`verdicts ${article} on ${model} (prompt version ${PROMPT_VERSION}): ${todo.length} unruled claim${todo.length === 1 ? "" : "s"} to propose for, ${skipped.length} skipped, ${dropped.length} citations dropped`);
+
+ const meter = new Meter();
+ const ask: BenchAsk =
+ deps.ask ??
+ (<T,>(system: string, user: string, schema: object, m: string) =>
+ structuredAnswer<T>({ llm: deps.llm, model: m, system, user, schema, meter, ...(deps.signal ? { signal: deps.signal } : {}), maxTokens: MAX_ANSWER_TOKENS }));
+ const proposed: string[] = [];
+ const failed: VerdictsOutcome["failed"] = [];
+ let status: VerdictsOutcome["status"] = "done";
+ let done = 0;
+ deps.progress?.(0, todo.length);
+ for (const item of todo) {
+ if (deps.signal?.aborted) {
+ status = "cancelled";
+ break;
+ }
+ if (!local && input.maxUsd !== undefined) {
+ const next = estimateCall({ ...item, verdict: "CORROBORATED" }, model, localCap).usd;
+ if (meter.usd + next > input.maxUsd) {
+ status = "capped";
+ log(`stopped at the cap: $${meter.usd.toFixed(4)} spent, the next call (~$${next.toFixed(4)}) would pass $${input.maxUsd}`);
+ break;
+ }
+ }
+ const prompt = benchPrompt(item, local ? { capTokens: localCap } : {});
+ try {
+ const ans = await ask<{ verdict?: unknown; reason?: unknown }>(prompt.system, prompt.user, VERDICT_ANSWER_SCHEMA, model);
+ const reason = typeof ans?.reason === "string" ? ans.reason.trim().slice(0, REASON_MAX) : "";
+ if (!isVerdict(ans?.verdict) || !reason) throw new StructuredAnswerError(`not a verdict and a reason: ${JSON.stringify(ans ?? null).slice(0, 120)}`);
+ const p: NewProposal = { verdict: ans.verdict, reason, model, promptVersion: PROMPT_VERSION, at: now().toISOString() };
+ const { written } = await recordVerdictProposals(article, { [item.claim]: p }, deps.paths, now());
+ if (written.length) proposed.push(item.claim);
+ log(`${item.claim}: ${ans.verdict} — ${reason}`);
+ } catch (err) {
+ if (deps.signal?.aborted) {
+ status = "cancelled";
+ break;
+ }
+ const error = (err as Error).message.slice(0, 300);
+ failed.push({ claim: item.claim, error });
+ log(`${item.claim}: no proposal (${error})`);
+ }
+ deps.progress?.(++done, todo.length);
+ }
+ const usd = Math.round(meter.usd * 1e6) / 1e6;
+ const summary =
+ `${proposed.length} verdict${proposed.length === 1 ? "" : "s"} proposed on ${model}` +
+ (failed.length ? `, ${failed.length} failed` : "") +
+ (status === "capped" ? ", stopped at the cap" : status === "cancelled" ? ", cancelled" : "") +
+ (usd ? ` · $${usd.toFixed(4)}` : "");
+ return { status, article, model, promptVersion: PROMPT_VERSION, proposed, failed, skipped, dropped, usd, byModel: meter.summary().byModel, summary };
+}
diff --git a/common/lib/report/schema.ts b/common/lib/report/schema.ts
@@ -205,7 +205,7 @@ export const CLAIM_FIELD_DOCS: FieldDocs<Claim> = {
id: `The claim's id (letters, digits, \`_ . : -\`; at most 64): its anchor on the report page. Unique among the report's section, claim and entry ids, and none of the page's own anchors (${RESERVED_ANCHOR_IDS.map((a) => `\`${a}\``).join(", ")}).`,
title: "A short headline for the claim (plain text, e.g. a phrase it turns on), shown above its text. Absent = the text alone.",
text: "The claim, as stated by the document under review (plain text).",
- verdict: `The ruling on the claim: ${VERDICTS.map((v) => `\`${v}\``).join(", ")} (what each means: "The verdicts", below). A fact-check's claim may leave it out (not yet ruled); a sweep's carries none.`,
+ verdict: `The ruling on the claim: ${VERDICTS.map((v) => `\`${v}\``).join(", ")} (what each means: "The verdicts", below). A fact-check's claim may leave it out (not yet ruled); a sweep's carries none. Only the operator sets it: a model's proposal is kept in the article's \`verdicts.proposed.json\`, never here.`,
gist: `The claim's finding in one line (plain text, at most ${CLAIM_GIST_MAX} characters), shown beside its title in the overview of what the check found. Absent = the title alone.`,
flag: `A short mark on the claim (plain text, one line, at most ${CLAIM_FLAG_MAX} characters), shown as a pill on its card: e.g. that the document gives no source for it. Absent = none.`,
sourceQuote:
diff --git a/common/lib/report/verdictProposals.ts b/common/lib/report/verdictProposals.ts
@@ -0,0 +1,218 @@
+// VERDICT PROPOSALS (release 29 M8) — a model's proposed verdicts for a
+// fact-check's unruled claims, kept in a SIDECAR beside the article:
+//
+// transcripts/reports/<id>/verdicts.proposed.json
+// { format: "archilyzer-verdict-proposals", version: 1, article,
+// proposals: { "<claim id>": { verdict, reason, model, promptVersion, at,
+// status: "proposed" | "approved" | "rejected",
+// note?, reviewedAt? } },
+// updatedAt }
+//
+// NEVER in report.json: the claim schema is strict, and `makeCurrent`
+// (./iterations.ts) replaces the article's report.json whole, so a proposal
+// kept there would vanish with the next iteration. The sidecar is written
+// only here, under the article store's lock (./registry.ts
+// withArticleStoreLock), whole and atomic, as the store's other per-article
+// files are; reads are lock-free.
+//
+// A proposal never sets a verdict. The operator's review does: approve →
+// `patchArticle` sets the claim's `verdict` to the proposal's (refused when
+// the claim was ruled meanwhile), then the proposal is marked approved;
+// reject → the proposal is marked rejected (the claim stays unruled). A
+// reviewed proposal is never replaced by a later run, and a ruled claim is
+// never proposed (draft/tasks/verdicts.ts reads the unruled claims only).
+//
+// SERVER-ONLY (node:fs).
+
+import path from "node:path";
+import { getPaths, type Paths } from "../paths";
+import { readJsonFile, writeJsonAtomic } from "../jsonFile-server";
+import { ArticleRegistryError, articleDir, patchArticle, withArticleStoreLock } from "./registry";
+import type { Section } from "./schema";
+import { isVerdict, type Verdict } from "./verdicts";
+
+export const VERDICT_PROPOSALS_FILE = "verdicts.proposed.json";
+export const VERDICT_PROPOSALS_FORMAT = "archilyzer-verdict-proposals";
+export const VERDICT_PROPOSALS_VERSION = 1;
+export const PROPOSAL_STATUSES = ["proposed", "approved", "rejected"] as const;
+export type ProposalStatus = (typeof PROPOSAL_STATUSES)[number];
+export const PROPOSAL_NOTE_MAX = 500;
+export const PROPOSAL_REASON_MAX = 300;
+
+export type VerdictProposal = {
+ verdict: Verdict;
+ reason: string;
+ model: string;
+ promptVersion: string;
+ at: string;
+ status: ProposalStatus;
+ note?: string;
+ reviewedAt?: string;
+};
+
+export type VerdictProposalsFile = {
+ format: typeof VERDICT_PROPOSALS_FORMAT;
+ version: typeof VERDICT_PROPOSALS_VERSION;
+ article: string;
+ proposals: Record<string, VerdictProposal>;
+ updatedAt: string;
+};
+
+// A proposal as a run makes it: everything but its status.
+export type NewProposal = Omit<VerdictProposal, "status" | "note" | "reviewedAt">;
+
+type StorePaths = Pick<Paths, "articlesDir" | "exportIndexDir">;
+
+export class VerdictProposalsError extends Error {
+ constructor(
+ message: string,
+ readonly status = 400,
+ ) {
+ super(message);
+ this.name = "VerdictProposalsError";
+ }
+}
+
+const CLAIM_ID_RE = /^[A-Za-z0-9._:-]{1,64}$/;
+
+export function verdictProposalsFile(paths: StorePaths, article: string): string {
+ return path.join(articleDir(paths, article), VERDICT_PROPOSALS_FILE);
+}
+
+function clean(raw: unknown, article: string): VerdictProposalsFile {
+ const r = (raw ?? {}) as Record<string, unknown>;
+ const proposals: Record<string, VerdictProposal> = {};
+ const given = r.proposals && typeof r.proposals === "object" && !Array.isArray(r.proposals) ? (r.proposals as Record<string, unknown>) : {};
+ for (const [claim, v] of Object.entries(given)) {
+ const p = v as Record<string, unknown> | null;
+ if (!CLAIM_ID_RE.test(claim) || !p || !isVerdict(p.verdict) || !(PROPOSAL_STATUSES as readonly unknown[]).includes(p.status)) continue;
+ proposals[claim] = {
+ verdict: p.verdict,
+ reason: typeof p.reason === "string" ? p.reason.slice(0, PROPOSAL_REASON_MAX) : "",
+ model: typeof p.model === "string" ? p.model : "",
+ promptVersion: typeof p.promptVersion === "string" ? p.promptVersion : "",
+ at: typeof p.at === "string" ? p.at : "",
+ status: p.status as ProposalStatus,
+ ...(typeof p.note === "string" && p.note ? { note: p.note.slice(0, PROPOSAL_NOTE_MAX) } : {}),
+ ...(typeof p.reviewedAt === "string" ? { reviewedAt: p.reviewedAt } : {}),
+ };
+ }
+ return {
+ format: VERDICT_PROPOSALS_FORMAT,
+ version: VERDICT_PROPOSALS_VERSION,
+ article,
+ proposals,
+ updatedAt: typeof r.updatedAt === "string" ? r.updatedAt : "",
+ };
+}
+
+/**
+ * An article's proposals: null when it has none; a file that does not read as
+ * one is an error (409) — never taken for empty, so no write replaces it.
+ */
+export async function readVerdictProposals(article: string, paths: StorePaths = getPaths()): Promise<VerdictProposalsFile | null> {
+ const read = await readJsonFile(verdictProposalsFile(paths, article));
+ if (!read.ok) {
+ if (read.reason === "absent") return null;
+ throw new VerdictProposalsError(`reports/${article}/${VERDICT_PROPOSALS_FILE} is ${read.reason}`, 409);
+ }
+ const v = read.value as { format?: unknown };
+ if (!v || v.format !== VERDICT_PROPOSALS_FORMAT) throw new VerdictProposalsError(`reports/${article}/${VERDICT_PROPOSALS_FILE} is not an ${VERDICT_PROPOSALS_FORMAT} file`, 409);
+ return clean(read.value, article);
+}
+
+/** The proposals still waiting on the operator (status `proposed`). */
+export function waitingProposals(f: VerdictProposalsFile | null): [string, VerdictProposal][] {
+ return Object.entries(f?.proposals ?? {}).filter(([, p]) => p.status === "proposed");
+}
+
+/**
+ * Record a run's proposals, under the store's lock. A proposal the operator
+ * has reviewed (approved or rejected) is kept as it is; a waiting one is
+ * replaced by the newer. Answers which claims were written and which kept.
+ */
+export async function recordVerdictProposals(
+ article: string,
+ made: Record<string, NewProposal>,
+ paths: StorePaths = getPaths(),
+ now: Date = new Date(),
+): Promise<{ written: string[]; kept: string[] }> {
+ return withArticleStoreLock(async () => {
+ const cur = (await readVerdictProposals(article, paths)) ?? clean(null, article);
+ const written: string[] = [];
+ const kept: string[] = [];
+ for (const [claim, p] of Object.entries(made)) {
+ if (!CLAIM_ID_RE.test(claim)) throw new VerdictProposalsError(`"${claim}" is not a claim id`);
+ if (!isVerdict(p.verdict)) throw new VerdictProposalsError(`${claim}: "${String(p.verdict)}" is not a verdict`);
+ const was = cur.proposals[claim];
+ if (was && was.status !== "proposed") {
+ kept.push(claim);
+ continue;
+ }
+ cur.proposals[claim] = { verdict: p.verdict, reason: p.reason.slice(0, PROPOSAL_REASON_MAX), model: p.model, promptVersion: p.promptVersion, at: p.at, status: "proposed" };
+ written.push(claim);
+ }
+ if (written.length) {
+ cur.updatedAt = now.toISOString();
+ await writeJsonAtomic(verdictProposalsFile(paths, article), cur, { mkdir: true });
+ }
+ return { written, kept };
+ }, paths);
+}
+
+export type ProposalReview = { article: string; claim: string; decision: "approve" | "reject"; note?: string };
+
+/**
+ * The operator's review of one waiting proposal. Approve: the claim's
+ * `verdict` set to the proposal's through `patchArticle` (refused when the
+ * claim has been ruled since, or is gone), then the proposal marked approved.
+ * Reject: the proposal marked rejected; the claim is untouched. Answers the
+ * proposal as it now is.
+ */
+export async function reviewVerdictProposal(r: ProposalReview, paths: StorePaths = getPaths(), now: Date = new Date()): Promise<VerdictProposal & { claim: string }> {
+ if (r.decision !== "approve" && r.decision !== "reject") throw new VerdictProposalsError('"decision" is "approve" or "reject"');
+ const note = typeof r.note === "string" ? r.note.trim().slice(0, PROPOSAL_NOTE_MAX) : "";
+ const f = await readVerdictProposals(r.article, paths);
+ const p = f?.proposals[r.claim];
+ if (!p) throw new VerdictProposalsError(`${r.article} has no proposal for claim ${r.claim}`, 404);
+ if (p.status !== "proposed") throw new VerdictProposalsError(`${r.article}/${r.claim}'s proposal was ${p.status} already`, 409);
+ if (r.decision === "approve") {
+ const patched = await patchArticle(
+ r.article,
+ (report) => {
+ let found = false;
+ const sections = report.sections.map((s: Section) => ({
+ ...s,
+ ...(s.claims
+ ? {
+ claims: s.claims.map((c) => {
+ if (c.id !== r.claim) return c;
+ found = true;
+ if (isVerdict(c.verdict)) throw new ArticleRegistryError(`${r.article}/${r.claim} is ruled already (${c.verdict})`);
+ return { ...c, verdict: p.verdict };
+ }),
+ }
+ : {}),
+ }));
+ if (!found) throw new ArticleRegistryError(`${r.article} has no claim ${r.claim}`);
+ return { sections };
+ },
+ paths,
+ );
+ if (!patched) throw new VerdictProposalsError(`${r.article} has no report.json`, 404);
+ }
+ return withArticleStoreLock(async () => {
+ const cur = (await readVerdictProposals(r.article, paths)) ?? clean(null, r.article);
+ const was = cur.proposals[r.claim] ?? p;
+ const next: VerdictProposal = {
+ ...was,
+ status: r.decision === "approve" ? "approved" : "rejected",
+ reviewedAt: now.toISOString(),
+ ...(note ? { note } : {}),
+ };
+ cur.proposals[r.claim] = next;
+ cur.updatedAt = now.toISOString();
+ await writeJsonAtomic(verdictProposalsFile(paths, r.article), cur, { mkdir: true });
+ return { ...next, claim: r.claim };
+ }, paths);
+}
diff --git a/common/testing/verdicts/reviewStub.ts b/common/testing/verdicts/reviewStub.ts
@@ -0,0 +1,30 @@
+// `verdict-review` for umtool's e2e editor stub (release 29 M8): the REAL
+// controller (controller/reportVerdicts.ts reviewProposal) over the fixture's
+// article store — what umtool/e2e/fixtures/editor-stub.mjs runs for each
+// `POST /api/ops/verdict-review`. Test-only; synthetic.
+//
+// tsx common/testing/verdicts/reviewStub.ts --articles <ARTICLES_DIR>
+// (the body on stdin)
+//
+// Prints one JSON line: {ok: true, proposal} or {ok: false, status, error}.
+
+import path from "node:path";
+import { reviewProposal } from "../../controller/reportVerdicts";
+import type { Paths } from "../../lib/paths";
+
+async function main() {
+ const at = process.argv.indexOf("--articles");
+ const articles = at >= 0 ? process.argv[at + 1] : "";
+ if (!articles) throw Object.assign(new Error("--articles <dir> is required"), { status: 500 });
+ let raw = "";
+ for await (const chunk of process.stdin) raw += chunk;
+ const body = JSON.parse(raw || "{}") as Record<string, unknown>;
+ const paths = { articlesDir: articles, exportIndexDir: path.join(path.dirname(articles), ".export-index") } as Paths;
+ const proposal = await reviewProposal(body, { paths });
+ process.stdout.write(`${JSON.stringify({ ok: true, proposal })}\n`);
+}
+
+main().catch((e: Error & { status?: number }) => {
+ const status = typeof e.status === "number" ? e.status : e.name === "ArticleRegistryError" ? 409 : 400;
+ process.stdout.write(`${JSON.stringify({ ok: false, status, error: e.message })}\n`);
+});
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## [Unreleased]
+- **A model can propose verdicts for a fact-check's unruled claims, for you to approve or reject.** `pnpm ops report-draft --json '{"task":"verdicts","article":"<id>"}'` asks each claim with no verdict, with the verdict bench's own prompt, and keeps each proposed verdict, its reason, the model and the prompt version in `verdicts.proposed.json` beside the article, never in `report.json`. It runs only on a model you ticked on the verdict bench (`settings.generation.verdicts.models`, empty until you do), and never sets a verdict itself. umtool's Inbox shows "N verdicts proposed" under Review; **Review verdicts** opens the article, where each proposal has **Approve** (the claim gets that verdict) and **Reject** (the claim stays unruled), with an optional note. A claim you have ruled, or whose proposal you have reviewed, is not asked again. `pnpm ops verdict-review` does the same from the command line. Needs a restart of the editor and umtool.
- **The verdict bench asks to the operator's standard, and says which prompt it asked with.** What each verdict means is written once (`common/lib/report/verdicts.mjs`) and read by the bench's prompt, REPORT.md and umtool's bench page: CORROBORATED when the substance of the claim is shown by the cited words (framing, emphasis or a detail the transcript does not show does not demote it), PARTLY only when a part is shown overstated or wrong, and when in doubt between the two, CORROBORATED. The model now writes its reason before its verdict, and sees the report's title, the claim's section, and each cited line's speaker and recording date. Each run records its prompt version and a hash of its items; a run made before this is version 1, and a run is never resumed under another version. Needs a restart of the editor and umtool.
- **`archilyzer reports bench-verdicts` takes `--items-from <run>`, `--window-mode seconds|turn` and a stratified `--limit`.** `--items-from vb-r28` asks the same items again (for example a local model on a new prompt, at no cost). `--window-mode turn` shows the cited speaker's turn instead of a fixed number of seconds either side, bounded by `--window`. `--limit` keeps every verdict the operator ruled, in proportion. A re-run of a run asks only the models it names, so a local-only re-run never asks a paid model again. A citation that gives no transcript is listed with its reason instead of being left out silently. `pnpm ops bench-verdicts` takes the same keys (`itemsFrom`, `windowMode`, `limit`).
- **umtool's verdict bench compares runs and takes your marks.** `/tools/bench` shows each run's prompt version and items hash, and **compare with** lists the runs over the same items: each model's agreement in both and every claim whose answer changed. Each disagreement has **Right** and **Wrong** (was the model right?), kept beside the run, and the not-CORROBORATED precision and recall beside the bar are shown as ruled and with your marks, so the bar can be set from what you marked. "What the verdicts mean" lists the definitions.
diff --git a/editor/app/api/ops/_verdicts.test.ts b/editor/app/api/ops/_verdicts.test.ts
@@ -0,0 +1,103 @@
+import { after, before, test } from "node:test";
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { CHANNELS } from "yt-dlp-transcript-common/testing/draft/corpus.mjs";
+import { jsonReply, startFakeOllama, type FakeOllama } from "yt-dlp-transcript-common/testing/llm/fakeOllama.mjs";
+import { enqueueReportDraft, parseReportDraftBody, type ReportDraftDeps } from "yt-dlp-transcript-common/controller/reportDraft";
+import { parseVerdictReviewBody, reviewProposal } from "yt-dlp-transcript-common/controller/reportVerdicts";
+import { sanitizeGeneration, type GenerationSettings } from "yt-dlp-transcript-common/lib/generationSettings";
+import { getRegistry } from "yt-dlp-transcript-common/jobs/registry";
+import { readVerdictProposals } from "yt-dlp-transcript-common/lib/report/verdictProposals";
+import { articleFile } from "yt-dlp-transcript-common/lib/report/registry";
+import type { Paths } from "yt-dlp-transcript-common/lib/paths";
+
+// Run with:
+// pnpm -C editor exec tsx --test "app/api/ops/_verdicts.test.ts"
+//
+// Verdict proposals (release 29 M8) end to end in this process: report-draft
+// {task: "verdicts"} — the controller the route adapts — over the synthetic
+// fact-check (r02, r04, r07 unruled) in a temp article store, the synthetic
+// recordings' cues on disk and the fake ollama; then verdict-review's
+// controller (the editor's /api/ops/verdict-review adapts it).
+
+const RULED = path.join(path.dirname(new URL(import.meta.url).pathname), "../../../../common/testing/draft/reports/ruled.report.json");
+let tmp: string;
+let ol: FakeOllama;
+let paths: Paths;
+let gen: GenerationSettings;
+let id: string;
+
+before(async () => {
+ tmp = await mkdtemp(path.join(os.tmpdir(), "verdict-proposals-"));
+ ol = await startFakeOllama();
+ const report = JSON.parse(await readFile(RULED, "utf8"));
+ for (const s of report.sections) for (const c of s.claims) if (["r02", "r04", "r07"].includes(c.id)) delete c.verdict;
+ id = report.id;
+ await mkdir(path.join(tmp, "reports", id), { recursive: true });
+ await writeFile(path.join(tmp, "reports", id, "report.json"), JSON.stringify(report));
+ for (const ch of CHANNELS) {
+ for (const r of ch.records) {
+ const rec = path.join(tmp, "channels", ch.slug, "data", r.id);
+ await mkdir(rec, { recursive: true });
+ await writeFile(path.join(rec, "transcript.cues.json"), JSON.stringify({ cues: r.cues }));
+ }
+ }
+ paths = {
+ jobsDir: path.join(tmp, ".jobs"),
+ articlesDir: path.join(tmp, "reports"),
+ exportIndexDir: path.join(tmp, ".export-index"),
+ channelsDir: path.join(tmp, "channels"),
+ generationUsageFile: path.join(tmp, ".generation", "usage.jsonl"),
+ ollamaUrl: ol.url,
+ } as Paths;
+ gen = sanitizeGeneration({});
+});
+
+after(async () => {
+ await ol.close();
+ await rm(tmp, { recursive: true, force: true });
+});
+
+const deps = (g: Partial<GenerationSettings> = {}): ReportDraftDeps =>
+ ({ paths, settings: () => ({ generation: { ...gen, ...g } }), corpusTools: async () => { throw new Error("no corpus tools for verdicts"); } }) as unknown as ReportDraftDeps;
+
+test("the body: a verdicts job takes claims, never an iteration; claims are a verdicts job's", () => {
+ assert.deepEqual(parseReportDraftBody({ task: "verdicts", article: "a", claims: ["c1", "c2"] }), { task: "verdicts", article: "a", claims: ["c1", "c2"] });
+ assert.throws(() => parseReportDraftBody({ task: "verdicts", article: "a", iteration: 2 }), /takes no iteration/);
+ assert.throws(() => parseReportDraftBody({ task: "sweep", article: "a", question: "q", channels: ["c"], claims: ["c1"] }), /"claims" is a verdicts job's/);
+ assert.throws(() => parseVerdictReviewBody({ article: "a", claim: "c1", decision: "maybe" }), /"approve" or "reject"/);
+});
+
+test("refused until a model clears the bar; then a report-draft job on draft:local writes proposals, never a verdict; approve sets it", async () => {
+ const none = await enqueueReportDraft({ task: "verdicts", article: id }, deps());
+ assert.equal(none.result.ok, false);
+ assert.match((none.result as { error: string }).error, /models is empty/);
+ const unlisted = await enqueueReportDraft({ task: "verdicts", article: id, model: "qwen3:8b" }, deps({ verdicts: { bar: gen.verdicts.bar, models: ["claude-opus-5-5"] } }));
+ assert.match((unlisted.result as { error: string }).error, /has not cleared the verdict bench's bar/);
+
+ const before = await readFile(articleFile(paths, id), "utf8");
+ for (let i = 0; i < 3; i++) ol.push(jsonReply({ reason: "the window shows the opposite", verdict: "CONTRADICTED" }));
+ const out = await enqueueReportDraft({ task: "verdicts", article: id }, deps({ verdicts: { bar: gen.verdicts.bar, models: ["qwen3:8b"] } }));
+ assert.ok(out.result.ok, (out.result as { error?: string }).error);
+ assert.equal("iteration" in out ? out.iteration : null, 0);
+ const job = getRegistry().get(out.result.jobId)!;
+ assert.equal(job.kind, "report-draft");
+ assert.equal(job.queueKey, "draft:local");
+ void out.result.stream.cancel();
+ const done = await out.result.done;
+ const log = await readFile(job.logPath, "utf8");
+ assert.equal(done.status, "done", log);
+ assert.match(log, /@@report-draft \{"article":"synth-ruled","iteration":0,"task":"verdicts","status":"done"/);
+ assert.match(log, /unloaded qwen3:8b from ollama/);
+ assert.deepEqual(ol.unloads.at(-1), "qwen3:8b");
+ assert.equal(await readFile(articleFile(paths, id), "utf8"), before, "report.json untouched");
+ const f = (await readVerdictProposals(id, paths))!;
+ assert.deepEqual(Object.keys(f.proposals).sort(), ["r02", "r04", "r07"]);
+
+ const p = await reviewProposal({ article: id, claim: "r04", decision: "approve" }, { paths });
+ assert.equal(p.status, "approved");
+ const after = JSON.parse(await readFile(articleFile(paths, id), "utf8"));
+ assert.equal(after.sections.flatMap((s: any) => s.claims).find((c: any) => c.id === "r04").verdict, "CONTRADICTED");
+});
diff --git a/editor/app/api/ops/verdict-review/route.ts b/editor/app/api/ops/verdict-review/route.ts
@@ -0,0 +1,34 @@
+import { NextResponse } from "next/server";
+import { getPaths } from "yt-dlp-transcript-common/lib/paths";
+import { VERDICT_REVIEW_BODY_KEYS, reviewProposal } from "yt-dlp-transcript-common/controller/reportVerdicts";
+import { VerdictProposalsError } from "yt-dlp-transcript-common/lib/report/verdictProposals";
+import { ArticleRegistryError } from "yt-dlp-transcript-common/lib/report/registry";
+import { opsFail, ops } from "../_lib";
+
+export const dynamic = "force-dynamic";
+
+// POST { article, claim, decision: "approve" | "reject", note? }
+// -> { ok: true, proposal: {claim, verdict, reason, model, promptVersion, at, status, note?, reviewedAt} }
+//
+// The operator's review of one verdict PROPOSAL (release 29 M8): a model's
+// proposed verdict for an unruled fact-check claim, kept in
+// `reports/<article>/verdicts.proposed.json` (never report.json). Approve
+// sets the claim's `verdict` to the proposal's through the registry's
+// patchArticle, then marks the proposal approved; reject marks it rejected
+// and leaves the claim unruled. Synchronous. 404 no such proposal; 409 one
+// reviewed already, a claim ruled meanwhile, or a sidecar that does not read.
+//
+// AN ADAPTER: the rules are the controller's (controller/reportVerdicts.ts,
+// lib/report/verdictProposals.ts).
+export async function POST(request: Request) {
+ return ops(request, VERDICT_REVIEW_BODY_KEYS, async (body) => {
+ try {
+ const proposal = await reviewProposal(body, { paths: getPaths() });
+ return NextResponse.json({ ok: true, proposal });
+ } catch (e) {
+ if (e instanceof VerdictProposalsError) return opsFail(e.message, e.status);
+ if (e instanceof ArticleRegistryError) return opsFail(e.message, 409);
+ throw e;
+ }
+ });
+}
diff --git a/mcp/src/generation.test.ts b/mcp/src/generation.test.ts
@@ -141,6 +141,8 @@ test("generation_policy sets a preset as its routes, and one route alone", async
flips: "api",
threads: "api",
youtube: "api",
+ // Verdict proposals (release 29 M8): on a model in verdicts.models only.
+ verdicts: "api",
},
},
},
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -9524,3 +9524,19 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
- **The Wayback CDX client** (`lib/waybackClient.ts`) is an `ArchiveOrgClient` instance of its own (gap, UA,
back-off); `parseCdxJson` reads the header row's columns, and `[]`, an empty body or a header alone are none.
+## Release 29 M8: verdict proposals (verified 2026-10-15, branch `r29/verdicts`)
+
+- **The sidecar** is `transcripts/reports/<id>/verdicts.proposed.json` (`archilyzer-verdict-proposals` v1,
+ `{article, proposals: {<claim id>: {verdict, reason, model, promptVersion, at, status: proposed | approved |
+ rejected, note?, reviewedAt?}}, updatedAt}`). ONE writer: `common/lib/report/verdictProposals.ts`
+ (`recordVerdictProposals`, `reviewVerdictProposal`) under `withArticleStoreLock`; reads lock-free
+ (`readVerdictProposals`: null when absent, a `VerdictProposalsError` 409 when it does not read). It is never in
+ `report.json`; a claim's `verdict` is set only by the operator's approve (`patchArticle`).
+- **`verdicts` is a GenerationTask with no iteration and no step**: `report-draft {"task": "verdicts"}` is its own job
+ (`controller/reportVerdicts.ts`), answering `iteration: 0`; `runReportDraft` refuses it like refresh and triage. It
+ runs only on a model in `settings.generation.verdicts.models` (`verdictsModelOf`; the job re-reads the list at its
+ turn). Its usage rows are task `verdicts`, iteration 0.
+- **umtool's `verdict-proposed`** rows are one per waiting proposal on a still-unruled claim of a store fact-check
+ (`umtool/lib/articles/verdicts.ts` `readArticleProposals`), group Review, action "Review verdicts" →
+ `/articles/<id>?tab=article`, whose region `verdict proposals` approves or rejects through `/api/articles/verdicts` →
+ `POST /api/ops/verdict-review`.
diff --git a/plans/release-29.md b/plans/release-29.md
@@ -372,6 +372,79 @@ Gates (from the worktree root):
Not done: the editor has no UI for find-copy (ops and the research door only — the brief named none); prepare's
`warnings` are in the index and the job log, not on the editor's Reports tab.
+### M8, as shipped (code) (2026-10-15, lane B, `r29/verdicts`)
+
+Proposed verdicts: a model that cleared the bench's bar proposes a verdict for each unruled claim of a fact-check; the
+operator approves or rejects each. Built and tested over the fakes and an injected `ask` only; **nothing runs live
+until the operator ticks a model** (`settings.generation.verdicts.models` is empty by default) — after V2 and the bar.
+
+- **The sidecar** `transcripts/reports/<id>/verdicts.proposed.json` (`archilyzer-verdict-proposals` v1:
+ `proposals: {<claim>: {verdict, reason, model, promptVersion, at, status: proposed|approved|rejected, note?,
+ reviewedAt?}}`), written only by `common/lib/report/verdictProposals.ts` under the article store's lock, whole and
+ atomic; a file that does not read is a 409, never taken for empty. Never in `report.json`, so `makeCurrent` cannot
+ drop it (tested); compose, the homepage and the history read `report.json` only. `recordVerdictProposals` replaces a
+ waiting proposal and keeps a reviewed one; `reviewVerdictProposal` approve → `patchArticle` sets the claim's
+ `verdict` (refused when the claim was ruled meanwhile, or is gone), then the proposal `approved`; reject → `rejected`,
+ the claim untouched.
+- **The task** `common/lib/report/draft/tasks/verdicts.ts` `proposeVerdicts`: `unruledItemsOfReport` (V1's reading of
+ the claims with no verdict; a ruled claim is skipped "ruled by the operator") and `benchPrompt` (PROMPT_VERSION on
+ every proposal), one claim per call; REFUSES a model not in `allowed` (`settings.generation.verdicts.models`, read
+ again at the job's turn); never writes `verdict`; skips a claim whose proposal the operator approved or rejected; an
+ API model held to `maxUsd` before each call. `verdictsModelOf`: the asked model (must be listed), else the first
+ listed model on the `verdicts` route (`api`/`local`); `code` needs a model named.
+- **Generation:** `verdicts` in `GENERATION_TASKS` and every preset (`code`, `balanced` local, `api`, `local`);
+ `report-draft {"task": "verdicts", "article", "claims"?, "model"?, "maxUsd"?}` dispatched in `reportDraft.ts` beside
+ refresh/triage to `controller/reportVerdicts.ts` `enqueueVerdictProposals` — one `report-draft` job (no iteration:
+ the answer's `iteration` is 0) on `draft:local` (the GPU arbiter's gated fetch, ollama unloaded at the end) or
+ `draft:api` (the revision cap, the daily cap at the ask and the turn, ledger rows task `verdicts`); the cues the
+ local corpus's (`diskCuesOf`, as the bench); the log ends `@@report-draft {…, verdicts: {proposed, failed, skipped,
+ promptVersion}}`. The new body key `claims` (a verdicts job's only).
+- **Review:** `pnpm ops verdict-review {article, claim, decision: approve|reject, note?}` → `POST
+ /api/ops/verdict-review` (synchronous; 404 no proposal, 409 reviewed already / ruled meanwhile / a sidecar that does
+ not read). The ops ACTIONS row and help, COMMANDS.md, SETTINGS.md (`routes.verdicts`), settings.json.example,
+ REPORT.md (the sidecar, the claim's `verdict` doc) regenerated.
+- **umtool:** the Inbox's `verdict-proposed` kind (Review, action **Review verdicts** → the article's `?tab=article`;
+ `lib/inbox/verdicts.mjs` after `drafts-unreviewed`'s pattern, one row per proposal, the card "N verdicts proposed",
+ "by <model> · prompt v<n>"; `lib/inbox.ts` reads each store fact-check's waiting proposals on still-unruled claims —
+ gone once approved, rejected, or ruled by hand); the article tab's region `verdict proposals`
+ (`components/articles/VerdictProposals.tsx`: each claim with its section, the proposed verdict as plain mono text —
+ no verdict colour, it is not a ruling — the reason, model and prompt version, a note box `note on <claim>`, **Approve**
+ / **Reject** outlines; `data-proposal`, `data-proposed`; status "Approved: c2 is PARTLY." / "Rejected: c3 stays
+ unruled.") through `/api/articles/verdicts` → the editor's verdict-review. The e2e stub runs the REAL review over the
+ fixture's store (`common/testing/verdicts/reviewStub.ts`). Docs: `umtool/docs/inbox.md`, `tools.md`.
+
+| Commit | What |
+| --- | --- |
+| `784e421f` | common, editor: the sidecar store, the task, the generation wiring, the controller, `verdict-review` (route + ops row); `tasks/verdicts.test.ts` (4), `_verdicts.test.ts` (2), mcp `generation.test.ts` (the api preset routes verdicts); COMMANDS.md, SETTINGS.md, REPORT.md, settings.json.example |
+| `62ed2add` | umtool: the inbox kind, the proposals panel, `/api/articles/verdicts`, the stub route, `verdict-proposed.spec`, `inbox/verdicts.test.mjs` |
+| `a14f4fc6` | docs: umtool's inbox and tools |
+| (this commit) | this record, FACTS, CHANGELOG |
+
+Gates (at `a14f4fc6`):
+
+| Gate | Result |
+| --- | --- |
+| repo-wide `tsc --noEmit` | clean at each commit |
+| common | 4202 tests, 4201 pass, 1 fail — `controller/transcribeFile.test.ts` "with no workerId the pool's highest-priority local worker…" (timing under the full suite's load; that file 24/24 three times alone; not touched by this lane) (+4: `tasks/verdicts.test.ts` — the model rule; the unruled claims only, report.json byte-identical, unlisted models refused; the sidecar survives makeCurrent, approve through patchArticle, reject, twice refused, a rerun skips ruled and reviewed claims, a reviewed proposal never replaced, a claim ruled by hand refuses approve; an API model capped) |
+| editor unit | **306/306** (+2 `_verdicts.test.ts`: the body; refused until a model clears the bar, then a job on draft:local writing proposals and never a verdict, ollama unloaded, approve sets it) |
+| mcp | 370/370 |
+| `test:scripts` | 1015 tests, 1012 pass, 3 skipped, 0 fail (+1 `inbox/verdicts.test.mjs`) |
+| `pnpm --filter umtool test` | 33/33 |
+| `docs cli|files|env --check`, `settings example --check` | clean |
+| capped umtool `next build` (the corpus linked, heavy slot, `MemoryMax=5G`) | exit 0; compiled 16.5 s, 55.7 s wall, 1.54 GB max RSS; the link removed; `/api/articles/verdicts`, `/api/bench/marks`, `/tools/bench`, `/api/browse/decisions` traces 1,019–1,088 files, none from `transcripts/`, `.e2e-song` or `.env*` |
+| capped editor `next build` (heavy slot, `MemoryMax=5G`) | exit 0; compiled 21.2 s, 1:31 wall, 2.52 GB |
+| umtool e2e `verdict-proposed.spec` (+ `article-notes.spec`, foreground, queued) | run 1: 9 passed, 1 failed — the panel unmounted with its status when the last proposal went (fixed: mounted while the article has a proposals file); run 2: **1/1**, 40.6 s |
+
+Found and left:
+- **Enabling is the operator's**: tick a model on `/tools/bench` after V2; then `pnpm ops report-draft --json
+ '{"task":"verdicts","article":"<a fact-check>"}'` (or the MCP's `generate`). No umtool button starts a run yet (the
+ brief named none); the Inbox and the article tab are the review side.
+- **The window** a proposal reads is the bench's default (±60 s, `seconds`); a bar set on a `turn` run would want the
+ proposals in that mode too — `VerdictsInput.windowMode` exists, nothing sets it from settings yet.
+- **Two lock windows on approve**: the verdict is set by `patchArticle`, then the proposal marked; a crash between
+ leaves a `proposed` entry on a ruled claim, which nothing shows (the inbox and the tab list unruled claims only) and
+ a rerun skips.
+
## Not in this release
Auto-posting to X/Bluesky/YouTube (text only); any umtool restructuring; the "en track → 0 cues" bug (closed in r20).
diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs
@@ -117,6 +117,8 @@
// pnpm ops report-draft --json '{"task":"refresh","article":"demo-article","dryRun":true}'
// pnpm ops report-draft --json '{"task":"triage","article":"co-host-watch","question":"Who co-hosts?","channels":["demo-channel"],"terms":"co-host"}' --wait
// pnpm ops bench-verdicts --json '{"models":["claude-sonnet-5-5","qwen3:8b"],"maxUsd":5}' --wait
+// pnpm ops report-draft --json '{"task":"verdicts","article":"demo-factcheck"}' --wait
+// pnpm ops verdict-review --json '{"article":"demo-factcheck","claim":"c04","decision":"approve"}'
// pnpm ops report-schedule --json '{"action":"create","shape":"series","topic":"Co-host updates","channels":["demo-channel"],"cadence":"weekly mon 06:00","dryRun":true}'
// 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-schedule --json '{"action":"list"}'
@@ -434,6 +436,10 @@ const ACTIONS = [
// job — refreshed from their jobs, then approved (run through the editor) or
// rejected ({article, iteration, ids?, approve?, note?}). Synchronous.
"research-approve",
+ // VERDICT PROPOSALS (release 29 M8): the operator's review of one model's
+ // proposed verdict ({article, claim, decision: approve | reject, note?}):
+ // approve sets the claim's verdict through the registry. Synchronous.
+ "verdict-review",
// THE VERDICT BENCH (release 28 M7): ruled fact-check claims asked of each
// model, one per call ({models, run?, reports?, window?, windowMode?,
// maxUsd?, limit?, itemsFrom?}),
@@ -1338,6 +1344,19 @@ export function usage() {
' "dryRun": true answers {plan} and writes nothing. Its log ends with',
" @@report-draft {…, refresh: {status, newIds, changed, drifted, deleted,",
" summary}}.",
+ ' "verdicts" proposes a verdict for each UNRULED claim of a fact-check',
+ ' ("article"; "claims"? only those; "model"?, "maxUsd"?): the verdict bench\'s',
+ " prompt, one claim per call, on a model in settings.generation.verdicts.models",
+ " only (refused otherwise; none named: the first of them on the verdicts",
+ " route). No iteration (iteration 0): the proposals go to the article's",
+ " verdicts.proposed.json, never report.json; a claim the operator ruled, or",
+ " whose proposal was reviewed, is not asked. Its log ends with",
+ " @@report-draft {…, verdicts: {proposed, failed, skipped, promptVersion}}.",
+ "",
+ 'verdict-review settles one verdict proposal: {"article", "claim",',
+ ' "decision": "approve" | "reject", "note"?} -> {proposal}. approve sets the',
+ " claim's verdict to the proposal's (through the registry; refused when the",
+ " claim was ruled meanwhile); reject leaves the claim unruled. Synchronous.",
"",
'research-approve settles a research run\'s acquisitions: {"article",',
' "iteration", "ids"?: ["p01", …], "approve"?: true | false, "note"?} ->',
diff --git a/settings.json.example b/settings.json.example
@@ -253,7 +253,8 @@
"teaser": "local",
"flips": "local",
"threads": "local",
- "youtube": "local"
+ "youtube": "local",
+ "verdicts": "local"
},
"models": {
"api": "claude-sonnet-5-5",
diff --git a/umtool/app/api/articles/verdicts/route.ts b/umtool/app/api/articles/verdicts/route.ts
@@ -0,0 +1,25 @@
+import { errorResponse } from "@/lib/articles/generation";
+import { readArticleProposals, reviewArticleProposal } from "@/lib/articles/verdicts";
+
+export const dynamic = "force-dynamic";
+
+// VERDICT PROPOSALS (release 29 M8): an article's waiting proposals, and the
+// operator's approve or reject of one — through the editor's verdict-review
+// (approve sets the claim's verdict through the registry).
+//
+// GET ?article=<id> -> { waiting, approved, rejected }
+// POST {article, claim, decision: "approve" | "reject", note?} -> { proposal }
+export async function GET(request: Request) {
+ const article = new URL(request.url).searchParams.get("article") ?? "";
+ const got = await readArticleProposals(article).catch(() => null);
+ return Response.json(got ?? { waiting: [], approved: 0, rejected: 0 }, { headers: { "cache-control": "no-store" } });
+}
+
+export async function POST(request: Request) {
+ try {
+ const body = await request.json().catch(() => null);
+ return Response.json(await reviewArticleProposal(body), { headers: { "cache-control": "no-store" } });
+ } catch (err) {
+ return errorResponse(err);
+ }
+}
diff --git a/umtool/components/articles/ArticlePage.tsx b/umtool/components/articles/ArticlePage.tsx
@@ -27,6 +27,8 @@ import { articleWorkspaceListing, openWorkspaceFile } from "@/lib/articles/files
import { linkedProjects } from "@/lib/articles/links.mjs";
import { readArticleNotes, readReportFile, reportDirFor } from "@/lib/articles/sites";
import { sourceFor } from "@/lib/articles/sources.mjs";
+import { readArticleProposals } from "@/lib/articles/verdicts";
+import VerdictProposals from "@/components/articles/VerdictProposals";
import { articleEvidenceHref, articleHref, projectHref } from "@/lib/hrefs";
import { ARTICLES_KEY, corpusNotesFile } from "@/lib/paths";
import { readPieceGraph } from "@/lib/pieces";
@@ -450,6 +452,8 @@ async function ArticleTab({
...(notes.error ? { error: notes.error } : {}),
};
const status = sp.status === "resolved" || sp.status === "all" ? sp.status : "open";
+ // A fact-check's proposed verdicts (release 29 M8), waiting on the operator.
+ const proposals = site === ARTICLES_KEY && r.kind === "factcheck" ? await readArticleProposals(reportId).catch(() => null) : null;
const videoSlot = r.video
? { file: r.video.src, src: media(r.video.src), poster: r.video.poster ? media(r.video.poster) : undefined, caption: r.video.caption }
: null;
@@ -463,7 +467,16 @@ async function ArticleTab({
initialNotes={initialNotes}
initialFilter={status}
initialNote={sp.note ?? null}
- meta={line}
+ meta={
+ proposals ? (
+ <>
+ {line}
+ <VerdictProposals article={reportId} waiting={proposals.waiting} />
+ </>
+ ) : (
+ line
+ )
+ }
video={videoSlot}
videoProjects={links.linked.map((p: { id: string; title: string; generatedBy: string | null }) => ({ id: p.id, title: p.title, generatedBy: p.generatedBy }))}
/>
diff --git a/umtool/components/articles/VerdictProposals.tsx b/umtool/components/articles/VerdictProposals.tsx
@@ -0,0 +1,88 @@
+"use client";
+
+import { useState } from "react";
+import { useRouter } from "next/navigation";
+import { Button } from "@/components/ui/button";
+import type { WaitingProposal } from "@/lib/articles/verdicts";
+
+// A FACT-CHECK'S PROPOSED VERDICTS (release 29 M8), on the article's tab: each
+// unruled claim a model proposed a verdict for, with the model's reason, the
+// model and its prompt version — and Approve (the claim's verdict is set, by
+// the editor's verdict-review through the registry) or Reject (the claim
+// stays unruled), each with an optional note. Proposed verdicts are plain
+// text: a verdict's colour is a ruling's, and these are not rulings yet.
+
+export default function VerdictProposals({ article, waiting }: { article: string; waiting: WaitingProposal[] }) {
+ const router = useRouter();
+ const [left, setLeft] = useState(waiting);
+ const [notes, setNotes] = useState<Record<string, string>>({});
+ const [busy, setBusy] = useState<string | null>(null);
+ const [status, setStatus] = useState<{ ok: boolean; text: string } | null>(null);
+
+ async function review(p: WaitingProposal, decision: "approve" | "reject") {
+ setBusy(p.claim);
+ setStatus(null);
+ try {
+ const note = notes[p.claim]?.trim();
+ const r = await fetch("/api/articles/verdicts", { method: "POST", body: JSON.stringify({ article, claim: p.claim, decision, ...(note ? { note } : {}) }) });
+ const body = await r.json();
+ if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`);
+ setLeft((xs) => xs.filter((x) => x.claim !== p.claim));
+ setStatus({ ok: true, text: decision === "approve" ? `Approved: ${p.claim} is ${p.verdict}.` : `Rejected: ${p.claim} stays unruled.` });
+ router.refresh();
+ } catch (e) {
+ setStatus({ ok: false, text: (e as Error).message });
+ } finally {
+ setBusy(null);
+ }
+ }
+
+ if (!left.length && !status) return null;
+ return (
+ <section aria-label="verdict proposals" id="verdict-proposals" className="w-full rounded-[3px] border border-seam bg-panel px-3 py-2 text-[12px] text-text">
+ <div className="micro">
+ verdict proposals · {left.length} waiting
+ </div>
+ {status && (
+ <p role="status" className={status.ok ? "mt-1 text-text-2" : "mt-1 text-[var(--color-bad)]"}>
+ {status.text}
+ </p>
+ )}
+ <ul className="mt-1 flex flex-col gap-2">
+ {left.map((p) => (
+ <li key={p.claim} data-proposal={p.claim} className="border-t border-seam pt-1.5">
+ <div className="flex flex-wrap items-baseline gap-2">
+ <span className="font-mono text-[11px] text-muted">{p.claim}</span>
+ {p.section && <span className="text-muted">{p.section}</span>}
+ </div>
+ <p className="m-0">{p.text}</p>
+ <p className="m-0 mt-0.5">
+ <span className="font-mono" data-proposed={p.verdict}>
+ {p.verdict}
+ </span>{" "}
+ <span className="text-text-2">— {p.reason}</span>
+ </p>
+ <div className="mt-0.5 font-mono text-[10.5px] text-muted">
+ {p.model} · prompt v{p.promptVersion}
+ </div>
+ <div className="mt-1 flex flex-wrap items-center gap-2">
+ <input
+ aria-label={`note on ${p.claim}`}
+ placeholder="note (optional)"
+ className="min-w-[14rem] flex-1 rounded-[3px] border border-seam-2 bg-[var(--color-ink)] px-1.5 py-0.5 text-[12px] text-text"
+ value={notes[p.claim] ?? ""}
+ onChange={(e) => setNotes({ ...notes, [p.claim]: e.target.value })}
+ />
+ <Button type="button" size="sm" disabled={busy !== null} onClick={() => void review(p, "approve")}>
+ Approve
+ </Button>
+ <Button type="button" size="sm" disabled={busy !== null} onClick={() => void review(p, "reject")}>
+ Reject
+ </Button>
+ </div>
+ </li>
+ ))}
+ </ul>
+ </section>
+ );
+}
diff --git a/umtool/docs/inbox.md b/umtool/docs/inbox.md
@@ -91,6 +91,7 @@ Cover); a cut's opens the cut's page, at the song's full path.
| `refresh-held` ([refresh.md](refresh.md)) | Your call | Refresh |
| `iteration-ready` — done, not current, newer than current | Review | Make i<n> current |
| `drafts-unreviewed` — drafted fields awaiting review (unreviewed, or edited since approved) | Review | Review drafts |
+| `verdict-proposed` — a model's proposed verdict for a fact-check's unruled claim (the article's `verdicts.proposed.json`), one row per proposal; gone once approved or rejected on the article's tab, or the claim is ruled by hand | Review | Review verdicts |
| `edition-ready` | Review | Review edition |
| `refresh-available` — a partial check says so ("the check was partial — not reached: …; a Refresh reads the rest"), never "nothing new" | Review | Refresh |
| `open-note` — an operator note (its href ends `note=<id>`) | Notes | Answer note |
diff --git a/umtool/docs/tools.md b/umtool/docs/tools.md
@@ -13,7 +13,7 @@ a tool the rail opens Tools into its tools: find · mix · **song ▸** (the fou
| Faces | `/tools/faces` | every cover corner on record, deduped by episode and moment, the ones that ship first: judge the crop (`face-verdicts.json`, which `make-thumb.mjs` reads; the page never touches the thumb manifests). The dashed box is what `facecrop.py` would cut, the solid one yours. `?cover=` / `?key=` open one |
| Sources | `/tools/sources` | where the song palette comes from: placements (the finished runtime an episode supplies) and clips (the palette) per episode — different units, both shown, never summed — the top episode, the top five, how many cover half |
| Trim | `/tools/trim/<set>` | a hook set's trims against the waveform, then **run the chain** (apply-hook-trims → pick-take → mix-hooks) |
-| Verdict bench | `/tools/bench` | could a model propose a fact-check verdict well enough to review: runs of `archilyzer reports bench-verdicts`, each model's agreement and recalls against the bar (**passes the bar** / **fails the bar**), confusion matrices, the items; the bar is set here (`settings.generation.verdicts`) |
+| Verdict bench | `/tools/bench` | could a model propose a fact-check verdict well enough to review: runs of `archilyzer reports bench-verdicts`, each with its prompt version and items hash, each model's agreement and recalls against the bar (**passes the bar** / **fails the bar**), confusion matrices, the items; **compare with** another run over the same items (each model's agreement in both, the claims whose answers changed); **Right** / **Wrong** on each disagreement (was the model right? kept in the run's `marks.json`), and not-CORROBORATED precision and recall as ruled and as marked beside the bar; what the verdicts mean. The bar is set here (`settings.generation.verdicts`); a ticked model is the only kind verdict proposals run on (the Inbox's `verdict-proposed`, [inbox.md](inbox.md)) |
A song's own page links its piles, find, mix and sources (its Overview's Song tools; [piece.md](piece.md#a-song-projectspath)).
The old addresses (`/sort`, `/salvage`, `/verify`, `/keeps`, `/mix`, `/bench`, `/browse/find`, `/browse/faces`,
diff --git a/umtool/e2e/fixtures/editor-stub.mjs b/umtool/e2e/fixtures/editor-stub.mjs
@@ -112,6 +112,9 @@ function writeWindow(dir, name, seconds) {
// the stub's acquisition jobs, then
// approved (a job: running after 1 s,
// done after 3 s) or rejected
+// POST /api/ops/verdict-review (release 29 M8) the REAL review of
+// a verdict proposal over the
+// fixture's article store (tsx)
// A `refresh` report-draft (R4): `dryRun` answers a plan (the iteration
// refreshed, a fetch per channel and one held platform skipped, a site built,
// the policy's model and cap); else a `refresh` iteration, running after 1 s,
@@ -900,6 +903,30 @@ function generationRoute(req, res, url, auth) {
return json(res, 200, out);
});
}
+ // VERDICT PROPOSALS (release 29 M8): the REAL verdict-review over the
+ // fixture's article store (common/testing/verdicts/reviewStub.ts, under
+ // tsx) — approve sets the claim's verdict through the registry.
+ if (req.method === "POST" && url.pathname === "/api/ops/verdict-review") {
+ return readBody(req, (body) => {
+ requests.push({ route: "verdict-review", ...(body ?? {}), authorization: auth });
+ record();
+ const r = spawnSync(path.join(REPO, "node_modules/.bin/tsx"), [path.join(REPO, "common/testing/verdicts/reviewStub.ts"), "--articles", ARTICLES], {
+ cwd: REPO,
+ input: JSON.stringify(body ?? {}),
+ encoding: "utf8",
+ timeout: 60_000,
+ });
+ const last = String(r.stdout ?? "").trim().split("\n").filter(Boolean).at(-1);
+ let out;
+ try {
+ out = JSON.parse(last ?? "");
+ } catch {
+ return json(res, 500, { ok: false, error: `the verdict-review stub failed: ${String(r.stderr ?? "").slice(-400)}` });
+ }
+ if (!out.ok) return json(res, out.status ?? 400, { ok: false, error: out.error });
+ return json(res, 200, out);
+ });
+ }
if (req.method === "POST" && url.pathname === "/api/ops/research-approve") {
return readBody(req, (body) => {
requests.push({ route: "research-approve", ...(body ?? {}), authorization: auth });
diff --git a/umtool/e2e/verdict-proposed.spec.ts b/umtool/e2e/verdict-proposed.spec.ts
@@ -0,0 +1,112 @@
+import { test, expect } from "@playwright/test";
+import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { WARM_TIMEOUT, warm } from "./warm";
+
+// ---------------------------------------------------------------------------
+// Verdict proposals (release 29 M8): a synthetic fact-check in the fixture's
+// article store with two unruled claims a model proposed verdicts for
+// (`verdicts.proposed.json` beside it). The Inbox's `verdict-proposed` card
+// (Review) → the article's tab → Approve sets the claim's verdict (the stub
+// editor runs the REAL verdict-review over the fixture's store), Reject
+// leaves the claim unruled; the card goes once nothing waits.
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const ARTICLES = path.join(HERE, "..", ".e2e-song", "articles");
+const ID = "vprop-check";
+const DIR = path.join(ARTICLES, ID);
+const AT = "2026-10-15T10:00:00.000Z";
+const MODEL = "qwen3:8b";
+
+const report = {
+ format: "archilyzer-report",
+ version: 1,
+ id: ID,
+ kind: "factcheck",
+ title: "The Bakery Check",
+ citations: {
+ q1: { kind: "video", channel: "sitechan", id: "sv1", start: 3, end: 6, quote: "The vote was rigged and everybody knew." },
+ },
+ sections: [
+ {
+ id: "s1",
+ title: "The shop",
+ claims: [
+ { id: "c1", text: "The article says she opened the shop in spring.", verdict: "CORROBORATED", citations: ["q1"] },
+ { id: "c2", text: "The article says the oven was broken for a month.", citations: ["q1"] },
+ { id: "c3", text: "The article says she sold the van.", citations: ["q1"] },
+ ],
+ },
+ ],
+};
+
+const proposals = {
+ format: "archilyzer-verdict-proposals",
+ version: 1,
+ article: ID,
+ proposals: {
+ c2: { verdict: "PARTLY", reason: "She says the oven ran hot, not that it was broken.", model: MODEL, promptVersion: "2", at: AT, status: "proposed" },
+ c3: { verdict: "CONTRADICTED", reason: "She says she kept the van.", model: MODEL, promptVersion: "2", at: AT, status: "proposed" },
+ },
+ updatedAt: AT,
+};
+
+const claims = () => (JSON.parse(readFileSync(path.join(DIR, "report.json"), "utf8")) as typeof report).sections[0]!.claims as { id: string; verdict?: string }[];
+const sidecar = () => JSON.parse(readFileSync(path.join(DIR, "verdicts.proposed.json"), "utf8")) as typeof proposals;
+
+test.beforeAll(async ({ playwright }) => {
+ test.setTimeout(WARM_TIMEOUT);
+ rmSync(DIR, { recursive: true, force: true });
+ mkdirSync(DIR, { recursive: true });
+ writeFileSync(path.join(DIR, "report.json"), JSON.stringify(report, null, 2) + "\n");
+ writeFileSync(path.join(DIR, "verdicts.proposed.json"), JSON.stringify(proposals, null, 2) + "\n");
+ await warm(playwright, ["/", `/articles/${ID}?tab=article`, "/api/browse/decisions"]);
+});
+test.afterAll(() => {
+ rmSync(DIR, { recursive: true, force: true });
+});
+
+test("an Inbox row → the article's proposals → Approve sets the verdict, Reject leaves the claim; the card goes", async ({ page, request }) => {
+ // The API: one row per waiting proposal, in Review, its action the article's tab.
+ const rows = ((await (await request.get("/api/browse/decisions")).json()) as {
+ items: { kind: string; target: string; group: string; piece?: string; action: { label: string; href: string } }[];
+ }).items.filter((d) => d.kind === "verdict-proposed" && d.piece === `a:articles/${ID}`);
+ expect(rows.map((d) => d.target).sort()).toEqual(["c2", "c3"]);
+ expect(rows.every((d) => d.group === "review")).toBe(true);
+ expect(rows[0]!.action).toEqual({ label: "Review verdicts", href: `/articles/${ID}?tab=article` });
+
+ await page.goto("/");
+ const card = page.locator("[data-group=review] [data-card=verdict-proposed]").filter({ hasText: "The Bakery Check" });
+ await expect(card).toHaveCount(1);
+ await expect(card.locator("[data-count]")).toHaveText("2");
+ await expect(card.locator("[data-card-title]")).toHaveText("The Bakery Check · 2 verdicts proposed");
+ await expect(card.locator("small")).toHaveText(`by ${MODEL} · prompt v2`);
+ await card.locator("[data-action-link]").click();
+ await expect(page).toHaveURL(new RegExp(`/articles/${ID}\\?tab=article$`));
+
+ const panel = page.getByRole("region", { name: "verdict proposals" });
+ await expect(panel.locator("[data-proposal]")).toHaveCount(2);
+ const c2 = panel.locator('[data-proposal="c2"]');
+ await expect(c2.locator("[data-proposed]")).toHaveText("PARTLY");
+ await expect(c2).toContainText("She says the oven ran hot");
+ await c2.getByRole("button", { name: "Approve" }).click();
+ await expect(panel.getByRole("status")).toHaveText("Approved: c2 is PARTLY.");
+ await expect(panel.locator('[data-proposal="c2"]')).toHaveCount(0);
+ expect(claims().find((c) => c.id === "c2")!.verdict).toBe("PARTLY");
+ expect(sidecar().proposals.c2.status).toBe("approved");
+
+ const c3 = panel.locator('[data-proposal="c3"]');
+ await c3.getByRole("textbox", { name: "note on c3" }).fill("the window is too short");
+ await c3.getByRole("button", { name: "Reject" }).click();
+ await expect(panel.getByRole("status")).toHaveText("Rejected: c3 stays unruled.");
+ expect(claims().find((c) => c.id === "c3")!.verdict).toBeUndefined();
+ expect(sidecar().proposals.c3).toMatchObject({ status: "rejected", note: "the window is too short" });
+ // The operator's ruling stayed as it was.
+ expect(claims().find((c) => c.id === "c1")!.verdict).toBe("CORROBORATED");
+
+ // Nothing waits: the card is gone.
+ await page.goto("/");
+ await expect(page.locator("[data-group=review] [data-card=verdict-proposed]").filter({ hasText: "The Bakery Check" })).toHaveCount(0);
+});
diff --git a/umtool/lib/articles/verdicts.ts b/umtool/lib/articles/verdicts.ts
@@ -0,0 +1,91 @@
+import { readVerdictProposals, waitingProposals, type VerdictProposal } from "yt-dlp-transcript-common/lib/report/verdictProposals";
+import { articleFile } from "yt-dlp-transcript-common/lib/report/registry";
+import { readJsonFile } from "yt-dlp-transcript-common/lib/jsonFile-server";
+import { isVerdict, type Verdict } from "yt-dlp-transcript-common/lib/report/verdicts";
+import { isReportId } from "yt-dlp-transcript-common/lib/report/schema";
+import { askEditor, EditorError } from "./generation";
+import { sitesPaths } from "./sites";
+
+// VERDICT PROPOSALS, AS UMTOOL SEES THEM (release 29 M8): a model's proposed
+// verdicts for a fact-check's unruled claims, read from the article's
+// `verdicts.proposed.json` (common's lib/report/verdictProposals.ts; read
+// here, never written) and joined with its report.json as it is now — a
+// proposal waits while its claim is still unruled. The operator's approve or
+// reject goes to the editor's `verdict-review` (the one writer: approve sets
+// the claim's verdict through the registry).
+//
+// SERVER-ONLY.
+
+export type WaitingProposal = {
+ claim: string;
+ text: string;
+ section: string;
+ verdict: Verdict;
+ reason: string;
+ model: string;
+ promptVersion: string;
+ at: string;
+};
+
+export type ArticleProposals = {
+ waiting: WaitingProposal[];
+ approved: number;
+ rejected: number;
+ // The sidecar did not read (it is never taken for empty).
+ error?: string;
+};
+
+type ClaimRow = { id: string; text: string; section: string; verdict?: unknown };
+
+async function claimsOf(article: string): Promise<Map<string, ClaimRow> | null> {
+ const read = await readJsonFile(articleFile(sitesPaths(), article));
+ if (!read.ok) return null;
+ const r = read.value as { kind?: unknown; sections?: { title?: string; claims?: { id?: string; text?: string; verdict?: unknown }[] }[] };
+ if (r.kind !== "factcheck") return null;
+ const out = new Map<string, ClaimRow>();
+ for (const s of r.sections ?? []) {
+ for (const c of s.claims ?? []) if (typeof c.id === "string") out.set(c.id, { id: c.id, text: String(c.text ?? ""), section: String(s.title ?? ""), verdict: c.verdict });
+ }
+ return out;
+}
+
+/** An article's proposals: the waiting ones on still-unruled claims, in the report's order. */
+export async function readArticleProposals(article: string): Promise<ArticleProposals | null> {
+ if (!isReportId(article)) return null;
+ let f;
+ try {
+ f = await readVerdictProposals(article, sitesPaths());
+ } catch (e) {
+ return { waiting: [], approved: 0, rejected: 0, error: (e as Error).message };
+ }
+ if (!f) return null;
+ const claims = await claimsOf(article);
+ const all = Object.values(f.proposals) as VerdictProposal[];
+ const order = claims ? [...claims.keys()] : [];
+ const waiting = waitingProposals(f)
+ .filter(([id]) => {
+ const c = claims?.get(id);
+ return !!c && !isVerdict(c.verdict);
+ })
+ .map(([id, p]) => {
+ const c = claims!.get(id)!;
+ return { claim: id, text: c.text, section: c.section, verdict: p.verdict, reason: p.reason, model: p.model, promptVersion: p.promptVersion, at: p.at };
+ })
+ .sort((a, b) => order.indexOf(a.claim) - order.indexOf(b.claim));
+ return {
+ waiting,
+ approved: all.filter((p) => p.status === "approved").length,
+ rejected: all.filter((p) => p.status === "rejected").length,
+ };
+}
+
+/** Approve or reject one proposal through the editor's verdict-review. */
+export async function reviewArticleProposal(body: unknown): Promise<{ proposal: unknown }> {
+ const b = (body ?? {}) as Record<string, unknown>;
+ if (typeof b.article !== "string" || typeof b.claim !== "string") throw new EditorError('send {"article", "claim", "decision": "approve" | "reject", "note"?}', 400);
+ if (b.decision !== "approve" && b.decision !== "reject") throw new EditorError('"decision" is "approve" or "reject"', 400);
+ if (b.note !== undefined && typeof b.note !== "string") throw new EditorError('"note" is text', 400);
+ const sent = { article: b.article, claim: b.claim, decision: b.decision, ...(typeof b.note === "string" && b.note.trim() ? { note: b.note.trim() } : {}) };
+ const answer = await askEditor<{ proposal?: unknown }>("/api/ops/verdict-review", { method: "POST", body: sent });
+ return { proposal: answer.proposal ?? null };
+}
diff --git a/umtool/lib/inbox.ts b/umtool/lib/inbox.ts
@@ -10,6 +10,8 @@ import { readManifest, reportSignature } from "./projects/report.mjs";
import { draftsView } from "./report/drafts.mjs";
import { articleHref, generationPolicyHref, reviewHref, triageHref } from "./hrefs";
import { awaitingReview, draftsDecisions } from "./inbox/drafts.mjs";
+import { verdictsDecisions } from "./inbox/verdicts.mjs";
+import { readArticleProposals } from "./articles/verdicts";
import { readFieldProvenance } from "./report/draft-provenance.mjs";
import { pieceOfDecision, readPieceGraph, type Piece, type PieceGraph } from "./pieces";
import { lifecycleOf, readLifecycle, type LifecycleRead } from "./lifecycle";
@@ -57,6 +59,11 @@ import { refreshDecisions } from "./inbox/refresh";
// row per field, kept per project against
// reportSignature -- which signs the review files, so an
// approve drops the card on the next read
+// verdict-proposed a model's proposed verdict for a fact-check's unruled
+// claim (release 29 M8; the article's
+// verdicts.proposed.json, lib/inbox/verdicts.mjs), one row
+// per proposal, gone once approved or rejected (or the
+// claim ruled by hand)
//
// -- each row given its piece, category, group, one action, lifecycle and
// `hidden` (lib/inbox/groups.mjs), ranked. One row per decision, never dropped:
@@ -344,12 +351,29 @@ async function worthOf(views: ScheduleView[]): Promise<Map<string, { href: strin
return out;
}
-/** The decisions read from disk beside openDecisions(): iterations, research, links, looks-done, drafts, recurring reports. */
+/** The store's fact-checks' proposed verdicts (release 29 M8), waiting on the operator. */
+async function proposalDecisions(graph: PieceGraph): Promise<Decision[]> {
+ const per = await Promise.all(
+ storeArticles(graph).map(async (p) => {
+ const got = await readArticleProposals(p.report as string).catch(() => null);
+ if (!got?.waiting.length) return [] as Decision[];
+ return verdictsDecisions({
+ base: articleRow(p),
+ href: articleHref({ site: ARTICLES_KEY, id: p.report as string }, { tab: "article" }),
+ waiting: got.waiting,
+ }) as Decision[];
+ }),
+ );
+ return per.flat();
+}
+
+/** The decisions read from disk beside openDecisions(): iterations, research, links, looks-done, drafts, verdict proposals, recurring reports. */
export async function diskDecisions(graph: PieceGraph, life: LifecycleRead): Promise<Decision[]> {
- const [spend, drafts, schedules] = await Promise.all([
+ const [spend, drafts, schedules, proposals] = await Promise.all([
spendByJob(),
draftsDecisionsAll().catch(() => [] as Decision[]),
readSchedules().catch(() => ({ schedules: [] as ScheduleView[] })),
+ proposalDecisions(graph).catch(() => [] as Decision[]),
]);
// An edition's article is its series' piece's business (one Review card there).
// A watch's tick article is its watch's (one Worth researching card there).
@@ -366,7 +390,7 @@ export async function diskDecisions(graph: PieceGraph, life: LifecycleRead): Pro
const refresh = await readMutes()
.then((mutes) => refreshDecisions(graph, life, mutes))
.catch(() => [] as Decision[]);
- return [...perArticle.flat(), ...pieceDecisions(graph, life), ...drafts, ...refresh, ...recurring];
+ return [...perArticle.flat(), ...pieceDecisions(graph, life), ...drafts, ...proposals, ...refresh, ...recurring];
}
/**
diff --git a/umtool/lib/inbox/groups.mjs b/umtool/lib/inbox/groups.mjs
@@ -9,7 +9,8 @@
// your-call research proposals, then failed runs: money is waiting
// on a yes or no ("spend")
// review a finished iteration that is not current; a cut whose
-// drafted fields nobody has reviewed (r28's drafts, P2b)
+// drafted fields nobody has reviewed (r28's drafts, P2b);
+// a fact-check's proposed verdicts (release 29 M8)
// blocking something downstream would lie, on an ACTIVE piece
// notes the operator's open notes
// open every other open decision (a variant with no verdict, a
@@ -63,6 +64,9 @@ const KIND_CATEGORY = {
// recordings since the current report are something to review.
"refresh-held": "spend",
"refresh-available": "review",
+ // Release 29 M8: a model's proposed verdicts for a fact-check's unruled
+ // claims, each waiting on the operator's approve or reject.
+ "verdict-proposed": "review",
};
const CATEGORY_GROUP = {
@@ -91,7 +95,7 @@ export function groupOf(d) {
// Within a group: the brief's order first (proposals before failed runs), then
// everything else as equals.
-const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "unreadable-notes": 0, "refresh-held": 2, "refresh-available": 2 };
+const KIND_RANK = { "worth-researching": 0, "research-proposal": 0, "iteration-failed": 1, "tick-held": 2, "tick-failed": 2, "tick-partial": 2, "iteration-ready": 0, "edition-ready": 0, "drafts-unreviewed": 1, "verdict-proposed": 1, "unreadable-notes": 0, "refresh-held": 2, "refresh-available": 2 };
const SEVERITY_RANK = { blocking: 0, open: 1, info: 2 };
// ONE primary action per decision, its button copy naming the result.
@@ -100,6 +104,7 @@ const ACTION_LABEL = {
"iteration-failed": "Retry run",
"iteration-ready": (d) => `Make ${d.target} current`,
"drafts-unreviewed": "Review drafts",
+ "verdict-proposed": "Review verdicts",
"open-note": "Answer note",
"unreadable-notes": "Repair notes.json",
"link-ambiguous": "Link the video",
diff --git a/umtool/lib/inbox/verdicts.mjs b/umtool/lib/inbox/verdicts.mjs
@@ -0,0 +1,38 @@
+// VERDICT PROPOSALS AS DECISIONS (release 29 M8; the kind the redesign
+// reserved): a fact-check whose unruled claims a model has proposed verdicts
+// for, waiting on the operator's approve or reject — the Inbox's Review
+// group, one row per proposal (the API keeps one row per decision), one card
+// per article ("3 verdicts proposed"), its action the article's tab where
+// each is approved or rejected. Pure: lib/inbox.ts reads the proposals
+// (lib/articles/verdicts.ts) and hands the waiting ones here. Not the
+// manifest claim bench's `claim-unadjudicated`.
+
+/** The card's title: how many verdicts wait. */
+export function verdictsWhat(waiting) {
+ const n = waiting.length;
+ return `${n} verdict${n === 1 ? "" : "s"} proposed`;
+}
+
+/** The card's sentence: how many, by which models, on which prompt. */
+export function verdictsWhy(waiting) {
+ const models = [...new Set(waiting.map((w) => w.model).filter(Boolean))];
+ const versions = [...new Set(waiting.map((w) => w.promptVersion).filter(Boolean))];
+ return [verdictsWhat(waiting), models.length ? `by ${models.join(", ")}` : null, versions.length ? `prompt v${versions.join(", v")}` : null].filter(Boolean).join(" · ");
+}
+
+/**
+ * The `verdict-proposed` rows of one article.
+ *
+ * @param {{
+ * base: { project: string, projectKind?: string, projectTitle: string, piece?: string },
+ * href: string,
+ * waiting: { claim: string, model: string, promptVersion: string, at: string }[],
+ * }} o
+ */
+export function verdictsDecisions({ base, href, waiting }) {
+ if (!waiting?.length) return [];
+ const what = verdictsWhat(waiting);
+ const why = verdictsWhy(waiting);
+ const at = Math.max(0, ...waiting.map((w) => Date.parse(w.at) || 0));
+ return waiting.map((w) => ({ ...base, kind: "verdict-proposed", target: w.claim, what, why, href, severity: "open", at }));
+}
diff --git a/umtool/lib/inbox/verdicts.test.mjs b/umtool/lib/inbox/verdicts.test.mjs
@@ -0,0 +1,29 @@
+// The verdict-proposed rows (release 29 M8): one per waiting proposal, one
+// card's words, in the Review group with its one action.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { verdictsDecisions, verdictsWhy } from "./verdicts.mjs";
+import { annotate, groupOf, summarizeGroups } from "./groups.mjs";
+import { whatOf } from "./what.mjs";
+
+test("verdict-proposed: a row per proposal, the card's words, the Review group, Review verdicts", () => {
+ const waiting = [
+ { claim: "c2", model: "qwen3:8b", promptVersion: "2", at: "2026-10-15T10:00:00Z" },
+ { claim: "c4", model: "qwen3:8b", promptVersion: "2", at: "2026-10-15T11:00:00Z" },
+ ];
+ const rows = verdictsDecisions({ base: { project: "sites/articles/fc", projectKind: "article", projectTitle: "A check", piece: "a:articles/fc" }, href: "/articles/fc?tab=article", waiting });
+ assert.equal(rows.length, 2);
+ assert.ok(rows.every((r) => r.kind === "verdict-proposed" && r.severity === "open" && r.what === "2 verdicts proposed" && r.href === "/articles/fc?tab=article"));
+ assert.deepEqual(rows.map((r) => r.target), ["c2", "c4"]);
+ assert.equal(rows[0].at, Date.parse("2026-10-15T11:00:00Z"));
+ assert.equal(verdictsWhy(waiting), "2 verdicts proposed · by qwen3:8b · prompt v2");
+ assert.equal(groupOf(rows[0]), "review");
+ assert.equal(whatOf("verdict-proposed"), "verdicts proposed");
+ const annotated = annotate(rows, { pieceOf: () => "a:articles/fc", lifecycleOf: () => "active", isMuted: () => false });
+ assert.equal(annotated[0].action.label, "Review verdicts");
+ const review = summarizeGroups(annotated).find((g) => g.id === "review");
+ assert.equal(review.cards.length, 1);
+ assert.equal(review.cards[0].count, 2);
+ assert.equal(review.cards[0].what, "2 verdicts proposed");
+ assert.deepEqual(verdictsDecisions({ base: { project: "x", projectTitle: "x" }, href: "/", waiting: [] }), []);
+});
diff --git a/umtool/lib/inbox/what.mjs b/umtool/lib/inbox/what.mjs
@@ -8,6 +8,7 @@ export const WHAT = {
"iteration-failed": "run failed",
"iteration-ready": "iteration ready",
"drafts-unreviewed": "drafts to review",
+ "verdict-proposed": "verdicts proposed",
"open-note": "open notes",
"unreadable-notes": "notes.json does not read",
"link-ambiguous": "video not linked",