Phase Gate
Purpose: run the validation checks for the current phase and produce an honest PASS or FAIL report that includes unresolved architect review notes.
This playbook is stack-agnostic. The actual commands for bootstrap, migrations, tests, type-check,
lint, e2e, and smoke live in docs/STACK.md under the Gate Commands section. That file is
written or extended by /workflow-init when the workflow is integrated into a project, and edited
by hand whenever the stack changes.
Inputs
- Target phase number, or infer it from
docs/STATE.md.
Required reads
docs/PHASE_XX.md— the phase under gatedocs/STACK.md(Gate Commandssection) — the only source of executable commandsdocs/STATE.md— only if no phase number was given on the call
Procedure
- Identify the target phase file. If a number was given, open
docs/PHASE_XX.md. Otherwise readdocs/STATE.mdand select the latest phase whose status isIN_PROGRESS. - Read the phase file's
Gate Checkssection. Treat it as the per-phase contract: every check listed there must produce a status in the final report. - Read the phase file's
Architect Review Notessection and count unchecked items. Unchecked items block PASS regardless of automated results. - Read
docs/STACK.md#gate-commandsand treat it as the human-readable command source for the standard gate steps below. If a command is not defined for a given step, mark that step asSKIPPED — no command in STACK.mdrather than guessing. - Ensure a project
.env(or equivalent secrets file declared bySTACK.md) exists so any container-based commands use the same credentials the app uses. - If the project has a helper script (
scripts/phase-gate.shor any path declared inSTACK.md#gate-commands), prefer it. Otherwise execute the steps below directly. - Run the bootstrap / infrastructure command from
STACK.md(e.g. starting Docker services). Wait until services report ready before continuing. - Run the migrations command from
STACK.md. - Run the backend tests command from
STACK.md. - Run the frontend prep command from
STACK.md(if the project has a frontend). - Run the frontend type-check command from
STACK.md. - Run the frontend unit tests command from
STACK.md. - Run the e2e lint / determinism check command from
STACK.md(if defined). It must fail on any policy violation (e.g. committedwaitForTimeoutcalls when Playwright is in use). - Run the e2e command from
STACK.md(if defined). - Run the smoke command from
STACK.md, unless the phase file declares a phase-specific smoke override underGate Checks. - Produce a table report with one row per check, plus a row for
Architect Review Notes. Return overall PASS only if (a) every executed step is green and (b) there are no unchecked architect review items.
Rules
- Do not edit files.
- Do not commit.
- Do not stop at the first failure — show the full picture so the architect sees every failing check at once.
- Do bring up the full stack yourself when bootstrap is required; the gate verifies the real end-to-end environment, not isolated unit tests.
- Do not treat unchecked architect review notes as informational; they block PASS until resolved.
- If the stack changes (new framework, new test runner, new container layout), update
docs/STACK.md, never this playbook.
Preferred command
If the project ships a helper:
bash
./scripts/phase-gate.sh [XX]
If no helper exists, follow the procedure above manually using the commands declared in
docs/STACK.md#gate-commands.
Done when
- Every required check has a reported status (PASS / FAIL / SKIPPED).
- The output clearly states overall PASS or FAIL.
- Any unchecked architect review notes are listed explicitly in the report.