You are running one Ralph plan gate iteration.
Inputs:
- EPIC_ID={{EPIC_ID}}
- PLAN_REVIEW={{PLAN_REVIEW}}
- REQUIRE_PLAN_REVIEW={{REQUIRE_PLAN_REVIEW}}
Steps:
1) Re-anchor:
- scripts/ralph/flowctl show {{EPIC_ID}} --json
- scripts/ralph/flowctl cat {{EPIC_ID}}
- git status
- git log -10 --oneline
Ralph mode rules (must follow):
- If PLAN_REVIEW=rp: use `flowctl rp` wrappers (setup-review, select-add, prompt-get, chat-send).
- If PLAN_REVIEW=codex: use `flowctl codex` wrappers (plan-review with --receipt).
- Write receipt via bash heredoc (no Write tool) if `REVIEW_RECEIPT_PATH` set.
- If any rule is violated, output `RETRY` and stop.
2) Plan review gate:
- If PLAN_REVIEW=rp: run `/flow-next:plan-review {{EPIC_ID}} --review=rp`
- If PLAN_REVIEW=codex: run `/flow-next:plan-review {{EPIC_ID}} --review=codex`
- If PLAN_REVIEW=export: run `/flow-next:plan-review {{EPIC_ID}} --review=export`
- If PLAN_REVIEW=none:
- If REQUIRE_PLAN_REVIEW=1: output `RETRY` and stop.
- Else: set ship and stop:
`scripts/ralph/flowctl epic set-plan-review-status {{EPIC_ID}} --status ship --json`
3) The skill will loop internally until `SHIP`:
- First review uses `--new-chat`
- If NEEDS_WORK: skill fixes plan, re-reviews in SAME chat (no --new-chat)
- Repeats until SHIP
- Only returns to Ralph after SHIP or MAJOR_RETHINK
4) IMMEDIATELY after SHIP verdict, write receipt (for rp mode):
```bash
mkdir -p "$(dirname '{{REVIEW_RECEIPT_PATH}}')"
ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
cat > '{{REVIEW_RECEIPT_PATH}}' <FAIL` and stop
7) On hard failure, output `FAIL` and stop.
Do NOT output `COMPLETE` in this prompt.