commit 95163cce110b76d2c1bff370c1f268eb55bd8531
parent f6a28a5cf1db2bebc8c5894a414c7b8327aecb14
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 18 Oct 2026 17:16:54 -0400
docs: the phrase finder — umtool/docs/tools.md (the page), cli.md (`umtool phrases`), FACTS (phraseScanMany, the cue-text cache, the store, Create montage's scan), CHANGELOG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## [Unreleased]
+- **Find the next montage phrase in umtool, with no model.** Tools → **Phrases** (`/tools/phrases`) searches several phrases at once across the channels you pick: type plain words (a caption's commas, hyphens and a plural are allowed for) or a regular expression, choose a channel to cut from where it holds the same stream and a pattern to leave out, and press **Search**. It runs as a job with its progress and a Stop. For each phrase you see how many times it was said (a stream and its clip upload counted once), a bar per year, how many are on Rumble and how many elsewhere, how many have a speaker change in the captions, and ten moments spread over the years, each with **Play** and **Transcript** (the lines around it); several phrases are ranked side by side. **Create montage** makes a report-video project from that search, exactly as the new-project form's phrase seed would, and opens it. A catchphrase report's `candidates.json` under the reports folder shows as suggestions. The page remembers your last search. The same search from a terminal: `umtool phrases "<phrase>" … --channels a,b --prefer c`. A second search over the same channels reads a cache and takes seconds instead of most of a minute. Needs a restart of umtool.
- **Report videos cut clips from Rumble windows on the right second.** Some downloaded windows (Rumble's) keep their source's clock, so their picture starts a second or two in, and every cut from one landed that much late — in the slow-news montage, one clip's "slow news week" fell into the pause after it. The build now reads where such a window's picture starts and cuts on its own clock (and says so in the build log). In a montage with even loudness, a clip or wall tile that measures near-silent is taken for a phrase looked for in the wrong place: it is found again by the sound — the speech nearest where it was expected — recorded, said in the log, and never boosted from silence.
- **Montages are level, and their walls don't repeat themselves side by side.** With `render.montage.loudness` (every montage style has it, at −16 LUFS), each clip and each wall tile is measured and brought to the same loudness, with a limiter so a quiet clip raised up cannot clip — an old upload and a recent stream no longer jump in level at the cut. `wall.spread: "stream"` keeps two clips of one stream, or a stream and its mirror on another platform, from touching in the wall's grid, and `wall.distinct` takes one clip per stream when there are enough. `wall.label` puts each tile's year, its number or both in its corner. Build to the wall uses all three. Manifests without them render exactly as before.
- **A montage can build to its wall.** The closing wall can fill in groups of 1, 1, 2, 4, 8 … tiles, each group sliding in on a beat that comes a little sooner than the last; a group says the phrase together, with every tile's first syllable placed on the beat (from whisper's word timings, or from the captions checked against the sound), and at the end every tile says it on the same frame. The wall can take the latest clips instead of a spread (`wall.clips: "tail"`) and take them out of the run before it (`wall.exclusive`), so it condenses the repetition instead of repeating it; the count before it then stops where the wall begins. A ramp can end at the wall's first beat (`ramp.into: "wall"`), so the cuts speed straight into it. A seventh style, **Build to the wall**, puts these together: whip cuts getting shorter, tally marks, then the latest twenty-five in synced groups. Manifests without the new keys render exactly as before.
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -10493,3 +10493,37 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
estimate; tuned on s38/s70) → recut; records `montage.loudness.relocated {from, to, why}` and `montage.found: "sound"`; a wall-only tile:
`montageWall.sync[].relocated`. `loudnessGain` is 0 under −40 LUFS. Consensus shifts failing `shiftAllowed` (−10 dB)
keep the estimate (`by: "estimate"`, `held`).
+
+## Release 34 lane N3: the phrase finder (verified 2026-10-18, branch `r34/phrase-finder`)
+
+- `phraseScanMany({channelsDir, channels, phrases: [{id, phrase, exclude?}], prefer, exclude, cacheDir?, concurrency?,
+ onProgress?})` (common/lib/montage/phraseScan.mjs) → `[{id, phrase, instances, hits, dropped, scanned}]` in the
+ order given; each phrase's `{instances, hits, dropped, scanned}` deep-equals `phraseScan` for that phrase alone (unit
+ tests in every cache state; the real corpus, 7 phrases incl. slow-news, 2026-10-18). `phraseScan` is unchanged in
+ behaviour; both share `foldHits`. `onProgress({done, total, channel, channelsDone, channels})`, every 250 videos and
+ per channel.
+- The cue-text cache (common/lib/montage/cueTextCache.mjs, `CACHE_VERSION` 3):
+ `<cacheDir>/<sha1(resolved channelsDir)[:12]>/<encodeURIComponent(slug)>.ndjson` (one line per video, video-id order:
+ `{"id", "r": {uploadDate, duration, title, platform, source, j: texts joined by "\n", a: starts, b: ends} | null}`)
+ and `.index.json` (`{version, slug, videos: {id: [mtimeMs, size]}}`). Streamed a line at a time; rewritten (temp +
+ rename) only when a cue file's mtime/size changed, one appeared or one went; a line the index promised and the file
+ lacked → the index is deleted (rebuilt next search). umtool's is `<UMTOOL_CACHE_DIR>/phrase-text` (real corpus,
+ 5 Quartering channels: 473 MB).
+- Measured 2026-10-18 over the-quartering-rumble (prefer) + the-quartering, jeremy-hambly, quartering-live,
+ cornbreadman = 23,312 transcripts, page cache warm: `phraseScan` one phrase 27.5 s / 560 MB RSS; `phraseScanMany`
+ one 17.3 s / 192 MB, 25 phrases 29.0 s / 424 MB; cache build 36.3 s / 336 MB; cache warm one 6.4 s / 168 MB, 25
+ 20.8 s / 278 MB (25 phrases are regex-bound).
+- `phraseSourceOf(text, mode)` (common/lib/montage/phraseSource.mjs, no node imports, client-safe): `auto` = regex when
+ the text holds `\ ^ $ . | ? * + ( ) [ ] { }`, else words → `\b` + words joined by `[\s,.\-]+` (apostrophe →
+ `['’]?`) + optional plural on the last word (`(?:s|es)?`; consonant+y → `(?:y|ies)`; none after s or a digit) + `\b`.
+- umtool: `/tools/phrases` (`phraseFinderHref({q, scan})`); a search is a child process `umtool phrases --spec <f>
+ --out <f> --progress` (one at a time; registry on `globalThis.__umtoolPhraseScans`); the store is
+ `<UMTOOL_CACHE_DIR>/phrase-finder/{scans,specs}/ps-<UTC yyyymmddhhmmss>-<6 hex>.json` (last 20) and `last.json`
+ (the page's defaults). API: `GET|POST /api/phrase-finder`, `GET|DELETE /api/phrase-finder/<id>`,
+ `GET /api/phrase-finder/context?channel&video&at`.
+- Create montage posts `/api/projects/new` with the phrase seed's settings plus `scan: {id, row}`; `scaffoldProject`
+ loads that row (`scanRowFor`, refused unless phrase source, channels, prefer and exclude match exactly) and passes it as
+ `scaffoldReportVideo({scan})`, which uses it instead of `phraseScan`. The phrase seed's channel check is now
+ `CHANNEL_SLUG_RE` (`/^[A-Za-z0-9][A-Za-z0-9._-]*$/`): mixed-case channel dirs (HasanAbiVODs3) were refused before.
+- Suggestions: `UMTOOL_PHRASE_CANDIDATES` (`:`-separated paths) else every `<REPORTS_ROOT>/<dir>/candidates.json` with
+ `scanned: [{key, regex, instances?, spark?}]` (the catchphrase report's shape).
diff --git a/umtool/docs/README.md b/umtool/docs/README.md
@@ -15,7 +15,7 @@ anywhere), Pinned, the **Running** list with today's API spend, and the theme (*
| A series or watch | `/series/<id>`, a triage run `/series/<id>/triage/<k>` | [recurring.md](recurring.md), [triage.md](triage.md) |
| The benches | `/projects/<path>/clip/<id>`, `…/claim/<id>`, `…/narration`, `…/takes`, `…/review`; a song's cut `/projects/<path>/<cut>` | [piece.md](piece.md#the-benches) |
| Create | `/create` (`?make=`, `?from=`, `?case=`, `?article=`) | below |
-| Tools | `/tools`, `/tools/{find,mix,faces,sources,bench}`, `/tools/song[/<mode>]`, `/tools/trim/<set>` | [tools.md](tools.md) |
+| Tools | `/tools`, `/tools/{find,mix,phrases,faces,sources,bench}`, `/tools/song[/<mode>]`, `/tools/trim/<set>` | [tools.md](tools.md) |
| Settings | `/settings`, `/settings/generation`, `/settings/system` | [settings.md](settings.md) |
**Create** is one list, "What are you making?" — j/k move the lit line, Enter opens its form, Escape closes it; the
@@ -123,7 +123,7 @@ root. See [report-video.md](report-video.md#one-manifest-two-cuts).
| [refresh.md](refresh.md) | Refresh: fetch what is new, check it, update; the daily check |
| [recurring.md](recurring.md) | Recurring reports: living reports, series and watches, the schedule, the series page |
| [triage.md](triage.md) | Triage first: the cheap pass, its tiers, flags and marks, Worth researching |
-| [tools.md](tools.md) | The song piles, find, mix, faces, sources, trims, the verdict bench |
+| [tools.md](tools.md) | The song piles, find, mix, the phrase finder, faces, sources, trims, the verdict bench |
| [settings.md](settings.md) | The generation policy and spend; the system page; `umtool doctor` |
| [report-video.md](report-video.md) | The manifest as an EDL, the three-stage window model, `lock` |
| [clip-bench.md](clip-bench.md) | Editing a clip's window against the waveform and the cues |
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -42,6 +42,7 @@ Inbox cannot disagree about what is wrong with one.
| `take <project> --id <id> --label L [--group G] [--kind similar\|different] [--summary S] [--style NAME] [--patch FILE \| --patch-json JSON \| --set path=value …] [--at S --dur S \| --full] [--quick] [--force] [--progress ndjson]` | one **take**: the manifest with a montage style's patch, then the take's own, rendered into `takes/<id>/` (the Takes page's New take); `--id <id> --rebuild` makes one again from its own `take.json` ([report-video.md](report-video.md#making-takes)) |
| `takes make <project> [--recipe FILE] [--only ID,ID] [--force]` · `takes make <project> --all-styles [--group G] [--at S --dur S \| --full]` | a recipe's takes, one at a time (default `takes/recipe.json`); every montage style, one take each (Make all styles); **exit 1** if any failed |
| `takes styles [--json]` · `takes pick <project> <take> [--anyway] [--json]` | the montage styles; **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway` |
+| `phrases "<phrase>" ["<phrase>" …] --channels a,b [--prefer c] [--exclude RE] [--words \| --regex] [--samples N] [--no-cache] [--json \| --full]` | the phrase finder's search ([tools.md](tools.md#the-phrase-finder-toolsphrases)): every phrase in one pass, each with its count once folded, by year, the preferred channel's share or Rumble's, speaker changes, sample contexts. Plain words become a tolerant pattern unless the phrase holds a regular expression's characters. `--json` the numbers, `--full` every instance; `--spec FILE --out FILE --progress` is the page's job form. **Exit 1** on a bad phrase |
A project argument is an exact id, a directory, or a **unique** basename. Two
projects answering to one name is reported, never resolved by picking one.
@@ -49,7 +50,7 @@ projects answering to one name is reported, never resolved by picking one.
## Environment
`REPORTS_DIR`, `SONG_REPORTS_DIR`, `SONG_DIR`, `CHANNELS_DIR`, `UMTOOL_INDEX_DIR`,
-`UMTOOL_CACHE_DIR`, `UMTOOL_MEDIA_DIR`
+`UMTOOL_CACHE_DIR`, `UMTOOL_MEDIA_DIR`, `UMTOOL_PHRASE_CANDIDATES` (the phrase finder's suggestion files)
— which is how it is tested against the e2e fixture (which also sets
`E2E_UMTOOL_MONTAGE_STYLES`, the montage styles module `take`/`takes` read in place of
`report-to-video/montage-styles.mjs`). The path defaults
diff --git a/umtool/docs/tools.md b/umtool/docs/tools.md
@@ -2,13 +2,15 @@
## `/tools`
-Two lists. **Song**: song piles, find, mix, faces, sources, a trim set. **Articles**: the verdict bench. While you are in
-a tool the rail opens Tools into its tools: find · mix · **song ▸** (the four piles) · faces · sources · bench.
+Three lists. **Song**: song piles, find, mix, faces, sources, a trim set. **Montage**: the phrase finder. **Articles**:
+the verdict bench. While you are in a tool the rail opens Tools into its tools: find · mix · phrases · **song ▸** (the
+four piles) · faces · sources · bench.
| Tool | Address | What it is |
|---|---|---|
| Song piles | `/tools/song`, `/tools/song/<mode>` | the clip-judging deck, one pile at a time: `sort` (candidate clips never judged), `salvage` (clips parked as unclean, offered again), `verify` (accepted clips the risk check flagged, riskiest first), `keeps` (clips kept on purpose for a stray word, to side). `?limit=`, `?only=<ids>` |
| Find | `/tools/find` | every occurrence of a word across the song corpus: a GET form (`?q=`, `?page=`, `?list=<shortlist>`), filters as links, so a view is one pasteable URL |
+| Phrases | `/tools/phrases` | how often phrases were said, by year, across the channels picked, and a montage from one ([the phrase finder](#the-phrase-finder-toolsphrases)). `?q=` prefills a phrase, `?scan=<id>` reopens a search |
| Mix | `/tools/mix` | the mix bench: set the handover and the end point, hear it, render it. A clip deep-links in with `?body=&start=&end=&from=&clip=` ([mix-from-a-project.md](mix-from-a-project.md)) |
| Faces | `/tools/faces` | every cover corner on record, deduped by episode and moment, the ones that ship first: judge the crop (`face-verdicts.json`, which `make-thumb.mjs` reads; the page never touches the thumb manifests). The dashed box is what `facecrop.py` would cut, the solid one yours. `?cover=` / `?key=` open one |
| Sources | `/tools/sources` | where the song palette comes from: placements (the finished runtime an episode supplies) and clips (the palette) per episode — different units, both shown, never summed — the top episode, the top five, how many cover half |
@@ -19,6 +21,45 @@ A song's own page links its piles, find, mix and sources (its Overview's Song to
The old addresses (`/sort`, `/salvage`, `/verify`, `/keeps`, `/mix`, `/bench`, `/browse/find`, `/browse/faces`,
`/browse/sources`, `/browse/trim/<set>`) redirect here.
+## The phrase finder (`/tools/phrases`)
+
+Finding the next montage phrase, with no model. Type phrases — one row each, **Add phrase** for another — pick the
+channels, and **Search**: every phrase in one pass over the transcripts.
+
+- **A phrase** is plain words or a regular expression, and the row says which it was read as. Plain words become a
+ tolerant pattern: any run of spaces, commas, full stops or hyphens between the words, an apostrophe or none inside
+ one (`dont` finds `don't`), an optional plural on the last word (`day` → `days`, `story` → `stories`), whole words
+ only. A phrase with a regular expression's characters (`\ ^ $ . | ? * + ( ) [ ] { }`) is taken as written; the row's
+ select forces either. Case never matters.
+- **Channels**: the ones with transcripts, filtered by typing. **Prefer** is the channel to cut from where it holds a
+ copy of the same stream (a Rumble upload of a YouTube stream); **Exclude** leaves out a hit whose words around it
+ match (a chat line read out). These are the new-project form's phrase seed's own settings, and they fold the same:
+ a rolling caption's repeat is one hit, a stream and its clip upload are one instance, a hit on another channel is
+ cut from the preferred copy when its words are found there ([report-video.md](report-video.md)).
+- **The search** runs as a job (`umtool phrases --spec … --out …`), with its progress (transcripts read, the channel)
+ and **Stop**. Its answer is kept under the cache (`<UMTOOL_CACHE_DIR>/phrase-finder/`, the last 20); **Recent**
+ reopens one. The next visit opens on the last search's phrases and settings.
+- **Per phrase**: the times it was said once folded and the years they span, a bar per year, how many are on Rumble
+ and how many elsewhere, how many have a caption speaker change (`>>` — listen for who says it), how many were placed
+ in the preferred copy by their words, how many the exclude left out, the raw hits; each channel's count. Then ten
+ contexts spread over the years, each with **Play** (the clip window or saved video on disk; else **Fetch clip**, the
+ editor's managed fetch) and **Transcript** (the cues around it, read where it was said). With several phrases,
+ **Compared** ranks them side by side.
+- **Create montage** (the slug prefilled from the phrase) makes a report-video project seeded from THIS search — the
+ phrase seed with these exact settings, its `phrase-scan.json` the search's answer, nothing read again — and opens it.
+ A search whose settings no longer match is refused ("search again").
+- **Suggestions**: the phrases of a catchphrase report's `candidates.json` (`{scanned: [{key, regex, instances}]}`):
+ every `<REPORTS_DIR>/<dir>/candidates.json`, or the files `UMTOOL_PHRASE_CANDIDATES` names (`:`-separated). One
+ click adds the phrase as a row. None found, none shown.
+
+A second search reads a cache of each channel's cue text (`<UMTOOL_CACHE_DIR>/phrase-text/`, one file per channel,
+streamed; a video's entry is used while its `transcript.cues.json` keeps its modification time and size). Measured
+over five channels (23,312 transcripts): one phrase 17 s cold, 6 s from the cache; 25 phrases 29 s cold, 21 s from
+the cache. Delete it at any time.
+
+From a terminal: `umtool phrases "<phrase>" ["<phrase>" …] --channels a,b [--prefer c] [--exclude RE]`
+([cli.md](cli.md)).
+
## The deck (`/tools/song/<mode>`)
A clip at a time, its verdict and reason codes by key. Some of the keys: space play, `[` / `]` +1 s left / right, `,`