Start autonomous Ralph loop to execute PRP plan until all validations pass
Executes PRP plans autonomously through iterative implementation and validation cycles.
/plugin marketplace add Wirasm/PRPs-agentic-eng/plugin install prp-core@prp-marketplace<plan.md|prd.md> [--max-iterations N]Input: $ARGUMENTS
Start an autonomous Ralph loop that executes a PRP plan iteratively until all validations pass.
Core Philosophy: Self-referential feedback loop. Each iteration, you see your previous work in files and git history. You implement, validate, fix, repeat - until complete.
Extract from input:
.plan.md or .prd.md--max-iterations N (default: 20)| Input | Action |
|---|---|
Ends with .plan.md | Valid - use as plan file |
Ends with .prd.md | Valid - will select next phase |
| Free-form text | STOP with message below |
| No input | STOP with message below |
If invalid input:
Ralph requires a PRP plan or PRD file.
Create one first:
/prp-plan "your feature description" # Creates plan from description
/prp-prd "your product idea" # Creates PRD with phases
Then run:
/prp-ralph .claude/PRPs/plans/your-feature.plan.md --max-iterations 20
test -f "{file_path}" && echo "EXISTS" || echo "NOT_FOUND"
If NOT_FOUND: Stop with error message.
If input is a .prd.md file:
Status: pending where dependencies are completePHASE_1_CHECKPOINT:
Create .claude/prp-ralph.state.md:
mkdir -p .claude
Write state file with this structure:
---
active: true
iteration: 1
max_iterations: {N}
plan_path: "{file_path}"
input_type: "{plan|prd}"
started_at: "{ISO timestamp}"
---
# PRP Ralph Loop State
## Current Task
Execute PRP plan and iterate until all validations pass.
## Plan Reference
{file_path}
## Instructions
1. Read the plan file
2. Implement all incomplete tasks
3. Run ALL validation commands from the plan
4. If any validation fails: fix and re-validate
5. Update plan file: mark completed tasks, add notes
6. When ALL validations pass: output <promise>COMPLETE</promise>
## Progress Log
(Append learnings after each iteration)
## PRP Ralph Loop Activated
**Plan**: {file_path}
**Iteration**: 1
**Max iterations**: {N}
The stop hook is now active. When you try to exit:
- If validations incomplete → same prompt fed back
- If all validations pass → loop exits
To monitor: `cat .claude/prp-ralph.state.md`
To cancel: `/prp-ralph-cancel`
---
CRITICAL REQUIREMENTS:
- Work through ALL tasks in the plan
- Run ALL validation commands
- Fix failures before proceeding
- Only output <promise>COMPLETE</promise> when ALL validations pass
- Do NOT lie to exit - the loop continues until genuinely complete
---
Starting iteration 1...
PHASE_2_CHECKPOINT:
Read the plan file referenced in state.
From the plan, identify:
For each incomplete task:
Run ALL validation commands from the plan:
# Typical validation levels (adapt to plan)
bun run type-check || npm run type-check
bun run lint || npm run lint
bun test || npm test
bun run build || npm run build
| Check | Result | Notes |
|---|---|---|
| Type check | PASS/FAIL | {details} |
| Lint | PASS/FAIL | {details} |
| Tests | PASS/FAIL | {details} |
| Build | PASS/FAIL | {details} |
After each significant change:
Append to Progress Log section:
### Iteration {N} - {timestamp}
- Completed: {task summaries}
- Validation: {results}
- Issues fixed: {list}
- Learnings: {patterns discovered, gotchas encountered}
PHASE_3_CHECKPOINT:
ALL of these must be true:
Generate Implementation Report
Create .claude/PRPs/reports/{plan-name}-report.md:
# Implementation Report
**Plan**: {plan_path}
**Completed**: {timestamp}
**Iterations**: {N}
## Summary
{What was implemented}
## Tasks Completed
{List from plan}
## Validation Results
| Check | Result |
|-------|--------|
| Type check | PASS |
| Lint | PASS |
| Tests | PASS |
| Build | PASS |
## Learnings
{Consolidated from state file progress log}
## Deviations from Plan
{Any changes made}
Archive Plan
mkdir -p .claude/PRPs/plans/completed
mv {plan_path} .claude/PRPs/plans/completed/
Clean Up State
rm .claude/prp-ralph.state.md
Output Completion Promise
<promise>COMPLETE</promise>
If validations are not all passing:
Do NOT output the completion promise if validations are failing.
If iteration count reaches max_iterations:
If you notice you're stuck:
If the plan itself has issues: