The Problem with Chatting
Most developers use AI agents like a chat buddy. You open a window, paste in a request ("Make the button blue"), wait for the code, paste it into your editor, fix the inevitable bugs, and repeat.
It is faster than coding by hand, but you are still the bottleneck. You have to be there. You are the human router passing data back and forth.
A new pattern called "Ralph" flips this model. Instead of a conversation, it’s a loop. You give the AI a plan, a set of tools, and a simple script. The AI wakes up, grabs the first task, finishes it, commits the code, and then restarts itself to do the next one. You go to sleep, and you wake up to a stack of completed features.
How Ralph Works
Ralph isn't a product you buy; it's a technique you use. It relies on a few simple text files and a bash script working together.
The core philosophy is Fresh Context. Long conversations make AI stupid. They get confused by their own history. Ralph solves this by wiping the agent's memory after every single task. It starts fresh every time, looking at the code as it exists right now, not remembering the mistakes it made ten minutes ago.
To make this work, you need three things:
- The Brain: A CLI agent (like Anthropic's
claude). - The Plan: A file (like
PRD.md) that lists what needs to be done. - The Memory: A file (like
progress.txt) where the agent writes notes to its future self.
The Blueprint: How to Build It
Here is the exact setup you can use to run a Ralph loop on your own machine.
1. The File Structure
Create a folder in your project (e.g., ralph/) and add these files:
2. The Plan (PRD.md)
This is your backlog. The trick is to be extremely granular. Don't write "Build Login." Break it down so each step fits in one context window.