commit c8292375b3b5d8739e7c088bb14f1887dcfa6e5a
parent 7d7a2c3a35b01d10493fc2ef9800d1821780e4c3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 20 Oct 2026 12:44:36 -0400
plans: release 38 — research cases as a pipeline (API/local/manual + MCP tools) and a local video assistant
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 117 insertions(+), 0 deletions(-)
diff --git a/plans/release-38/research-cases-and-assist.md b/plans/release-38/research-cases-and-assist.md
@@ -0,0 +1,117 @@
+# Release 38 — research cases as a pipeline, and a local video assistant (plan)
+
+Operator, 2026-10-20 (during the Oneylyzer case): "Add all the research techniques we do here as possibilities in
+umtool that can use API or qwen, including creating Archilyzer tools for the MCP to replicate Claude Code functionality
+if needed." "Part of the purpose of these research sessions with Claude Code are discovering things to add to umtool."
+"A feature to iterate on the video with hyperframes using qwen, such that I can request little things like changing
+transition time on local AI even when Claude Code is not available."
+
+The reference implementation is the case's own scripts (`~/reports/oneylyzer/sweep-1/candidates.py`, `merge.py`,
+`prompts/*.md`; not committed: they read a private case). What they did, step by step, is the inventory below; each
+step becomes a stage with a **manual path (no model)**, an **AI path routed by `settings.generation`** (api / local
+Qwen through the GPU arbiter / code = a Claude Code session via the MCP), and an MCP surface.
+
+## What exists (survey, 2026-10-20) — extend, don't duplicate
+- umtool `/research` (ask bar, one `enumerate_matches` scan, reading log) and `/research/[case]` (a board of pinned
+ quotes, verify, hand-off to an article or video) — `lib/research/cases.mjs`, `app/api/research/cases/**`.
+- The API sweep agent (`sweep-agent.ts`: extractor subagents via `extract_batch`, strict quote check, trace.jsonl) and
+ the local sweep pipeline (`sweep-pipeline.ts`, code-driven 7000-char chunks). Research runs that propose
+ acquisitions (`research.ts`, `decide.ts`, research-approve, autonomy modes, standing-rule refusals).
+- Triage tiers 0/1/2, the claim bench, swipe decks for clips/drafts, "by hand" articles (`handEdits.ts`).
+- `revise-video` (release 27/28): feedback → checked `videoOps` (drop/move/heading/narration/trim/add_clip/title/
+ subtitle), local = one schema-bound ask. No look/render ops, no hyperframes ops, article iterations only.
+- Clip editor "Ask the assistant" (release 36 D, `clips-suggest mode:"ask"`) — clip notes only.
+- Gaps: no case definition with eras/term families/private names; no candidate-window stage; no findings store,
+ dedupe or sectioned report; no private-name gate; no quote-vs-captions/audio check; no lead discovery; the research
+ agent has no wayback/import-page/capture-posts/find-copy; the MCP has no web/wayback/archive tools and can't do what a
+ Claude Code session did with its shell (read a batch file, write findings, merge).
+
+## The case pipeline (what the Oneylyzer session did, as stages)
+
+A **case** (`/research/[case]`, extended — its board stays) gains `case.json`:
+`{subjects:[{name, aliases[]}], scope:{channels[], groups[], sites[]}, eras:[{id, from, to, families:{<id>: regex}}],
+groups:[{id, label, channels[]|"subject"|"coverage", era?}], privateNames:{terms[], note}, readerPrompts:{common,
+<group>: text}, status}`. `privateNames` is never exported, never shown outside the case page, and is a GATE (below).
+
+1. **Coverage** — per channel × year: listed, held, transcribed, untranscribed audio; the key periods highlighted;
+ gaps as actions (download-missing, focus the case's site, persist, transcribe) — buttons, no model.
+2. **Candidates** — term families per era over the scope's transcripts (en-orig before en; rolling-caption dedupe;
+ cue/whisper fallback; title hits; ±W s windows merged), noise filters ("the video mentions a subject at all" for
+ coverage groups; a stricter family for a subject's own late material), counts per family/year/channel before any
+ read. Deterministic, a job; `candidates.jsonl` in the case dir.
+3. **Batches** — windows grouped per reader group, budgeted by characters, written as WRAPPED TEXT (no line over 200
+ chars — the round-1 lesson: a reader's file tool truncates long lines and silently drops the densest windows).
+4. **Read** — three paths producing the same findings rows
+ (`{batch, slug, id, date, title, t, url, category, relevance 1–3, quote (verbatim ≤45 words), summary, speaker,
+ confidence, round, by}`):
+ - **by hand**: a candidate deck (the swipe-deck primitive): each window with its text and a player at t; keep →
+ pick the quote by selecting words, set category/relevance/speaker; skip. Keyboard-first.
+ - **AI**: a new generation task `case-read` per batch (api: Haiku/Sonnet extractor; local: Qwen through the GPU
+ arbiter with the batch split to the prompt cap; code: the MCP tools below), concurrency-capped, each batch a job
+ with its own ledger row; the reader prompt = `common` + the group's prompt, editable on the case page.
+ - **quote check**: every AI row's quote must be found in the window's caption text (normalised) or it is marked
+ "quote not found" (kept, flagged — not dropped: a garbled caption is still evidence to check).
+5. **Merge** — validate, dedupe (same video, |Δt| ≤ 20 s → keep higher relevance, later round), sections by group,
+ relevance ≥ 2 by default, a SUMMARY written by hand (or drafted by a model, marked as a draft) on top;
+ `REPORT.md` / `.html` export; hand-off to an article as claims with citations (the board's hand-off path).
+6. **Privacy gate** — every write of findings, summary, export and hand-off is scanned against `privateNames.terms`
+ (word-boundary, case-insensitive); a hit blocks the export/hand-off and lists the rows (counts + row ids, never the
+ term in a log). Readers' prompts always include the naming rule with `[name withheld]`.
+7. **Verify** — per finding: the window's captions in both tracks side by side, the quote highlighted; **audio check**
+ = `pnpm ops transcribe` of the window (whilePaused allowed by a button) and a word diff; status
+ `verified | corrected | disputed | unverified`; "corrected by hand" edits keep the reader's original in history.
+8. **Leads** — over a posts/forum channel in scope: the accounts/URLs it links most (counts), with context snippets
+ on demand; each lead gets a role note and one of `archive | watch | never-archive` (never-archive feeds
+ `privateNames`); `archive` creates the channel (X on no site, by rule) and starts its fetch/older walk.
+9. **Absence and date checks** — the subject's uploads around each key date, and the latest uploads after an event
+ ("no response found in captioned uploads through <date>"), as a table.
+10. **Evidence capture** — Wayback captures at chosen dates for a target list (release 37 `import-page`; the scan when
+ B lands), and a forum post's attachments/screenshot (`capture-posts`) marked "forum attachment, post #N,
+ unverified" in every surface.
+11. **Polite retries** — a forum fetch that meets a challenge page retries after N minutes up to M times (today a
+ shell wrapper): `fetch-posts {retryOnBlock:{minutes, max}}`, the job's log says each wait.
+
+## The MCP: what a Claude Code session did, as tools (lane D)
+- Web and archives: `web_search`, `web_fetch`, `wayback_lookup`, `archive_search` (read-only, through the editor's
+ paced ops) and `enqueue` kinds `import-page`, `capture-posts`, `find-copy`, `create-channel` (X never on a site;
+ sites only by the operator).
+- Case tools: `case_get`, `case_coverage`, `case_candidates` (build or read counts), `case_batch` (one batch's
+ wrapped text, paged), `case_findings_write` (append rows; schema-checked; privacy gate), `case_merge`,
+ `case_verify` (captions side by side; queue the audio check), `case_leads`.
+- The research agent (`research.ts`) gains `wayback_lookup`, `import-page`, `capture-posts` and `find-copy` as
+ proposals under its autonomy rules; `_researchEditor.ts` ROUTES extended.
+- `instructions.ts`: a `case_plan` (like `sweep_plan`) that tells an agent the stage order, the wrapped-batch rule,
+ the naming rule and the merge — the corpus discipline stays in code, not prose.
+
+## The video assistant (lane E) — "make the joins 0.15 s" on local Qwen
+- **Look ops** for `videoOps` (and the clip-project manifest): `{op:"look", key, value}` over `LOOK_KEYS`
+ (headerHeight, footerHeight, qr, transition, transitionStyle, loudness, captions, room, slide) validated by the same
+ validators `updateRender` uses; `{op:"clip_room", id, …}`, `{op:"clip_edges", id, start, end}` (within bounds),
+ `{op:"fx", id, param, value}` over a hyperframes composition's declared params (each fx module declares its tunable
+ params + bounds; `chrome-fx.mjs` / deck fx) — never free HTML.
+- **Ask box** on every project (Build tab's Look panel, a project-level note, the clip editor's side column): a request
+ in words → task `video-assist` (default route LOCAL; one schema-bound ask with the project's current look + cut view
+ trimmed to the prompt cap) → proposed ops shown as a diff ("transition 0.22 → 0.15 s") with **Apply** / **Dismiss**;
+ Apply goes through `updateRender` / the clip editor writer (token-guarded); nothing applies silently.
+ **Preview**: a short join preview render (the r36 `transition-<v>.mp4` 4-clip pattern) through the heavy slot.
+- Works for article videos (`revise-video` gains the look/fx ops) AND for clip projects (no article needed).
+- Manual path: the Look panel itself, now with the owed fields (slide travel/smear/grain, room tail/head).
+- Tests with the fake ollama/anthropic: requests → ops (a fixture table of 20 requests: "quicker joins", "no QR",
+ "louder", "smear less", "keep 2 s after the last word"); refusals for out-of-bounds values.
+
+## Lanes (parallel Opus implementers; dependency graph)
+- **0 (orchestrator, on main first):** the contract — `common/lib/research/caseTypes.ts` (case.json, candidate window,
+ batch, finding row, verify status, lead) + `common/lib/report/videoAssistTypes.ts` (look/fx/clip ops).
+- **A `r38/case-pipeline`** (stages 1–3, 5, 6, 9; case page UI; jobs + ops + CLI): after 0.
+- **B `r38/case-read`** (stage 4: candidate deck, `case-read` task api/local/code, quote check): after 0, parallel
+ with A (codes against the contract; wires to A's batch files after A merges).
+- **C `r38/case-verify-leads`** (stages 7, 8, 10, 11): after 0, parallel.
+- **D `r38/mcp-research`** (the MCP tools + research-agent tools + case_plan): generic tools now; case tools after A.
+- **E `r38/video-assist`** (look/fx/clip ops, Ask box, preview, Look panel fields): independent; first to launch.
+Merge order: E, A, C, B, D. Gates: tsc; common/editor/mcp/umtool/test:scripts; docs; e2e per lane + the full suites at
+the end; editor + umtool restarts.
+
+## First live use
+The Oneylyzer case re-run end to end through the app: coverage → candidates → local Qwen readers on the early batches
+and API readers on the coverage batches → merge → privacy gate → verify the 20 starred findings → export. And on the
+Nik Drop: "make the joins 0.15 s with less smear" from the Ask box on local Qwen, applied, previewed.