Ralph - Autonomous Development Environment

Ralph is an autonomous agent loop for implementing features in Orcha.

Prerequisites

LocalStack and PostgreSQL must be running:

bb dev:up

Workflow

1. Write a Spec

Create a spec file in .ralph/specs/:

cp .ralph/specs/README.md .ralph/specs/my-feature.md
vim .ralph/specs/my-feature.md

Only one spec file (excluding README.md) should exist at a time.

2. Build the Image

cd .ralph
docker compose build

3. Run Planning Phase

docker compose run --rm ralph-plan

This reads your spec and creates IMPLEMENTATION_PLAN.md in the project root.

4. Review the Plan

cat ../IMPLEMENTATION_PLAN.md

Edit if needed. Each task should be small enough for one commit.

5. Run Build Phase

docker compose run --rm ralph-build

This executes tasks one by one, committing after each. Runs until all tasks are complete or blocked.

6. Clean Up

After completion:

Services

Service Purpose Command
ralph Interactive sandbox docker compose run --rm ralph
ralph-plan Create implementation plan docker compose run --rm ralph-plan
ralph-build Execute plan tasks docker compose run --rm ralph-build

Configuration

Single config file: ralph.yml

Interactive Sandbox

For debugging or manual work:

docker compose run --rm ralph

Inside the container:

Files

File Purpose
ralph.yml Ralph orchestrator config
PROMPT_plan.md Planning phase prompt
PROMPT_build.md Building phase prompt
AGENTS.md Build/test commands reference
guardrails.md Failure patterns to avoid
completion-marker.txt Completion signal for build phase
specs/ Feature specifications

Troubleshooting

Network not found

network orcha_default declared as external, but could not be found

Run bb dev:up first to create the network.

Container can't connect to services

Ensure services are using hostnames postgres and localstack, not localhost.

Build phase stuck

Check IMPLEMENTATION_PLAN.md for incomplete tasks. The agent may be blocked on a failing test or compilation error. Run interactively to debug:

docker compose run --rm ralph

Claude CLI not authenticated

Ensure ~/.claude exists and contains valid credentials. The directory is mounted into the container.