commit e7d6b75b7b9b253918d8ef41c9628c711d6687a5
parent 9928c6eac5b19158bb7a6055892a2fc37fb3e434
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 11 Oct 2026 16:48:41 -0400
plans: report media from a local model (ratified 2026-10-11; Q0 bake-off running, Q1–Q5 release 27)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 90 insertions(+), 0 deletions(-)
diff --git a/plans/local-llm-report-media.md b/plans/local-llm-report-media.md
@@ -0,0 +1,90 @@
+# Report media from a local model — draft it in umtool, no agent session
+
+Status: RATIFIED 2026-10-11 — D1, D2, D4, D5 as recommended; **D3 amended: the model may PROPOSE fact-check verdicts**
+(as `AWAITING_REVIEW`, the operator confirms each); ledger adjudication and posts stay human. Q0 runs now;
+Q1–Q5 are release 27, after release 26.
+
+## Why
+
+Everything a report's media needs that is not code is written today by an agent session (Claude Code) following
+`umtool/docs/authoring.md`, `umtool/report-to-video/README.md` and `mcp/src/instructions.ts`. The operator wants a
+local model (Qwen, already on this machine for digests) to write all of it, started from umtool's UI.
+
+## What is authored today, and what is already code
+
+| Step | Today | With this plan |
+|---|---|---|
+| Project from a report | code (`umtool new` / `POST /api/projects/new`, `lib/projects/scaffold.mjs`); timeline left EMPTY | unchanged, then "Draft" |
+| Citations → clips: which, in what order | agent ("the part nothing automates", authoring.md) | **model** picks and orders; **code** makes each window |
+| Clip start/end | code from one cited second (`cueWiden`, `resolve-windows.mjs`, `cutToQuote` on the quote) | unchanged — the model never writes a time |
+| Clip `title`, `onscreen.{title,subtitle}`, manifest `title`/`subtitle` | agent | **model** |
+| Card `narration.text` | agent, under `NARRATION_HARD_RULE` + `NARRATION_WRITING_RULES` | **model**, same rules, plus a grounding check in code |
+| Teaser lines, flips pairs, thread labels | agent (reference docs only, no writing guide) | **model**, each with a writing guide written for it |
+| Fact-check verdicts | agent proposes, operator rules | **model proposes** (`AWAITING_REVIEW`), operator confirms (D3) |
+| Ledger adjudication | agent proposes, operator rules | unchanged: never the model (D3) |
+| Posts | agent, raw manifest JSON | unchanged (not drafted; posts are cited evidence) |
+| Narration audio, build, podcast, YouTube description/chapters, show notes | code (editor TTS job; umtool job chain; `export.mjs`; `build-podcast.mjs`) | unchanged — they follow the drafted fields |
+
+## Shape
+
+- **Inference runs as an editor job**, `report-draft` on a new `llm` queue — the editor already owns the ollama lane
+ (`common/lib/digestApps.ts` `/api/chat` with a JSON `format`, `acquireLlmSlot` with model verification, the
+ GPU yield to transcription in `digestYield.ts`). It also yields to a TTS synthesis (Orpheus is on the same 8 GB
+ card) and asks ollama to unload (`keep_alive: 0`) when its batch ends, so the VRAM is free for Orpheus and parakeet.
+ The job RETURNS a draft (JSON); it writes nothing under a project.
+- **umtool applies it.** As `narrate-via-editor.mjs` does for TTS: umtool posts to `POST /api/ops/report-draft` with
+ `WORKER_TOKEN`, waits, and applies the returned fields through the existing `umtool/lib/report/manifest.mjs`
+ writers and validators — never a raw manifest write. Every applied field carries
+ `drafted: {by: "<model tag>", at, task, promptVersion}`; a field the operator has edited since is never overwritten
+ (a re-draft goes to the review queue as an alternative, the takes pattern).
+- **One prompt source.** The writing rules move from `mcp/src/instructions.ts` prose into a shared module
+ (`common/lib/report/authoringRules.ts`) that the MCP plans and the draft tasks both read, so Claude and Qwen are held
+ to the same text. New guides for teaser/flips/threads/on-screen titles are written there once.
+- **Tasks are a registry** (`common/lib/report/draftTasks.ts`): each task = input builder (the report's sections,
+ claims, citations with their quotes; never the open web) + JSON schema + validator + grounding check. Tasks:
+ `cut` (select + order citations, a title each), `onscreen`, `narration`, `teaser`, `flips`, `threads`, `titles`,
+ `verdicts` (a proposed verdict per claim with the quoted evidence it rests on; never applied as ruled).
+- **Grounding check (code, every narration/title draft):** every number, date, proper name and quoted span in the
+ draft must appear in the report or a cited quote; quoted text must match cues; the hard rule's banned forms
+ (invented motive, intensifiers) are linted. A failing draft is re-asked once with the failures, then kept FLAGGED,
+ never applied silently.
+- **UI (umtool):** a "Draft with local model" button per section on the project page (cut, on-screen, narration,
+ teaser, flips, threads) and "Draft everything" on a new project: scaffold → cut → windows (code) → text tasks →
+ narration audio (the editor's TTS) → a `fast` build → podcast, as one chain in umtool's job runner
+ (`lib/jobs.ts`), progress in its job panel. Drafted fields show a "drafted by qwen3:8b" badge and approve/reject
+ (the `narration.review.json` pattern, generalised), and a `final` build refuses unreviewed drafts (D2).
+
+## Slices
+
+- **Q0 — bake-off, before any repo change.** 3 existing reports with agent-authored cuts (one sweep, one polemic,
+ one fact-check) × models qwen3:8b, qwen3:14b, qwen2.5:7b (installed) × tasks cut / narration / on-screen / teaser,
+ with the draft prompts and the grounding check as a script. Review page in umtool's audit style (yes/no per item,
+ side by side with the agent's version), plus seconds per task and VRAM beside Orpheus. Decides D1, and whether
+ the plan goes ahead as written. (~half a day.)
+- **Q1 — the editor job.** `report-draft` job kind + `pnpm ops report-draft {task, project?, input}` + route + usage
+ + COMMANDS.md; settings `reportDraft.{model, think, timeoutSeconds}` (SETTINGS.md regenerated); GPU arbitration
+ with TTS and transcription; tests against a fake ollama. (Q0.)
+- **Q2 — the rules and the tasks.** `authoringRules.ts` (MCP switched to it, its tests unchanged), `draftTasks.ts` with
+ schemas, validators, grounding check; unit tests on fixtures, including deliberately ungrounded drafts. (Q0.)
+- **Q3 — umtool apply + review.** `drafted` provenance in `manifest.mjs`, the no-overwrite rule, the generalised
+ review state, the `final` build refusal; umtool unit tests. (Q1, Q2.)
+- **Q4 — umtool UI.** Section buttons, "Draft everything" chain, badges, review; one umtool e2e spec over a fake
+ editor. (Q3.)
+- **Q5 — docs.** `umtool/docs/authoring.md` gains "Drafting with a local model"; OPERATING.md recipe; CHANGELOG.
+
+Q1 and Q2 run in parallel after Q0; then Q3 → Q4; Q5 with Q4. Gates: tsc, unit, umtool + editor e2e, builds,
+the private-data grep. Nothing touches a live project until a draft is asked for from the UI.
+
+## Decisions (for the operator)
+
+- **D1 — the model.** qwen3:8b (5.2 GB: fits the card beside nothing else, fast) or qwen3:14b (9.3 GB: spills to the
+ CPU on an 8 GB card, several times slower, likely better prose). *Recommended: Q0 decides; default 8b, 14b a
+ setting.*
+- **D2 — review gate.** Drafted fields allowed in `preview`/`fast` builds, but a `final` build refuses any drafted
+ field not approved. *Recommended.*
+- **D3 — judgments.** ~~The model never writes a fact-check verdict~~ **Ruled: the model may propose verdicts**
+ (`AWAITING_REVIEW` until the operator confirms each); ledger adjudication and posts stay human.
+- **D4 — where inference runs.** An editor job umtool calls (recommended: one GPU arbiter, one jobs list) vs umtool
+ calling ollama directly.
+- **D5 — scope.** Drafting starts from a finished report. Writing the report itself (the sweep) with a local model is
+ out of scope here; a later plan if Q0's results are strong.