How to Run a Ralph Loop With the Cursor CLI
A full end-to-end setup for running the Ralph loop with the Cursor CLI: install, create a task list, log in inside the sandbox, run cursor-agent in a loop, and review the commits in the morning.
A full end-to-end setup for running the Ralph loop with the Cursor CLI: install, create a task list, log in inside the sandbox, run cursor-agent in a loop, and review the commits in the morning.
ralph.sh is the open-source shell script behind the Ralph loop. Here is how to install it, the flags that drive it, what it does on every iteration, and why it stays hackable.
Claude Code is Ralph’s default agent. A full end-to-end walkthrough for running the Ralph loop with Claude Code: install, log in inside the sandbox, loop on your task list, and review the commits.
A full end-to-end walkthrough for running the Ralph loop with OpenAI Codex CLI: install, log in inside the sandbox, drive codex exec non-interactively, pick a model, and review the commits.
A full end-to-end walkthrough for running the Ralph loop with the Gemini CLI: install, log in inside the sandbox, loop on your task list, choose a model, and review the commits.
A full end-to-end walkthrough for running the Ralph loop with the GitHub Copilot CLI: install, authenticate with gh inside the sandbox, loop on your task list, and review the commits.
A full end-to-end walkthrough for running the Ralph loop with the open-source opencode CLI: install, log in inside the sandbox, loop on your task list with your own model provider, and review the commits.
A Ralph loop fails in a handful of predictable ways. Here is each failure mode, why it happens, and the specific guardrail that stops it.
A Ralph loop stops on an explicit signal, not a guess. How promise tags and exit codes tell the loop and your scripts when the agent is COMPLETE, BLOCKED, or needs a decision.
PROMPT.md is the instruction sent to the agent on every iteration. Here is how to structure it so a fresh-context agent reorients from disk and ships one verified task at a time.
One-shot prompting solves small changes in a single response and stalls on hard ones. A Ralph loop iterates with fresh context and tests until the work is actually done.
Geoffrey Huntley popularized the Ralph technique by running a coding agent in a plain Bash loop until a working programming language fell out the other end. Here is where the idea came from and why it stuck.
The Ralph technique runs a coding agent in a loop until it signals completion. Fresh context each iteration, state on disk, and a promise tag that tells the loop when to stop.