|
| 1 | +# Minion Closed-Loop SOP |
| 2 | + |
| 3 | +This SOP defines an autonomous execution loop for minion workers and QA. |
| 4 | +All autonomous runs must follow this sequence until DoD is met. |
| 5 | + |
| 6 | +## Phase Loop |
| 7 | + |
| 8 | +Plan -> Build -> Test -> Semantic Verify -> QA -> Loop/Retry -> Ship |
| 9 | + |
| 10 | +1. Plan |
| 11 | + - Read task brief, source references, and current `docs/minion/definition_of_done.md`. |
| 12 | + - Record assumptions, out-of-scope items, and risks. |
| 13 | +2. Build |
| 14 | + - Apply focused changes only for the assigned task. |
| 15 | + - Record files touched and command(s) planned. |
| 16 | +3. Test |
| 17 | + - Run task-relevant checks (lint/tests/CLI checks as applicable). |
| 18 | + - Capture command + exit code + key output. |
| 19 | +4. Semantic Verify |
| 20 | + - Validate behavior against intended semantics, not only transport success. |
| 21 | + - Confirm capability coverage, tool-backed execution, and expected outputs. |
| 22 | +5. QA |
| 23 | + - Validate outputs against DoD and rejection rules. |
| 24 | + - Verify release-readiness gate command is runnable and passing. |
| 25 | +6. Loop/Retry |
| 26 | + - If any phase fails, classify and route via failure matrix. |
| 27 | + - Apply remediation and re-run Plan→...→QA. |
| 28 | +7. Ship |
| 29 | + - Stop only when all stop conditions are satisfied. |
| 30 | + |
| 31 | +## Stop Conditions |
| 32 | + |
| 33 | +- Stop and hand over as **DONE** when: |
| 34 | + - Workflow and/or agent checks satisfy `docs/minion/definition_of_done.md`. |
| 35 | + - Semantic Verify is pass/fail documented as `pass`. |
| 36 | + - QA confirms release readiness and no hard blockers remain. |
| 37 | +- Stop and escalate as **BLOCKED** when: |
| 38 | + - Max retry policy is exhausted. |
| 39 | + - Required artifact is missing or unrecoverable in this loop. |
| 40 | + - Security/compliance or dependency constraints cannot be resolved. |
| 41 | + |
| 42 | +## Max Retry Policy |
| 43 | + |
| 44 | +- Retry budget per task: 3 total full loop attempts. |
| 45 | +- Per attempt, rerun only failed phases after fixes. |
| 46 | +- After 3 failed full attempts, stop as BLOCKED and report blockers. |
| 47 | + |
| 48 | +## Artifact Requirements per Iteration |
| 49 | + |
| 50 | +Each loop attempt must produce: |
| 51 | + |
| 52 | +- `Plan`: task hypothesis and changed file list. |
| 53 | +- `Build`: code/docs diff and command plan. |
| 54 | +- `Test`: command list with pass/fail status. |
| 55 | +- `Semantic Verify`: explicit pass/fail against intended behavior. |
| 56 | +- `QA`: DoD check against `docs/minion/definition_of_done.md` with blockers. |
| 57 | +- `Release`: output of `bash scripts/release_readiness.sh` (or explicit failure reason). |
| 58 | + |
| 59 | +## Failure Classification and Remediation Routing |
| 60 | + |
| 61 | +- `Transport-only pass` |
| 62 | + - Root cause: command exit status passed but intent/semantic checks failed. |
| 63 | + - Route: rerun with semantic checks and user-behavior evidence. |
| 64 | +- `Semantic fail` |
| 65 | + - Route: fix behavior mismatch and re-run Test + Semantic Verify. |
| 66 | +- `Test failure` |
| 67 | + - Route: fix implementation defect, missing deps, or fixture issues; rerun failing tests. |
| 68 | +- `Tooling/infra failure` |
| 69 | + - Route: capture error context, retry once, then escalate if persistent. |
| 70 | +- `Blocked/dependency` |
| 71 | + - Route: mark BLOCKED immediately and escalate unresolved items. |
| 72 | + |
| 73 | +## Release Gate Requirements |
| 74 | + |
| 75 | +Before Ship, all runs must satisfy: |
| 76 | + |
| 77 | +1. `bash scripts/release_readiness.sh` completes successfully. |
| 78 | +2. DoD checks in this repo are met for affected scope. |
| 79 | +3. Semantic checks are explicitly marked pass (no placeholders). |
| 80 | +4. Artifacts for the iteration are present and internally consistent. |
| 81 | +5. Transport-only and silent semantic regressions are rejected. |
0 commit comments