Skip to content
Sign up
Features

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.

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:

  1. The agent outputs a completion promise (a specific phrase wrapped in <promise> XML tags)
  2. The maximum iterations limit is reached
  3. You manually exit Ralph mode using Shift+Tab (in the CLI)
Terminal window
/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:

Terminal window
/ralph
> Build a REST API for todos with full test coverage
Limit iterations
/ralph "Fix the failing tests" --max-iterations 100
Custom completion phrase
/ralph "Implement auth" --completion-promise "AUTH COMPLETE"
Disable completion check (infinite loop)
/ralph "Keep improving the code" --completion-promise ""

By default, the agent must output this exact text to stop the loop:

<promise>The task is complete. All requirements have been implemented
and verified working. Any tests that were relevant have been run and
are passing. The implementation is clean and production-ready. I have
not 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.

Combine autonomous loops with Letta Code’s built-in “yolo” (permission bypass) mode:

Full autonomy
/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.

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.

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 documentation

The 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.

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