Ralph mode (aka forced continuation)
Force your agent to continue working until a task is complete
Sometimes you want your agent to keep working until the job is completely done, without having to manually remind it to “keep going”, or prod it to reflect with “are you sure it’s completely finished?”. The /ralph command starts an iterative loop that continually prompts the agent to continue working until it outputs an explicit “promise” that the task at hand has been completed.
This iterative looping + promise checking method is also called the Ralph Wiggum technique (aka “Ralph loop”), and it implemented natively inside of Letta Code as “Ralph mode”. The name comes from Ralph Wiggum’s persistence in The Simpsons.
How it works
Section titled “How it works”When you run /ralph, Letta Code overrides the normal end-of-turn behavior. Instead of returning control to you (the user) after an agent yields execution (for example, when the agent stops to say “I’ve finished”), Letta Code will automatically re-prompt the agent to continue working.
The loop continues until one of these happens:
- The agent outputs a completion promise (a specific phrase wrapped in
<promise>XML tags) - The maximum iterations limit is reached
- You manually exit Ralph mode using Shift+Tab (in the CLI)
Starting a loop
Section titled “Starting a loop”/ralph "Build a REST API for todos with full test coverage"The agent will work on your task, and when it finishes a turn, Letta Code automatically continues with the same prompt. You’ll see iteration counts in the status bar.
You can also start the command first, then type your task:
/ralph
> Build a REST API for todos with full test coverageOptions
Section titled “Options”/ralph "Fix the failing tests" --max-iterations 100/ralph "Implement auth" --completion-promise "AUTH COMPLETE"/ralph "Keep improving the code" --completion-promise ""The completion promise
Section titled “The completion promise”By default, the agent must output this exact text to stop the loop:
<promise>The task is complete. All requirements have been implementedand verified working. Any tests that were relevant have been run andare passing. The implementation is clean and production-ready. I havenot taken any shortcuts or faked anything to meet these requirements.</promise>The phrasing is intentionally strong. The agent is instructed not to output the promise unless the statement is genuinely true — no lying to escape the loop. This encourages thorough completion rather than premature exits.
You can customize the promise text with --completion-promise, but keep it meaningful. Vague phrases like “DONE” make it too easy for the agent to exit prematurely.
Combining with yolo mode
Section titled “Combining with yolo mode”Combine autonomous loops with Letta Code’s built-in “yolo” (permission bypass) mode:
/yolo-ralph "Refactor the auth module and update all tests"This runs the loop with bypassPermissions enabled, so the agent won’t pause for tool approvals. The status bar shows orange instead of yellow to indicate the elevated permissions.
Yolo mode is a perfect combination for Ralph mode, since it allows you to leave your Letta Code agent to run for extremely extended periods of time without requiring any intervention, since Letta Code will never stop execution to ask for permisisons.
Interrupting and resuming
Section titled “Interrupting and resuming”Similar to regular interactive mode in Letta Code, you can press ESC during streaming to interrupt the current turn. You can type additional instructions to provide feedback, and when you send them, the Ralph loop continues with your input prepended to the original prompt.
Press Shift+Tab to fully exit the loop and return to normal interactive mode.
Writing good prompts
Section titled “Writing good prompts”Ralph mode works best with clear, verifiable completion criteria.
Works well:
Build a REST API for todos. Requirements:- CRUD endpoints for todo items- Input validation on all endpoints- Unit tests with >80% coverage- README with API documentationThe agent can verify each requirement before claiming completion.
Works poorly:
Make the code better.Without concrete criteria, the agent might loop indefinitely or exit too early.
When to use Ralph mode
Section titled “When to use Ralph mode”Ralph mode shines for well-defined tasks with automatic verification:
- Getting a test suite to pass
- Implementing features with clear acceptance criteria
- Refactoring with existing test coverage
- Generating boilerplate that follows patterns
Ralph mode is less suited for tasks that benefit from a human in-the-loop:
- Tasks requiring human judgment or design decisions
- Exploratory work without clear goals
- One-shot operations that don’t benefit from long-horizon iteration