Skip to content

Commit 37aef48

Browse files
Kasper JungeRalphify
authored andcommitted
docs: add TL;DR and descriptive headings to how-it-works page (category 1)
Replace generic headings like "What happens in each iteration" with descriptive ones that work in table of contents and search results. Add TL;DR summary box matching the pattern on other guide pages. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 65bb978 commit 37aef48

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/how-it-works.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ keywords: autonomous coding loop lifecycle, how AI coding agents work, self-heal
66

77
# How the ralph loop works
88

9+
!!! tldr "TL;DR"
10+
Each iteration: re-read `RALPH.md` from disk → run commands → replace `{{ placeholders }}` with output → pipe the assembled prompt to the agent → agent works and exits → repeat. The prompt body is re-read every iteration (so you can edit it live), but frontmatter is parsed once at startup. Failed commands still capture output — that's what makes the loop self-healing.
11+
912
What happens inside each iteration of an autonomous coding loop? This page breaks down the lifecycle — from command execution to prompt assembly to agent piping — so you can write better prompts, debug unexpected behavior, and understand the self-healing feedback cycle.
1013

11-
## What happens in each iteration
14+
## The six steps of each iteration
1215

1316
Every iteration follows the same sequence:
1417

@@ -87,7 +90,7 @@ When the agent command starts with `claude`, ralphify automatically adds `--outp
8790

8891
The loop starts the next iteration from step 1. The RALPH.md is re-read, commands run again with fresh output, and the agent gets a new prompt reflecting the current state of the codebase.
8992

90-
## What changes between iterations
93+
## What gets re-read vs. what stays fixed
9194

9295
| What | When read | Why it matters |
9396
|---|---|---|
@@ -96,7 +99,7 @@ The loop starts the next iteration from step 1. The RALPH.md is re-read, command
9699
| Frontmatter (`agent`, `commands`, `args`) | Once at startup | Parsed when the loop starts. Restart to pick up changes. |
97100
| User arguments | Once at startup | Passed via CLI flags, constant for the run |
98101

99-
## The self-healing feedback loop in action
102+
## How broken code gets fixed automatically
100103

101104
Here's a concrete example. Given this `RALPH.md`:
102105

@@ -167,7 +170,7 @@ If tests are failing, fix them first.
167170

168171
The agent sees the test failure and the instruction to fix it first. This is the **self-healing feedback loop**: the agent breaks something, the command captures the failure, and the agent sees it in the next iteration.
169172

170-
## How commands run in sequence
173+
## Command execution order and failure handling
171174

172175
Commands run in the order they appear in the `commands` list in the RALPH.md frontmatter. All commands run regardless of whether earlier commands fail.
173176

@@ -181,7 +184,7 @@ commands:
181184
run: git log --oneline -10
182185
```
183186

184-
## When does the loop stop
187+
## How to stop the loop (Ctrl+C, limits, and errors)
185188

186189
The loop continues until one of these happens:
187190

0 commit comments

Comments
 (0)