commit 74e70fac29663d486fa204eb0cbbd6425ad6098c
parent 5846ae957f7a78918f2fedcc21c758eaaeaf1201
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 18 Oct 2026 23:49:40 -0400
plans: release 35 — the clip finder (Archilyzer as an assisted clipping tool): pipeline, shared shapes, lanes C1/C2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 124 insertions(+), 0 deletions(-)
diff --git a/plans/release-35/clip-finder.md b/plans/release-35/clip-finder.md
@@ -0,0 +1,124 @@
+# Release 35 — the clip finder: Archilyzer as an assisted clipping tool (plan of record)
+
+Operator, 2026-10-18 night: "This should mark a significant step in adding the ability to use the Archilyzer as an
+AI-assisting clipping tool. Plan this out more fully and move some serious focus on it." And: "Add the ability in the
+UI for an easy way for a human to hop in and either comment or manually adjust clips created by an assistant."
+
+The first case: a 2 h 34 min reaction livestream (a host reacting to a narrated video; two very different voices),
+cut down to the funny parts — roughly, the stretches the host comments on, above all where he laughs. The output is
+a highlights video. The same machinery must serve any long recording in the corpus (streams, podcasts, panels).
+
+## The rules it is built under
+
+- **The UI works without AI** (operator, 2026-10-16). Every proposal a model or a heuristic makes, a person can make,
+ undo or adjust in the UI; the whole loop runs with no model at all. A model is an optional assistant on top.
+- **Deterministic first.** Speakers, laughs, moments and clip proposals come from local signal processing and local
+ models already in the repo's style (sherpa-onnx, TitaNet) — reproducible, no network at analysis time.
+- **Fetches through the editor, transcription through `pnpm ops`** (no yt-dlp or ASR by hand).
+- **umtool evolves with the video**: each review step is a umtool surface, never a TSV or a script under ~/reports.
+- **Comments are notes.** A comment on a clip is a `notes.json` note anchored to it (`{kind:"entry"}`) — the same
+ store and the same `umtool notes` agent loop (an assistant reads open notes, acts, replies, resolves).
+
+## The pipeline
+
+```
+video in the corpus (audio + saved video) ← editor: import-video, persist-videos
+ → words: `pnpm ops transcribe {path, words:true, out}` ← parakeet, word timings, into the project
+ → speakers: diarization.json (sherpa-onnx, existing) ← editor job / `archilyzer diarize backfill`
+ → roles: which cluster is the HOST, which the SUBJECT ← voice centroids + turn statistics; operator flips
+ → laughs: audio tagging (CED, AudioSet "Laughter" + kin) ← new: .diarize/models/<ced>, scripts/audio-tag.py
+ → moments: host comments + laughs, scored ← common/lib/clips/
+ → proposals: setup line → reaction → tail, snapped, merged ← common/lib/clips/
+ → manifest clips (report-video), each marked "by the assistant" ← `umtool new --seed reactions`
+ → REVIEW: the clip editor — keep/cut, trim, split/merge, add, comment
+ → render: a highlights take (hard cuts; optional speaker captions = release 35 O2's effects)
+```
+
+### Roles (host vs subject)
+Diarization gives anonymous clusters. The host is decided by, in order: an operator-marked reference (a span the
+operator says is the host — the editor's speaker strip has "This is the host"), else a heuristic: in a reaction stream
+the subject talks in long continuous turns (the narrated video plays), the host in short interjections spread across
+the whole stream; the cluster with the most turns under 8 s and the widest spread is the host. Clusters that are the
+same voice split in two are merged by TitaNet centroid cosine (≥ 0.6). Every role carries `how: "auto"|"operator"`.
+
+### Laughs
+CED-mini (sherpa-onnx `AudioTagging`) over the audio in 1 s windows, hop 0.5 s: the AudioSet laughter family
+(Laughter, Giggle, Chuckle/chortle, Belly laugh, Snicker) summed → a laugh score per window; runs where the score is ≥
+`laughMin` (default 0.25, calibrate on the first case) become laugh events, attributed to the speaker active then.
+Fallback when the model is absent: transcript markers (`[laughter]`, `haha`, `lol`, `lmao`) and the host's voiced
+energy bursts with no words. A laugh by the host is the strongest signal.
+
+### Moments and proposals
+A moment: a host laugh (score = laugh strength × duration), a host comment (a host turn ≥ 1.5 s of words; score by
+length and by the laugh around it). A proposal: from the start of the subject sentence that set it up (the last
+subject turn before the moment, back to a sentence/cue boundary, at most `setupMax` 20 s) to the end of the host's
+reaction (the end of his turn or laugh) + a tail to the next silence (≤ 1.5 s); edges snapped to word gaps / silence.
+Proposals closer than `mergeGap` (6 s) merge; each capped at `clipMax` (75 s); ranked by score; the top ones kept
+until `target` seconds (default 600) — the rest stay listed as `unused` so the operator can bring one in with a click.
+Chronological order in the cut.
+
+## The shared shapes (exact — both lanes code against these)
+
+`<project>/reactions.json` — OWNED BY C1 (written by the analysis; the editor only reads it, except `speakers[].role`
+which the editor may set through C1's exported writer `setSpeakerRole`):
+
+```json
+{ "version": 1,
+ "source": { "channel": "slug", "video": "id", "duration": 9278.0,
+ "words": "words.json" | null, "diarization": { "generatedAt": "ISO", "engine": "sherpa-onnx" } },
+ "params": { "target": 600, "laughMin": 0.25, "mergeGap": 6, "setupMax": 20, "clipMax": 75 },
+ "speakers": [ { "index": 0, "role": "host"|"subject"|"other", "label": "Host", "seconds": 1234.5,
+ "turns": 812, "how": "auto"|"operator" } ],
+ "turns": [ { "start": 1.2, "end": 4.8, "speaker": 0 } ],
+ "laughs": [ { "start": 61.0, "end": 63.5, "score": 0.71, "speaker": 0 } ],
+ "moments": [ { "id": "m001", "t": 61.0, "kind": "laugh"|"comment", "score": 0.83, "speaker": 0,
+ "text": "the words around it" } ],
+ "proposals": [ { "id": "p001", "start": 48.2, "end": 66.0, "score": 0.83, "moments": ["m001"],
+ "used": true, "clipId": "r001", "why": "host laughs 2.5 s after the narrated line" } ] }
+```
+
+Manifest clip entries the seed writes: the ordinary report-video clip (`type:"clip", id, channel, video, start, end,
+cutStart, cutEnd, quote, title?`) plus one new optional key, `assist` — OWNED BY C1 (validator + docs):
+
+```json
+"assist": { "by": "assistant"|"operator", "proposal": "p001", "score": 0.83, "why": "…",
+ "original": { "start": 48.2, "end": 66.0, "cutStart": 49.0, "cutEnd": 65.4 },
+ "edits": [ { "at": "ISO", "by": "operator", "what": "trim"|"split"|"merge"|"add"|"restore",
+ "from": { "cutStart": 49.0, "cutEnd": 65.4 }, "to": { … } } ] }
+```
+
+`by` flips to `"operator"` on the first human edit; **Restore** puts `original` back. A clip the operator adds from the
+strip has `by:"operator"` and no `proposal`. Rulings (keep / cut) reuse `montage-rulings.json` keyed by
+`clipMomentKey` (release 34) — renamed nowhere; for a reactions project the deck offers Keep / Cut only.
+
+## Lanes (two Opus implementers in parallel, then the orchestrator runs it live)
+
+- **C1 `r35/clip-analysis` (common + scripts + umtool seed/CLI):** `common/lib/clips/` (roles, laughs, moments,
+ proposals — pure functions over turns/words/laugh windows, unit-tested on synthetic data), `scripts/audio-tag.py`
+ (sherpa-onnx AudioTagging, modelled on speaker-embed.py; model at `.diarize/models/<ced dir>`), the laugh scan in
+ JS (`decodeSpan` from voiceMatch), `umtool new <slug> --seed reactions --from <channel>/<id> [--target S]` and
+ `umtool clips analyze|propose <project> [--target S] [--host <speaker>]` (re-propose after a role flip or a param
+ change, never touching clips the operator edited), the `assist` key in the manifest validator, the New project
+ form's "highlights from a recording", docs, FACTS, record `plans/release-35/clip-analysis.md`.
+- **C2 `r35/clip-editor` (umtool UI):** the clip editor — `/projects/<id>/clips` grows an editor mode for report-video
+ projects (the montage deck stays as it is): a player looping the selected clip from the saved video; under it a strip
+ for the clip's neighbourhood (± 60 s) with the speaker turns in two colours, laugh marks, the words; in/out handles
+ (drag), nudges (±0.1 / ±0.5 / ±2 s), Snap to word / silence; Keep / Cut; Split here; Merge with next; Add a clip from
+ a selection on the strip; Restore the assistant's version; the clip's provenance ("by the assistant · score · why",
+ "edited by you"); a comment box writing a note anchored to the clip, with the thread (agent replies) shown; a list
+ of unused proposals to bring in; "This is the host" on the strip (calls C1's `setSpeakerRole`, then offers
+ Re-propose); Render a take. All writes through one server writer (`updateClip` + an `assist.edits` append);
+ keyboard: J/K/L, I/O set in/out, S split, M merge, K keep, X cut. Works on any report-video project (no reactions.json
+ → no strip colours, still trims/comments). e2e `clip-editor.spec.ts` on a fixture project; record
+ `plans/release-35/clip-editor.md`.
+
+The orchestrator: runs the live pipeline on the first case, renders the first cut BEFORE the lanes land (by driving the
+same steps from the CLI where they exist), then re-runs it through the shipped feature, merges, gates, ships umtool.
+
+## Later (owed, not tonight)
+- An optional model pass (`umtool clips suggest`, through `settings.generation`): ranks or labels proposals ("why
+ it's funny") and answers clip notes — writes notes as `author:"agent"`, never edits clips silently.
+- Vertical/short exports (9:16 with the speaker cropped), per-clip export for sharing.
+- The editor's own job for the whole chain (import → words → diarize → analyse) as one button on a video page:
+ "Find clips".
+- Multi-host streams (more than two roles), chat-replay signals (Twitch chat bursts) as a moment source.