Skip to content

Commit bc8ed80

Browse files
Kasper Jungeclaude
authored andcommitted
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>
1 parent 716eb77 commit bc8ed80

11 files changed

Lines changed: 79 additions & 653 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ node_modules/
1313
mess/
1414
.agents/
1515
.DS_Store
16-
.coverage
16+
.coverage
17+
.ralphify/

docs/cli.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ralph run my-ralph --dir ./src # Pass user args to the ralph
6161

6262
### User arguments
6363

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.
6565

6666
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:
6767

@@ -114,6 +114,16 @@ The loop also stops automatically when:
114114
- All `-n` iterations have completed
115115
- `--stop-on-error` is set and the agent exits non-zero or times out
116116

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+
117127
---
118128

119129
## `ralph scaffold`
@@ -137,7 +147,7 @@ Errors if `RALPH.md` already exists at the target location.
137147

138148
## RALPH.md format
139149

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.
141151

142152
```markdown
143153
---
@@ -200,6 +210,6 @@ Unmatched placeholders resolve to an empty string.
200210

201211
## Next steps
202212

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
204214
- [Quick Reference](quick-reference.md) — condensed cheat sheet for daily use
205215
- [Python API](api.md) — run loops programmatically instead of via the CLI

docs/cookbook.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ All recipes use **Claude Code** as the agent. To use a different agent, swap the
2020

2121
## Run autonomous ML experiments {: #autoresearch }
2222

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.
2424

2525
**`autoresearch/RALPH.md`**
2626

@@ -150,7 +150,7 @@ ralph run bug-hunter -n 5 --focus "focus on input validation" --log-dir ralph_lo
150150

151151
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.
152152

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.
154154

155155
**`research/RALPH.md`**
156156

@@ -174,7 +174,7 @@ ralph run research --workspace ai-safety --focus "current approaches to AI align
174174
✓ Iteration 1 completed (185.6s)
175175
```
176176

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).
178178

179179
---
180180

@@ -243,7 +243,7 @@ Swap `bandit` for your scanner of choice — `semgrep`, `npm audit`, `cargo audi
243243

244244
## Increase test coverage automatically {: #test-coverage }
245245

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.
247247

248248
**`test-coverage/RALPH.md`**
249249

@@ -271,6 +271,5 @@ The coverage report gives the agent a clear metric to improve and shows exactly
271271

272272
## Next steps
273273

274-
- [Writing Prompts](writing-prompts.md) — customize your recipe's prompt with patterns for task sources, constraints, and live editing
275274
- [CLI Reference](cli.md) — all `ralph run` options (`--timeout`, `--stop-on-error`, `--delay`, user args)
276275
- [Troubleshooting](troubleshooting.md) — when the agent hangs, commands fail, or output looks wrong

docs/how-it-works.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,7 @@ What happens inside each iteration of an autonomous coding loop? This page break
1313

1414
## The six steps of each iteration
1515

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.
3117

3218
### 1. Re-read the prompt from disk
3319

@@ -70,7 +56,7 @@ Unmatched placeholders resolve to an empty string — you won't see raw `{{ }}`
7056

7157
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.
7258

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.
7460

7561
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.
7662

@@ -199,6 +185,5 @@ The loop continues until one of these happens:
199185
## Next steps
200186

201187
- [Getting Started](getting-started.md) — set up your first loop
202-
- [Writing Prompts](writing-prompts.md) — patterns for effective autonomous loop prompts
203188
- [CLI Reference](cli.md) — all commands and options
204189
- [Troubleshooting](troubleshooting.md) — when things don't work as expected

docs/index.md

Lines changed: 53 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Autonomous AI Coding Loops
3-
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
55
hide:
66
- toc
77
---
@@ -11,19 +11,48 @@ hide:
1111
</p>
1212

1313
<p align="center" style="font-size: 1.3em; margin-top: -0.5em;">
14-
<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>
1515
</p>
1616

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+
```
1845

1946
```bash
20-
while :; do cat RALPH.md | claude -p ; done
47+
ralph run grow-coverage # loops until Ctrl+C
2148
```
2249

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.*
2453

2554
[Get Started](getting-started.md){ .md-button .md-button--primary }
26-
[View Cookbook](cookbook.md){ .md-button }
55+
[Read the Format Spec](blog/posts/the-ralph-format.md){ .md-button }
2756

2857
---
2958

@@ -47,102 +76,39 @@ Ralphify wraps this into a proper tool — running commands that feed test resul
4776
pip install ralphify
4877
```
4978

50-
## Create a ralph and run it
79+
## Scaffold a ralph and run it
5180

5281
```bash
53-
ralph init my-ralph
82+
ralph scaffold my-ralph
5483
```
5584

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:
9586

9687
```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
12690
```
12791

12892
Edit `RALPH.md` while the loop is running — changes take effect on the next iteration.
12993

13094
## Or install one with agr
13195

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):
13397

13498
```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
137101
```
138102

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`.
140104

141105
---
142106

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.
144110

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.
146112

147113
<div class="grid cards" markdown>
148114

@@ -183,8 +149,8 @@ A single agent conversation fills up its context window, slows down, and eventua
183149

184150
## Next steps
185151

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
187153
- **[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
190156
- **[Python API](api.md)** — embed the loop in your own automation

docs/quick-reference.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Your instructions here. Use {{ args.dir }} for user arguments. <!-- (6) -->
8888
| `timeout` | number | `60` | Max seconds before the command is killed |
8989

9090
!!! 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).
9292

9393
## Placeholders
9494

@@ -105,7 +105,7 @@ Your instructions here. Use {{ args.dir }} for user arguments. <!-- (6) -->
105105
- Unmatched placeholders resolve to empty string
106106
- Must be `commands` (plural)
107107

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).
109109

110110
### User argument placeholders
111111

@@ -156,6 +156,7 @@ Each iteration:
156156
|---|---|
157157
| `Ctrl+C` (once) | Finishes the current iteration gracefully, then stops |
158158
| `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) |
159160
| `-n` limit reached | Stops after the specified number of iterations |
160161
| `--stop-on-error` | Stops if agent exits non-zero or times out |
161162

@@ -164,8 +165,6 @@ Each iteration:
164165
- The prompt body is re-read from disk every iteration — edit the prompt while the loop runs (frontmatter is parsed once at startup)
165166
- HTML comments (`<!-- ... -->`) are stripped from the prompt — use them for notes to yourself
166167

167-
Tips on structuring prompts for different tasks → [Writing Prompts](writing-prompts.md)
168-
169168
## Common patterns
170169

171170
### Minimal ralph
@@ -228,6 +227,6 @@ More patterns and real-world examples → [Cookbook](cookbook.md)
228227
## Next steps
229228

230229
- [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
232231
- [Cookbook](cookbook.md) — copy-pasteable ralphs for common tasks
233232
- [Troubleshooting](troubleshooting.md) — common issues and how to fix them

0 commit comments

Comments
 (0)