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.
Install the skill
Section titled “Install the skill”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/rereelOn older Claude Code versions, add the marketplace first:
/plugin marketplace add mathrunet/rereel/plugin install rereel@rereelClaude 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.
Use the skills CLI. It detects the agents installed on your machine and copies the skill to the right place:
npx skills add mathrunet/rereelAdd -g to install it for every project instead of only the current one.
The npm package ships the same skill. Copy it to pin the skill to the installed rereel version:
npm install -D @mathrunet/rereelmkdir -p .claude/skillscp -R node_modules/@mathrunet/rereel/skills/rereel .claude/skills/rereelUse ~/.claude/skills/rereel for every project, or your agent’s own skill directory. Commit the copy so collaborators get it, and copy it again after upgrading rereel.
The agent loop
Section titled “The agent loop”-
Inspect. Get a compact view instead of reading a large
props.json:Terminal window npx @mathrunet/rereel inspect reels/ep01 --scene s03 -
Edit JSON. Make the smallest change in
props.jsonormix_plan.json. For timing changes, useTerminal window npx @mathrunet/rereel patch reels/ep01 ripple-shift --at-sec 12.0 --delta-sec -0.5Never overwrite files in
media/or splice raw audio. -
Validate. Proceed only when the JSON says
"valid": true:Terminal window npx @mathrunet/rereel validate reels/ep01 -
Build and check the result:
Terminal window npx @mathrunet/rereel build reels/ep01A local edit should report
chunksRenderedwell belowchunksTotal. If every chunk re-rendered, the edit touched a global key. Report that to the user.
Reading results
Section titled “Reading results”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.
Prompt patterns
Section titled “Prompt patterns”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.