[RALPH + ULTRAWORK - ITERATION {{ITERATION}}/{{MAX}}]
Your previous attempt did not output the completion promise. Continue working on the task.
Opt-out: If {{PROMPT}} contains --no-prd, skip PRD generation and work in legacy mode (no story tracking, generic verification). Use this for trivial quick fixes.
Deslop opt-out: If {{PROMPT}} contains --no-deslop, skip the mandatory post-review deslop pass entirely. Use this only when the cleanup pass is intentionally out of scope for the run.
Reviewer selection: Pass --critic=architect, --critic=critic, or --critic=codex in the Ralph prompt to choose the completion reviewer for that run. architect remains the default.
Pick next story: Read prd.json and select the highest-priority story with passes: false. This is your current focus.
Implement the current story:
- Delegate to specialist agents at appropriate tiers:
- Simple lookups: LOW tier (Haiku) -- "What does this function return?"
- Standard work: MEDIUM tier (Sonnet) -- "Add error handling to this module"
- Complex analysis: HIGH tier (Opus) -- "Debug this race condition"
- If during implementation you discover sub-tasks, add them as new stories to
prd.json
- Run long operations in background: Builds, installs, test suites use
run_in_background: true
Verify the current story's acceptance criteria:
a. For EACH acceptance criterion in the story, verify it is met with fresh evidence
b. Run relevant checks (test, build, lint, typecheck) and read the output
c. If any criterion is NOT met, continue working -- do NOT mark the story as complete
Mark story complete:
a. When ALL acceptance criteria are verified, set passes: true for this story in prd.json
b. Record progress in progress.txt: what was implemented, files changed, learnings for future iterations
c. Add any discovered codebase patterns to progress.txt
Check PRD completion:
a. Read prd.json -- are ALL stories marked passes: true?
b. If NOT all complete, loop back to Step 2 (pick next story)
c. If ALL complete, proceed to Step 7 (architect verification)
Reviewer verification (tiered, against acceptance criteria):
- <5 files, <100 lines with full tests: STANDARD tier minimum (architect-medium / Sonnet)
- Standard changes: STANDARD tier (architect-medium / Sonnet)
20 files or security/architectural changes: THOROUGH tier (architect / Opus)
- If
--critic=critic, use the Claude critic agent for the approval pass
- If
--critic=codex, run omc ask codex --agent-prompt critic "..." for the approval pass
- Ralph floor: always at least STANDARD, even for small changes
- The selected reviewer verifies against the SPECIFIC acceptance criteria from prd.json, not vague "is it done?"
7.5 Mandatory Deslop Pass:
- Unless
{{PROMPT}} contains --no-deslop, run oh-my-claudecode:ai-slop-cleaner in standard mode (not --review) on the files changed during the current Ralph session only.
- Keep the scope bounded to the Ralph changed-file set; do not broaden the cleanup pass to unrelated files.
- If the reviewer approved the implementation but the deslop pass introduces follow-up edits, keep those edits inside the same changed-file scope before proceeding.
7.6 Regression Re-verification:
- After the deslop pass, re-run all relevant tests, build, and lint checks for the Ralph session.
- Read the output and confirm the post-deslop regression run actually passes.
- If regression fails, roll back the cleaner changes or fix the regression, then rerun the verification loop until it passes.
- Only proceed to completion after the post-deslop regression run passes (or
--no-deslop was explicitly specified).
On approval: After Step 7.6 passes (with Step 7.5 completed, or skipped via --no-deslop), run /oh-my-claudecode:cancel to cleanly exit and clean up all state files
On rejection: Fix the issues raised, re-verify with the same reviewer, then loop back to check if the story needs to be marked incomplete
After refinement:
acceptanceCriteria: [
"detectNoPrdFlag('ralph --no-prd fix') returns true",
"detectNoPrdFlag('ralph fix this') returns false",
"stripNoPrdFlag removes --no-prd and trims whitespace",
"TypeScript compiles with no errors (npm run build)"
]
Why good: Generic criteria replaced with specific, testable criteria.
</Good>
<Good>
Correct parallel delegation:
Task(subagent_type="oh-my-claudecode:executor", model="haiku", prompt="Add type export for UserConfig")
Task(subagent_type="oh-my-claudecode:executor", model="sonnet", prompt="Implement the caching layer for API responses")
Task(subagent_type="oh-my-claudecode:executor", model="opus", prompt="Refactor auth module to support OAuth2 flow")
Why good: Three independent tasks fired simultaneously at appropriate tiers.
</Good>
<Good>
Story-by-story verification:
- Story US-001: "Add flag detection helpers"
- Criterion: "detectNoPrdFlag returns true for --no-prd" → Run test → PASS
- Criterion: "TypeScript compiles" → Run build → PASS
- Mark US-001 passes: true
- Story US-002: "Wire PRD into bridge.ts"
- Continue to next story...
Why good: Each story verified against its own acceptance criteria before marking complete.
</Good>
<Bad>
Claiming completion without PRD verification:
"All the changes look good, the implementation should work correctly. Task complete."
Why bad: Uses "should" and "look good" -- no fresh evidence, no story-by-story verification, no architect review.
</Bad>
<Bad>
Sequential execution of independent tasks:
Task(executor, "Add type export") → wait →
Task(executor, "Implement caching") → wait →
Task(executor, "Refactor auth")
Why bad: These are independent tasks that should run in parallel, not sequentially.
</Bad>
<Bad>
Keeping generic acceptance criteria:
"prd.json created with criteria: Implementation is complete, Code compiles. Moving on to coding."
Why bad: Did not refine scaffold criteria into task-specific ones. This is PRD theater.
</Bad>
</Examples>
<Escalation_And_Stop_Conditions>
- Stop and report when a fundamental blocker requires user input (missing credentials, unclear requirements, external service down)
- Stop when the user says "stop", "cancel", or "abort" -- run `/oh-my-claudecode:cancel`
- Continue working when the hook system sends "The boulder never stops" -- this means the iteration continues
- If the selected reviewer rejects verification, fix the issues and re-verify (do not stop)
- If the same issue recurs across 3+ iterations, report it as a potential fundamental problem
</Escalation_And_Stop_Conditions>
<Final_Checklist>
- [ ] All prd.json stories have `passes: true` (no incomplete stories)
- [ ] prd.json acceptance criteria are task-specific (not generic boilerplate)
- [ ] All requirements from the original task are met (no scope reduction)
- [ ] Zero pending or in_progress TODO items
- [ ] Fresh test run output shows all tests pass
- [ ] Fresh build output shows success
- [ ] lsp_diagnostics shows 0 errors on affected files
- [ ] progress.txt records implementation details and learnings
- [ ] Selected reviewer verification passed against specific acceptance criteria
- [ ] ai-slop-cleaner pass completed on changed files (or `--no-deslop` specified)
- [ ] Post-deslop regression tests pass
- [ ] `/oh-my-claudecode:cancel` run for clean state cleanup
</Final_Checklist>
<Advanced>
## Background Execution Rules
**Run in background** (`run_in_background: true`):
- Package installation (npm install, pip install, cargo build)
- Build processes (make, project build commands)
- Test suites
- Docker operations (docker build, docker pull)
**Run blocking** (foreground):
- Quick status checks (git status, ls, pwd)
- File reads and edits
- Simple commands
</Advanced>
Original task:
{{PROMPT}}
1---2name: ralph3description: Self-referential loop until task completion with configurable verification reviewer4level: 45---67[RALPH + ULTRAWORK - ITERATION {{ITERATION}}/{{MAX}}]89Your previous attempt did not output the completion promise. Continue working on the task.1011<Purpose>12Ralph is a PRD-driven persistence loop that keeps working on a task until ALL user stories in prd.json have passes: true and are reviewer-verified. It wraps ultrawork's parallel execution with session persistence, automatic retry on failure, structured story tracking, and mandatory verification before completion.13</Purpose>1415<Use_When>16- Task requires guaranteed completion with verification (not just "do your best")17- User says "ralph", "don't stop", "must complete", "finish this", or "keep going until done"18- Work may span multiple iterations and needs persistence across retries19- Task benefits from structured PRD-driven execution with reviewer sign-off20</Use_When>2122<Do_Not_Use_When>23- User wants a full autonomous pipeline from idea to code -- use `autopilot` instead24- User wants to explore or plan before committing -- use `plan` skill instead25- User wants a quick one-shot fix -- delegate directly to an executor agent26- User wants manual control over completion -- use `ultrawork` directly27</Do_Not_Use_When>2829<Why_This_Exists>30Complex tasks often fail silently: partial implementations get declared "done", tests get skipped, edge cases get forgotten. Ralph prevents this by:311. Structuring work into discrete user stories with testable acceptance criteria (prd.json)322. Iterating story-by-story until each one passes333. Tracking progress and learnings across iterations (progress.txt)344. Requiring fresh reviewer verification against specific acceptance criteria before completion35</Why_This_Exists>3637<PRD_Mode>38By default, ralph operates in PRD mode. A scaffold `prd.json` is auto-generated when ralph starts if none exists.3940**Opt-out:** If `{{PROMPT}}` contains `--no-prd`, skip PRD generation and work in legacy mode (no story tracking, generic verification). Use this for trivial quick fixes.4142**Deslop opt-out:** If `{{PROMPT}}` contains `--no-deslop`, skip the mandatory post-review deslop pass entirely. Use this only when the cleanup pass is intentionally out of scope for the run.4344**Reviewer selection:** Pass `--critic=architect`, `--critic=critic`, or `--critic=codex` in the Ralph prompt to choose the completion reviewer for that run. `architect` remains the default.45</PRD_Mode>4647<Execution_Policy>48- Fire independent agent calls simultaneously -- never wait sequentially for independent work49- Use `run_in_background: true` for long operations (installs, builds, test suites)50- Always pass the `model` parameter explicitly when delegating to agents51- Read `docs/shared/agent-tiers.md` before first delegation to select correct agent tiers52- Deliver the full implementation: no scope reduction, no partial completion, no deleting tests to make them pass53</Execution_Policy>5455<Steps>561. **PRD Setup** (first iteration only):57 a. Check if `prd.json` exists (in project root or `.omc/`). If it already exists, read it and proceed to Step 2.58 b. If no `prd.json` exists, the system has auto-generated a scaffold. Read `.omc/prd.json`.59 c. **CRITICAL: Refine the scaffold.** The auto-generated PRD has generic acceptance criteria ("Implementation is complete", etc.). You MUST replace these with task-specific criteria:60 - Analyze the original task and break it into right-sized user stories (each completable in one iteration)61 - Write concrete, verifiable acceptance criteria for each story (e.g., "Function X returns Y when given Z", "Test file exists at path P and passes")62 - If acceptance criteria are generic (e.g., "Implementation is complete"), REPLACE them with task-specific criteria before proceeding63 - Order stories by priority (foundational work first, dependent work later)64 - Write the refined `prd.json` back to disk65 d. Initialize `progress.txt` if it doesn't exist66672. **Pick next story**: Read `prd.json` and select the highest-priority story with `passes: false`. This is your current focus.68693. **Implement the current story**:70 - Delegate to specialist agents at appropriate tiers:71 - Simple lookups: LOW tier (Haiku) -- "What does this function return?"72 - Standard work: MEDIUM tier (Sonnet) -- "Add error handling to this module"73 - Complex analysis: HIGH tier (Opus) -- "Debug this race condition"74 - If during implementation you discover sub-tasks, add them as new stories to `prd.json`75 - Run long operations in background: Builds, installs, test suites use `run_in_background: true`76774. **Verify the current story's acceptance criteria**:78 a. For EACH acceptance criterion in the story, verify it is met with fresh evidence79 b. Run relevant checks (test, build, lint, typecheck) and read the output80 c. If any criterion is NOT met, continue working -- do NOT mark the story as complete81825. **Mark story complete**:83 a. When ALL acceptance criteria are verified, set `passes: true` for this story in `prd.json`84 b. Record progress in `progress.txt`: what was implemented, files changed, learnings for future iterations85 c. Add any discovered codebase patterns to `progress.txt`86876. **Check PRD completion**:88 a. Read `prd.json` -- are ALL stories marked `passes: true`?89 b. If NOT all complete, loop back to Step 2 (pick next story)90 c. If ALL complete, proceed to Step 7 (architect verification)91927. **Reviewer verification** (tiered, against acceptance criteria):93 - <5 files, <100 lines with full tests: STANDARD tier minimum (architect-medium / Sonnet)94 - Standard changes: STANDARD tier (architect-medium / Sonnet)95 - >20 files or security/architectural changes: THOROUGH tier (architect / Opus)96 - If `--critic=critic`, use the Claude `critic` agent for the approval pass97 - If `--critic=codex`, run `omc ask codex --agent-prompt critic "..."` for the approval pass98 - Ralph floor: always at least STANDARD, even for small changes99 - The selected reviewer verifies against the SPECIFIC acceptance criteria from prd.json, not vague "is it done?"1001017.5 **Mandatory Deslop Pass**:102 - Unless `{{PROMPT}}` contains `--no-deslop`, run `oh-my-claudecode:ai-slop-cleaner` in standard mode (not `--review`) on the files changed during the current Ralph session only.103 - Keep the scope bounded to the Ralph changed-file set; do not broaden the cleanup pass to unrelated files.104 - If the reviewer approved the implementation but the deslop pass introduces follow-up edits, keep those edits inside the same changed-file scope before proceeding.1051067.6 **Regression Re-verification**:107 - After the deslop pass, re-run all relevant tests, build, and lint checks for the Ralph session.108 - Read the output and confirm the post-deslop regression run actually passes.109 - If regression fails, roll back the cleaner changes or fix the regression, then rerun the verification loop until it passes.110 - Only proceed to completion after the post-deslop regression run passes (or `--no-deslop` was explicitly specified).1111128. **On approval**: After Step 7.6 passes (with Step 7.5 completed, or skipped via `--no-deslop`), run `/oh-my-claudecode:cancel` to cleanly exit and clean up all state files1131149. **On rejection**: Fix the issues raised, re-verify with the same reviewer, then loop back to check if the story needs to be marked incomplete115</Steps>116117<Tool_Usage>118- Use `Task(subagent_type="oh-my-claudecode:architect", ...)` for architect verification cross-checks when changes are security-sensitive, architectural, or involve complex multi-system integration119- Use `Task(subagent_type="oh-my-claudecode:critic", ...)` when `--critic=critic`120- Use `omc ask codex --agent-prompt critic "..."` when `--critic=codex`121- Skip architect consultation for simple feature additions, well-tested changes, or time-critical verification122- Proceed with architect agent verification alone -- never block on unavailable tools123- Use `state_write` / `state_read` for ralph mode state persistence between iterations124</Tool_Usage>125126<Examples>127<Good>128PRD refinement in Step 1:129```130Auto-generated scaffold has:131 acceptanceCriteria: ["Implementation is complete", "Code compiles without errors"]132133After refinement:134 acceptanceCriteria: [135 "detectNoPrdFlag('ralph --no-prd fix') returns true",136 "detectNoPrdFlag('ralph fix this') returns false",137 "stripNoPrdFlag removes --no-prd and trims whitespace",138 "TypeScript compiles with no errors (npm run build)"139 ]140```141Why good: Generic criteria replaced with specific, testable criteria.142</Good>143144<Good>145Correct parallel delegation:146```147Task(subagent_type="oh-my-claudecode:executor", model="haiku", prompt="Add type export for UserConfig")148Task(subagent_type="oh-my-claudecode:executor", model="sonnet", prompt="Implement the caching layer for API responses")149Task(subagent_type="oh-my-claudecode:executor", model="opus", prompt="Refactor auth module to support OAuth2 flow")150```151Why good: Three independent tasks fired simultaneously at appropriate tiers.152</Good>153154<Good>155Story-by-story verification:156```1571. Story US-001: "Add flag detection helpers"158 - Criterion: "detectNoPrdFlag returns true for --no-prd" → Run test → PASS159 - Criterion: "TypeScript compiles" → Run build → PASS160 - Mark US-001 passes: true1612. Story US-002: "Wire PRD into bridge.ts"162 - Continue to next story...163```164Why good: Each story verified against its own acceptance criteria before marking complete.165</Good>166167<Bad>168Claiming completion without PRD verification:169"All the changes look good, the implementation should work correctly. Task complete."170Why bad: Uses "should" and "look good" -- no fresh evidence, no story-by-story verification, no architect review.171</Bad>172173<Bad>174Sequential execution of independent tasks:175```176Task(executor, "Add type export") → wait →177Task(executor, "Implement caching") → wait →178Task(executor, "Refactor auth")179```180Why bad: These are independent tasks that should run in parallel, not sequentially.181</Bad>182183<Bad>184Keeping generic acceptance criteria:185"prd.json created with criteria: Implementation is complete, Code compiles. Moving on to coding."186Why bad: Did not refine scaffold criteria into task-specific ones. This is PRD theater.187</Bad>188</Examples>189190<Escalation_And_Stop_Conditions>191- Stop and report when a fundamental blocker requires user input (missing credentials, unclear requirements, external service down)192- Stop when the user says "stop", "cancel", or "abort" -- run `/oh-my-claudecode:cancel`193- Continue working when the hook system sends "The boulder never stops" -- this means the iteration continues194- If the selected reviewer rejects verification, fix the issues and re-verify (do not stop)195- If the same issue recurs across 3+ iterations, report it as a potential fundamental problem196</Escalation_And_Stop_Conditions>197198<Final_Checklist>199- [ ] All prd.json stories have `passes: true` (no incomplete stories)200- [ ] prd.json acceptance criteria are task-specific (not generic boilerplate)201- [ ] All requirements from the original task are met (no scope reduction)202- [ ] Zero pending or in_progress TODO items203- [ ] Fresh test run output shows all tests pass204- [ ] Fresh build output shows success205- [ ] lsp_diagnostics shows 0 errors on affected files206- [ ] progress.txt records implementation details and learnings207- [ ] Selected reviewer verification passed against specific acceptance criteria208- [ ] ai-slop-cleaner pass completed on changed files (or `--no-deslop` specified)209- [ ] Post-deslop regression tests pass210- [ ] `/oh-my-claudecode:cancel` run for clean state cleanup211</Final_Checklist>212213<Advanced>214## Background Execution Rules215216**Run in background** (`run_in_background: true`):217- Package installation (npm install, pip install, cargo build)218- Build processes (make, project build commands)219- Test suites220- Docker operations (docker build, docker pull)221222**Run blocking** (foreground):223- Quick status checks (git status, ls, pwd)224- File reads and edits225- Simple commands226</Advanced>227228Original task:229{{PROMPT}}