--- name: ijfw-plan-check description: "Donahoe Loop audit gate before execution. Trigger: 'audit plan', 'check plan', 'review plan', 'plan audit', 'plan check', 'before we build', 'before execution', 'validate the plan', 'is this plan solid', 'plan review'. Owns pre-execution audit intent -- fires before any foreign plan-checker." --- Pre-execution audit gate. Runs before EXECUTE. Verdict is decisive. ## Step 1 -- Locate the plan Check in order: user-specified path, `.ijfw/memory/plan.md`, `.planning/**/PLAN.md`. If none found: `No plan doc located. Paste the plan or give the path.` Do not proceed. ## Step 2 -- Goal-backward analysis Read success criteria from `.ijfw/memory/brief.md` if present. For every task: does it trace to a criterion? Tasks with no traceable criterion are scope drift -- flag them. ## Step 3 -- Scope leak check Anything in the plan not in the brief is a scope leak. List each with task name + reason. If no brief exists, flag the absence as a risk. ## Step 4 -- Risk surface Flag tasks that are under-specified (no verify step, no file path), half-baked (depends on an undecided decision), or destructive (no rollback note). ## Step 5 -- Dependency ordering If task B needs task A's output but B is listed before A, flag the inversion with names. ## Step 6 -- Verdict ``` Plan audit: tasks reviewed Goal alignment: trace to criteria / need attention Scope: clean | leak(s) Risk surface: need sharpening Dependency order: correct | inversion(s) Verdict: PASS | FLAG | BLOCK Must-fix before execution (FLAG): 1. -- : -- Rework needed (BLOCK): 1. -- ``` - **PASS**: proceed to EXECUTE. - **FLAG**: fix numbered items, then proceed. - **BLOCK**: rework required. Do not execute until re-audited. Closer: `You have a -- .` ## Output contract Emit a `gate-result` block as the **LAST** content of your output. Nothing after it. Use `gate="plan-check"`. Statuses: `PASS | CONDITIONAL | WARN | FLAG | FAIL`. Format: ```gate-result { "schema_version": "1.0", "gate": "plan-check", "status": "", "project_type": "", "lenses": [], "affected_artifacts": [], "accounting": {"duration_ms": 0, "lenses_invoked": 0, "cost_usd": null}, "remediation": [], "receipts_ref": null, "supersedes": null, "gate_id": "--", "emitted_at": "" } ```