Motion Video Studio
Build video as code, in stages, checking cheaply before spending expensively. Rendering and image inspection are the costliest operations in this workflow. Every stage below ends with a gate that is cheaper than the stage after it, so mistakes surface early, when they cost a few hundred tokens instead of a few thousand.
Core rules (why they exist)
- Persist state to disk, not to chat. Write
video.spec.jsonandPROGRESS.md(templates inreferences/stages.md). Any agent, or a cheaper model after a quota fallback, resumes by reading these two small files instead of replaying the conversation. - Defer to the official framework skills for API detail. If installed, read them rather than relying on memory. They are maintained against current versions, which these notes are not.
- HyperFrames:
npx skills add heygen-com/hyperframes→/hyperframes,/hyperframes-cli,/gsap - Remotion:
npx skills add remotion-dev/skills→/remotion-best-practices,/remotion-renderIf a CLI flag is uncertain, run<cli> --helponce instead of guessing.
- HyperFrames:
- Cheap gate before expensive step. Order of cost: lint/typecheck < single still < contact sheet < draft render < final render. Never skip ahead.
- Look at small images, few images. Review frames via a low-res contact sheet (
scripts/contact_sheet.sh), never full-res frames one by one. - Trim tool output. Pipe logs through
tail -n 20orgrep -iE "error|warn". Do not paste whole render logs into context. - Build one scene at a time, reuse components. A second scene should mostly be a reuse of the first with new content.
Stage pipeline
| # | Stage | Output | Gate (must pass to continue) | Tier |
|---|---|---|---|---|
| 0 | Brief and route | video.spec.json | Duration, fps, size, framework chosen | Operator |
| 1 | Environment check | go/no-go | scripts/env_check.sh passes | Operator |
| 2 | Storyboard | scene table in spec | Scene durations sum to total; each scene has one idea | Director |
| 3 | Scaffold and design tokens | empty project + tokens | Lint/typecheck clean; one blank frame renders | Builder |
| 4 | Build scenes (loop) | one scene per iteration | Lint clean + one still at scale 0.25 looks right | Builder |
| 5 | Assemble and audio sync | full timeline | scripts/probe_media.sh durations match spec | Builder |
| 6 | Draft render | low-res preview | Contact sheet (≤12 frames) reviewed once | Operator + Director |
| 7 | Final render and deliver | MP4 + summary | Probe confirms codec, size, fps, duration | Operator |
Tier names map to models in references/model-fallback.md. The point of tiers: only stages 2 and hard debugging need strong reasoning; stages 0, 1, 6, 7 are mechanical and should run on the cheapest capable model.
Read references/stages.md for per-stage detail, token budgets and the spec/progress templates. Do not load it for trivial one-scene requests.
Choosing the framework (Stage 0)
| Situation | Pick |
|---|---|
| Agent-written, quick iteration, pasted HTML/CSS, GSAP/Lottie/Three.js animation, no build step wanted | HyperFrames |
| Existing Remotion/React project, React component reuse, data-driven templates, Lambda scale-out rendering | Remotion |
| Unsure | HyperFrames for one-offs, Remotion for repeatable templated pipelines |
Licensing differs (HyperFrames is Apache 2.0; Remotion is source-available with its own terms), so mention this if the video is for a company. Framework specifics: references/hyperframes.md, references/remotion.md. Load only the one you chose.
Hard-won defaults
- Default to 30 fps, 1920x1080 (16:9), 1080x1920 (9:16), or 1080x1080 (1:1). Ask at most one clarifying question; otherwise state assumptions in the spec and proceed.
- Animate with the framework's frame clock only (Remotion:
useCurrentFrame; HyperFrames: seekable adapters like GSAP timelines). Wall-clock tricks (setTimeout, CSS animations that aren't seekable) break deterministic rendering and produce flicker in output. - Keep fonts and assets local or from the framework's supported loaders so renders are reproducible.
- Text-first, simple shapes first. Add images, particles, shaders or 3D only if the brief calls for them; each adds render time and debugging tokens.
- For footage edits (trims, cuts, overlays on existing clips), probe the source once (
probe_media.sh), then reference it by timestamps in the spec rather than re-inspecting it.
Failure handling
- Lint/typecheck fails twice on the same error → stop patching blindly; re-read the relevant official skill section, then fix once.
- A still looks wrong → fix the scene, re-render that one still. Do not re-render the whole video to check a layout change.
- Quota or rate limit hit → write
PROGRESS.md(stage, next action, open issues), then followreferences/model-fallback.md.
Final response to the user
Give: output path, duration/size/fps, what was assumed, and one line per scene. Offer specific tweaks (pacing, colors, captions). Do not narrate the pipeline.