You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: remove deprecated pages and streamline site navigation
Remove when-to-use.md and writing-prompts.md (content folded into other
pages), update nav in mkdocs.yml, and clean up stale sitemap entries.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/cli.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ ralph run my-ralph --dir ./src # Pass user args to the ralph
61
61
62
62
### User arguments
63
63
64
-
User arguments are passed as named flags after the ralph path. Use `{{ args.<name> }}`[placeholders](writing-prompts.md#ralph-context-placeholders) in your RALPH.md to reference them.
64
+
User arguments are passed as named flags after the ralph path. Use `{{ args.<name> }}`[placeholders](how-it-works.md#3-resolve-placeholders-with-command-output) in your RALPH.md to reference them.
65
65
66
66
Named flags (`--name value`) work without any frontmatter declaration. The `args` field is only required when you want to pass **positional** arguments — it tells ralphify which names to map them to:
67
67
@@ -114,6 +114,16 @@ The loop also stops automatically when:
114
114
- All `-n` iterations have completed
115
115
-`--stop-on-error` is set and the agent exits non-zero or times out
116
116
117
+
### Peeking at live agent output
118
+
119
+
When you run `ralph run` in an interactive terminal, the agent's stdout and stderr stream live to the console by default. Press `p` to silence the stream (useful for quieter loops) and press `p` again to resume it. The default is off whenever the output is not a real terminal (piped, redirected, or captured in CI), so `ralph run ... | cat` is unaffected.
120
+
121
+
Live streaming works with line-buffered agents such as Claude Code, OpenAI Codex, Aider, and any other process that writes one line at a time. For Claude running in stream-json mode you'll see the raw JSON events; for other agents you'll see the agent's plain output. Agents that repaint their own terminal UI (full-screen curses or TUI apps) are not supported — ralphify pipes their stdio, so they detect a non-TTY and fall back to plain output.
122
+
123
+
When `--log-dir` is set, output is captured to the log file and also echoed after each iteration completes; live peek still works the same way in that mode.
124
+
125
+
Some runtimes block-buffer their stdout when it is piped, which can make lines appear in bursts rather than as they are produced. If you notice stuttering, set `PYTHONUNBUFFERED=1` (or the equivalent for your agent) in the environment where you launch `ralph`.
126
+
117
127
---
118
128
119
129
## `ralph scaffold`
@@ -137,7 +147,7 @@ Errors if `RALPH.md` already exists at the target location.
137
147
138
148
## RALPH.md format
139
149
140
-
The `RALPH.md` file is the single configuration and prompt file for a ralph. It uses YAML frontmatter for settings and the body for the prompt text. See [Writing Prompts](writing-prompts.md) for detailed guidance on crafting effective prompts.
150
+
The `RALPH.md` file is the single configuration and prompt file for a ralph. It uses YAML frontmatter for settings and the body for the prompt text.
141
151
142
152
```markdown
143
153
---
@@ -200,6 +210,6 @@ Unmatched placeholders resolve to an empty string.
200
210
201
211
## Next steps
202
212
203
-
-[Writing Prompts](writing-prompts.md) — learn how to craft effective RALPH.md prompts
213
+
-[How it Works](how-it-works.md) — what happens inside each iteration
204
214
-[Quick Reference](quick-reference.md) — condensed cheat sheet for daily use
205
215
-[Python API](api.md) — run loops programmatically instead of via the CLI
Copy file name to clipboardExpand all lines: docs/cookbook.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ All recipes use **Claude Code** as the agent. To use a different agent, swap the
20
20
21
21
## Run autonomous ML experiments {: #autoresearch }
22
22
23
-
An autonomous ML research loop inspired by [Karpathy's autoresearch](https://github.com/karpathy/autoresearch). The agent runs experiments on a training script to minimize validation loss — modifying code, training for 5 minutes, keeping improvements and reverting failures. This recipe uses [helper scripts](writing-prompts.md#shell-features-in-commands) as commands to surface experiment state each iteration.
23
+
An autonomous ML research loop inspired by [Karpathy's autoresearch](https://github.com/karpathy/autoresearch). The agent runs experiments on a training script to minimize validation loss — modifying code, training for 5 minutes, keeping improvements and reverting failures. This recipe uses helper scripts as commands to surface experiment state each iteration.
24
24
25
25
**`autoresearch/RALPH.md`**
26
26
@@ -150,7 +150,7 @@ ralph run bug-hunter -n 5 --focus "focus on input validation" --log-dir ralph_lo
150
150
151
151
A structured research loop that builds up a report over many iterations. Uses shell scripts as commands to track maturity, show the question tree, and even run an editorial review agent that gives feedback between iterations.
152
152
153
-
This is a more advanced ralph — it uses [`args`](writing-prompts.md#parameterized-ralphs) for the research topic, helper scripts (run with `./`[relative to the ralph directory](how-it-works.md#2-run-commands-and-capture-output)), and a [`timeout`](writing-prompts.md#command-timeouts) on the review command.
153
+
This is a more advanced ralph — it uses [`args`](cli.md#user-arguments) for the research topic, helper scripts (run with `./`[relative to the ralph directory](how-it-works.md#2-run-commands-and-capture-output)), and a [`timeout`](how-it-works.md#2-run-commands-and-capture-output) on the review command.
154
154
155
155
**`research/RALPH.md`**
156
156
@@ -174,7 +174,7 @@ ralph run research --workspace ai-safety --focus "current approaches to AI align
174
174
✓ Iteration 1 completed (185.6s)
175
175
```
176
176
177
-
This recipe shows several advanced patterns: commands that call scripts relative to the ralph directory (`./show-focus.sh`), a command with a `timeout`, a command that itself calls an AI agent (`review.sh` pipes to `claude -p`), and `args` used in the prompt body via [`{{ args.workspace }}` placeholders](writing-prompts.md#ralph-context-placeholders).
177
+
This recipe shows several advanced patterns: commands that call scripts relative to the ralph directory (`./show-focus.sh`), a command with a `timeout`, a command that itself calls an AI agent (`review.sh` pipes to `claude -p`), and `args` used in the prompt body via [`{{ args.workspace }}` placeholders](how-it-works.md#3-resolve-placeholders-with-command-output).
178
178
179
179
---
180
180
@@ -243,7 +243,7 @@ Swap `bandit` for your scanner of choice — `semgrep`, `npm audit`, `cargo audi
243
243
244
244
## Increase test coverage automatically {: #test-coverage }
245
245
246
-
A loop that systematically increases test coverage. The agent sees the current coverage percentage and a list of uncovered functions, then writes tests for one module per iteration. The coverage command output feeds into the prompt via [`{{ commands.coverage }}`](writing-prompts.md#using-commands-for-dynamic-data) so the agent always knows where to focus.
246
+
A loop that systematically increases test coverage. The agent sees the current coverage percentage and a list of uncovered functions, then writes tests for one module per iteration. The coverage command output feeds into the prompt via [`{{ commands.coverage }}`](how-it-works.md#3-resolve-placeholders-with-command-output) so the agent always knows where to focus.
247
247
248
248
**`test-coverage/RALPH.md`**
249
249
@@ -271,6 +271,5 @@ The coverage report gives the agent a clear metric to improve and shows exactly
271
271
272
272
## Next steps
273
273
274
-
-[Writing Prompts](writing-prompts.md) — customize your recipe's prompt with patterns for task sources, constraints, and live editing
275
274
-[CLI Reference](cli.md) — all `ralph run` options (`--timeout`, `--stop-on-error`, `--delay`, user args)
276
275
-[Troubleshooting](troubleshooting.md) — when the agent hangs, commands fail, or output looks wrong
Copy file name to clipboardExpand all lines: docs/how-it-works.md
+2-17Lines changed: 2 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,21 +13,7 @@ What happens inside each iteration of an autonomous coding loop? This page break
13
13
14
14
## The six steps of each iteration
15
15
16
-
Every iteration follows the same sequence:
17
-
18
-
```mermaid
19
-
flowchart TD
20
-
A[Start iteration] --> B[Re-read RALPH.md from disk]
21
-
B --> C[Run commands]
22
-
C --> D[Resolve placeholders]
23
-
D --> E[Assemble prompt]
24
-
E --> F[Pipe prompt to agent]
25
-
F --> G{Agent exits}
26
-
G --> H[Next iteration]
27
-
H --> A
28
-
```
29
-
30
-
Here's what happens at each step.
16
+
Every iteration follows the same sequence. Here's what happens at each step.
31
17
32
18
### 1. Re-read the prompt from disk
33
19
@@ -70,7 +56,7 @@ Unmatched placeholders resolve to an empty string — you won't see raw `{{ }}`
70
56
71
57
The prompt body (everything below the YAML frontmatter in `RALPH.md`) with all placeholders resolved becomes the fully assembled prompt — a single text string ready for the agent.
72
58
73
-
HTML comments (`<!-- ... -->`) are stripped during assembly — they never reach the agent. Use them for notes to yourself, like why a rule exists or what to change next. See [Annotate your prompt with HTML comments](writing-prompts.md#annotate-your-prompt-with-html-comments) for examples.
59
+
HTML comments (`<!-- ... -->`) are stripped during assembly — they never reach the agent. Use them for notes to yourself, like why a rule exists or what to change next.
74
60
75
61
By default, ralphify appends a **co-author trailer instruction** to the end of the prompt, asking the agent to include `Co-authored-by: Ralphify <noreply@ralphify.co>` in its commit messages. This gives visibility into which commits were produced by a ralph loop. To disable it, set `credit: false` in the frontmatter.
76
62
@@ -199,6 +185,5 @@ The loop continues until one of these happens:
199
185
## Next steps
200
186
201
187
- [Getting Started](getting-started.md) — set up your first loop
202
-
- [Writing Prompts](writing-prompts.md) — patterns for effective autonomous loop prompts
203
188
- [CLI Reference](cli.md) — all commands and options
204
189
- [Troubleshooting](troubleshooting.md) — when things don't work as expected
description: Ralphify is a minimal CLI harness for autonomous AI coding loops. Run commands, assemble a prompt, pipe it to an AI agent, and repeat.
4
-
keywords: ralphify, AI coding agent, autonomous coding loop, CLI agent harness, while true loop, agent FOMO, agentic engineering
2
+
title: Ralphify — a runtime for the ralph format
3
+
description: Ralphify is the runtime for the ralph format — a skill-like spec for autonomous agent loops. A ralph is a directory with a RALPH.md file. Ralphify runs it.
4
+
keywords: ralphify, ralph format, RALPH.md, autonomous agent loop, agent runtime, harness engineering, skill-like format, ralph spec
<strong>Put your AI coding agent in a <code>while True</code> loop and let it ship.</strong>
14
+
<strong>A ralph is a directory that defines an autonomous agent loop. Ralphify runs it.</strong>
15
15
</p>
16
16
17
-
Ralphify is a minimal CLI harness for autonomous AI coding loops, inspired by the [Ralph Wiggum technique](https://ghuntley.com/ralph/). The core idea fits in one line:
17
+
A **ralph** is a directory with a `RALPH.md` file — a skill-like format that bundles a prompt, the commands to run between iterations, and any files the agent needs. **Ralphify** is the CLI runtime that executes them.
18
+
19
+
See [The Ralph Format](blog/posts/the-ralph-format.md) for the full spec.
20
+
21
+
```
22
+
grow-coverage/
23
+
├── RALPH.md # the loop definition (required)
24
+
├── check-coverage.sh # command that runs each iteration
25
+
└── testing-conventions.md # context for the agent
26
+
```
27
+
28
+
```markdown
29
+
---
30
+
agent: claude -p --dangerously-skip-permissions
31
+
commands:
32
+
- name: coverage
33
+
run: ./check-coverage.sh
34
+
---
35
+
36
+
You are an autonomous coding agent working in a loop.
37
+
Each iteration, write tests for one untested module, then stop.
38
+
39
+
Follow the conventions in testing-conventions.md.
40
+
41
+
## Current coverage
42
+
43
+
{{ commands.coverage }}
44
+
```
18
45
19
46
```bash
20
-
while:;do cat RALPH.md | claude -p ;done
47
+
ralph run grow-coverage # loops until Ctrl+C
21
48
```
22
49
23
-
Ralphify wraps this into a proper tool — running commands that feed test results and context into each iteration, tracking progress, and handling clean shutdown.
50
+
One directory. One command. Each iteration starts with fresh context and current data — ralphify runs the commands, fills in `{{ placeholders }}`, pipes the prompt to your agent, and loops.
51
+
52
+
*Works with any agent CLI. Swap `claude -p` for Codex, Aider, or your own — just change the `agent` field.*
[Read the Format Spec](blog/posts/the-ralph-format.md){ .md-button }
27
56
28
57
---
29
58
@@ -47,102 +76,39 @@ Ralphify wraps this into a proper tool — running commands that feed test resul
47
76
pip install ralphify
48
77
```
49
78
50
-
## Create a ralph and run it
79
+
## Scaffold a ralph and run it
51
80
52
81
```bash
53
-
ralph init my-ralph
82
+
ralph scaffold my-ralph
54
83
```
55
84
56
-
This creates a directory with a `RALPH.md` template. Edit it to fit your project:
57
-
58
-
**`my-ralph/RALPH.md`**
59
-
60
-
```markdown
61
-
---
62
-
agent: claude -p --dangerously-skip-permissions
63
-
commands:
64
-
- name: tests
65
-
run: uv run pytest -x
66
-
- name: git-log
67
-
run: git log --oneline -10
68
-
---
69
-
70
-
# Prompt
71
-
72
-
## Recent commits
73
-
74
-
{{ commands.git-log }}
75
-
76
-
## Test results
77
-
78
-
{{ commands.tests }}
79
-
80
-
You are an autonomous coding agent running in a loop. Each iteration
81
-
starts with a fresh context. Your progress lives in the code and git.
82
-
83
-
Read TODO.md for the current task list. Pick the top uncompleted task,
84
-
implement it fully, then mark it done.
85
-
86
-
If tests are failing, fix them before starting new work.
87
-
88
-
## Rules
89
-
90
-
- One task per iteration
91
-
- No placeholder code — full, working implementations only
92
-
- Commit with a descriptive message like `feat: add X` or `fix: resolve Y`
93
-
- Mark the completed task in TODO.md
94
-
```
85
+
This creates a directory with a `RALPH.md` template. Edit it, then run:
95
86
96
87
```bash
97
-
ralph run my-ralph # Start the loop (Ctrl+C to stop)
98
-
ralph run my-ralph -n 3 # Run 3 iterations
99
-
```
100
-
101
-
### What it looks like
102
-
103
-
```text
104
-
$ ralph run my-ralph -n 3 --log-dir ralph_logs
105
-
106
-
▶ Running: my-ralph
107
-
2 commands · max 3 iterations
108
-
109
-
── Iteration 1 ──
110
-
Commands: 2 ran
111
-
✓ Iteration 1 completed (52.3s)
112
-
→ ralph_logs/001_20250115-142301.log
113
-
114
-
── Iteration 2 ──
115
-
Commands: 2 ran
116
-
✗ Iteration 2 failed with exit code 1 (23.1s)
117
-
→ ralph_logs/002_20250115-142512.log
118
-
119
-
── Iteration 3 ──
120
-
Commands: 2 ran
121
-
✓ Iteration 3 completed (41.7s)
122
-
→ ralph_logs/003_20250115-143012.log
123
-
124
-
──────────────────────
125
-
Done: 3 iterations — 2 succeeded, 1 failed
88
+
ralph run my-ralph # loop until Ctrl+C
89
+
ralph run my-ralph -n 3 # run 3 iterations
126
90
```
127
91
128
92
Edit `RALPH.md` while the loop is running — changes take effect on the next iteration.
129
93
130
94
## Or install one with agr
131
95
132
-
Install a pre-built ralph from any GitHub repo using [agr](https://github.com/computerlovetech/agr) and run it immediately:
96
+
Ralphs are just directories, so you can share them via any git repo. Install a pre-built ralph from GitHub with [agr](https://github.com/computerlovetech/agr):
133
97
134
98
```bash
135
-
agr add owner/repo/my-ralph #Install a ralph from GitHub
136
-
ralph run my-ralph # Run it
99
+
agr add owner/repo/my-ralph #install a ralph from GitHub
100
+
ralph run my-ralph # run it by name
137
101
```
138
102
139
-
agr installs ralphs to `.agents/ralphs/` so you can run them by name.
103
+
agr installs ralphs to `.agents/ralphs/` so they're automatically discovered by `ralph run`.
140
104
141
105
---
142
106
143
-
## Why ralph loops?
107
+
## Why a format
108
+
109
+
Everyone writing ralph loops ends up with the same scaffolding: a markdown prompt, a few shell commands that surface state between iterations, a while-loop that ties them together. Turning that into a format makes ralphs **shareable**, **versionable**, and **installable** — the same way skills made inner-loop workflows shareable.
144
110
145
-
A single agent conversation fills up its context window, slows down, and eventually loses the plot. ralph loops solve this by resetting every iteration — the agent always starts fresh.
111
+
Ralphs are to the outer loop what [skills](https://agentskills.io/) are to the inner loop. A skill guides an agent inside a session. A ralph defines what runs *between* sessions.
146
112
147
113
<divclass="grid cards"markdown>
148
114
@@ -183,8 +149,8 @@ A single agent conversation fills up its context window, slows down, and eventua
183
149
184
150
## Next steps
185
151
186
-
-**[When to Use](when-to-use.md)** — figure out if a ralph loop fits your task
152
+
-**[The Ralph Format](blog/posts/the-ralph-format.md)** — the full spec
187
153
-**[Getting Started](getting-started.md)** — from install to a running loop in 10 minutes
188
-
-**[Writing Prompts](writing-prompts.md)** — patterns for effective autonomous loop prompts
189
-
-**[Cookbook](cookbook.md)** — copy-pasteable setups for coding, docs, research, and more
154
+
-**[How it Works](how-it-works.md)** — what happens inside each iteration
155
+
-**[Cookbook](cookbook.md)** — copy-pasteable ralphs for coding, docs, research, and more
190
156
-**[Python API](api.md)** — embed the loop in your own automation
Copy file name to clipboardExpand all lines: docs/quick-reference.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Your instructions here. Use {{ args.dir }} for user arguments. <!-- (6) -->
88
88
|`timeout`| number |`60`| Max seconds before the command is killed |
89
89
90
90
!!! warning "No shell features in commands"
91
-
Commands are run directly, not through a shell — pipes (`|`), redirections (`>`), and chaining (`&&`) won't work in the `run` field. Use a script instead: `run: ./my-script.sh` (scripts starting with `./` run from the ralph directory). See [Writing Prompts → Shell features](writing-prompts.md#shell-features-in-commands) for details.
91
+
Commands are run directly, not through a shell — pipes (`|`), redirections (`>`), and chaining (`&&`) won't work in the `run` field. Use a script instead: `run: ./my-script.sh` (scripts starting with `./` run from the ralph directory).
92
92
93
93
## Placeholders
94
94
@@ -105,7 +105,7 @@ Your instructions here. Use {{ args.dir }} for user arguments. <!-- (6) -->
105
105
- Unmatched placeholders resolve to empty string
106
106
- Must be `commands` (plural)
107
107
108
-
For details on writing effective prompts with placeholders, see [Writing Prompts](writing-prompts.md).
108
+
For details on placeholder resolution, see [How it Works](how-it-works.md#3-resolve-placeholders-with-command-output).
109
109
110
110
### User argument placeholders
111
111
@@ -156,6 +156,7 @@ Each iteration:
156
156
|---|---|
157
157
|`Ctrl+C` (once) | Finishes the current iteration gracefully, then stops |
158
158
|`Ctrl+C` (twice) | Force-kills the agent process and exits immediately |
159
+
|`p`| Toggle live peek of the agent's stdout (on by default in an interactive terminal — press to silence, press again to resume) |
159
160
|`-n` limit reached | Stops after the specified number of iterations |
160
161
|`--stop-on-error`| Stops if agent exits non-zero or times out |
161
162
@@ -164,8 +165,6 @@ Each iteration:
164
165
- The prompt body is re-read from disk every iteration — edit the prompt while the loop runs (frontmatter is parsed once at startup)
165
166
- HTML comments (`<!-- ... -->`) are stripped from the prompt — use them for notes to yourself
166
167
167
-
Tips on structuring prompts for different tasks → [Writing Prompts](writing-prompts.md)
168
-
169
168
## Common patterns
170
169
171
170
### Minimal ralph
@@ -228,6 +227,6 @@ More patterns and real-world examples → [Cookbook](cookbook.md)
228
227
## Next steps
229
228
230
229
-[Getting Started](getting-started.md) — set up your first ralph end-to-end
231
-
-[Writing Prompts](writing-prompts.md) — prompt structure, shell limitations, and advanced patterns
230
+
-[How it Works](how-it-works.md) — what happens inside each iteration
232
231
-[Cookbook](cookbook.md) — copy-pasteable ralphs for common tasks
233
232
-[Troubleshooting](troubleshooting.md) — common issues and how to fix them
0 commit comments