Skip to content

Using rereel with AI agents

rereel was designed so that a coding agent can edit a video the way it edits code: read a compact state, change a few lines of JSON, check, build, and read one JSON result.

The npm package ships an agent skill at node_modules/@mathrunet/rereel/skills/rereel/SKILL.md. It tells the agent to keep media out of Git, inspect before editing, use ripple-shift for timing changes, cut non-destructively, and validate before committing.

Terminal window
mkdir -p .claude/skills/rereel
cp node_modules/@mathrunet/rereel/skills/rereel/SKILL.md .claude/skills/rereel/SKILL.md

The skill’s front matter (name: rereel, description: …) lets Claude Code load it automatically for Remotion/video tasks. To make it available in every project, use ~/.claude/skills/rereel/SKILL.md instead.

Commit the copied file so that every collaborator and agent session gets it. Re-copy it after upgrading rereel.

  1. Inspect. Get a compact view instead of reading a large props.json:

    Terminal window
    npx @mathrunet/rereel inspect reels/ep01 --scene s03
  2. Edit JSON. Make the smallest change in props.json or mix_plan.json. For timing changes, use

    Terminal window
    npx @mathrunet/rereel patch reels/ep01 ripple-shift --at-sec 12.0 --delta-sec -0.5

    Never overwrite files in media/ or splice raw audio.

  3. Validate. Proceed only when the JSON says "valid": true:

    Terminal window
    npx @mathrunet/rereel validate reels/ep01
  4. Build and check the result:

    Terminal window
    npx @mathrunet/rereel build reels/ep01

    A local edit should report chunksRendered well below chunksTotal. If every chunk re-rendered, the edit touched a global key. Report that to the user.

Every command writes exactly one JSON line to stdout. --help writes to stderr. Failures look like this:

{"status":"error","code":2,"error":"ripple-shift requires --at-sec and --delta-sec"}

The process exit code matches code:

Code Meaning Typical agent action
0 success continue
1 failure: invalid reel (validate), SHA mismatch, missing asset, frame-count mismatch read errors / error, fix the JSON
2 usage: bad flag, missing file, invalid JSON, unknown provider fix the command
3 dependency missing (ffmpeg, ffprobe, remotion, a builtin template) ask the user to install it
4 an external command failed. stderr (last 1500 chars) and exitCode are included inspect stderr

See Exit codes.

Change the caption in scene s03 to “Ship it on Monday”, then rebuild ep01 and tell me how many chunks re-rendered.

Run cut-retakes on raw/take2.wav with raw/take2.json and script.md, show me what was dropped, then update work/mix_plan.json with the new segments.

The pause at 12 s is too long. Remove 0.4 s there in ep01 and rebuild.