Move beyond pull requests.
Multiple coding agents. Separate worktrees. One mainline.
Coding agents write code fast. The handoffs around them do not scale the same way: babysitting a session, re-explaining context, resolving conflicts, waiting in a review queue.
Ralph Workflow is a free, open-source AI agent orchestrator and software factory — the operating system for autonomous coding — for developers and teams who already have a coding agent: you supply the specification and the checks you trust, and it returns integrated, checked software on one mainline.
Ralph Workflow manages the harness, not the models. A harness of harnesses: coding agents such as Claude Code, Codex, and Cursor are harnesses around models, and Ralph Workflow is the workflow, review, recovery, and Git layer around those agents. There is no vendor lock-in: nine built-in agent backends ship with it, and agent chains can mix them and fall back to the next when an attempt fails. Switching or combining vendors is a configuration change, not a rewrite. Ralph Workflow needs no API key of its own and sells no model access; it launches the agent CLI you installed and authenticated, so whatever login or subscription that agent supports is what runs. Each agent defines its own authentication (a login, an API key, or either), and the agent's vendor determines model access, rate limits, and cost.
Every default ships with the package (workflow, agent chains, tools,
artifact contracts, retries, recovery, Git sync), and ralph --init seeds
your setup, so there is no setup project: productive on day 1,
preconfigured, and yours to tweak. See the
bundled defaults.
It runs on your machine: local, free, AGPL-3.0-or-later, no account, no hosted service, and no metering from Ralph Workflow. Your specifications, configuration, and Git history stay yours.
Run one agent by hand and you are the scheduler, reviewer, and merger. Run a plain agent loop and it repeats one prompt. Ralph Workflow runs a configurable workflow graph with review gates, retries, recovery, and fallback agent chains, keeps independent runs in separate Git worktrees, and lands checked work on one mainline.
A fit for tasks with a clear finish line and checks you trust; not (yet) for open-ended exploration or repositories with no reliable tests. See Is Ralph Workflow for you?.
You supply the specification and the checks you trust; the factory returns integrated software for you to judge. Every factory claim maps to a real mechanism:
- Stations. Phases are stations on the line: planning, development, review, fix, commit.
- Gates. Checks are gates: a phase advances only on
on_success, and its declared transitions loop work back (on_loopback), send a rejected commit review back to development (on_reject), or route a failure tofailed_terminal(on_failure). See the pipeline configuration reference. - Interchangeable workers. An agent chain is the worker pool for a station: you choose the agent, and which one takes over when an attempt fails; see the configuration reference.
- Parallel lines. Worktrees are the production lines: independent runs work in separate Git worktrees without sharing agent context.
- Shipping. Git integration ships successful work to the configured mainline.
Adopt the bundled default graph as-is first; it is a strong default for writing software. Its phases and routes are in the pipeline configuration reference, and each phase's output contract is in the artifacts reference.
For developers and teams who want to run autonomous coding work across Git worktrees, keep the mainline moving, and spend less time coordinating agents and merges, and who have tasks with a clear finish line and checks they trust.
Not (yet) for open-ended exploration with no defined finish line, or for repositories with no reliable tests or checks. If the finish line is fuzzy, write it down first: one sentence saying what "done" means. If the repository has no checks you trust, build that first: a test suite, a script, or a recognizable diff.
A plain agent loop repeats one prompt until the work stops changing: give an agent a task, let it work, check the result, iterate. That is the whole Ralph loop: plan → build → verify → fix. Run it by hand and you supply every call yourself: the next prompt, the retry, the merge.
A workflow graph keeps that loop and moves those calls into configuration:
- Which phase runs next. Each phase's drain binds it to an agent chain, and
the transitions declared in
pipeline.tomlpick the next phase; a run ends atcompleteorfailed_terminal. - Which agent handles it. Routing is policy, not code. A phase is bound to an agent chain, so planning can go to one agent and development to another.
- What evidence is produced. Each phase declares a contract the runtime validates before the phase ends. These contracts are the factory's durable handoffs: each phase's validated output is handed to the next phase and survives an interruption. See the artifacts reference and the recovery reference.
- What happens on failure. A failed attempt retries, falls over to the next agent in the chain, and a stuck or crashed agent is caught by the watchdog.
- How work resumes. Checkpoints and durable recovery state carry an interrupted run forward, including a half-finished Git operation.
Routing and recovery are described in the concepts reference.
Review and integration happen inside the execution graph, not in a pull-request queue. You define the outcome and the checks; Ralph Workflow runs the workflow; you judge the software. Branch protections and required checks still apply, and nothing lands without the Git result proving it.
Separate worktrees give agents room to work. Ralph Workflow handles the Git coordination that makes that work converge.
- Synchronize automatically. Feature work syncs with the configured mainline at startup, after commits, and at phase boundaries.
- Resolve conflicts in the workflow. Ralph Workflow rebases onto the target and routes conflicts to a resolution agent chain, with an endpoint-merge fallback.
- Land automatically. The local target fast-forwards to the integrated
tip once Git proves the integration finished. Local integration is on by
default and the target defaults to
main; remote sync publishes to the configured remote when one exists, and can be turned off for local-only operation. - Recover interrupted integration. Durable recovery state continues an unfinished Git operation before ordinary development resumes.
Two facts worth stating plainly. Your repository's branch protections and
required checks still determine what is permitted; Ralph Workflow does not
bypass them. And the worktree that holds main is integration
infrastructure: when uncommitted content there blocks an advance, it can be
snapshotted to a recoverable ref and reset by default. Keep active edits in
feature worktrees.
The auto-integration guide covers synchronization, recovery, snapshot restoration, and local-only or manual Git operation.
Nine backends ship with Ralph Workflow. Authenticate each one yourself: Ralph Workflow needs no API key of its own and sells no model access, and each agent's own login or key is what runs.
- Claude Code (
claude) —claude loginor an Anthropic API key. - Claude Code (headless) (
claude) — the same binary without a PTY; the sameclaude loginor an Anthropic API key. - Codex (
codex) —codex loginor an OpenAI API key. - OpenCode (
opencode) — provider-specific keys, per provider. - Nanocoder (
nanocoder) — local-only TUI, no remote authentication. - AGY (Google Anti Gravity) (
agy) —agy loginwith a Google account. - Pi (
pi) — provider configuration inside Pi. - Cursor (
agent) —CURSOR_API_KEYor a file-backed Cursor login; if no valid Cursor auth file exists, Ralph Workflow copies your existing Cursor IDE login into Cursor's file-backed auth paths. - Kimi Code (
kimi) — an interactivekimilogin wires themanaged:kimi-codesubscription provider.
The agent guide covers the CLI lifecycle; the compatibility reference lists every CLI and model syntax.
You need Python 3.12+, Git, pipx, and one coding agent CLI
installed and authenticated. Ralph Workflow runs locally; the agent you
choose determines model access and cost. The executable is named ralph.
Run these in your own terminal, inside the project you want to work on:
pipx install ralph-workflow
ralph --version
cd /path/to/your/project
ralph --init
ralph --list-agents
ralph --diagnoseConfirm your agent appears and every diagnostic line is green. Then edit
the PROMPT.md that ralph --init created: replace the starter with your
task, acceptance criteria, and verification commands, and remove the
<!-- ralph:starter-prompt ... --> marker; Ralph Workflow refuses to run
while it remains.
A small first task in a Python project with pytest:
# Goal
Reject an empty email address in the signup validator with a clear error.
## Acceptance criteria
- An empty email is rejected before a user record is created.
- Valid signup behavior and public interfaces stay unchanged.
- Tests cover both the rejected input and a valid signup.
## Verification
- Run python -m pytest and fix any failures.A ready-made first task is in the
Flask /health starter.
Start the run:
ralphA successful first run completes with the changes committed on a branch in a worktree, integrated onto the mainline or reported with the evidence it produced: what changed, which checks ran, what to review. Then exercise the software and decide what to keep.
No pipx? pip install ralph-workflow in a Python 3.12+ virtual environment
also works; from a source checkout, see the
source installation guide.
The first-run walkthrough covers each step; the
getting-started tutorial
covers task picking.
| You want to… | Go here |
|---|---|
| Complete your first run | Start here |
Set agents, Git sync, and project settings in ralph-workflow.toml |
Configuration reference |
Change phases and routing in pipeline.toml |
Pipeline configuration |
Set the tool surface in mcp.toml |
MCP configuration |
Define output contracts in artifacts.toml |
Artifact configuration |
| Find an answer or troubleshoot a run | Docs map · Operator manual |
Those four names are configurable policy files, not top-level repository files.
Ralph Workflow is free and open source under AGPL-3.0-or-later: you may run, read, and modify it, and if you offer a modified version over a network you publish your changes.
Next step, by reader type:
-
Evaluate it: run the first-run walkthrough.
-
Use it: configure your setup with the operator manual.
-
Contribute it: read CONTRIBUTING.md and the code of conduct; every contribution must agree to the Contributor License Agreement.
-
LICENSE · CODE_OF_CONDUCT.md · PyPI package page · Report an issue
The Ralph loop pattern is credited to Geoffrey Huntley; Ralph Workflow is an independent implementation built on that core, and it is independent of the agent vendors it drives.