@@ -127,11 +127,35 @@ When auto-skipped: create epic + single task directly, skip to plan phase.
1271274 . Validate: $FLOWCTL validate --epic $EPIC_ID --json
128128
129129### Plan Review (plan_review)
130- 1 . Detect review backend: ` $FLOWCTL review-backend ` (returns "rp", "codex", "none", or "ASK")
131- 2 . If backend is "none" or "ASK", skip review and advance with ` $FLOWCTL phase done `
132- 3 . Otherwise run review via RP context_builder or Codex
133- 4 . Fix issues until SHIP verdict (max 3 iterations)
134- 5 . Verify plan does not propose anything listed in Non-Goals or contradict Architecture Decisions from ` .flow/project-context.md ` .
130+
131+ ** Self-review first** (always runs, even if external review is "none"):
132+
133+ #### Premise Challenge (4 forcing questions)
134+ 1 . ** Right problem?** — Could a different framing yield a simpler/more impactful solution?
135+ - Reject: "The spec says X" (spec might be wrong). Accept: Evidence the problem is correctly framed.
136+ 2 . ** Do-nothing test** — What SPECIFICALLY breaks in 30 days if we ship nothing?
137+ - Reject: "Tech debt grows." Accept: Measurable degradation or blocked feature.
138+ 3 . ** Existing code** — Does the plan reuse what already exists? Run ` flowctl graph map --json ` and check.
139+ - Reject: "We checked." Accept: Specific files/functions cited as reused or ruled out.
140+ 4 . ** Non-Goals compliance** — Read ` .flow/project-context.md ` Non-Goals and ADRs. Does the plan violate any?
141+ - If yes: flag and fix before proceeding.
142+
143+ #### Architecture Interrogation (6 forcing questions)
144+ 5 . ** Data flow completeness** — For every data path: what happens on happy / nil / empty / error?
145+ - Reject: Only happy path described. Accept: All 4 paths addressed.
146+ 6 . ** Coupling analysis** — What components become coupled that weren't before?
147+ 7 . ** Scaling characteristics** — What breaks first at 10x load?
148+ 8 . ** Rollback posture** — If this breaks production, how do we undo? (git revert? feature flag? migration rollback?)
149+ 9 . ** Security surface** — New auth boundaries, API surfaces, data access patterns?
150+ 10 . ** Task sizing** — Is every task M-sized (3-5 files)? Any L tasks that should be split?
151+
152+ #### Verdict
153+ Score each question 1-3 (1=concern, 2=acceptable, 3=solid). Total /30.
154+ - ** 25-30** : SHIP the plan
155+ - ** 18-24** : Fix flagged issues, then SHIP
156+ - ** <18** : MAJOR_RETHINK — plan needs significant revision
157+
158+ Then, if external review backend is configured (rp/codex), also run that. Max 3 iterations total.
135159
136160### Work (work)
1371611 . Find ready tasks: ` $FLOWCTL ready $EPIC_ID --json `
@@ -146,36 +170,78 @@ When auto-skipped: create epic + single task directly, skip to plan phase.
1461708 . Repeat waves until no ready tasks remain
147171
148172### Impl Review (impl_review)
149- 1 . Detect review backend: ` $FLOWCTL review-backend ` (same as plan_review)
150- 2 . If backend is "none" or "ASK", skip review and advance with ` $FLOWCTL phase done `
151- 3 . Generate diff: ` git diff main...HEAD `
152- 4 . Spawn 3-layer parallel review (see flow-code-code-review skill):
153- - Blind Hunter (diff only, no context)
154- - Edge Case Hunter (diff + project access)
155- - Acceptance Auditor (diff + spec + project-context.md)
156- 5 . Merge findings, apply zero-findings rule
157- 6 . Fix Critical/Important issues until SHIP (max 2 iterations)
158- When a review returns NEEDS_WORK, auto-capture the key findings as memory pitfalls:
159- ``` bash
160- $FLOWCTL memory add pitfall " Review finding: <summary of what was wrong and how it was fixed>"
161- ```
173+
174+ ** Self-review first** (always runs):
175+
176+ #### Correctness Interrogation (5 forcing questions)
177+ 1 . ** Spec fidelity** — Re-read every acceptance criterion. For each: is it MET, PARTIAL, or NOT_MET? Evidence?
178+ - Reject: "All criteria met." Accept: Each criterion cited with specific file: line proof.
179+ 2 . ** Error path coverage** — For every new function/endpoint: what happens when input is nil? empty? malformed? unauthorized?
180+ - Reject: "Errors are handled." Accept: Specific error type → response code → user message mapped.
181+ 3 . ** Edge cases** — What are the 3 inputs that would break this code? (empty string, max int, concurrent access, Unicode, null)
182+ - Must be specific to THIS diff, not generic.
183+ 4 . ** Regression risk** — Did any existing test break? Run ` $FLOWCTL guard ` . Any new code paths without tests?
184+ 5 . ** Impact verification** — ` flowctl graph impact <changed-files> ` — are all impacted files still working?
185+
186+ #### Quality Interrogation (5 forcing questions)
187+ 6 . ** Dead code** — Any commented-out code, unused imports, TODO without ticket?
188+ 7 . ** Naming & readability** — Would a new developer understand each function name and variable without the PR context?
189+ 8 . ** Performance** — Any N+1 queries, unbounded loops, missing pagination, large allocations in hot paths?
190+ 9 . ** Security** — Input validated at boundaries? Secrets not in code? SQL parameterized? Auth checked?
191+ 10 . ** Consistency** — Does the code follow project-context.md Critical Rules and existing patterns? (` flowctl find "<pattern>" --json ` )
192+
193+ #### Verdict
194+ Score each question 1-3. Total /30.
195+ - ** 25-30** : SHIP
196+ - ** 18-24** : NEEDS_WORK — fix flagged issues
197+ - ** <18** : MAJOR_RETHINK
198+
199+ Then, spawn 3-layer parallel review (Blind Hunter + Edge Case Hunter + Acceptance Auditor) for external perspective. Apply zero-findings rule. Max 2 iterations.
200+
201+ When NEEDS_WORK, auto-capture pitfalls:
202+ ``` bash
203+ $FLOWCTL memory add --type pitfall --epic $EPIC_ID " Review finding: <what was wrong and how fixed>"
204+ ```
162205
163206### Close (close)
164- 1 . Validate: $FLOWCTL validate --epic $EPIC_ID --json
165- 2 . Run final guard: ` $FLOWCTL guard ` (lint + type + test must pass)
166- 3 . ** Run Quick Commands** from epic spec: ` $FLOWCTL cat $EPIC_ID | grep -A20 "## Quick commands" ` — execute each listed smoke test. If any fails, fix before shipping.
167- 4 . ** Verify all task checklists** : For each task in the epic, run ` $FLOWCTL checklist verify --task <TASK_ID> --json ` . All items must be checked.
168- 5 . ** Pre-launch checklist** — verify all six dimensions before shipping:
169- - ** Code quality** : guard passes, no Critical/Important review findings open
170- - ** Security** : no secrets in code (` grep -rn password\|secret\|api_key ` ), input validated at boundaries
171- - ** Performance** : no N+1 queries, list endpoints paginated, images optimized
172- - ** Accessibility** : keyboard navigable, screen reader compatible, contrast ratios met (frontend changes only)
173- - ** Infrastructure** : environment variables documented, migrations reversible, feature flags configured
174- - ** Documentation** : README/CHANGELOG updated if user-facing, API docs match implementation
175- - ** Non-Goals compliance** : verify changes don't introduce anything listed in ` .flow/project-context.md ` Non-Goals
176- Any failing dimension: fix before proceeding. Skip dimensions not applicable to the change (e.g., skip accessibility for backend-only epics).
177- 6 . Mark complete: $FLOWCTL epic completion $EPIC_ID ship --json
178- 7 . Push branch and create draft PR (unless --no-pr)
207+
208+ 1 . Validate: ` $FLOWCTL validate --epic $EPIC_ID --json `
209+ 2 . Run final guard: ` $FLOWCTL guard `
210+ 3 . Run Quick Commands from epic spec: ` $FLOWCTL cat $EPIC_ID | grep -A20 "## Quick commands" `
211+ 4 . Verify all task checklists: ` $FLOWCTL checklist verify --task <TASK_ID> --json ` for each task.
212+
213+ #### Ship-Readiness Interrogation (7 forcing questions)
214+
215+ 5 . ** Code quality** — Does ` $FLOWCTL guard ` pass? Any Critical/Important review findings still open?
216+ - Reject: "Guard passed" without running it. Accept: Guard output showing pass/skip/0 fail.
217+
218+ 6 . ** Security** — ` grep -rn 'password\|secret\|api_key\|token' <changed-files> ` — any secrets in code?
219+ - Reject: "No secrets." Accept: Grep output confirming clean, or justified exceptions documented.
220+
221+ 7 . ** Regression** — Did the FULL test suite pass? Any existing tests modified or deleted?
222+ - Reject: "Tests pass." Accept: Specific test count and any modifications explained.
223+
224+ 8 . ** Impact verification** — ` flowctl graph impact <changed-files> --json ` — are all dependent files still functional?
225+ - If impact list is non-empty: verify each affected module still works.
226+
227+ 9 . ** Non-Goals compliance** — Read ` .flow/project-context.md ` Non-Goals. Does the diff introduce anything explicitly excluded?
228+ - Check ADRs: ` ls docs/decisions/ADR-*.md ` — does the change violate any accepted ADR?
229+
230+ 10 . ** Documentation** — If user-facing changes: README/CHANGELOG/API docs updated?
231+ - If no user-facing changes: confirm and skip.
232+
233+ 11 . ** Rollback plan** — If this breaks production, how do we undo?
234+ - Accept: "git revert" / "feature flag" / "migration has down step"
235+ - Reject: "We'll fix forward" without a concrete plan.
236+
237+ #### Verdict
238+ Score each question 1-3. Total /21.
239+ - ** 18-21** : SHIP — proceed to push + PR
240+ - ** 14-17** : Fix flagged items first
241+ - ** <14** : Do NOT ship. Fix critical issues.
242+
243+ 12 . Mark complete: ` $FLOWCTL epic completion $EPIC_ID ship --json `
244+ 13 . Push branch and create draft PR (unless --no-pr)
179245
180246## Recovery
181247
0 commit comments