A simple PowerShell implementation of the Ralph Wiggum technique for autonomous AI coding agents.
Named after the Simpsons character known for naive persistence, Ralph Wiggum runs AI coding agents in automated loops. Each iteration:
- Starts with a fresh context (no accumulated confusion)
- Reads a specification and picks the next task
- Implements it and commits the code
- Updates a progress file and exits
The next iteration reads the same spec, sees what's been done via git history and progress file, and continues.
The key insight: Progress persists in files and git history, not in the context window. This avoids "context rot" where LLM performance degrades as input length increases.
- GitHub Copilot CLI - See GitHub CLI documentation
- PowerShell - Works cross-platform with PowerShell Core (Windows, macOS, Linux)
- Git - For version control and progress tracking
-
Copy the template to create a new scenario:
Copy-Item -Recurse _template my-scenario
-
Edit your scenario files:
my-scenario/plan.json- Define your PRDs (tasks) with dependenciesmy-scenario/prompt.txt- Customize instructions for the AImy-scenario/progress.md- Progress tracking (auto-updated)
-
Run the loop:
.\run-ralph.ps1 -Scenario my-scenarioEach scenario lives in its own folder:
my-scenario/
├── plan.json # PRDs with tasks, acceptance criteria, dependencies
├── prompt.txt # Instructions for the AI agent
└── progress.md # Progress tracking (updated by agent)
Defines your implementation plan as PRDs (Product Requirements Documents):
{
"scenario": "my-scenario",
"description": "What this scenario accomplishes",
"prds": [
{
"id": "PRD-001",
"title": "First Task",
"description": "What needs to be implemented",
"status": "not-started",
"acceptance_criteria": ["Criterion 1", "Criterion 2"],
"dependencies": []
},
{
"id": "PRD-002",
"title": "Second Task",
"status": "not-started",
"dependencies": ["PRD-001"]
}
]
}The script respects dependencies—PRD-002 won't start until PRD-001 is complete.
# Basic usage
.\run-ralph.ps1 -Scenario my-scenario
# Limit iterations
.\run-ralph.ps1 -Scenario my-scenario -Iterations 10
# Use a different model
.\run-ralph.ps1 -Scenario my-scenario -Model "claude-opus-4.5"
# Yolo mode - allow all tools without prompting (dangerous ops still blocked)
.\run-ralph.ps1 -Scenario my-scenario -YoloThe -Yolo flag enables --yolo which allows all tools to run without confirmation prompts. This is useful for:
- Sandboxed environments (Docker) where the agent is already isolated
- HITL mode where you're watching each iteration
- Trusted scenarios where permission prompts add friction
Safety: Even with -Yolo, dangerous operations are still blocked via the deny list (git push, rm, file deletion, etc.). To fully disable safety rails, edit the $DeniedTools array in the script.
claude-sonnet-4.5(default),claude-haiku-4.5,claude-opus-4.5,claude-sonnet-4gpt-5.2-codex,gpt-5.1-codex-max,gpt-5.1-codex,gpt-5.2,gpt-5.1,gpt-5gpt-5.1-codex-mini,gpt-5-mini,gpt-4.1gemini-3-pro-preview
- Context Optimization: Only the next eligible PRD is loaded (not the entire plan), minimizing context size
- Dependency Checking: PRDs are only worked on when their dependencies are complete
- Completion Detection: The agent signals completion with
<promise>COMPLETE</promise> - Safe Tool Permissions: File writes and safe git operations are allowed; dangerous operations (push, delete, reset --hard) are denied
- Write clear PRDs with specific acceptance criteria
- Keep tasks small - each PRD should be completable in one context window
- Use dependencies to enforce ordering when tasks build on each other
- Review commits after the loop completes
- Start with fewer iterations (5-10) until you tune your prompts
See _examples/ for working scenarios you can copy and adapt.
The Ralph Wiggum technique was developed and documented by Geoffrey Huntley.
MIT License - See LICENSE