Planning-first workflows for Ralph Wiggum loops
Turn a vague task into a clear execution plan — then run it in a loop.
Ralph Wiggum is a powerful loop execution plugin that iterates until a task is complete.
For complex tasks, having a structured plan before starting the loop helps:
- Define clear scope and phases upfront
- Set verifiable completion criteria
- Estimate iterations more accurately
Ralph Planner generates structured plans designed to integrate with ralph-wiggum loops.
/ralph-planner:plan-loop "Add user authentication with JWT"
That's it. You get a structured plan + a ready-to-run loop command.
The #1 reason loops run forever: no verifiable exit criteria.
Ralph Planner generates commands with specific DONE conditions:
# Bad (runs forever - no completion promise)
/ralph-wiggum:ralph-loop "Implement auth" --max-iterations 30
# Good (knows when to stop)
/ralph-wiggum:ralph-loop "Implement auth. DONE when: POST /login returns 200 with valid JWT, all tests pass, invalid credentials return 401. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 30
Every template includes verifiable promises like:
"All tests pass"(not "tests look good")"Endpoint returns 200"(not "endpoint works")"Bug no longer reproducible"(not "bug seems fixed")
/plugin marketplace add vavasilva/ralph-planner
/plugin install ralph-planner@ralph-planner
claude plugin marketplace add vavasilva/ralph-planner
claude plugin install ralph-planner@ralph-plannerRequires ralph-wiggum:
/plugin install ralph-wiggum@claude-plugins-official
/ralph-planner:feature "Implement JWT authentication for the API"
## Phase 1: Discovery
- [ ] Analyze authentication requirements
- [ ] Identify affected endpoints
- [ ] Research JWT best practices
## Phase 2: Implementation
- [ ] Create JWT generation on login
- [ ] Add validation middleware
- [ ] Secure protected routes
## Phase 3: Testing
- [ ] Write unit tests for auth logic
- [ ] Write integration tests for endpoints
## Phase 4: Documentation
- [ ] Update API documentation
Estimated iterations: 30/ralph-wiggum:ralph-loop "Implement JWT auth. DONE when: POST /login returns JWT, protected routes reject invalid tokens, all tests pass. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 30
Plan → Execute → Converge
| Command | Description |
|---|---|
/ralph-planner:plan-loop "<task>" |
Generic plan for any task |
/ralph-planner:feature "<desc>" |
New feature implementation |
/ralph-planner:bugfix "<desc>" |
Bug fix with regression test |
/ralph-planner:refactor "<desc>" |
Code refactoring |
/ralph-planner:migration "<desc>" |
Data/code migration |
/ralph-planner:performance "<desc>" |
Performance optimization |
/ralph-planner:from-file "<path>" |
Create plan from existing .md file |
/ralph-planner:from-issue "#123" |
Create plan from GitHub issue |
/ralph-planner:help |
Show help documentation |
Each template has pre-defined phases and verifiable promises:
/ralph-planner:feature "Add user authentication with JWT"
| Phases | Discovery → Implementation → Testing → Documentation |
|---|---|
| DONE when | All new tests pass, Feature works as specified, No regressions |
/ralph-planner:bugfix "Users can't login after password reset"
| Phases | Reproduction → Root Cause → Fix → Verification |
|---|---|
| DONE when | Bug no longer reproducible, Regression test added, No new issues |
/ralph-planner:refactor "Extract payment logic into separate service"
| Phases | Analysis → Preparation → Refactor → Validation |
|---|---|
| DONE when | All existing tests pass, No behavior changes, Goals met |
/ralph-planner:migration "Move user data from MySQL to PostgreSQL"
| Phases | Assessment → Preparation → Migration → Verification |
|---|---|
| DONE when | All data migrated, Application functional, Rollback tested |
/ralph-planner:performance "Reduce API response time for /users endpoint"
| Phases | Baseline → Analysis → Optimization → Validation |
|---|---|
| DONE when | Response time < target, No regressions, Benchmarks documented |
Already have a feature spec documented? Generate a plan from it:
/ralph-planner:from-file "./docs/my-feature.md"
/ralph-planner:from-file "./issues/bug-123.md" --type bugfix
/ralph-planner:from-file "./docs/feature.md" --output "./plans/feature-plan.md"
Create plans directly from GitHub issues. Labels auto-detect the work type:
/ralph-planner:from-issue "#42"
/ralph-planner:from-issue "owner/repo#123"
/ralph-planner:from-issue "#42" --include-comments
Auto-detection from labels:
| GitHub Labels | Template |
|---|---|
bug, bugfix, fix |
bugfix |
enhancement, feature |
feature |
refactor, tech-debt |
refactor |
migration, upgrade |
migration |
performance, perf |
performance |
Generic promises like "I will complete all phases systematically" are not verifiable.
Templates provide:
- Specific phases for each work type
- Verifiable DONE conditions ("All tests pass" vs "I'll do my best")
- Exit criteria that tell the loop when to stop
Understanding the workflow is important:
- Generates a detailed plan (phases, tasks, criteria) — for YOU to review
- Creates a summary prompt with DONE conditions — for ralph-loop to execute
Ralph-loop only receives the summary prompt, not the detailed plan:
/ralph-wiggum:ralph-loop "Implement auth. DONE when: login works, tests pass..."
Claude in the loop sees this summary, not the 4 phases with 15 tasks.
For complex tasks, save the plan to a file so Claude can reference it:
# 1. Generate and save plan
/ralph-planner:feature "Add authentication" --output "./plans/auth.md"
# 2. Generated command references the file
/ralph-wiggum:ralph-loop "Implement auth from ./plans/auth.md. DONE when: ..."Now Claude can read the plan file during execution to see detailed phases and tasks.
| Task Complexity | Recommendation |
|---|---|
| Simple (1-5 tasks) | Summary prompt is enough |
| Complex (10+ tasks, multiple phases) | Use --output for detailed reference |
| Tool | Role |
|---|---|
| ralph-wiggum | Execution loop |
| ralph-planner | Planning & scope definition |
| You | Decide when to run |
Ralph Planner does not compete with ralph-wiggum — it makes it better.
For long-running loops without permission prompts:
claude --dangerously-skip-permissionsWarning: This skips ALL permission checks. Only use in:
- Isolated/sandboxed environments
- Projects where you trust the plan completely
- When you've reviewed the generated plan first
Recommended workflow:
- Generate plan with ralph-planner (review it carefully)
- Start Claude with
--dangerously-skip-permissions - Run the ralph-loop command
- Configurable iteration multiplier (
--multiplier) #2 - Risk & dependency section in plans #3
- Machine-readable plan format (YAML/JSON) #4
- Custom template creation #5
If you see this message repeatedly:
Ralph iteration X | No completion promise set - loop runs infinitely
The ralph-wiggum plugin saves state in .claude/ralph-loop.local.md. If a loop wasn't properly cancelled, it persists.
Solution:
-
Cancel the active loop:
/ralph-wiggum:cancel-ralph -
Or delete the state file manually:
rm .claude/ralph-loop.local.md
-
Start a fresh Claude session
If planning triggers automatic execution, there's likely an active loop from a previous session. Cancel it first using the steps above.
MIT