Skip to content

Commit b997d9c

Browse files
Kasper JungeRalphify
authored andcommitted
docs: update agent output section to reflect live peek architecture
The "How agent output works" section in agents.md described the pre-peek behavior where blocking mode either inherited stdio or captured-then-replayed. Both modes now stream output line-by-line via background reader threads, and the peek toggle (p key) works in both. Updated to reflect the current architecture and link to the new peek docs in cli.md. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 6303fe1 commit b997d9c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

docs/agents.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ npm install -g @anthropic-ai/claude-code
6262
```
6363

6464
!!! info "Why `--dangerously-skip-permissions`?"
65-
Without this flag, Claude Code pauses to ask for approval before editing files, running commands, or making commits. In an autonomous loop, nobody is there to approve — so the agent would hang forever. [Commands](writing-prompts.md#using-commands-for-dynamic-data) in your RALPH.md act as your guardrails instead.
65+
Without this flag, Claude Code pauses to ask for approval before editing files, running commands, or making commits. In an autonomous loop, nobody is there to approve — so the agent would hang forever. [Commands](how-it-works.md#2-run-commands-and-capture-output) in your RALPH.md act as your guardrails instead.
6666

6767
### Automatic streaming mode
6868

@@ -187,24 +187,23 @@ ralph run my-ralph -n 1 --log-dir ralph_logs
187187

188188
## How agent output works
189189

190-
Ralphify uses two different execution modes depending on the agent (see [how the loop works](how-it-works.md) for the full lifecycle):
190+
Ralphify streams agent output line-by-line in both execution modes. In an interactive terminal, output streams live to the console by default — press `p` to silence it and `p` again to resume. See [Peeking at live agent output](cli.md#peeking-at-live-agent-output) for details.
191+
192+
When [`--log-dir`](cli.md#ralph-run) is set, output is captured to a log file and also echoed after each iteration completes. Live peek still works the same way in that mode.
191193

192194
### Streaming mode (Claude Code)
193195

194-
When the agent command starts with `claude`, ralphify spawns the process with `Popen` and reads its JSON output line by line. This enables:
196+
When the agent command starts with `claude`, ralphify parses the agent's structured JSON output line by line. This enables additional features beyond live output:
195197

196-
- **Live activity tracking** — the terminal shows what the agent is doing in real time
197-
- **Result text extraction** — the agent's final response is captured
198-
- **Verbose logging** — with [`--log-dir`](cli.md#ralph-run), logs include the agent's internal tool calls and reasoning
198+
- **Activity tracking** — the terminal shows what the agent is doing (tool calls, reasoning) in real time
199+
- **Result text extraction** — the agent's final response is captured separately
200+
- **Verbose logging** — with `--log-dir`, logs include the agent's internal tool calls and reasoning
199201

200202
### Blocking mode (all other agents)
201203

202-
For non-Claude agents, ralphify uses `subprocess.run` and waits for the process to exit. Output behavior depends on whether you're using `--log-dir`:
203-
204-
- **Without `--log-dir`** — agent output streams directly to your terminal in real time
205-
- **With `--log-dir`** — output is captured, written to a log file, then replayed to the terminal after the iteration completes
204+
For non-Claude agents, ralphify spawns the process and drains stdout and stderr through background reader threads. You see the agent's plain text output line by line as it's produced.
206205

207-
Both modes support all ralphify features (commands, timeouts, iteration tracking). The difference is only in how output is handled during each iteration.
206+
Both modes support all ralphify features (commands, timeouts, iteration tracking, live peek). The difference is that Claude Code gets structured activity tracking on top of the raw output.
208207

209208
## Adapting other tools
210209

@@ -221,5 +220,4 @@ If the tool has no way to accept a prompt non-interactively, a [custom wrapper s
221220
## Next steps
222221

223222
- [Getting Started](getting-started.md) — set up your first loop with the agent you just configured
224-
- [Writing Prompts](writing-prompts.md) — patterns for writing effective autonomous loop prompts
225223
- [Troubleshooting](troubleshooting.md) — when the agent hangs, produces no output, or exits unexpectedly

0 commit comments

Comments
 (0)