/demo:capturefrom demo
Film a real web app, logged in or public, SPA or multi-page, as clean re-recordable product footage. Drives real clicks through Playwright and films it deterministically (every frame rendered on demand, 2560x1440 lossless at exactly 60fps, with a screencast fallback that says when it is used), with spring-physics camera zooms and cursor, real motion blur, and emits per-chapter mp4 plus an events.json (timed marks with element rects and camera box) for a compositor. Use when asked to "record a product demo", "film the app", "capture a walkthrough", "screen-record a user flow", "make demo footage", "record the feature in the browser", or to re-shoot a demo chapter after the UI changed. Capture only; for spotlights, callouts, chapter cards, transitions and final assembly hand the output to demo:compose, which renders it through HyperFrames.
Ships in demo. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Capture real product footage from a live app. Compose it elsewhere.
Pairs with demo:compose (the sibling skill in this plugin): it takes the take directory this skill writes, plus one config carrying the brand and copy, and produces the finished cut.
beats.mjs ──▶ run.mjs ──▶ capture.mjs ──▶ <out>/<chapter>/ cfr/ + events.json
│ ▲ │
mintState (login) motion.mjs encode.sh ──▶ <chapter>.mp4
(springs)
│
montage.sh (grade the take) ──▶ demo:compose
demo:compose, which renders through HyperFrames (hyperframes, hyperframes-core, hyperframes-keyframes, hyperframes-animation). HyperFrames renders video FROM HTML and cannot drive an authenticated SPA, which is why capture is a separate step.Skill dir: this skill's own directory, referred to below as $SKILL_DIR. It pins @playwright/[email protected].
First run only, from that directory: npm ci, then
PLAYWRIGHT_BROWSERS_PATH="$PW" npx playwright install chromium, where $PW is a writable directory you keep
(for example ~/.local/pw-browsers). Neither node_modules nor the browsers ship with the plugin.
cd "$SKILL_DIR"
npm run check # self-check, ~9 min, no app needed
node scripts/run.mjs /path/to/beats.mjs --dry-run # every target resolved, no frames: seconds
node scripts/run.mjs /path/to/beats.mjs [chapter ...] # dry run, then capture + encode each chapter
scripts/montage.sh <out>/<chapter>.mp4 # 4x3 contact sheet; LOOK at it
node scripts/inventory.mjs <url> # what a beat can target on a page (see Drafting beats)
PLAYWRIGHT_BROWSERS_PATH when it is set and otherwise uses its own default (~/.cache/ms-playwright on Linux). Export PLAYWRIGHT_BROWSERS_PATH="$PW" in the shell that runs the rig and keep that directory stable; the scripts never set it for you. The installed revision must match node_modules/playwright-core/browsers.json (1.62.0 wants chromium 1234). On mismatch: PLAYWRIGHT_BROWSERS_PATH="$PW" npx playwright install chromium. Prefer a directory you control over ~/.cache/ms-playwright, which other tooling clears: measured wiped twice on one machine with 34G free, so not disk pressure.out under a scratch dir, never in a project repo.narration) runs hyperframes tts, which reads
HYPERFRAMES_PYTHON: point it at a venv with kokoro-onnx and soundfile installed.run.mjs prints each chapter's mode, fps, density and wall time, e.g.
fares: deterministic 60fps x2, 659 frames, 11.0s, 2 marks, filmed in 210s. A chapter that fell back
says screencast 30fps x1 and the line above it gives the cause.capture.mode
deterministic (default) ──▶ beginFrame + virtual time ──▶ PNG 2560x1440 @ exactly 60fps
│ a request holds page time: network 'auto' forces it on (see below)
│ no beginFrame / page time stuck even when forced / hard timeout / wrong frame size
▼ (one warning naming the cause, chapter re-filmed from scratch)
screencast ──────────────▶ CDP screencast ──▶ JPEG 1280x720, resampled to 30fps
HeadlessExperimental.beginFrame with
virtual time (pauseIfNetworkFetchesPending). The rig renders every frame on demand at exactly
n / fps of page time, so CSS animations, requestAnimationFrame and timers all step on the
footage clock. Frames come back at --force-device-scale-factor: 2560x1440 lossless PNG for a
1280x720 viewport. Network latency is edited out (page time stands still while a fetch is in
flight). Camera and cursor are posed every frame by the spring solver (motion.mjs). Costs
several times real time: see the measured facts.pauseIfNetworkFetchesPending waits for every request in
flight, and two kinds never let it go: a stream that stays open (SSE), and, measured, any
dynamic import() of a module, even an instant one, so every code-split route. With
network: 'auto' (the default) a frame that waits unstickMs (1.5s of wall time) is forced
through with policy advance; a lazy route then costs 1.5s once and the take stays fully
deterministic. Chrome does not say which request holds page time, so a stream is recognised by
behaviour: a request still in flight at two stalls, or stalls on three frames running (which
also catches a holder no request event shows). Then the rest of the chapter runs under advance (page time moves on regardless of the network, so a
load shows for its wall time, roughly a tenth of its real length), the rig says so once, and
capture.network / capture.networkNote in events.json record it. network: 'pause' never
forces and falls back to screencast after stallMs instead; 'advance' forces from the start.auto is the default. Almost every modern SPA lazy-loads its routes, and under strict
pause each of those loads freezes page time for good: a real app's first deterministic take
fell back to screencast on its first route change. auto keeps those apps deterministic, edits
network latency out everywhere else, and only gives that up (saying so) when a stream really
holds page time. Use pause when the footage must never show a load at anything but its edited
length, and accept a screencast fallback on apps that need it.timeoutMs of
wall time, frames come back at the wrong size, or network: 'pause' meets a request that never
finishes. The rig prints one line naming the cause, re-films the
chapter in screencast mode and records both in events.json (capture.mode,
capture.requested, capture.fallback). With a login, it checks the session again first
(and re-mints it): the failed take ran its beats, and one that signs out revoked it. It never
hands over a broken take. Set
capture: { mode: 'screencast' } to choose it outright.pause). Their messages arrive on the wall clock, which runs several times slower
than page time here, so live pushes land sooner in the footage than they would for a real viewer.capture: {
mode: 'deterministic', // or 'screencast'
dpr: 2, fps: 60, // pixel density and frame rate (deterministic only)
blur: { samples: 4, max: 64, spacing: 1.5, shutter: 0.5, threshold: 2 }, // on by default; false for drafts, spacing 4 in between
network: 'auto', // or 'pause' / 'advance': requests that hold page time, see above
unstickMs: 1500, // wall ms a frame waits on the network before 'auto' forces it
stallMs: 10000, // wall ms before falling back: page time stuck, or any wait under 'pause'
timeoutMs: 600000, // wall ms a chapter may take before falling back; by default 120x its estimated footage when that is longer
}
Motion blur (deterministic only, ON by default). Pick the setting by how final the take is. Measured on the ferry example (8 cores, no GPU, one take at a time):
| setting | capture time | a 5-minute demo films in | fast moves look |
|---|---|---|---|
capture: { blur: false } (drafts) | about 6.5x real time | about 33 minutes | sharp, stepping frame to frame |
capture: { blur: { spacing: 4 } } (middle ground) | about 17x | about 1 hour 25 minutes | smeared, faint steps up close |
| default (final takes) | about 35x | about 2 hours 55 minutes | smooth smear |
Screencast mode films at 1x. Set the option file-wide or per chapter: the footage is the same 2x, 60fps and deterministic in every case, only fast moves differ. Fact 14 has the per-chapter numbers.
How it works. Before each frame the rig steps copies of the spring solver across the shutter
(shutter of the frame interval, 0.5: a 180 degree shutter) and measures how far anything on
screen moves over it: the frame corner the camera moves most, or the pointer. Past threshold
output px, the frame is rendered enough times that the samples sit at most spacing (1.5) output
px apart, from samples (4) up to max (64), and averaged. Static pixels average to themselves,
so a hold stays exactly as sharp as without blur.
Two things the samples alone leave behind, both looked at on a fast ferry zoom (frame 380 of fares, 2560x1440): at the old spacing of about 4px every glyph showed as a stack of striated copies, and even at 1.5px each sample lands its glyph edges on whole pixels, so faint steps remain. So a frame the camera moves also gets a gap fill: the averaged frame is mixed with copies of itself warped (linear interpolation) by fractions of one gap's camera move: a scale about the zoom's fixed point plus a shift, so radial for a zoom and linear for a pan. The gap it spans is the wider of the shutter's first and last (a spring speeds up or slows down across it), and the copies sit at most 0.5px apart at the frame corner that move moves furthest. The fixed point of a zoom, which barely moves, stays as sharp as the samples. A frame where only the pointer moves gets no fill.
Averaging runs in ffmpeg alongside the capture, two frames at a time; while four blurred frames wait, rendering waits too, so temporary sub-frames stay bounded (16 MB at most on the ferry takes). A job that fails, or exits 0 without writing its frame, stops the take at once.
Measured with the anisotropy of the glyph region (structure tensor, smaller over larger
eigenvalue: 0 is a perfect smear, the unblurred frame scores 0.84), at the same camera pose in
each take: at peak speed (frame 380) 0.226 at the old spacing without fill, 0.207 at spacing: 4,
0.180 at the default; slowing down near the end of the zoom (10 frames later) 0.399, 0.349 and
0.348. Looked at: the old frames show stacked copies (two clear edges per glyph while slowing
down), the default a continuous smear. The default ferry
takes peak at 47 and 64 samples per frame, at most 1.5px apart (1.94px on the fares frames that hit
the cap, gap-filled too). events.json records capture.blur.spans (blurred frame ranges) and
maxSamples, maxGap, filled (frames that got the gap fill) and peakTempMB.
Rules the deterministic path imposes, all measured:
page.waitForTimeout (wall time).Date.now() / performance.now() hangs: the clock does not
advance inside a task.ready on the footage clock (readyCap is footage ms in both modes).Values below are one app's; only base, out and chapters are required.
export default {
base: 'http://localhost:5173',
out: '/scratch/takes',
state: '/scratch/session-state.json', // only with `login`: reused if it still gets past
// the login page, else re-minted
viewport: { width: 1280, height: 720 }, // optional, default 1280x720
localStorage: { someConsentKey: 'true' }, // optional, set before every document
login: { email: '[email protected]', password: '…' }, // OMIT for an app with no login
pace: 1, // optional filming pace, see below
cursor: { speed: 1200, hidden: false, ring: '#FFFFFF', tilt: false }, // optional, see below
capture: { mode: 'deterministic' }, // optional, see Capture modes
chapters: [{ name: 'home-to-detail', pace: 1.3, cursor: { hidden: true }, // per-chapter overrides
beats: [ /* ... */ ] }],
};
login overrides, with the defaults the rig ships: loginPath '/login', emailSel '#email',
passwordSel '#password', submitSel 'role=button[name=/^(log in|sign in)$/i]',
dismissSel '#rcc-decline-button' (the decline button id react-cookie-consent renders). Set whichever the app
needs.
login.loggedInSel (optional): a selector for an element that exists only when logged in, such
as an avatar menu. Without it a saved session counts as valid unless the probe (probe, default
/home) lands on loginPath, so an app that sends logged-out visitors to a landing page instead
reuses a dead session and films that page. With it set, the session is reused only if the element
becomes visible within 5s, and mintState also waits for it after submitting the form.
Drop login and state entirely when the app is public: the rig then films straight from
base with a fresh context.
A beat is an object; keys run in this fixed order within one beat:
| key | value | effect |
|---|---|---|
name | string | used in error messages |
goto | path | navigate. FIRST beat of a chapter must be a goto |
click | target | glide cursor to target, click |
ready | target | after goto/click/type, wait until visible (preferred) |
readyCap | ms | cap for ready, or for network-quiet fallback (8000) |
settle | ms | extra wait after ready/quiet, default 400 |
expectPath | string path or RegExp | assert pathname; throws and fails the take. A string matches that path or anything below it: /reports accepts /reports/7, never /reports-archive |
scroll | px, or a target | px (a number, or a numeric string): smooth window scrollBy. A target: smooth scrollIntoView to mid-viewport (top, if taller than the viewport), which also moves a scrolling dialog or panel the window cannot; it waits until the target holds still (at most 3s) and does nothing when the target is already fully in view. Compose delays a spotlight only for camera moves, so scroll in its own beat and hold before the beat that marks |
type | {into: target, text, cps=12} | glide to the field, click it, type text key by key at cps characters per second (type(), never fill(), so the viewer sees it typed), then wait like a click: ready, else network quiet, then settle |
zoom | {on: target, scale=2, ms=700} | move the camera onto the element centre on a spring (see Motion); the beat goes on once it has settled. ms: 0 is a cut |
wide | true or ms | camera back to full frame, same spring; 0 cuts |
mark | {label, on: target, id} | push an event into events.json (after zoom/wide). id (optional, a string unique in the chapter; a number or a repeat fails the take before filming) is copied onto the event. A beat-paced compose ("cut": "beats", from the demo:compose beat-paced change) can then name the mark, { "mark": "4.2" }, instead of counting it. The event's rect covers only the part of the target on screen and clear of fixed or sticky bars (an app's bottom nav): a taller target is boxed to that part, its event carries clipped: { h, open } and a lint names the beat. Mark a smaller element, or scroll or zoom out, to clear it |
hold | ms | keep filming. Deterministic: the pointer parks just off the lower right corner of the mark made in this beat (inside the camera box) and stays still. Screencast: the pointer drifts, which keeps frames coming (fact 1) |
Order: goto, click, wait (ready or network quiet), settle, expectPath, [filming starts here on beat 0], scroll, type, zoom, wide, mark, hold.
A target is a selector string, as it always was, or a locator, or a chain of them tried in order:
click: [{ role: 'link', name: 'Fares', in: { role: 'navigation' } }, { testid: 'nav-fares' }, 'header nav >> text=Fares'],
mark: { label: 'Resident fare needs proof', on: [{ role: 'cell', name: 'Island resident' }, '#resident'] },
| form | finds |
|---|---|
'css or Playwright selector' | page.locator(...); alone, its first match (the old meaning) |
{ role, name } | getByRole, exact name (name optional) |
{ testid } | getByTestId |
{ text }, { label }, { placeholder } | the exact getBy* |
{ css } | a selector inside a chain |
any of them plus in: <target> | the same, inside any element in finds |
A chain entry matches when it finds exactly one visible element, and the first that does wins
(for ready too: a chain ready waits for exactly one visible match; a lone selector string
waits for its first match to be visible, as before);
events.json records which (targets). A target that finds nothing within 5s (on the take's
clock) fails the take at once with every entry tried, how many visible elements each found, and
the nearest names on the page from its accessibility tree, e.g.:
beat "bad": click target matched no single visible element after 5000ms. Tried role=link[name="Fare list"]
(0 visible), testid=nav-fares (0 visible). Nearest on the page: link "Fares" (x5), cell "Fares" (x4), ...
Prefer role and name, then test id (Playwright's locator order): they survive a restyle that
breaks a class or a DOM path. Put the selector last, as the fallback. The dry run lints a
selector when a role and name (or the same scoped to its landmark) or a test id finds that very
element and nothing else, and prints the replacement; capture: { lint: true } in a beats file
prints the same lints while filming.
run.mjs dry-runs every chapter it is about to film, and --dry-run does only that (--no-dry-run
skips it). The same beat loop drives a plain page with no frames: every target and ready
resolves, clicks and typing happen, every wait that exists for the viewer (hold, settle, glides,
the gap between keys) is cut to at most 20ms. It prints a table per chapter (beat, use, the
locator that matched and which chain entry, ms per beat), the selector lints and the narrative
lint, and exits 1 before a frame is filmed on any MISS (a target the page does not have) or
FAIL (anything else: a goto that fails, an expectPath that does not hold), each said in one
line. After a clean dry run with login, the session is checked again before filming.
The dry run really clicks and types. Everything a beat does happens twice, once in the dry
run and once on film: a form submits twice, a cart fills twice, an invite goes out twice, a
sign-out ends the session. Write beats that can run twice (land on pages, open and close, type
into search, not submit what cannot be undone), or pass --no-dry-run for a chapter that cannot.
Run it after every UI change and in CI, but in CI only against an environment of its own (a
preview or a seeded local app), never a shared one other people use.
Ferry: both chapters, 14 targets, 1.3s (1.8s inside npm run check, starting the app included).
Given a goal ("show a late sailing and the resident fare") and an app URL, write the beats file yourself; no API key and nothing to install beyond this skill. Explore, write, dry-run, iterate:
goal + URL ──▶ inventory.mjs ──▶ beats.mjs + narration ──▶ run.mjs --dry-run ──▶ green? ──▶ film
▲ │ miss, lint
└──────────────── fix the target ◀─────────────┘
node scripts/inventory.mjs <url> lists everything a beat can
point at (role, name, test id, rect) with the chain to write for it. For a state you reach by
clicking (a modal, a later page), write the beats that get there and run
node scripts/inventory.mjs <beats.mjs> <chapter> <beat>: it replays them and lists that page.
A logged-in app: --state <session-state.json> with a URL (the beats file's state, which
run.mjs mints), or the beats form, which logs in itself. It walks the top document only; an
element inside an iframe or a shadow root needs a selector or an in: around it.mark with a label of at most 6 words, held 1.5 to 2s; end on a wide.#id.chapters[].narration.marks, one line per
mark, {@anchor} before the word that should light the spotlight), about 2.3 words per second
of the time until the next mark, and point the beats file at it: compose: './x.config.json'.node scripts/run.mjs beats.mjs --dry-run until it exits 0. A miss prints the nearest
names on the page: fix the target from them (or re-run the inventory at that beat). Act on a
selector lint unless the element truly has no role. Fix narrative warnings by holding longer or
saying less.run.mjs, which dry-runs again first), compose, and check, as in the compose skill.
Narration is spoken by hyperframes tts, which needs a Python with kokoro-onnx and
soundfile: make a venv with them and export HYPERFRAMES_PYTHON=<venv>/bin/python before
compose.mjs, or it stops with "The kokoro-onnx package is not installed".examples/ferry-draft/ is this procedure run on the ferry example app for that goal, from scratch:
two chapters (the late sailing on the card and on its board row; the Fares link, then the
resident fare and its proof note), every target a role chain with a selector last except the card,
narration in draft.config.json. Measured: the dry run resolved 12 targets with 0 misses in 0.9s
(every chain on its first entry) and printed no narrative warnings once the last line had a word
more (at 103 wpm it said "a long silence"); filmed deterministic in 308s and 421s for 7.4s and
8.6s of footage on a loaded machine; composed with narration (compose's HYPERFRAMES_PYTHON
setup), check.mjs 4/4 marks hit, final 25.7s at -14 LUFS, and its walkthrough export 5 steps,
the click among them as "Open Fares". Copy the directory beside the ferry app's, serve that app,
then node scripts/run.mjs <copy>/beats.mjs.
Printed with the dry run, warnings only, from the timeline the beats will film (estimated from their own durations at pace; on the ferry takes the estimate ran 0.2 to 0.7s early against the filmed marks, e.g. 2.0, 4.3, 7.9s against 2.22, 4.68, 8.58s):
compose: './demo.config.json' (relative to the beats file);The ferry beats with the narrated config get three: the departures and fares narration lines over 200 wpm, and the fares chapter's first mark at about 4s (it navigates there first).
Camera and pointer are springs. Constants and observable behaviour are taken from Cap's published
renderer (the open-source Screen Studio alternative, commit 97c0a45; paths cited in motion.mjs);
the implementation is written independently. No Cap code was copied: Cap's renderer is AGPLv3 and
this plugin is Apache-2.0, so motion.mjs integrates its own damped harmonic oscillator
(m x'' = -k (x - target) - c x', semi-implicit Euler in 0.25ms sub-steps), and npm run check
checks it against the oscillator's theory: the damping ratio its overshoot implies matches each
profile's within 0.005 (camera 0.943), and it peaks within 2% of the predicted time. Under
deterministic capture the springs are solved per frame, so a re-film of the same beats moves
identically. Screencast mode keeps the older eased glide.
zoom.ms 700 plays these constants as they are; another value
scales the spring's duration (stiffness / k^2, damping / k, for k = ms / 700). A 2x zoom at the
default settles to a quarter of a pixel in 48 frames (0.8s), and the beat goes on then.cursor.ring expands on a cubic ease-out over 0.6s while fading as (1-t)^1.5. Web Animations,
so it runs on virtual time and every take shows it identically.cursor.tilt, off by default; true = 0.15, or a number): the pointer leans with its
horizontal speed, 0.4s of travel times 0.03 degrees per px times the amount, at most 20 degrees.How fast things happen in front of the camera. Changing it means re-filming. To re-pace
footage you already have (speed up navigation, stretch holds) use demo:compose's playback
controls (speed, pace, targetDuration) instead: no re-shoot.
pace (default 1): multiplies every filmed duration in the take: zoom and wide ms (so the
springs' durations), hold, settle, the pause before a click, the end-of-take hold, and cursor
glides. 2 films
everything twice as slowly, 0.7 brisker. Set it on the beats file, override per chapter.
Page load waits (ready, network quiet) are the app's own time and are not scaled.cursor.speed (px/s, optional): a glide takes distance / speed, so a long move takes longer than
a short one. Deterministic: that time (at least 250ms) replaces the 500ms click lead and scales
the pointer spring to match. Screencast: a constant-speed glide. Unset: deterministic glides
take 500ms whatever the distance; screencast keeps its 300ms click glide plus 220ms pause and
200ms re-centre (one mouse.move step is one rendered frame, measured 16.7ms). pace scales
every case.cursor.hidden (default false): films no pointer and no click feedback. The pointer element
is still there at near-zero opacity and, in screencast mode, still drifts, because that drift is
what keeps the screencast emitting during a hold (fact 1). Measured: a hidden-cursor screencast
take still produced frames through a 1.5s hold.cursor.ring (CSS colour, default #FFFFFF): the click ring. Neutral by default, with a
faint dark outline so it reads on a white page; set it to the brand you are filming.--__demo-cs, on the pointer and ring only), in the
page and in an init script the next document reads when its overlay mounts: a page that loads
while zoomed mounts the pointer at its size and position from its first frame. npm run check
measures the pointer's area under a 2x zoom at 1.00x its unzoomed area deterministic and 0.88x
screencast, and 1.00x after a click navigates while zoomed (5.14x and 5.10x before any
counter-scale).type.cps sets typing speed per beat and is not scaled by pace.Merge rule: a chapter's pace replaces the file's; a chapter's cursor keys override the
file's cursor keys one by one.
Screencast mode: it emits only on repaint. A settled page produces almost no frames. The synthetic cursor drifting during hold is load-bearing there: a 7.5s hold gave 1 frame without it, 244 with it. Never remove the drift from screencast mode. Deterministic mode renders every frame on demand and needs no drift.
Screencast mode: it always emits at CSS-viewport size. deviceScaleFactor 1, 2, 3 and maxWidth 2560, 3840 all produced 1280x720 JPEGs; maxWidth only clamps down. Density needs deterministic mode (fact 11).
Zoom must happen in the browser. Same element, four approaches:
transform: scale() on <html>: sharp, but root becomes containing block for position:fixed; fixed bottom nav landed mid-frame.Emulation.setPageScaleFactor: sharp, but zooms about the visual-viewport origin; centring on a target was wrong.Emulation.setDeviceMetricsOverride with viewport: {x, y, width, height, scale}: sharp, correctly framed, fixed chrome behaves. This is the camera. Crispness is decided at capture time; no editor or compositor recovers it.viewport x/y are document-relative, while getBoundingClientRect is viewport-relative. After a 520px scroll, y: 0 filmed the blank page top; y: 520 framed the target. The rig adds the scroll (read once while unzoomed) and wide clears the override. npm run check asserts a scroll-then-zoom lands on its target (luma 255 fixed, 101 with the offset removed).--force-device-scale-factor the override's viewport x/y are device pixels while width, height and scale stay CSS (measured: x 300 at density 2 framed CSS x 150, at scale 1.5, 2 and 3 alike). The rig multiplies x/y by the density there; npm run check asserts a scroll-then-zoom lands in both modes.Never select by bare text. Measured: a bare text=<nav label> matched an article headline elsewhere on the page and navigated away. Scope every selector to its container (<nav-selector> >> text=<label>, e.g. nav.fixed.bottom-0 >> text=REPORTS or header nav >> text=Fares) and set expectPath on every navigating beat so a mis-click fails the take instead of filming the wrong screen.
Nav bars are context-dependent. Measured on one app: after clicking one nav item, another item was gone from the nav. Targets are resolved fresh per beat; never cache handles across beats.
addInitScript overlays survive SPA route changes (cursor verified present after three client-side navigations).
Login: never hand-write a token into storageState. It fails silently and films the login page. mintState drives the real form and throws unless the final pathname has left loginPath. Quirks it already handles, each found on a real app: an #email field that is input[type=text] rather than type=email, a cookie modal covering the submit button (dismissed via dismissSel first), and controlled React inputs that need type() rather than fill().
ffmpeg is resolved, not hardcoded. $FFMPEG/$FFPROBE win, then the distro build at /usr/bin, then PATH (Homebrew on macOS, where /usr/bin is read-only). Capture needs only signalstats, scale and libx264, which every common build has; it does not use drawtext. Some builds (Homebrew's default) lack drawtext; demo:compose's still-check then writes its contact tiles without captions and still gives its verdict.
Browsers live in $PLAYWRIGHT_BROWSERS_PATH when set (see Run).
The overlay mounts in the top frame only. Init scripts run in every frame; before this, a page with an iframe filmed a second cursor inside it. Seeding localStorage is skipped where storage throws (sandboxed documents) instead of aborting the cursor.
Deterministic capture needs chrome-headless-shell and the density flag. HeadlessExperimental.beginFrame is gone from full Chrome 147+ and survives in the headless shell, which Playwright 1.62 launches for headless Chromium (Chrome for Testing 151, revision 1234). The density must come from --force-device-scale-factor: an emulated deviceScaleFactor reports 2 but beginFrame returns 1280x720 pixels. The rig checks the first frame's size and falls back if it is wrong.
Deterministic frames are exact. npm run check: 2560x1440, avg_frame_rate 60/1, frame count = duration x 60 + 1, and 0 repeated frames out of 122 on a page animating every frame. The first ~24 beginFrames after a load repeat while the pipeline primes, so the rig draws 30 before filming. The PNGs survive encode.sh bit-exact (libx264rgb -qp 0, PSNR inf against the frame). Identical consecutive frames (a still hold) are hard links, so a hold costs no disk.
An open SSE stream and any dynamic import() hold virtual time for good; a websocket does not. Under pauseIfNetworkFetchesPending page time stood still until something forced it: a 0ms and an 800ms lazy module alike, and a lazy route of a real SPA (its first deterministic take fell back to screencast before network: 'auto' existed). npm run check asserts all three outcomes: the lazy module stays deterministic under auto, the SSE page films on under auto and says so once, and falls back to screencast under pause and says so once. A websocket pushing every 200ms did not hold it.
Deterministic capture costs wall time, most of it motion blur. The ferry example on 8 cores without a GPU, one run at a time: departures (12.5s of footage) filmed in 407s with the default blur, 209s with blur: { spacing: 4 }, 84s with blur: false, 12s in screencast mode; fares (10.9 to 11.0s) in 403s, 197s, 69s and 11s. So about 35x, 17x and 6.5x real time. The default renders 248 of departures' 753 frames again at up to 47 samples, with the averaging running alongside on the same cores. Running the gap fill on tmix's last output only (it used to fill all N outputs and keep the last, identical result) took the default from 530s and 459s, and spacing: 4 from 259s and 265s. A 5-minute demo: about 2 hours 55 minutes with the default, 1 hour 25 minutes at spacing: 4, 33 minutes with blur: false.
npm run check asserts frame-0 luma is neither blank nor black; moving startScreencast before the goto makes it fail with luma 255.ready, else network quiet (no request in flight for 500ms, capped at 8s; websockets/SSE ignored). Long-poll pages always hit the cap and warn: give those beats a ready selector.One per chapter, written next to the frames at <out>/<chapter>/events.json; <chapter>.mp4 sits beside the chapter dir at <out>/<chapter>.mp4. (demo:compose also accepts a flattened <out>/<chapter>-events.json.)
{
"chapter": "home-to-reports",
"viewport": { "width": 1280, "height": 720 },
"dpr": 2, "fps": 60,
"capture": { "mode": "deterministic", "blur": { "samples": 4, "shutter": 0.5, "spans": [[34, 51]], "maxSamples": 33, "maxGap": 1.5, "filled": 18 } },
"dur": 10.85,
"frames": 652,
"events": [
{ "t": 2.205, "kind": "mark", "label": "bottom nav",
"rect": { "x": 0, "y": 655, "w": 1265, "h": 65 },
"cam": { "x": 312.5, "y": 360, "w": 640, "h": 360, "s": 2 } },
{ "t": 1.29, "kind": "camera", "t0": 1.29, "t1": 1.884,
"cam": { "x": 312.5, "y": 360, "w": 640, "h": 360, "s": 2 } },
{ "t": 3.4, "kind": "click", "name": "Reports", "role": "link",
"rect": { "x": 1012, "y": 668, "w": 96, "h": 40 }, "cam": null }
],
"poses": [
[0,0,0,1],
[75,0,1.4984,1.0106],
[76,0,5.3117,1.0385]
]
}
dpr, fps: the take's pixel density and frame rate: 2 and 60 deterministic, 1 and 30 screencast. The mp4 is viewport x dpr pixels. Everything else in this file (rects, cam) stays in CSS px of the viewport, whatever the density. Takes from before these fields existed are 1 and 30.capture: the mode actually used. After a fallback it also holds requested and fallback, the cause. blur.spans lists blurred frames as [first, last] index pairs.dur: seconds, first to last frame. Deterministic: the mp4 has exactly dur * fps + 1 frames, one per rendered frame. Screencast: it has ceil(dur * 30) + 1 frames: capture.mjs resamples to 30fps itself (frame k shows the last frame captured at or before k/30) and writes cfr/ as hard links, which encode.sh encodes as a plain image sequence. It used to hand ffmpeg a concat list of per-frame durations instead; measured on a 4.4s take with zoom glides, that ran 0.17s short on ffmpeg 6.1 and 0.73s short on ffmpeg 8.1 (an 11.1s ferry take came out 8.9s long), putting marks late by growing amounts. npm run check now asserts the mp4 length matches the take.frames: frames filmed. Deterministic: the mp4's frame count. Screencast: captured JPEGs (variable rate; the mp4 is resampled to 30fps).t: seconds from the first frame, which is mp4 time 0. Deterministic: the time of the first frame that shows the event. Screencast: taken from the wall clock, because the last delivered frame lagged the screen by ~1s late in a 50s take.kind: "mark", "camera", or a sound cue: "click" (as the press lands, from a click beat or the click a type beat starts with; clicks before filming starts are not recorded) and "type" (t first key, dur seconds of typing, chars count). Both carry rect, the target
element (the field, for a type), and cam, the camera box in force, in the same CSS px as a
mark's, so a consumer can point at what was clicked or typed into. A click's rect is taken as the
press lands; a type cue's after the typing, so a field that widens as it fills is measured as it
ends up. rect is null when the target has no box (display:none, zero size). They also carry name,
the target's accessible name and role as the browser's accessibility tree has them (the same
source the lint and inventory use: a button holding an image with alt="Save" is button "Save",
an <input type=search> is searchbox), the name cut at a word under 40 characters; each null
when there is none. Takes filmed before these have cues
without them: treat all four as optional. A consumer that reads only marks filters on kind. A camera event is one zoom or wide glide: t0 and t1 its
start and end, cam the box it ends on (null for a wide). demo:compose plays
every camera move at 1x and fades a spotlight in only once the move into it has settled.
Deterministic: t1 is the frame the spring settled on, exactly. Screencast: the last pose
reaches the footage 1-2 frames after t1. Takes filmed before camera events existed have none,
and compose keeps the older zoom timing for them. Fields below describe a mark.poses (deterministic takes only): the camera on every frame it changed, [frame, x, y, s], the
frame's index in the mp4, the visible region's top left in CSS px and the scale (a frame not
listed keeps the pose before it; s 1 is full frame). Read at the frame's own time: a blurred
frame averages renders from there across the shutter (capture.blur.shutter, half a frame
interval by default), so on a moving camera its smear centres about a quarter frame later than
the logged pose. demo:compose moves a gliding spotlight and the vertical crop with the content
through it. One pose per line, last in the file: the ferry departures take (753 frames) logs 268
at 30 bytes each, about 190 KB for a 5-minute take filmed at that rate (49 bytes each when they
were indented like the rest). Screencast takes and takes filmed before it have none, and
compose falls back to cam and the camera events.id: the mark's id from the beats file (always a string, unique in the chapter); absent when the beat gave none.rect: element box in page CSS px (layout viewport, getBoundingClientRect); unaffected by the camera.cam: camera at that moment. null = full frame. Otherwise {x, y, w, h} visible region in CSS px and s scale.screenX = (rect.x - cam.x) * cam.s, screenY = (rect.y - cam.y) * cam.s, size * cam.s. With cam: null it is rect as-is. (Checked on the sample: (655 - 360) * 2 = 590, where the nav's top edge sits in the zoomed frame.)targets: one entry per target the beats resolved, in order: { beat, use, matched }, where
use is click, type, scroll, zoom, mark or ready and matched the locator that found it,
plus index and of when it came from a chain (index 1 of of 2 = the chain's second entry
matched: the first has gone stale, so update the beats). Takes filmed before have none.demo:compose reads this file directly. Its labels default to the label written here, so a good capture label is a usable on-screen label. If composing by hand instead, place the mp4 as a video clip and time/position overlays from events[]; clip timing (data-start, data-duration, data-media-start) is owned by hyperframes-core.Authenticated SPA with a fixed bottom nav (verified end to end, 2026-09-14):
const nav = 'nav.fixed.bottom-0';
export default {
base: 'http://localhost:5173',
state: '/scratch/demo/session-state.json',
out: '/scratch/demo/takes',
login: { email: '[email protected]', password: '…' },
chapters: [{ name: 'home-to-reports', beats: [
{ name: 'land', goto: '/home', expectPath: '/home', hold: 1500 },
{ zoom: { on: nav, scale: 2, ms: 900 }, mark: { label: 'bottom nav', on: nav }, hold: 1500 },
{ wide: 700, hold: 600 },
{ name: 'reports', click: `${nav} >> text=REPORTS`, expectPath: '/reports', hold: 2000 },
] }],
};
Result: session: minted, then home-to-reports: 477 frames, 10.8s, 1 marks. Zoomed frames sharp with nav at the frame bottom; tail on the loaded page.
Public multi-page app, no login (verified end to end, 2026-09-21). No login, no state:
export default {
base: 'http://127.0.0.1:7744',
out: '/scratch/ferry/takes',
chapters: [{ name: 'fares', beats: [
{ name: 'land', goto: '/board', expectPath: '/board', ready: '#board', hold: 900 },
{ name: 'to-fares', click: 'header nav >> text=Fares', expectPath: '/fares', ready: '#fares', hold: 1400 },
{ zoom: { on: '#fares', scale: 1.5, ms: 800 }, mark: { label: 'Single and return per ticket', on: '#fares' }, hold: 1800 },
{ wide: 700, hold: 800 },
] }],
};
Result: fares: 370 frames, 10.3s, 2 marks. Both marks passed demo:compose's still-check.
The full example, a made-up ferry operator's three-page app with its server, beats file and
compose config, ships in ../compose/examples/ferry/. Copy it to a scratch directory, run
node serve.mjs, then node scripts/run.mjs <copy>/beats.mjs from this skill's directory.
Takes land in <copy>/takes/, where the compose config expects them.
scripts/capture.mjs: capture(), mintState(), ensureState(), checkPath(); the deterministic and screencast recorders and the fallback between them. Edit here to change waits and beats.scripts/motion.mjs: the spring solver for camera and pointer, and click and tilt constants. Edit here to change how things move.scripts/run.mjs: dry-runs, then films each chapter of a beats file and encodes it; --dry-run stops after the dry run.scripts/locate.mjs: targets: selector strings and locator chains, the miss message with its nearest candidates, the selector lint, and the page inventory.scripts/inventory.mjs: prints what a beat can target on a page (role, name, test id, rect, chain to write).scripts/narrative.mjs: the narrative lint and the timeline estimate it runs on.scripts/encode.sh: cfr/ (the constant-rate frame sequence, at the take's fps) to a
lossless H.264 mp4: libx264rgb -qp 0 for deterministic PNGs, libx264 -qp 0 for screencast
JPEGs (their own 4:2:0 pixels); both measured bit-exact (PSNR inf). It is an intermediate:
demo:compose makes the only lossy encode. Browsers cannot play the lossless profiles, ffmpeg
and the montage can.scripts/montage.sh: contact sheet for grading a take.scripts/selfcheck.mjs: local throwaway server; asserts the springs (a retarget keeps velocity, a zoom from wide is pre-aimed, the camera settles exactly, a planned click lands within half a pixel), path guard (including a sibling path such as /reports-archive), zoom framing, events.json schema, 2560x1440 at exactly 60fps with every frame in the mp4, 0 repeated frames on an animated page, the SSE fallback with its one message, motion blur only inside camera moves with samples at most 1.5px apart and camera frames gap-filled (also when capped), a failing blur job failing the take, non-blank head, non-splash tail, screencast hold frame count, scroll-then-zoom in both modes, bare-text mis-click failing, one cursor on a page with an iframe, the cursor mounting where storage throws, every click restarting its feedback, a type beat typing key by key in both modes with a hidden cursor, pace: 2 lengthening a hold, loggedInSel re-minting a dead session, and the pointer keeping its size under a 2x zoom and after navigating while zoomed, in both modes, with the click ring taking cursor.ring; click and type cues' rects, names and roles (a nav link, a placeholder, an over-long aria-label cut at a word); a locator chain falling through to its second entry and recorded in targets; a miss naming every entry and the nearest candidates and writing no events.json; run.mjs --dry-run exiting 0 on a good beats file and 1 on a broken one, a plain run of a broken file filming nothing, and the ferry example's dry run passing; and the narrative lint's rules on a synthetic timeline.examples/ferry-draft/beats.mjs (opens in a new tab)examples/ferry-draft/draft.config.json (opens in a new tab)package-lock.json (opens in a new tab)package.json (opens in a new tab)scripts/capture.mjs (opens in a new tab)scripts/encode.sh (opens in a new tab)scripts/inventory.mjs (opens in a new tab)scripts/locate.mjs (opens in a new tab)scripts/montage.sh (opens in a new tab)scripts/motion.mjs (opens in a new tab)scripts/narrative.mjs (opens in a new tab)scripts/run.mjs (opens in a new tab)scripts/selfcheck.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/bragTurn the project in the current directory into a short, shareable launch video, by delegating to the upstream brag skill. Use when someone says "brag about this", "make a launch video", "turn this project into a video", "announce what I built", or wants a hype clip for a repo rather than a walkthrough of a running app. For filming an app's real UI, use demo:capture and demo:compose instead./composeTurn captured product footage into a finished demo video - a 1440p60 master with the app in a framed window on a themed backdrop, a feathered spotlight that glides between proof moments with a short label at each, blur and push transitions, chapter title cards, persona-switch and end cards, dead-hold trims and a mechanical still-check, an optional 9:16 vertical social cut whose crop follows the action with headline and burned captions, plus a sound layer timed from the capture's own events (UI sound effects, an optional ducked music bed with cuts on the beat, optional narration whose anchor words fire the spotlights, a loudness-checked mix) and WebVTT captions and chapters. Takes a demo:capture take directory (per-chapter mp4 plus events.json) and one JSON config carrying the brand, chapter titles, card copy and any label overrides; everything else is derived from the capture. Use when asked to "compose the demo", "assemble the captured chapters", "add spotlights and callouts to the footage", "put title cards on the demo", "cut the demo together", "make the walkthrough video from the takes", or to re-cut one chapter after re-shooting it, or to "add narration", "add a voiceover", "add music", "add sound effects" or "add captions" to a demo, or to "make a vertical cut", "make a 9:16 version for socials", "make a reel or short of the demo". Renders through HyperFrames. Does not record anything; pair it with demo:capture.Other plugins' skills for the same job
npx claudepluginhub stevengonsalvez/ainb-toolkit --plugin demo