Skip to content
Back to skills

Runbook Review Loop

ASecurity

One code change in a git repository. A coder implements a brief, a reviewer reads the changes and runs the checks, and the coder fixes the findings until none are left or the fix rounds run out, every step a subagent of this session. Inputs brief, repo, optional checks and maxFixRounds. Leaves the changes uncommitted.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 6, 2026
ai-agentspythongoshellgit

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add agent-runbooks/skills --skill runbook-review-loop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Runbook Review Loop?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Runbook Review Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/agent-runbooks-runbook-review-loop/badge)](https://www.skillsdirectory.com/skills/agent-runbooks-runbook-review-loop)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: runbook-review-loop
description: One code change in a git repository. A coder implements a brief, a reviewer reads the changes and runs the checks, and the coder fixes the findings until none are left or the fix rounds run out, every step a subagent of this session. Inputs brief, repo, optional checks and maxFixRounds. Leaves the changes uncommitted.
---

# Review loop

Leaves the brief implemented in a repository, uncommitted, with a report: the last `review.md` of the run says what the changes do and lists the findings still open, if any. Commit and PR happen outside.

Every step runs as a subagent of this session, on the model its settings pick. The session's own subagent tool is enough, the Agent tool in Claude Code: no MCP server is needed.

## Inputs

- `brief`: the change to make, as text. The orchestrator saves it to `<run>/brief.md` and passes `"brief": "brief.md"` to `start`
- `repo`: absolute path of the git repository, the directory this session started in unless the human names another
- `checks`: the shell command that checks the project, run from `repo`, e.g. `python3 -m unittest` or `pnpm test`. Optional: when it is omitted, the executors use the checks the repository's `AGENTS.md` or `CLAUDE.md` names
- `maxFixRounds`: integer, default 2. One round is one fix and the review after it. When the rounds are spent and findings remain, the human is asked, and may grant one more round or several
- `run-id`: given only to resume an interrupted run
- Smoke input, in any small git repository with a clean tree: brief "Add a file `SMOKE.md` with the single line `smoke`", checks `true`. The expected path is the shortest one: the reviewer finds nothing and the run ends `ready`. A second smoke input reaches the loop and the human step: the same brief, checks `exit 1`, `maxFixRounds` 1, and the answer `stop`. The run ends `needs_attention`. The human deletes `SMOKE.md` and the run directory after either

## Run directory

`<the directory this session started in>/.agent-runbooks/runs/<YYYYMMDD>-<slug>/`. Slug: three or four words from the brief in kebab-case, for example `add-smoke-file`.

## Execution rules

You are the orchestrator of this run. Orchestrating takes a session that can launch subagents and learn when they finish. If yours cannot, stop and say so. During the run you do only these things:

- run `python3 <skill>/flow.py …` as written below
- save the input files the Inputs section names into the run directory `start` created
- launch steps as subagents, with the message `flow.py` prints, and with the reply schema where your tool takes one
- send a step's message into the session of an earlier step, or into a fork of it, when `flow.py` says so
- send an executor the correction `flow.py` prints for its reply
- read a step's output file only to quote it to the human
- ask the human, and report the end of the run
- show the human the run's status, as the Status group below says

Nothing else. No command beyond these, no reading of `flow.py`, `state.json`, `progress.md` or the prompt files, no editing of anything in the run directory. `<skill>` is the directory this `SKILL.md` was loaded from.

Starting

- The human asks to run part of this run's work on another model, tool or effort: run `python3 <skill>/flow.py --executors` before `start`, and do what it prints.
- The run directory is `.agent-runbooks/runs/<YYYYMMDD>-<slug>` under the directory your session started in, with today's local date. Run `python3 <skill>/flow.py <run> start '<the inputs you were given, as one JSON object>'` first, with every input the Inputs section saves to a file given as that file name: it creates the directory, or refuses because it exists, in which case add `-2`, `-3` to the name and start again. Then save the input files the Inputs section names into the directory it created.
- Resume: `python3 <skill>/flow.py <run>`.

flow.py

- It keeps the state of the run and prints what to do: which steps to launch, with which executor and what message, whom to wait for, what to ask the human, or that the run has ended. Do all of what it prints, then wait. Every command it asks you to run next is printed in full.
- A `flow.py` command may run long, because it runs the runbook's code steps itself. Run it with the largest timeout your tool accepts, and wait for it as for a step. If your tool moves it to the background and tells you when it exits, wait for that. If your tool killed it, run `python3 <skill>/flow.py <run>` and do what it prints. Never start a second `flow.py` for a call that is running.
- `flow.py` names a code step running in another `flow.py` command. It is not a subagent: wait for that command, and never run `interrupted` for it.
- An executor is a named way to launch a step as a new subagent. Its description says what the executor does and binds what it names: a model, a tool, an effort, a working directory. The rest you pick as for any subagent of yours, by your settings and the human's instructions for that kind of work. A step listed with no executor is launched the same way, by your general settings: its name says nothing about the model. Never ask the human to pick a model, and do not pass your own model only because none is named.
- A step's message arrives: take the last JSON object in it and run the `reply` command printed for that step with that JSON. No JSON object in the message: pass `{}`. When the printed command has `--session '<…>'` before the JSON, replace `<…>` with the id your tool gave the subagent that ran the step, an agent id, a session id or a thread id. Leave the flag out if the tool gave none. Any JSON argument, for `start`, `reply` or `answer`, with a single quote (`'`) in it goes through stdin: put `-` in place of the JSON and pass the JSON on stdin, in a POSIX shell with a quoted heredoc. One argument of a command at most.
- The human answers a question: map the answer to one of the choices `flow.py` listed, ask again if none fits, and run the `answer` command printed with that choice and the human's words verbatim. A free-text question takes the words alone. When `flow.py` lists fields with the question, the command takes a JSON object in place of the choice: the choice and the fields the human gave. A field they did not give is left out, never guessed. `flow.py` keeps the words and writes them where the steps that follow read them.
- A reply did not pass the check: `flow.py` prints a correction. Send it to the subagent that ran the step, as a follow-up message in its session, not as a new launch, and wait for its answer the way you wait for a step. Its answer goes to the same `reply` command. If your tool cannot send a message to a subagent that has finished, run the command `flow.py` printed for that case instead. An executor that only relays another agent's reply passes the correction on to that agent, in its session, and returns its answer verbatim.
- `flow.py` prints a step to send into the session of an earlier step, in place of a new subagent: send the message to the subagent that ran the step `flow.py` names, as a follow-up message in its session, and wait for its answer the way you wait for a step. An executor that only relays another agent's reply passes the message on to that agent, in its session, and returns its answer verbatim.
- `flow.py` prints a step to launch as a fork of the session of an earlier step: start a new session that begins with a copy of the conversation of the subagent that ran that step, and send the message there. This takes a tool that copies a subagent's session. A tool that copies your own conversation cannot do this.
- For both, `flow.py` prints the id it has for the session, if it has one. Try it even when it comes from an earlier session of yours. If the session is gone, your tool does not know the id, or it cannot send the follow-up or make the fork, launch the step as a new subagent with the same message and record its reply with the `--new-session` command `flow.py` printed for that case.
- A running step's executor is gone, because the session is new or the tool reports it dead: `flow.py <run> interrupted <call>`, with the address `flow.py` printed for that launch, such as `main/review#2`, in single quotes, since `#` and `[` mean things to a shell. Executors you launched in this conversation are not gone: wait for them.
- You departed from these rules, or did something `flow.py` does not know about: `flow.py <run> log '<one line>'`.

Launching

- Launch every step `flow.py` lists, with its executor when one is named, in the way the line above its message says. Send exactly the text between `--- message ---` and `--- end of message ---`. Add nothing, apart from lines your harness or your own rules require in every subagent prompt. An executor that only relays another agent's reply gets one more line: "Return the agent's final message verbatim."
- Steps `flow.py` lists together are launched together, in one turn.
- The message names a `reply schema` file. If your subagent tool can hold a subagent's final message to a JSON schema, give it this one: the path, or the file's content when the tool takes only that. Otherwise leave the file to the executor.

Waiting

- Waiting costs zero turns. Pick the branch that matches your harness.
  - You can launch a subagent in the background and get woken up when it finishes, and ending your turn does not end your session: launch the ready steps that way and end your turn. On a wake-up, record the reply, do what `flow.py` prints, end your turn.
  - Otherwise, which includes running nested in another agent where the end of your turn is the end of your run: launch the ready steps in the foreground, in parallel if your harness allows several calls at once, otherwise one after another. Set every timeout or yield parameter your tool accepts to 24 hours or its maximum. If a call returns while the step still runs, call the wait again and do nothing else.
- Either way the step's completion is the only event. No polling, no sleeping, no reading ahead, no status messages while it runs. An hour-long step is a normal working state.

Status

- By default, show no status during the run: the final state comes with `end`.
- Before you ask the human a question, run `flow.py <run> status --tail 10` and show its output as it is, in a code block, above the question.
- If the human asks to see the progress after every step, run `flow.py <run> status --tail 10` after every `flow.py` command that launches or ends a step (`start`, `reply`, `answer`, `interrupted`, `relaunch`), and show its output as it is, in a code block, with no commentary. Never while waiting for a step.
- If the human asks for the status: `flow.py <run> status`, its output in a code block.

Human steps and side effects

- `flow.py` tells you when to ask the human and what. Ask, then wait for the answer the way you wait for a step. A failed or interrupted step with side effects is relaunched only after the human says yes: `flow.py <run> relaunch <call>`, with the address the question names.
- `flow.py` tells you to withdraw a question: tell the human no answer to it is needed, and do not run its `answer` command.

Ending

- When `flow.py` prints `end`, report what it says to the human: the status, the run directory, the file to read. Then show the table it prints under that as it is, as markdown and not in a code block. The run is over and these rules no longer bind you.

## Steps

Declared in `flow.py` next to this file: inputs, executors, steps with their prompts, what each reads and writes, and the flow that calls them. `flow.py` drives the run and prints, for every launch, the step's executor and its description, if the step has one. This section is a pointer, not a copy.

## End of run

- `ready`: the last review found nothing, the checks included. The human reads the review file `flow.py` names, then commits.
- `needs_attention`: the fix rounds ran out with findings open, and the human chose to stop. The review file `flow.py` names lists them, and the human decides what to do with them.
- `failed`: a step failed or was blocked. `progress.md`, which `flow.py` names, says which step and why.

Files in this skill

  • SKILL.md8.7 KB
  • flow.py2.1 KB
  • prompts/01-implement.md687 B
  • prompts/02-review.md1.7 KB
  • prompts/03-fix.md751 B
  • prompts/common.md2.5 KB
  • runbook.py58.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.