--- name: demo-recorder description: Use when the user wants a scripted screen-recording demo video of a web app, a storyboard, narration script or text-to-speech voice-over for one, or a dubbed cut. metadata: version: 2026-12-01 --- Drives headless Chromium through a scripted walkthrough, encodes a silent 3K 60fps `demo.mp4`, then optionally voices the narration with Cloney, fits the recording to the voice and dubs it on. Below, `$M` means `make -f /Makefile` and `` means `~/Downloads/demo-recorder//`; run `$M` from the directory holding `demos/`. `$M help` lists the targets and variables; each script in `scripts/` takes `--help`. ## Workflow 1. Create a task per step below, phrased with its completion criterion, then work them to completion. 2. Write `demos/.mjs` exporting `options`, `setup()`, `run(h, ctx)` and `teardown(ctx)`, modelled on `assets/examples/openspeccer.mjs`; the `h` helpers are in `scripts/lib/recorder.mjs`. 3. In `setup()`, record against a throwaway copy of the target so on-camera edits leave the user's repo untouched. 4. Call `h.scene("")` at the start of each narrated section, and put an `h.wait` after each thing the narration names. 5. Write `demos/.md`: one `## N. Title` section per scene in recording order, an `_On screen: ..._` note, then the spoken text (example: `assets/examples/openspeccer.md`). Each sentence describes what is on screen while it is spoken. A section with no spoken text is a silent scene. 6. Run `$M record encode DEMO=demos/.mjs`. Done when `/timings.tsv` lists every scene and you have viewed every image in `/stills/`. 7. Fix what the stills show (missed click, wrong tab, personal paths via `options.hide`), then repeat step 6. 8. Spell-check the narration, run `$M storyboard DEMO=demos/.mjs` and give the user the page it prints, which shows each scene's still with its narration as subtitles. Done when they approve the screens and the narration. Audio renders are slow and a reworded section re-renders, so no audio is rendered before this. 9. Ask which Cloney character and engine to use (offer `$M voices`; defaults are in `scripts/narrate.sh --help`), unless the user records clips themselves as `N.wav` in `/audio/`. If a `cloney` skill is available, activate it first; otherwise `cloney --help` covers the CLI. 10. Run `$M fitted DEMO=demos/.mjs VOICE= ENGINE=`. It renders the clips, scales each scene's `h.wait` pauses so the scene ends just after its clip, records again and dubs. Done when the narrate table has no FAILED row, the fit table has no note asking for more or fewer actions, and the dub table has no "runs past scene" and no `(no clip)` row other than silent scenes. 11. View the new images in `/stills/`, then report `/demo-dubbed.mp4`. ## Storyboard first When the story or the screens are unsettled (a pitch, mocked screens, several segments), get a storyboard approved before writing any `.mjs`: 1. Write the `.md` scripts, and each screen as a local HTML page with one URL per state (`page.html?step=2`); storyboard shots cannot be clicked. 2. Under each section's `_On screen:_` note add `_Shots: ../mocks/page.html, ../mocks/page.html?step=2_`, and write one paragraph of narration per shot. 3. Run `$M storyboard DEMOS='demos/*.md' CAP= PREVIEWS=1` unsandboxed. Done when it reports no missing shot, the estimate is under the cap, and you have viewed every PNG in the previews folder it prints. 4. Fix what the previews show, then give the user the page path. They step through with the arrow keys, type notes per beat and paste back what "Copy my notes" gives them. 5. Apply their notes and rebuild. Done when they approve; then continue the workflow at step 2, opening the same pages in the demo. `scripts/storyboard.mjs --help` lists where shots come from and the estimate's settings. To change the page itself, copy `assets/storyboard.html` beside the demos, edit the copy and pass it as `TEMPLATE`. ## Longer videos and more voices - **Segments:** write one demo per segment so each re-records alone. `$M each DO="record encode" DEMOS="demos/*.mjs"` runs targets for every demo; `$M join DEMOS="demos/*.mjs"` joins the cuts in filename order without re-encoding. - **Another voice:** add `TAKE=