Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f3796b3c4ad879c278a888deda02076690a17b0c
parent f68db9ca87c4514db8632fd1e608f53c60d857ba
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 19 Oct 2026 11:21:47 -0400

plans: release 36 — the clip finder, round two (plan of record)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aplans/release-36/clip-finder-2.md | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+), 0 deletions(-)

diff --git a/plans/release-36/clip-finder-2.md b/plans/release-36/clip-finder-2.md @@ -0,0 +1,110 @@ +# Release 36 — the clip finder, round two: one button, a clean look, captions, shorts, chat, an optional AI pass (plan of record) + +## Context + +Release 35 (main `ff6d0fbb`) made Archilyzer an assisted clipping tool. The first case, "The Nik Drop" (a reaction +livestream, 9278 s), was cut by the clip finder and adjusted by the operator in the clip editor (one clip cut, a +comment brought in, no on-screen UI, fade-through-black joins). Running it live exposed the hand work that is still +not a button: +- the chain (persist video → word timings → transcript → speakers → `umtool new --seed reactions` → `clips analyze`) + was run step by step from a shell; transcription had to be forced through a PAUSED worker pool by hand; +- the scope (where one narrated video ends and the next begins) was found by reading speaker clusters by hand; +- the render look (no header/QR, transitions) was a jq edit of the manifest; QR links for a site-less channel by hand; +- no captions, uneven loudness (−19 LUFS), no shareable shorts, the stream's chat ignored. + +Operator, 2026-10-19: focus on the clip finder, round two, with **speaker captions, vertical shorts, an AI "why it's +funny" pass, and live chat as a signal**; next real case: **the rest of the Nik Drop stream** (the second narrated +video, ≈6500–9278 s) as the fresh test — the first example is a **re-cut of the first half** through the new features. +Standing rules: the UI works without AI (every model step optional, every step a button); no yt-dlp/ASR by hand +(editor + `pnpm ops`); umtool evolves with the video; comments are notes; Docker first-class. + +## Shared shapes (all lanes code against these; additive, optional keys) + +`reactions.json` (release 35 C1's file, `common/lib/clips/reactions.mjs`): +- `segments: [{id:"s1", from, to, subject, host, why}]` — the narrated-video spans found in the recording (auto-scope). +- `chat: {source:"live_chat.cues.json", lagS, bins:{hop, rate[], laugh[]}} | null`; moments gain `kind:"chat"`. + +Manifest `render` (report-video; validated in lint + build like `validateTransitionStyle`, report-to-video/transition.mjs): +- `captions: {style:"speakers", labels?:{host,subject}, size?:"m"|"l"} | absent` — burned-in, speaker-coloured. +- `loudness: {target:-16} | absent` — per-clip gain toward the target (montage's helpers). +- existing: `headerHeight`, `footerHeight`, `qr`, `transition`, `transitionStyle`. + +Clip entry: `vertical: {crop:[x,y,w,h]}` (fractions of the source picture) — the 9:16 short's framing. + +`<project>/clip-suggestions.json`: `{model, at, items:{<proposalId>:{label, why, rank}}}` — the AI pass's output only. + +umtool route contract used by the editor: `POST /api/report/clips {mode:"new", slug, from:"<ch>/<id>", target?, +scope?|"auto", wordsPath?}` and `{mode:"analyze"|"propose", project}` with `Authorization: Bearer WORKER_TOKEN` → +`{jobId}`; `GET ?job=<id>` for progress (`umtool/app/api/report/clips/route.ts`, extended). + +## Lanes (parallel implementers in worktrees; D after B merges) + +### A — editor: "Find clips" on a video page (`r36/find-clips`) +1. **Run while paused** for one manual job: `transcribe-file` / `transcribe-one` body `whilePaused: true` (and a + "Transcribe now (workers paused)" button). In `common/jobs/workerPool.ts` the acquire carries the flag; `eligible()` + may lease a worker that is disabled ONLY by the pause (its `pausedSnapshot` state is `enabled`), never one drained, + degraded or turned off by hand; the snapshot is not touched. +2. **Chat replay for one video**: ensure `transcript.live_chat.json` + `live_chat.cues.json` exist (the chat-only fetch + path in `common/ytdlp/downloadOneManaged.ts`, `common/controller/normalizeLiveChat.ts`) — an ops action if one does + not exist (`fetch-chat {slug,id}`), paced like any YouTube request; YouTube only. +3. **`find-clips` job**: persist video (if none saved) → corpus transcript (if none) → word timings → chat (if YouTube) + → diarization → umtool `POST /api/report/clips {mode:"new", …, scope:"auto"}`. Each step skipped when its output + exists; the job log names each. `pnpm ops find-clips {slug,id,target?,whilePaused?}` + a **Find clips** button in + the video page's operations, linking the umtool project when done. +4. Tests: workerPool unit tests, the chain with stubs, editor e2e for the button; COMMANDS.md regenerated. + +### B — analysis: auto-scope, chat, site-less links (`r36/clip-analysis-2`) +1. **Auto-scope**: narrated-video spans where one long-turn cluster dominates (sliding 5-min windows; host-only gaps + folded into the neighbouring span) → `segments`; `--scope auto`; `clips segments <project>`; roles per segment. +2. **Chat signal**: 2 s bins of message rate + laugh tokens; chat lag by cross-correlating chat-laugh with the CED + laugh score (0–20 s; default 6 s); a burst ≥ 2.5× the local median → a `chat` moment at (t − lag), weighted below + a host laugh. Absent chat = today's behaviour exactly. +3. **Site-less links**: `citeUrl` = the platform watch URL `&t=<s>` when the channel is on no site; `provenance.channel` + from metadata. +4. **Default look for a site-less, one-video cut**: `headerHeight:0, footerHeight:0, qr:false, transition:0.5, + transitionStyle:"fadeblack", loudness:{target:-16}`. +5. umtool route `/api/report/clips` accepts the worker token and `mode:"new"`. +6. Tests on synthetic two-video streams + synthetic chat; docs; FACTS. + +### C — render + UI: the Look panel, loudness, speaker captions, vertical shorts (`r36/clip-look`) +1. **Look panel** (umtool): header, QR, transition length + style, loudness, captions + labels; writer + `updateRender(dir, patch, {token})` (model `updateChrome`), route `/api/report/render`. Never touches `render.chrome`. +2. **Loudness**: `render.loudness.target` → measure each cut window → `levelFilters(loudnessGain(...))` at the clip + encode. Absent = byte-identical. +3. **Speaker captions**: an ASS file per segment from `words.json` (else transcript words) + `reactions.json` turns + (host one colour/side, subject another; labels from `speakers[].label`), 2–6 words per line, burned with `ass=`. +4. **Vertical shorts**: **Make a short** → `<project>/shorts/<clipId>.mp4` 1080×1920 from `vertical.crop` (9:16 box + dragged on the player; default centre), large captions, no header/QR, loudness; through the heavy slot. A + **Shorts** list on the Deliver tab. +5. `umtool build <project> --run` calls the build route over HTTP. +6. Tests: ASS timing, caption colours by pixel, loudness ±0.5 LU, 1080×1920 short; byte-identical without new keys; e2e. + +### D — the optional AI pass (`r36/clips-suggest`, after B) +1. **`clips-suggest` generation task** (pattern: `verdicts`): per proposal, its words labelled by speaker → + `{label, why, rank}` → `clip-suggestions.json`. Never edits a clip. Routed by `settings.generation`. +2. **Clip editor**: labels, "Sort by the assistant's rank", **Suggest**; everything works with no suggestions. +3. **Ask the assistant** on a clip's note thread → an `author:"agent"` reply with an optional concrete proposal shown as + an **Apply** button (the operator's click performs it; never applied silently). +4. Tests with a fake model; docs. + +## The live cases (after A + B + C merge; D's pass when it lands) + +1. **Re-cut of the first half** (existing project, scope s1): Find clips → steps skip what exists, chat fetched, + segments found; s1 re-analyzed in the EXISTING project (operator edits stand; chat proposals show as unused). + Look: speaker captions on, loudness −16, no-UI + fadeblack kept. Render (old output kept as `.v2.mp4`) + a short. +2. **Fresh test, the second half**: Find clips → a new project scoped to s2 by auto-scope, the site-less look; review; + render + a short. + +## Order and gates + +Merge `--no-ff` B → A → C → D; full gate (tsc, common, test:scripts, umtool, docs checks) + umtool e2e whole suite + +editor e2e → umtool ship + an editor restart. Record `plans/release-36.md`. + +## Verification + +- workerPool: paused pool + `whilePaused` leases only a pause-disabled worker; the snapshot unchanged; auto jobs held. +- Auto-scope on the Nik Drop finds two segments within ±60 s of 6300 / 6500; chat lag estimated and logged. +- Render: a manifest without the new keys renders byte-identically; captions follow the turns; integrated loudness + within ±1 LU of −16; the short is 1080×1920, crop as set. +- Live: the re-cut keeps every operator edit and gains captions + −16 LUFS; the second half rendered from the button + path with no shell steps between Find clips and Render.