Branch on this deliverable's mode:
mode: build → go straight to step 2a below with retry = 0.
mode: review → run the initial review sub-procedure (R1–R4) first. If it passes, advance to the next deliverable. If it fails, enter the loop at step 2a with retry = 1.
Initial review sub-procedure (review mode only):
R1. Evaluator task file — write .adveloop/tasks/<N>/eval-task-0.md containing:
## Deliverable — this deliverable's name + description (verbatim from deliverables.md).
## Mode: review
## Completion signal — the literal signal name: adveloop-<run_id>-eval-done-<N>-0.
(No ## Generator summary section — there is nothing to claim yet.)
R2. Spawn the Evaluator pane via the /cmux skill. Same command shape as step f below; substitute <retry> = 0.
R3. Wait on adveloop-<run_id>-eval-done-<N>-0 via /cmux. Same observation and intervention rules as step c.
R4. On signal — read .adveloop/tasks/<N>/eval-result-0.json. Validate shape (non-empty evidence; if missing/malformed, AskUserQuestion Retry this round / Abort as in step h). Close the pane.
passed: true → record the pass and advance to the next deliverable.
passed: false → set retry = 1 and fall through to the Gen→Eval loop below starting at step a. No file copy is needed: eval-result-0.json is already the round-1 Generator's prior-feedback input.
The retry counter counts failed Gen→Eval pairs, not Evaluator invocations. This initial review round does not consume a retry slot; review deliverables still get up to 3 Gen→Eval fix attempts before the 3-fail escalation in step k.
Loop:
a. Generator task file — write .adveloop/tasks/<N>/gen-task-<retry>.md containing:
## Deliverable — this deliverable's name + description (verbatim from deliverables.md).
## Project context — optional: paths, tech-stack notes the user supplied, or leave empty.
## Prior evaluator feedback — only when retry > 0: contents of .adveloop/tasks/<N>/eval-result-<retry-1>.json. (In review mode, eval-result-0.json carries the initial review's verdict.)
## Completion signal — the literal signal name: adveloop-<run_id>-gen-done-<N>-<retry>.
b. Spawn the Generator pane via the /cmux skill. The command run inside the pane:
DISABLE_AUTOUPDATER=1 DISABLE_COST_WARNINGS=1 claude \
--dangerously-skip-permissions \
--append-system-prompt-file "${CLAUDE_SKILL_DIR}/prompts/generator.md" \
--name "adveloop-gen-<run_id>-<N>-<retry>" \
"Read .adveloop/tasks/<N>/gen-task-<retry>.md and execute it. Your completion signal is adveloop-<run_id>-gen-done-<N>-<retry>."
Only the short bootstrap prompt crosses the shell; the role file is read by claude itself; dynamic content is loaded via Read. Substitute <run_id>, <N>, <retry> with actual values.
c. Wait on adveloop-<run_id>-gen-done-<N>-<retry> via the /cmux skill. No fixed timeout. Sample the pane's output every ~60s for observation. If you judge the pane stuck (repeating errors, no new output for several minutes, fatal exit without the signal), pause and AskUserQuestion: Keep waiting / Intervene (user describes the issue; it becomes feedback for the next round) / Abort run.
d. On signal — read .adveloop/tasks/<N>/gen-result-<retry>.md for the Generator's summary. Close the pane.
e. Evaluator task file — write .adveloop/tasks/<N>/eval-task-<retry>.md containing:
## Deliverable — same description as in step a.
## Mode: build — always build at this step, even for review-mode deliverables. Once the Generator has produced code, the Evaluator's job is the same in both modes: challenge the Generator's claim against real runtime behavior.
## Generator summary — contents of .adveloop/tasks/<N>/gen-result-<retry>.md.
## Prior rounds — only when retry > 0: for each R in 0..retry-1, include that round's evaluator verdict (eval-result-<R>.json). This lets the Evaluator notice when a new concern contradicts an earlier verdict or would revert a fix it previously demanded. In review mode, eval-result-0.json is the initial review's verdict.
## Completion signal — adveloop-<run_id>-eval-done-<N>-<retry>.
f. Spawn the Evaluator pane via /cmux:
DISABLE_AUTOUPDATER=1 DISABLE_COST_WARNINGS=1 claude \
--dangerously-skip-permissions \
--append-system-prompt-file "${CLAUDE_SKILL_DIR}/prompts/evaluator.md" \
--name "adveloop-eval-<run_id>-<N>-<retry>" \
"Read .adveloop/tasks/<N>/eval-task-<retry>.md and execute it. Your completion signal is adveloop-<run_id>-eval-done-<N>-<retry>."
g. Wait on adveloop-<run_id>-eval-done-<N>-<retry>. Same observation + intervention rules as step c.
h. On signal — read .adveloop/tasks/<N>/eval-result-<retry>.json. Close the pane. Shape:
{
"passed": true,
"evidence": "Concrete log — commands run, endpoints hit, inputs/outputs observed.",
"notes": "Interpretation — what works, what fails, file paths, line numbers, expected vs. observed."
}
If the file is missing, malformed, or has an empty evidence field, tell the user and AskUserQuestion: Retry this round / Abort. A missing evidence field means the Evaluator didn't actually exercise the code — do not trust the passed value.
i. Pass (passed == true) — record it in a scratch log line; advance to the next deliverable.
j. Fail and retry < 3 — retry++; loop back to step a. The round's verdict is already persisted as eval-result-<retry>.json; no copy is needed.
k. Fail and retry == 3 — AskUserQuestion:
- Retry up to 3 more times — continue the loop.
- Edit deliverable (freeform rewrite; update
deliverables.md for this entry, including Mode: if the user changed it; reset retry = 0; restart this deliverable from step 2's mode branch so a changed mode takes effect).
- Skip — record as skipped; advance.
- Abort run — stop.