A VS Code Copilot Chat participant that implements the Ralph Wiggum iterative development technique - continuous AI loops for self-referential improvement.
The Ralph Wiggum technique is an iterative development methodology based on continuous AI loops, pioneered by Geoffrey Huntley.
Core concept: The same prompt is fed to the AI repeatedly. The "self-referential" aspect comes from the AI seeing its own previous work in the files and git history, not from feeding output back as input.
Each iteration:
- AI receives the SAME prompt
- Works on the task, modifying files
- AI sees its previous work in the files
- Iteratively improves until completion
The technique is described as "deterministically bad in an undeterministic world" - failures are predictable, enabling systematic improvement through prompt tuning.
- Download or clone this repository
- Navigate to the
ralph-wiggums-copilot-agentfolder - Install the extension:
code --install-extension ralph-wiggums-copilot-agent-0.1.0.vsix
- Reload VS Code
- Open Copilot Chat and type
@ralph
- Clone or download this extension
- Navigate to the folder:
cd ralph-wiggums-copilot-agent - Install dependencies:
npm install
- Compile TypeScript:
npm run compile
- Package the extension:
npm install -g @vscode/vsce vsce package
- Install the generated
.vsixfile:code --install-extension ralph-wiggums-copilot-agent-0.1.0.vsix
- Reload VS Code
- Open Copilot Chat and type
@ralph
- Clone or download this extension
- Open the folder in VS Code
- Run
npm installto install dependencies - Run
npm run compileto compile TypeScript - Press F5 to launch Extension Development Host
- In the new window, open a workspace folder
- Open Copilot Chat and type
@ralph
@ralph /loop Refactor the cache layer
@ralph /loop Add tests --max-iterations 20
@ralph /loop Fix auth bug --completion-promise "TESTS PASSING"
Options:
--max-iterations N- Maximum iterations before auto-stop (default: unlimited)--completion-promise "TEXT"- Promise phrase to signal completion
@ralph /status
Shows current iteration, duration, and prompt.
@ralph /cancel
Stops the active Ralph loop.
@ralph /help
Shows documentation about the Ralph Wiggum technique.
To signal that a task is complete, the AI must output a <promise> tag:
<promise>TASK COMPLETE</promise>
Critical Rule: The promise should ONLY be output when the statement is completely and unequivocally TRUE. Do not output false promises to escape the loop.
@ralph /loop Fix the token refresh logic in auth.ts. Output <promise>FIXED</promise> when all tests pass. --completion-promise "FIXED" --max-iterations 10
@ralph /loop Refactor the database layer to use async/await --max-iterations 15
@ralph /loop Build a REST API for user management. Output <promise>API COMPLETE</promise> when all endpoints work. --completion-promise "API COMPLETE"
- When you start a loop with
/loop, a state file is created in.ralph-loop/state.json - The AI works on your task, making changes to files
- Each iteration, the AI sees the same prompt but can review its previous work
- The loop continues until:
- The completion promise is detected in the response
- Maximum iterations is reached
- You manually cancel with
/cancel
The extension creates a .ralph-loop/ directory in your workspace to store loop state:
{
"active": true,
"iteration": 5,
"maxIterations": 20,
"completionPromise": "TESTS PASSING",
"startedAt": "2024-01-09T10:30:00.000Z",
"prompt": "Add comprehensive tests for the auth module"
}This directory is automatically added to .gitignore.
When a Ralph loop is active, you'll see a spinning sync icon in the status bar showing the current iteration:
π Ralph Loop: 5
Click it to see detailed status information.
The "loop" doesn't mean the AI talks to itself. It means:
- Same prompt repeated each iteration
- AI's work persists in files
- Each iteration sees previous attempts
- Builds incrementally toward goal
β Good for:
- Complex refactoring tasks
- Iterative feature development
- Bug fixes that require multiple attempts
- Learning and experimentation
β Not ideal for:
- Simple, single-step tasks
- Tasks with unclear success criteria
- When you need human decision points
npm install
npm run compilePress F5 in VS Code to launch the Extension Development Host.
The extension works in any workspace with VS Code Copilot Chat enabled.
The Ralph Wiggum technique was pioneered by Geoffrey Huntley. This VS Code extension brings the technique to Copilot Chat participants.
MIT
Issues and pull requests welcome!