agentleFS
kendrickkendrick/skills/divvy-up/SKILL.md

divvy-up

Skill1 starsChanged 2 months agoMITView on GitHub

Run an approved implementation plan as waves of parallel subagents whose tasks own disjoint files. Use when a plan is already approved and its tasks should run at once rather than one at a time, or when another skill needs a plan's waves derived, dispatched, and gated. It never writes the plan: to plan, use writing-plans.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read PLAN end to end. One task per unit of work that names files.

    line 32
  2. Very specific:

    Done when: every task names one of haiku, sonnet, opus, fable, and every task the ladder's opus row describes sits at opus or above.

    line 53
  3. Very specific:

    Write the result into PLAN under a ## Waves heading, as a pipe table with the header Wave | Task | Files owned | Model | Done when | …

    line 67
  4. Distinctive:

    When MAX is set, pass it, so a wave over the cap fails here instead of passing on the planner's say-so:

    line 81
  5. Very specific:

    When GUILD, stop here. Print Run /agent-guild:job <PLAN> and say plainly that the guild re-derives its own tasks, so the ownership and …

    line 97
  6. Distinctive:

    When PLAN is still being shaped—plan mode, or the user has not approved it—stop after the table.

    line 99
  7. Very specific:

    Put every question Step 1 recorded to the user before asking anything else, and settle each one.

    line 101
  8. Very specific:

    Read references/worker-prompt.md for its Dispatching rules, then render every task in the wave with scripts/render-prompt.py, exiting 0 …

    line 111
  9. Distinctive:

    Reports: Read each one against its task's done-when and its constraints, not against whether it sounds finished.

    line 166
  10. Very specific:

    After the last wave, read git diff <START_SHA> in-session against PLAN as a whole.

    line 191

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

divvy-up

An implementation plan is a dependency graph, not a list. Read as a list it executes in the order somebody typed the bullets, one task at a time, on whatever model the session happens to be running. Read as a graph it has width: most tasks wait on one or two others and on nothing else, so they can run at the same moment.

Width is only safe under one condition—no two concurrent tasks write the same path—and that condition gets proved by a script before anything is dispatched, rather than asserted in a "watch out for conflicts" note attached to the workers. Two agents editing one file in one working tree lose a write and neither of them reports it, so a check that runs after the fan-out is a check that runs too late.

Cost falls for a second reason. Each task runs on the cheapest rung of the ladder that can do it correctly, and the savings hold only because review stays on the session model. Delegation that also delegates the judgment of whether the work came back right does not save money; it moves the mistake somewhere nobody is looking.

Three skills cover three shapes of the same job. Reach for agent-guild when the work needs a written constitution and an independent checker per task. Reach for divvy-up when a plan is already approved and its tasks can be carved into disjoint file ownership. Reach for subagent-driven-development when they cannot be, and the tasks have to run one at a time.

This skill is model-invocable because work-issue reaches it at its own Step 0, and a skill no sibling can call is one no sibling can compose with. Typing its name still works—a description adds agent discovery without taking the human's away. Step 4's confirmation is what stands between a misfire and a spent fan-out: it stops the run before a single dispatch.

Where a step names a shell command, treat it as the intent and use your native shell or file tools.

Resolve once per invocation:

  • PLAN — the plan path from the arguments; failing that, the plan file this session wrote; failing that, the approved plan held in the conversation.
  • MAX — the cap on tasks per wave from --max N, else unbounded.
  • COMMIT — set by --commit, else asked at Step 4.
  • START_SHA — git rev-parse HEAD, taken before any task runs. Step 7 reads the whole run against it.
  • GUILD — whether .agent-guild/ exists.
  • PROMPT_DIR — where rendered worker prompts go: the directory a wrapping skill names, else mktemp -d, made once. It stays outside the work tree, because Step 6 derives ownership from the diff and a prompt inside the tree would read as a write no task owns.

Step 1 — Derive tasks

Read PLAN end to end. One task per unit of work that names files. Shared contracts—types, interfaces, schemas, migrations—become wave-0 tasks, each alone, ahead of everything that consumes them: a consumer that starts before its contract exists writes against a guess.

Batch small same-shape edits into ONE task. The same one-line fix or field addition repeated across eight files is one dispatch and one review surface, not eight of each; splitting it multiplies the gate work without buying any parallelism.

Then take each pair of tasks whose files are disjoint and ask whether one's change would alter what the other builds against, even where PLAN names no dependency between them. Disjoint paths prove two tasks cannot lose each other's writes; they do not prove the two tasks are about different things. Three shapes turn up: both change behavior some third module reads, one fix may make the other unnecessary, or both touch a runtime agreement that is neither a type nor a schema and so never became a wave-0 task. A coupling found this way lands in a mechanism this skill already has. Directional—A's result shapes B's work—is a dependency, which Step 3's rule already resolves by putting B in a later wave. Mutual, or either may make the other moot, is a merge into one task, the same way the batching rule merges same-shape edits. Suspected but unclear is an ambiguity: write it up as a question for Step 4 rather than settling it here.

Every task carries four things: an owns list of exact paths or directory prefixes ending in /, a model, a done-when somebody could fail it against, and a constraint naming the shortcut that would satisfy that done-when without doing the work, or the boundary the work stays inside. A done-when also has to be reachable while peers are still writing. Where a task's tests compose a peer's output, its bar is its own files; the suite belongs to the gate. A tree-wide command, the full suite or a typecheck, is the gate's bar after the wave lands, and it is a task's done-when only where that task's own files are all the command reads. A done-when states what passing looks like, and a cheap rung told "these tests pass" can get there by weakening the test—the gate then sees green. So where the done-when has an obvious cheap wrong path—a test that could be loosened, a timeout that could be raised, production code a test-only task could edit—write that shortcut down. Work can also meet its done-when honestly by widening the file it owns, with a new helper, convention, or dependency where the file already has a fixed set. Where the file has one, the constraint names that boundary and tells the worker to work inside it. Most tasks have no such path and no such boundary, and their constraint cell stays empty rather than holding something invented to fill it. Where PLAN leaves a task ambiguous, write it up with the open question attached and carry the question to Step 4 rather than guessing an answer that six parallel agents will then build on.

Done when: every unit of work in PLAN is a task with owns, model, a checkable done-when that the task can reach from its own files while its peers are still writing, and a constraint cell that names any cheap wrong path and any vocabulary boundary the task's file holds, or is deliberately empty; every disjoint-file pair has been asked the coupling question, and each coupling found has landed as a dependency, a merge, or a recorded question; and every ambiguity is written down as a question instead of a guess.

Step 2 — Route

RungWork it takes
haikuFile and symbol discovery, grep-and-report, mechanical renames, test scaffolding, docs and changelogs, formatting, dependency-free boilerplate against a spec the user already approved.
sonnetFeature implementation inside a single module, tests written to stated behavior, straightforward refactors.
opusAnything touching auth, payments, migrations, deletes, infra, or public API surface; any task whose spec is ambiguous.
fableExplicit assignment only, and the rung above opus when an opus task fails.

Orchestrator work is not a dispatch. Deriving the plan, gating a wave, and reading the merged diff all run on the session model, whatever it is. That is where the delegation savings survive contact: cheap rungs produce the work, the session model judges it. When a task sits between two rungs, escalate—a wrong guess downward costs a revert, a retry, and the gate that caught it.

Done when: every task names one of haiku, sonnet, opus, fable, and every task the ladder's opus row describes sits at opus or above.

Step 3 — Wave

Check git status --porcelain before writing anything. A dirty tree stops the run with "commit or stash first": Step 6 recovers a failed task by reverting the paths it owns, and against pre-existing uncommitted work that revert destroys something this run never wrote. Where the user overrides deliberately, name the exposed paths. The check runs here, ahead of the table, because writing the table into a tracked plan file is itself a modification—checking after that edit would stop every ordinary run on the skill's own change.

Then capture BASELINE, which starts as the verify command's output before any task runs, so Step 6 can tell a failure this run caused from one that was already there. Where the wrapping skill names a verify command, that command is VERIFY_CMD, and the repo-disk resolution below is skipped. Otherwise resolve VERIFY_CMD from the repo on disk rather than asking for it: manifest scripts first (package.json, Makefile, pyproject.toml, Cargo.toml), then runnable scripts under tests/ or scripts/, then whatever .github/workflows/ runs. Run it once, and keep its exit status and the tail of its output as a first line exit: <n> followed by the tail, the shape a wrapper's file has and {{BASELINE}} hands workers. BASELINE is green on exit 0 and red otherwise. Step 6 refreshes it after each passing wave.

A wrapping skill's baseline replaces the run. When the invocation names a baseline file, or says one will be named before Step 5, skip running VERIFY_CMD here and take that file as BASELINE once it is named. Resolve VERIFY_CMD all the same, because Step 6 runs it; a command the wrapper named is that resolution. A wrapping skill that continues the run at a later wave can name another file, and that file replaces BASELINE from then on. The wrapper must have recorded the run-start file at the HEAD this run starts from, and a later wave's file at the HEAD that wave's gate passed on, both in the tree its workers will write, since that is the tree the gate compares against. A named file's first line exit: <n> gives its status: green on 0, red otherwise. That line is a status, not a failure, so attribution reads failures from the rest of the file. A named file with no exit: first line reads as red, because a status nobody recorded can't be called green: a falsely green baseline charges the tree's own failure to the first task that meets it. Reading it red errs toward stopping, since a red baseline whose output names no failures sends the first failing verification to Step 6's stop row rather than to a retry of a healthy task.

With no command found, VERIFY_CMD and BASELINE are both absent, and Steps 4 and 6 run as they would with no baseline at all. Both placeholders still go into the worker prompt as the literal absent, and the template tells a worker handed that to run nothing and set its status by the task's done-when alone.

A task goes in the lowest wave where it shares no owned path with a peer already in that wave, and every task it depends on sits in an earlier wave. Apply MAX as a cap on wave size.

Write the result into PLAN under a ## Waves heading, as a pipe table with the header Wave | Task | Files owned | Model | Done when | Constraints, one row per task:

| 0 | add-user-schema | src/db/schema.ts | opus | schema exported, migration applies cleanly | |

Files owned takes bare repo-relative paths, comma-separated for a task that owns more than one. validate refuses a backticked path and a markdown link alike, quoting back whatever the author typed.

Then:

divvy-up/scripts/check-waves.py validate <PLAN>

When MAX is set, pass it, so a wave over the cap fails here instead of passing on the planner's say-so:

divvy-up/scripts/check-waves.py validate <PLAN> --max <MAX>

A plan that lives only in the conversation still needs a pathname, because Step 6's owners takes its changed paths on stdin and refuses -. Write the table to a temporary file, use that path for the rest of the run, and print the table for the user as well. Validating through validate - and dispatching anyway strands the run: workers modify the tree, and the mandatory ownership check then has no plan to read.

A non-zero exit is a hard stop, not a warning. Overlapping owners inside one wave remove the single property the whole design rests on, and a fan-out on top of that overlap produces a diff nobody can attribute. Its serialized: lines are the healthy case: two tasks that touch one tree, held in different waves.

Announce the shape in one line before anything spends a token—4 waves, 9 tasks; wave 0 is 1 contract task on opus. That line is the user's correction point.

Done when: VERIFY_CMD is resolved or absent, and BASELINE is captured, named by the wrapping skill, promised by it before Step 5, or absent with VERIFY_CMD; validate exits 0; and the shape line has been printed.

Step 4 — Confirm

When GUILD, stop here. Print Run /agent-guild:job <PLAN> and say plainly that the guild re-derives its own tasks, so the ownership and model columns just written become advisory prose for the guild to read rather than instructions anything will execute.

When PLAN is still being shaped—plan mode, or the user has not approved it—stop after the table. Waves computed over a moving plan expire the moment it moves.

Put every question Step 1 recorded to the user before asking anything else, and settle each one. An ambiguous task that reaches a dispatch spends a rung and comes back stopped, by which time its peers have already written the tree it was guessing about.

Ask once, in one question: execute wave 0, and commit after each passing wave. Drop the commit half when --commit already answered it. A wrapping skill that has already put the wave-0 and commit question to the user in its own confirmation answers it here on the user's behalf, and says so in its own shape line. Run alone, read the commit style first, with the command in Step 5's git-write paragraph, and when it reads bare, add one clause to the question: squash-only repo: in-branch commits get bare subjects.

When BASELINE is red, the same question names each failure BASELINE shows and offers two answers: execute wave 0 and judge verification against this baseline, or stop. A red baseline does not stop the run on its own, because a plan can exist to fix the very failure the baseline shows. When a red BASELINE names no individual failures, the question says so in their place, and says that executing means the first wave whose verification fails stops the run, since nothing can be attributed against it. A green or absent BASELINE leaves the question as worded above.

Done when: every recorded question is answered, and the user has approved executing wave 0 with COMMIT settled and, when BASELINE is red, its failures named in that question, and, run alone, the commit style read and the bare clause asked when it applies—or the run stopped at the guild handoff or the unapproved plan.

Step 5 — Dispatch a wave

Read references/worker-prompt.md for its Dispatching rules, then render every task in the wave with scripts/render-prompt.py, exiting 0 each time:

python3 <skill-dir>/scripts/render-prompt.py PLAN --wave N --task LABEL --out PROMPT_DIR/N-LABEL.md \
    [--contract FILE] [--verify-cmd CMD] [--baseline FILE] [--caller-notes FILE] [--prior FILE]

The script fills the template from the Waves table and the flags, and fails on any template placeholder left unfilled. Write CONTRACT and BASELINE to files first. A wrapping skill's preamble goes in through --caller-notes, since {{CALLER_NOTES}} is the seam through which it reaches every dispatch, and a re-dispatch's report goes in through --prior. Typing the filled template into the dispatch costs about 2.4 s per 1k characters of output, ~37 s a worker, and the file costs none.

Dispatch every task in a SINGLE message so they run concurrently—one dispatch per message is exactly the serialization the wave exists to remove, and it looks identical in the transcript. Each prompt is one sentence with that task's path: Read <path> in full before doing anything else. It is your complete task instructions; follow it exactly as if it were this message. The rendered file stays in PROMPT_DIR as the verbatim record of what the worker received, beside the saved report.

Every git write belongs to you, not to a worker. Workers write files; you stage, commit, and branch. A worker that commits stages its peers' half-written changes along with its own and moves HEAD out from under Step 6's revert, so a failed task survives its own rollback. Say so in the dispatch: a repo's own agent docs are usually written for an agent working alone, and this one is not. The same goes for a formatter or a linter's --fix: a worker runs one only scoped to its own paths, and you run the tree-wide pass at Step 6. Every commit you make takes one commit style. When a wrapping skill hands over bare or full, use that. Run alone, read it once from the repo's settings, before Step 4's question: gh api repos/{owner}/{repo} --jq '.allow_squash_merge == true and .allow_merge_commit == false and .allow_rebase_merge == false'. true is bare: a squash-only repo folds every in-branch commit into the pull request's squash, so each message is one Conventional Commits subject in the repo's log style, with no body and no prose pass, even where the repo's or host's own rules ask for one. false, an error, or no output is full: write each message as you would without this rule, to whatever prose rules the repo or host sets. A token that can't administer the repo reads each setting as null, and the expression turns that into false, so the fallback is always full. Either style carries no trailer or footer.

Name each dispatch's model explicitly. An omitted model inherits the session's, which is usually the most expensive one available, and the routing silently evaporates while the run still looks correct.

Save every returned JSON report verbatim, one file per task, as REPORT: the path a wrapping skill saves its reports at, else PROMPT_DIR/N-LABEL.report.json. work-issue saves each at RUN_DIR/reports/<wave>-<task>.json, so that file is REPORT under it. Save the JSON object itself unchanged and leave out only the code fence around it. Step 6 reads these as evidence of what happened, and a summarized report is evidence of what the orchestrator thought happened.

Before the dispatch goes out, record WAVE_BASE and the wave's untracked manifest with python3 <skill-dir>/scripts/wave-snapshot.py record --out PROMPT_DIR/wave-N.json. The snapshot file sits in PROMPT_DIR because one inside the tree would read as a write no task owns, so the script exits 1 on an in-tree --out and writes nothing. WAVE_BASE is a commit object: git stash create, falling back to git rev-parse HEAD when that prints nothing because the tree is clean. git stash create writes a commit of the current tree without touching the working tree or the index, which is what makes it safe to run mid-run.

The manifest records the wave's untracked files beside it as content, not as names: each path from git ls-files --others --exclude-standard with its git hash-object -w. The script hashes with --no-filters, so a clean filter or an eol rule cannot normalize the recorded bytes and a revert restores what the file actually held. An untracked symlink is recorded by its link text, the way git stores one, so a peer rewriting the link's target leaves the link unchanged and revert restores a recorded link as a symlink. git stash create ignores untracked files even under --include-untracked, so nothing else covers them, and a name-only list repeats the defect below in the untracked half—wave 1 creates a file, a wave-2 worker rewrites it, both lists hold the same path, and the clobber is invisible.

-w is what makes the manifest more than a detector. Without it git hash-object prints a hash and stores nothing, so once a worker overwrites the file the bytes are gone and Step 6 has a name for what it cannot restore. -w writes the blob into the object database, where git cat-file -p can still reach it.

A commit object rather than a status snapshot, because status text cannot see a second write. When wave 1 leaves a file at M path and a wave-2 worker rewrites that same file, both snapshots hold the identical line, the difference between them is empty, and the clobber the gate exists to catch passes it silently.

Done when: wave-snapshot.py record exited 0, every prompt was rendered by render-prompt.py exiting 0, every task in the wave was dispatched in one message at its routed model, and every report is saved verbatim.

Step 6 — Gate

Three checks with a format pass between the first two, then a route.

  1. Ownership. Work out what this wave wrote into a file in PROMPT_DIR, then feed those paths through the plan:

    python3 <skill-dir>/scripts/wave-snapshot.py changed PROMPT_DIR/wave-N.json > PROMPT_DIR/wave-N.changed && divvy-up/scripts/check-waves.py owners <PLAN> --wave N < PROMPT_DIR/wave-N.changed

    A non-zero exit from that line fails the ownership check, whichever command set it. Keep the && and the file rather than a pipe: owners exits 0 on empty input, so a changed that failed on an unreadable snapshot or a git error would pass the gate unseen in any shell without pipefail.

    changed derives the paths against WAVE_BASE, not against the working tree as a whole, and the same way whether or not COMMIT is set: every tracked path whose bytes differ from WAVE_BASE, plus every untracked path whose blob differs from the wave's manifest, is missing from it, or has since disappeared. It keys on content, so a rewrite that leaves the status line and the name unchanged still lists, and a touch that leaves the bytes alone does not. Reading the whole dirty tree instead fails wave 2 for every path wave 1 legitimately owned. Take any other read of what the wave changed from git diff --stat HEAD plus the untracked paths the manifest comparison above finds, rather than git status, because a worker's scratch copy that reached the shared index leaves staged noise that git status reports as uncommitted work, while git diff --stat HEAD reads the working tree and skips new files.

    A path no task in the wave owns fails the run. That is a write into territory nobody claimed, and it is invisible in a passing test suite.

    Then check each report's files_changed against that task's own owns, and fail any task claiming a path it does not own. Run it once per task, writing the list to a file and chaining with && for the same reason as above, since an extraction that fails would otherwise hand owners empty input and pass:

    python3 -c 'import json,sys; print("\n".join(json.load(open(sys.argv[1]))["files_changed"]))' "REPORT" > "PROMPT_DIR/N-LABEL.files" && divvy-up/scripts/check-waves.py owners <PLAN> --wave N --task "<LABEL>" < "PROMPT_DIR/N-LABEL.files"

    A non-zero exit fails that task. --task exits 1 on a path the plan gives a peer or gives nobody, and 3 on a label with no task in the wave. owners answers which task owns a path, never which agent wrote it, so a worker that writes a peer's owned file leaves a path the gate happily attributes to its rightful owner. The report cross-check is what catches that case, and it rests on the worker's own account of what it touched—see Known Limitations for what stays uncovered.

    Then the format pass. With every worker finished, run the repo's own format or fix command once, if it has one: found where Step 3 finds VERIFY_CMD, or named as a pre-commit step in the repo's agent docs. Scope it to the derived paths that still exist where the command takes paths, since the derived set includes paths a task deleted, and run it tree-wide where it cannot be scoped, since nothing else is writing now. It runs after the ownership check, because its writes are yours rather than any task's, and before verification, because the workers were told to leave it to you and a verification that checks formatting would otherwise fail them for obeying. Name to the user every path it changed outside the derived set before the wave is committed: rerun the derivation above and take every path it now lists that it did not list before the pass. To do that, run changed before the pass and again after it, and keep the lines new in the second run. Write each run to its own file in PROMPT_DIR, PROMPT_DIR/wave-N.pre-format and PROMPT_DIR/wave-N.post-format. A non-zero exit from either changed run stops the run the way a format-command error naming no derived path stops it, because a failed run lists nothing and hides every path the pass changed. A non-zero exit from the pass is no task's failure by itself: where it reported what it could not fix, carry that output into verification, which reports what remains; where the command itself errored, revert every path it changed outside the derived set back to WAVE_BASE, then classify the error by the paths its output names. Revert each one the way reverting a task, below, reverts an owned path, applying by hand the per-path case revert applies, since these paths belong to no task and revert --task cannot reach them. An untracked path the manifest lacks is deleted. Paths inside the derived set keep the pass's writes: they belong to the wave, and the next pass rewrites them. Compare the paths the output names with the derived set as repo-relative paths, resolving an absolute path against the repo root first. An error naming only paths inside the derived set is the failure of each task that owns one of them, since that task left a file the formatter cannot parse: route it as failed in the table below, with the formatter's output attached as its failure. Verification still runs for the wave as usual; after it, route every other task in the wave by its own report. An error naming no derived path, such as a missing tool, a bad config, or a repo-level failure, stops the run: show the user its output. Where the output cannot be tied to a path either way, stop the same way, because a guess sends a healthy task back for a retry. Output naming both a derived path and a path outside the derived set counts as one that cannot be tied, since a tree-wide pass that also chokes on a file broken before the wave would otherwise retry a healthy task. The revert comes first on every branch because an erroring formatter can leave a partial rewrite behind, and a resumed run that records a fresh WAVE_BASE over it absorbs a write no ownership check ever saw. A retried task comes back through this step, so the pass runs again on its paths.

  2. Verification. Run VERIFY_CMD, the command Step 3 resolved or the wrapper named, so the gate verifies with the same command BASELINE ran. Attribute each failure by BASELINE: a failure routes a task as failed only when BASELINE does not show that same test or check. A failure BASELINE does show goes in the wave summary and is charged to no task. With a green or absent BASELINE every failure belongs to the wave and routes as failed. With a red BASELINE, where verification fails and either this wave's output or BASELINE names no individual failures, nothing can be attributed, so the run stops by the last row of the table below. Once the wave passes its gate, BASELINE becomes the exit status and output tail of the verification run that passed it, the run after any retries, and every later wave's workers and gate read that refreshed BASELINE, since a failure an earlier wave fixed and a later wave brings back must count against the later wave. A wave that changed nothing refreshes the same way. Step 4's question reads the run-start BASELINE alone, because only that one is ever asked about. With VERIFY_CMD absent, skip this check, and nothing refreshes.
  3. Reports. Read each one against its task's done-when and its constraints, not against whether it sounds finished.

Then route each task:

ResultRoute
PassingMove to the next wave, committing first when COMMIT is set.
stoppedRevert that task's owned paths, then hold its question. Put every held question to the user once the rest of the wave lands, then re-dispatch the task alone at the same rung with the answer attached. Same rung, because it stopped for want of an answer rather than for want of a better model. Reverting first matters as much as it does for a failure: partial work built toward a guess the worker declined to make is worse than an empty tree.
failed, or failed the gateRevert that task's owned paths, then re-dispatch it alone one rung up with the failure attached. Work that reached its done-when by the shortcut its constraint named has failed the gate: a worker that took that route lacked the judgment the task needed, and the rung above is what supplies it.
Failed on fableRevert its owned paths and stop the run. fable is the top rung, so nothing is left to escalate to, and a retry at the same rung spends the budget to learn the same thing.
Failed twiceStop the run and report.
Verification failed on a red BASELINE, and this wave's output or BASELINE names no individual failuresStop the run with Verification failed without naming individual failures, so this wave's failures can't be told from the baseline's., followed by both outputs quoted: this wave's verification and BASELINE. A guess here sends a healthy task back for a retry or passes a broken one.

Revert before the retry. A re-dispatch onto a half-written tree hands the second agent the first one's leftovers to debug, and it will spend its budget there instead of on the task. The revert is bounded by the clean tree Step 3 required and by WAVE_BASE, so it only ever discards writes this run made.

Reverting a task means python3 <skill-dir>/scripts/wave-snapshot.py revert PROMPT_DIR/wave-N.json --plan <PLAN> --wave N --task <LABEL>, against the snapshot file recorded before the dispatch it undoes. Ownership comes from check-waves.py's own rule, so revert touches only the changed paths that task owns and leaves every peer's paths as they are. Each path takes one case: a tracked path goes back with git --literal-pathspecs checkout <WAVE_BASE> -- <path>, so a bracket in an owned name never matches a peer's file; an untracked path the wave created is deleted; an untracked path in the wave's manifest is restored from its blob with git cat-file -p, whether the task rewrote it or removed it. Before that restore, revert removes whatever file or symlink sits at the manifest path and writes a fresh one, so the restore never writes through a symlink or a hard link into a peer's file. It also refuses to restore or delete a path whose parent directory is now a symlink, and reports that path instead. A non-zero exit names each path it could not restore, one stderr line apiece; stop the run and show the user that output, because those bytes are gone.

Before each re-dispatch, failed or stopped, record WAVE_BASE and its untracked manifest again with wave-snapshot.py record into a new file in PROMPT_DIR, after the revert and after the format pass has written, and gate the retry against that file. A format-pass write outside the derived set never matches the old base, so a retry gated against it fails owners on your own write; the fresh base leaves the retry's gate seeing only what the retry wrote. The revert is unaffected: each revert uses the base recorded before the dispatch it undoes.

Render each re-dispatch with its own --out PROMPT_DIR/N-LABEL.retry-<k>.md and its own --prior PROMPT_DIR/N-LABEL.retry-<k>.prior.md, where <k> is one more than the highest PROMPT_DIR/N-LABEL.retry-<k>.md that already exists for that task, or 1 when none does. Read <k> from disk at every re-dispatch, because a count held in memory restarts at 1 after a compaction or a resumed lane and overwrites a retry record. render-prompt.py overwrites --out, so a retry rendered to Step 5's path erases the record of what the first worker received.

Done when: every report has been read against its task's done-when and its constraints, the format pass ran after the ownership check or the repo has none, and every task in the wave is passing; or was reverted and retried one rung up; or was reverted, answered, and re-dispatched at its own rung; or the run stopped after a second failure, on a fable task, on a revert that could not restore a path, or on a format-command error naming no derived path or one that could not be tied to a path, or on a verification failure against a red BASELINE where this wave's output or BASELINE named no individual failures. Every verification failure is charged to a task or, where BASELINE shows it too, named in the wave summary. Once the wave passes, BASELINE holds its gate's last verification run. The wave is committed when COMMIT is set, and no worker has committed anything.

Step 7 — Review

After the last wave, read git diff <START_SHA> in-session against PLAN as a whole. The gates checked tasks one at a time; nothing before this point has looked at whether the assembled change does what the plan set out to do.

Report waves run, tasks per model, escalations, questions asked, and what is left uncommitted.

Done when: the full diff has been read against PLAN, and the report names waves run, per-model task counts, escalations, open questions, and uncommitted work.

Further Reading

  • references/worker-prompt.md — read at Step 5 for the dispatch rules; render-prompt.py fills its Template
  • scripts/render-prompt.py — run at Step 5 to fill each task's worker prompt into a file
  • scripts/check-waves.py — run at Step 3 to prove the waves, and at Step 6 to attribute what a wave wrote
  • scripts/wave-snapshot.py — run at Step 5 to record WAVE_BASE and the untracked manifest, and at Step 6 to derive what a wave changed, revert a task, and record again before a retry

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.