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 rereel skill (skills/rereel/SKILL.md plus a CLI cheat sheet in references/cli.md) teaches the agent the rules: keep media out of Git, inspect before editing, change the smallest piece of JSON, use patch for timing and asset changes, cut recordings non-destructively, validate before committing, and report the chunk counts after each build.

Install it as a plugin from the rereel repository:

/plugin install rereel --marketplace mathrunet/rereel

On older Claude Code versions, add the marketplace first:

/plugin marketplace add mathrunet/rereel
/plugin install rereel@rereel

Claude Code loads the skill automatically when a task involves a rereel bundle or a Remotion video edit. Run /plugin update rereel after a new rereel release.

  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.

Replace the background of scene s02 with assets/bg_v2.png and rebuild ep01.

Freeze work/ep02 into reels/ep02 with the template in ../remotion-template, validate it and tell me what to add to .gitignore.