# Report media from a local model — draft it in umtool, no agent session Status: Q1–Q5 SUPERSEDED by `plans/release-27.md` (2026-10-13). Was 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: "", 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. ## Record ### Q0, as run (2026-10-11) Bake-off in `~/reports/qwen-bakeoff/` (local only: one input is Candace data). Inputs: ferret-rescue (sweep), polemic-groundbreaking (polemic), the Candace fact-check (3 of 14 sections, 21 claims), the quartering-week narration. - **D1 decided: qwen3:8b, `think: false`** (~37 tok/s); `think: true` an option for narration only; qwen2.5:7b (~46 tok/s) the fallback; qwen3:14b impractical on the 8 GB card (~3.4 tok/s, 62–71% on the GPU), a setting only. - **Prompt cap 8k tokens, `num_ctx` ≤ 12k**: a 13.8k-token prompt hung the GPU compute ring once (recovered). - JSON schema adherence 100%; the failures are of shape (54–72 clips against the agent's 19, 6-row teasers, 200+ char on-screen titles) — counts and lengths are enforced in code, not asked for. - **Verdict proposals are not viable**: every model answered CORROBORATED for nearly every claim (57–67% agreement, no better than always CORROBORATED). D3's amendment is parked: no `verdicts` task until a model passes a one-claim-per-call test. - The grounding check catches invented numbers and quotes, but not a reversed meaning ("I've never met Alexander Dugin" → "Candace meets Dugin"), a dropped hedge, or a speaker's words in the narrator's mouth: every drafted claim and line is reviewed against its quote; lints flag negation mismatches and dropped hedges. - Models copy example sentences from the rules they are shown: drafting prompts carry rules, never worked examples. - Keep the better of the two attempts on a re-ask, not always the second. ### Scope change (operator, 2026-10-11 ~17:00) "Make sure I can make my own reports without needing Claude asap": the sweep itself is now in scope (D5 overridden). A stopgap outside the repo — `~/reports/local-reports/` (`local-sweep`, `local-narrate`, `RUNBOOK.html`) — is built first; release 27 folds it in. ### A second provider: the Claude API on a key (operator, 2026-10-12) "Set something up to use the promotional Claude API credits, which can't be used in Claude Code": the draft tasks and the sweep run on either provider, **ollama** (local, the GPU lane above) or **the Claude API** (an `ANTHROPIC_API_KEY`, billed to the Console account). The model tag picks it (`claude-…` is the API). The stopgap in `~/reports/local-reports/` has it now: - `claude_api.py`: stdlib HTTPS, the key from env or `~/.config/archilyzer/anthropic.env` (mode 600, never printed), retries, prompt caching, and a per-run estimated-USD meter. - `api-sweep`: the MCP `sweep_plan` text worked by Claude over the read-only MCP tools. An `extract_batch` tool, run by Haiku, stands in for the Task-tool extractor. The tool writes only `sweep.md`, has a `--max-usd` cap with a wrap-up at 85%, and prunes old tool results. - After convert and verify-quotes, a **strict** verbatim check: every fragment must be in the transcript within ±90 s. verify-quotes passed a quote with two words reversed in meaning at 0.85. A refusal goes back for one repair round. For release 27: - An API call never takes the GPU lane or the heavy slot. - The key is a setting that points at the file. The key itself never goes in `settings.json`. - umtool's "Draft with …" picker lists both providers. - The run's estimated cost is shown on the job. - The strict check moves into code that both providers' sweeps run. ### Iterate on anything, and the balance with Claude Code (operator, 2026-10-12 evening) Rulings: - Every media task done in Claude Code (not code changes) can also run on the API or the local model. - Articles and videos are iterated as VERSIONS made from feedback. - The agents may use the web. - The work is balanced between the Code plan and the API or local model by a policy that can be moved either way. Stopgap in `~/reports/local-reports/`: - `revise` makes a report or video version through checked edit ops, including `merge`. - A claim never carries quoted words: convertSweep makes every quoted span before a link that link's quote. - The local web search is a paced DuckDuckGo read; Claude uses the API's web search. - `gen` routes each task to `code`, `api` or `local`, from `~/.config/archilyzer/generation.json` with presets `code`, `balanced`, `api` and `local`. Claude Code's `/gen` follows it. - umtool /drafts has versions, a channel picker and the policy editor. For release 27: - Web search and page fetch become editor actions (`pnpm ops`), paced like a post fetch, shared by every agent. - The version lineage moves into the article registry. - The ops, their checks and the policy move into `common/`.