Implement the Ralph Wiggum technique — a self-referential iterative loop for autonomous task completion.
What is Ralph Wiggum?
A development methodology where the agent runs in a continuous loop, re-reading its own previous work (files, git history, test output) and iterating until a completion condition is met. Named after Ralph Wiggum from The Simpsons — persistent iteration despite setbacks.
Core concept
1. Agent receives task + completion promise
2. Agent works on the task (writes code, runs tests, etc.)
3. When agent tries to finish, the loop checks for the completion promise
4. If not complete → feed the SAME prompt back, agent sees its previous work
5. Repeat until completion promise is found or max iterations hit
The prompt never changes between iterations. The agent improves by reading its own past output in files and git history.
Implementation
- Add a
ralph or loop mode to the engine/CLI
- Accept: task prompt, completion promise string, max iterations
- After each ReAct run, check if the answer contains the completion promise
- If not, restart with the same prompt (agent sees modified files from previous run)
- Support cancellation
CLI example
golem --ralph -r 'Build a REST API for todos. Output DONE when complete.' --completion-promise DONE --max-iterations 50
Reference
Implement the Ralph Wiggum technique — a self-referential iterative loop for autonomous task completion.
What is Ralph Wiggum?
A development methodology where the agent runs in a continuous loop, re-reading its own previous work (files, git history, test output) and iterating until a completion condition is met. Named after Ralph Wiggum from The Simpsons — persistent iteration despite setbacks.
Core concept
The prompt never changes between iterations. The agent improves by reading its own past output in files and git history.
Implementation
ralphorloopmode to the engine/CLICLI example
golem --ralph -r 'Build a REST API for todos. Output DONE when complete.' --completion-promise DONE --max-iterations 50Reference