Skip to main content
Ralph loop is an execution mode for tasks that need more rigor than a single implementation pass. You set a budget, agree on acceptance criteria with the agent, and Twill loops between implementation and automated verification until the criteria pass or the budget runs out.

When to use it

  • Large features that span multiple files or subsystems
  • Ambiguous tasks where “done” needs to be defined upfront
  • Work where you want automated quality gates, not just a single pass

How it works

1

Select Ralph loop and set a budget

In the Twill web app, select Ralph loop from the mode dropdown in the message composer. Enter a maximum USD budget for the task. The budget is required.
2

Criteria drafting

A criteria agent explores your repo and drafts acceptance criteria for the task. If the task is ambiguous, the agent asks clarifying questions with structured options before finalizing.
3

Approve criteria

Review the proposed acceptance criteria. Click Approve to proceed to implementation. You can also answer follow-up questions or ask the agent to revise.
4

Implementation and verification loop

After approval, the agent implements against the criteria. When each implementation pass finishes, a separate verifier model checks whether the criteria are met:
  • Pass: the task is complete.
  • Fail: the verifier’s feedback is fed back into a new implementation pass automatically.
The loop continues until criteria pass or the budget is exhausted.

Budget enforcement

Twill tracks spend continuously during Ralph loop tasks. When spend reaches 90% of your budget, the agent wraps up its current work and stops looping. Each job in the loop shows an estimated cost badge so you can see where the budget is going.

Triggering Ralph loop

Select Ralph loop in the mode dropdown and enter a budget before submitting your task.
Ralph loop always uses Claude Code Sonnet for implementation, regardless of your workspace’s default agent or model setting.