| name | ralph-wiggum |
| description | Autonomous execution workflow integrating OpenSpec with Ralph Wiggum methodology. Use when implementing approved OpenSpec changes with longer autonomous runs - compiles OpenSpec files (proposal.md, design.md, tasks.md) into a PRD.json for iterative execution with progress tracking. Invoked via /ralph-wiggum compile, /ralph-wiggum run, /ralph-wiggum status, or /ralph-wiggum resume. |
Ralph Wiggum
Autonomous execution workflow that compiles OpenSpec planning documents into a simple PRD format for extended, unattended task completion.
Workflow Overview
┌─────────────────────────────────────────────────────────────┐
│ OPENSPEC (Source of Truth - Human-Friendly) │
│ proposal.md + design.md + tasks.md + spec deltas │
└─────────────────────────────────────────────────────────────┘
↓
/ralph-wiggum compile [change-id]
↓
┌─────────────────────────────────────────────────────────────┐
│ PRD.json (Execution Format - Agent-Friendly) │
│ All sections and tasks in one file │
└─────────────────────────────────────────────────────────────┘
↓
/ralph-wiggum run [change-id]
↓
┌─────────────────────────────────────────────────────────────┐
│ EXECUTION LOOP │
│ Read prd.json + progress.md → Do next task → Append log │
│ Repeat until stop condition │
└─────────────────────────────────────────────────────────────┘
Commands
/ralph-wiggum compile [change-id] [--section N or N-M]
Generate PRD.json from OpenSpec files. Compile all sections or target specific ones.
/ralph-wiggum compile add-browser-extension-ui
/ralph-wiggum compile add-browser-extension-ui --section 5
/ralph-wiggum compile add-browser-extension-ui --section 5-8
Process:
- Read
openspec/changes/[change-id]/proposal.md for context
- Read
openspec/changes/[change-id]/design.md for requirements (if exists)
- Read
openspec/changes/[change-id]/tasks.md and extract sections
- Generate
openspec/changes/[change-id]/prd.json
- Create empty
progress.md if not exists
Output:
✓ Compiled PRD for: add-browser-extension-ui (section 5)
✓ 1 sections, 8 tasks
✓ Progress: 6/8 (75.0%)
✓ Written to openspec/changes/add-browser-extension-ui/prd.json
/ralph-wiggum run [change-id] [--section N] [--max-iterations N]
Execute the autonomous loop using the ralph-wiggum.sh script.
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui --section 5
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui --max-iterations 20
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui -s 5 -m 20
The loop:
- Load
prd.json and progress.md
- Build prompt from template with current state
- If
--section specified, inject focus instruction
- Call Claude with the prompt
- Claude completes ONE task (test → implement → commit)
- Claude updates
prd.json and progress.md
- Check for stop signals or section completion
- Repeat until signal, section complete, or max iterations
/ralph-wiggum status [change-id]
Display current progress summary.
/ralph-wiggum status add-browser-extension-ui
Output:
Change: add-browser-extension-ui
Progress: 35/108 tasks (32.4%)
Sections:
✓ 1. Design System Foundation (6/6)
✓ 2. Core Component Architecture (5/5)
◐ 5. Panel Component (6/8)
○ 6. Issues View (0/9)
...
Next task: 5.7 Implement panel expand/collapse animations
Section: 5. Panel Component
Status: Ready to continue
/ralph-wiggum resume [change-id]
Continue from where the previous session stopped.
/ralph-wiggum resume add-browser-extension-ui
Reads progress.md to restore context before continuing execution.
PRD.json Format
{
"change_id": "add-browser-extension-ui",
"context": "Why this change exists...",
"requirements": ["TDD", "Commit per task", "..."],
"sections": [
{
"number": 5,
"name": "Panel Component",
"tasks": [
{
"id": "5.7",
"category": "feature",
"description": "Implement panel expand/collapse animations",
"steps": ["Write test", "Implement", "Verify"],
progress.md Format
Append-only log preserving context across sessions.
# Progress: [change-id]
## Session: YYYY-MM-DD HH:MM
### Completed
- [x] 5.7 Implement panel expand/collapse animations
### Decisions
- Used motion-vue AnimatePresence for exit animations
### Blockers
- None
### Files Changed
- src/components/OculisPanel.vue
- src/composables/usePanel.ts
### Notes for Next Session
- Ready for 5.8 Storybook stories
Stop Conditions
Halt execution and signal when:
| Condition | Signal | Action |
|---|
| All tasks complete | SECTION_COMPLETE | Create PR |
| Tests failing 3x | BLOCKED:TESTS | Log error, wait for human |
| Ambiguous requirement | BLOCKED:CLARIFICATION | Log question, wait for human |
| 10 iterations reached | PAUSED:LIMIT | Log progress, wait for human |
Execution Discipline
Commit Per Task (Mandatory)
Every completed task gets its own commit immediately:
git add .
git commit -m "type(scope): description [task-id]"
Example: git commit -m "feat(browser): add panel animations [5.7]"
Frequent commits allow recovery if something breaks and provide clear history.
PR Per Section (Mandatory)
When ALL tasks in a section have "passes": true:
- Push your branch
- Create PR with title:
[change-id] Section N: Section Name
- Signal
SECTION_COMPLETE and wait for review
git push -u origin feat/add-browser-extension-ui
gh pr create --title "[add-browser-extension-ui] Section 5: Panel Component" --body "..."
Task Prioritization
When choosing the next task, prioritize:
- Architectural decisions and core abstractions - Foundation work
- Integration points between modules - Failures cascade
- Unknown unknowns and spike work - Risky/unclear work
- Standard features - Regular implementation
- Polish and quick wins - Easy tasks last
Fail fast on risky work. Save easy wins for later.
TDD Workflow
- Write failing test first
- Implement minimal code to pass
- Refactor if needed
- Never skip tests
CI Green Rule
- Run
pnpm test after each implementation
- Run
pnpm lint before committing
- If tests fail 3x, stop and log blocker
Progress Logging
- Append to
progress.md after each task
- Include: completed tasks, decisions, blockers, files changed
- Keep entries concise (5-10 lines per session)
Scripts
scripts/ralph-wiggum.sh
The main execution loop. Repeatedly calls Claude with the PRD until completion or stop condition.
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui
.claude/skills/ralph-wiggum/scripts/ralph-wiggum.sh add-browser-extension-ui --max-iterations 20
What it does:
- Loads PRD.json and progress.md
- Builds prompt from template with current state
- Calls
claude --print with the prompt
- Checks output for stop signals
- Repeats until signal or max iterations
Stop signals it watches for:
TASK_COMPLETE - Continue to next iteration
SECTION_COMPLETE - Stop, create PR
ALL_TASKS_COMPLETE - Stop, all done
BLOCKED:TESTS - Stop, needs human help
BLOCKED:CLARIFICATION - Stop, needs clarification
scripts/prompt.md
The prompt template fed to Claude on each iteration. Contains placeholders:
{{CHANGE_ID}} - The change being worked on
{{PRD_JSON}} - Current PRD contents
{{PROGRESS_MD}} - Current progress log
scripts/compile.py
Compiles OpenSpec files into PRD.json format.
python3 .claude/skills/ralph-wiggum/scripts/compile.py [change-id]
python3 .claude/skills/ralph-wiggum/scripts/compile.py [change-id] --dry-run
scripts/status.py
Displays current progress for a change.
python3 .claude/skills/ralph-wiggum/scripts/status.py [change-id]