# Steps and loops

An episode takes 5 loops. Each loop makes a part, checks it, fixes what fails, and stops after 3 rounds.

A step is one piece of work with its own file and its own check, such as the episode script or the shot prompts. A loop groups the steps for one part of the episode. It makes the part, checks it on your computer, fixes what fails and checks again. When the part passes, or the loop reaches its limit, your agent stops and shows you the result.

## Loops

Your agent runs the loops in this order. The order is a suggestion: a loop run out of order prints one warning and runs.

| Loop | Name in the CLI | What you look at |
|---|---|---|
| Script | `script` | The episode script, `script.md` |
| Shot sheet | `sheet` | The [shot sheet](/docs/cli/shot-sheet) |
| Mock | `mock` | The picture sheet of the mock and its video, in the **剪辑** tab of the app |
| Videos | `videos` | The video take picked for each shot |
| Edit | `edit` | The finished cut, in the **剪辑** tab of the app |

What each loop makes is on the [Overview](/docs/cli/overview). `minicut loop` shows where every loop stands, and `minicut loop next` prints the one command to run next.

## Rounds

One run of a loop is one round. The round checks the loop's files and saves the result in `loops.json` in the episode folder. A round that finds problems prints one `FAIL` line for each, with the fix under it. Your agent makes the fixes and runs the loop again.

A round that finds nothing prints `PASSED`. The loop then waits for your yes. You look at what it made and your agent records your answer with `minicut loop approve`.

In the Script, Shot sheet and Mock loops, a missing file stops the run. It lists what is missing, exits with code 3 and uses no round.

## Limits

A loop stops after a fixed number of rounds, so a problem it cannot fix does not repeat without end.

| Loop | The limit counts | Default |
|---|---|---|
| Script, Shot sheet, Mock, Edit | Rounds | 3 |
| Videos | Video takes for one shot | 3 |

To change a limit, add `"loops"` to `series.json`, such as `"loops": {"mock": 4, "takes": 5}`. The key for the Videos loop is `takes`. `minicut loop run` also takes `--max`. See [minicut loop](/docs/cli/checks-and-loops#minicut-loop).

## When a loop fails

Under the limit, your agent fixes what the round printed and runs the loop again. If you change a file after a failed round, `minicut loop next` tells your agent to run the loop again.

At the limit, the loop prints `CAP REACHED` and your agent stops and shows you what still fails. You decide:

- Approve it as it is with `minicut loop approve`.
- End the loop with `minicut loop done`, and give your reason.
- Raise the limit and let your agent try again.

In the Videos loop, only the failing shot is made again. At a shot's limit, your agent picks the best take and tells you what is still wrong with it. Nothing keeps that take for you.

## When something changes

A loop that passed is out of date once the files it is built from change. `minicut loop` then shows `out of date, re-run suggested`. You can also tell the loops to go only as far as one loop with `minicut loop stop-at`, or to go quiet with `minicut loop pause`.

Claude Code and Codex have a stop hook that `minicut install-skill` adds. It runs `minicut loop guard`. It sends the agent back to work while a loop is mid-round or a job of the project still runs. It also holds the agent while video takes wait for the Videos loop.

## Next

[Checks and loops](/docs/cli/checks-and-loops) [Shot sheet](/docs/cli/shot-sheet) [Project directory](/docs/cli/project-directory)
