eab8e71a4815d9b03b0b6dabba48390560981c40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ralph Wiggum Loop - Generic Software Template
A PowerShell outer loop that repeatedly invokes Claude Code with fresh context each iteration. Memory persists via filesystem only: git commits, progress.txt, and IMPLEMENTATION_PLAN.md.
How It Works
ralph.ps1pipesRALPH_PROMPT.mdtoclaude --printin a loop- Each iteration, Claude reads
IMPLEMENTATION_PLAN.md, picks the first unchecked task, implements it, commits, and updatesprogress.txt - When all tasks are checked off, Claude outputs
<promise>COMPLETE</promise>and the loop exits - No context accumulates between iterations - each one starts clean
Setup
- Copy this template folder into your project directory
- Edit
IMPLEMENTATION_PLAN.md:- Fill in the Project Overview section
- Add your Quality Checks commands (e.g.
npm test,dotnet build) - List your Tasks as
- [ ]checklist items in priority order
- Ensure
claudeCLI is available on your PATH
Usage
Basic run:
.\ralph.ps1
With options:
.\ralph.ps1 -MaxIterations 15 -Model sonnet -BranchName "feature/my-feature"
Parameters
| Parameter | Default | Description |
|---|---|---|
-MaxIterations |
10 | Maximum loop iterations before stopping |
-Model |
sonnet | Claude model to use |
-BranchName |
(none) | Git branch to create/checkout before starting |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All tasks completed |
| 1 | Max iterations reached without completing all tasks |
Files
| File | Purpose |
|---|---|
ralph.ps1 |
PowerShell outer loop script |
RALPH_PROMPT.md |
Prompt template piped to Claude each iteration |
IMPLEMENTATION_PLAN.md |
Task checklist and project config (you edit this) |
progress.txt |
Accumulated learnings and iteration log (auto-populated) |
Git Behaviour
- The script initialises a git repo if one doesn't exist
- Creates/checks out
-BranchNameif provided - Pushes to remote after each iteration (silently skips if no remote configured)
- Claude commits after implementing each task and after updating progress files
Languages
TypeScript
71.7%
HTML
25.5%
CSS
2.3%
JavaScript
0.5%