|
| 1 | +# Ralph Operations |
| 2 | + |
| 3 | +This repo implements the Ralph loop runner. Ralph runs an agent repeatedly until it emits the completion signal: |
| 4 | + |
| 5 | +`<promise>COMPLETE</promise>` |
| 6 | + |
| 7 | +Ralph is intentionally context-scoped: each iteration is a fresh agent invocation. Long-term memory MUST live in repo state (git history, `progress.txt`, and TaskMaster tasks). |
| 8 | + |
| 9 | +## Prereqs |
| 10 | + |
| 11 | +- `uv` installed |
| 12 | +- One agent CLI installed/authenticated: |
| 13 | + - `amp` |
| 14 | + - `claude` |
| 15 | + - `codex` |
| 16 | +- A git repo (Ralph resolves the project root by walking up to `.git`) |
| 17 | + |
| 18 | +## Tasks (TaskMaster) |
| 19 | + |
| 20 | +Ralph uses TaskMaster tasks stored at: |
| 21 | + |
| 22 | +`.taskmaster/tasks/tasks.json` |
| 23 | + |
| 24 | +If `tasks.json` is missing/empty/invalid, `./ralph.sh` exits early and prints a copy/paste prompt to generate tasks (nothing runs until tasks exist). |
| 25 | + |
| 26 | +Schema reference: |
| 27 | + |
| 28 | +`schemas/taskmaster-schema.json` |
| 29 | + |
| 30 | +### Generating Tasks (Recommended) |
| 31 | + |
| 32 | +Run your designated agent and instruct it to use the `prd` skill to produce TaskMaster-format tasks at: |
| 33 | + |
| 34 | +`.taskmaster/tasks/tasks.json` |
| 35 | + |
| 36 | +Requirements for generated tasks: |
| 37 | + |
| 38 | +- MUST be TaskMaster format with `tasks[]` and `metadata` |
| 39 | +- MUST include 3-7 small tasks with verifiable acceptance criteria |
| 40 | +- MUST use IETF 2119 language (MUST/SHOULD/MAY) in acceptance criteria |
| 41 | +- MUST set `metadata.project` and `metadata.branchName` |
| 42 | + |
| 43 | +## Running Ralph (CLI) |
| 44 | + |
| 45 | +Preferred (uses the packaged entrypoint): |
| 46 | + |
| 47 | +```bash |
| 48 | +uv run ralph --agent codex 3 |
| 49 | +uv run ralph --agent amp 10 |
| 50 | +uv run ralph --agent claude 5 |
| 51 | +``` |
| 52 | + |
| 53 | +Wrapper (runs preflight + delegates to `uv run ralph ...`): |
| 54 | + |
| 55 | +```bash |
| 56 | +./ralph.sh --agent codex 3 |
| 57 | +``` |
| 58 | + |
| 59 | +Script entrypoint (equivalent behavior): |
| 60 | + |
| 61 | +```bash |
| 62 | +uv run --script ralphython.py --agent codex 3 |
| 63 | +``` |
| 64 | + |
| 65 | +Notes: |
| 66 | +- `--agent` is required (unless using `--mcp`) |
| 67 | +- default iterations is 10 |
| 68 | + |
| 69 | +## Running Ralph (MCP Server) |
| 70 | + |
| 71 | +stdio: |
| 72 | + |
| 73 | +```bash |
| 74 | +uv run ralph --mcp --transport stdio |
| 75 | +``` |
| 76 | + |
| 77 | +http: |
| 78 | + |
| 79 | +```bash |
| 80 | +uv run ralph --mcp --transport http --host 127.0.0.1 --port 8000 |
| 81 | +``` |
| 82 | + |
| 83 | +MCP tools/resources (current): |
| 84 | +- Tools: `run_ralph_iteration`, `get_ralph_status`, `get_task_status` |
| 85 | +- Resources: `ralph://tasks`, `ralph://progress` |
| 86 | + |
| 87 | +## Configuration |
| 88 | + |
| 89 | +TaskMaster model (written to `.taskmaster/config.json` by `ralph.sh`): |
| 90 | + |
| 91 | +- `RALPH_TASKMASTER_MODEL` (default: `gpt-5-codex`) |
| 92 | + |
| 93 | +Codex: |
| 94 | +- `CODEX_MODEL` |
| 95 | +- `CODEX_REASONING_EFFORT` |
| 96 | +- `CODEX_SANDBOX` |
| 97 | +- `CODEX_EXTRA_ARGS` |
| 98 | + |
| 99 | +## Sandboxed Environments |
| 100 | + |
| 101 | +`ralph.sh` sets a repo-local uv cache by default: |
| 102 | + |
| 103 | +- `UV_CACHE_DIR=$GIT_ROOT/.uv-cache` |
| 104 | + |
| 105 | +If your environment needs a different location, set `UV_CACHE_DIR` explicitly. |
| 106 | + |
0 commit comments