Skip to content

Commit 0931b16

Browse files
Kasper Jungeclaude
authored andcommitted
docs: document iteration browsing in full-screen peek
Describe the `[` / `]` keys, the bounded iteration history that survives iteration end, and the deferred-render buffering that protects terminal scrollback while fullscreen is active. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7108d99 commit 0931b16

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

docs/cli.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The loop also stops automatically when:
118118

119119
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.
120120

121-
The compact peek panel shows the ten most recent activity lines to keep the terminal tidy. When you need to see earlier activity from the current iteration, press **shift+P** to enter **full-screen peek** a scrollable view of the entire buffer that takes over the terminal on the alt screen.
121+
The compact peek panel shows the ten most recent activity lines to keep the terminal tidy. When you need to see earlier activity from the current iteration — or the activity from a previous iteration — press **shift+P** to enter **full-screen peek**, a scrollable view of the entire buffer that takes over the terminal on the alt screen.
122122

123123
Inside full-screen peek:
124124

@@ -127,9 +127,10 @@ Inside full-screen peek:
127127
| `j` / `k` | Scroll one line down / up |
128128
| `space` / `b` | Page down / page up |
129129
| `g` / `G` | Jump to the top / bottom (bottom re-enables follow mode) |
130+
| `[` / `]` | Browse to the previous / next iteration |
130131
| `q` or `P` | Exit back to the compact view |
131132

132-
Activity keeps streaming into the buffer while you scroll, so follow mode (`G` or scrolling back to the bottom) catches up to the tail. The full-screen view exits automatically when the iteration ends, returning you to the normal terminal.
133+
Activity keeps streaming into the buffer while you scroll, so follow mode (`G` or scrolling back to the bottom) catches up to the tail. Iteration ends no longer drop you out of the alt screen — the finished iteration moves into a bounded history so you can keep browsing it (and the new live iteration) with `[` / `]`. Status lines and result text printed during the session are buffered and replayed when you exit fullscreen, so the terminal scrollback stays intact.
133134

134135
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.
135136

docs/contributing/codebase-map.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Events are defined in `_events.py:EventType`, with a corresponding TypedDict pay
136136

137137
Both execution paths in `_agent.py` accept an `on_output_line(line, stream)` callback and drain the agent's stdout/stderr line-by-line — the blocking path uses two background reader threads, and the streaming path forwards each raw line from `_read_agent_stream`. The engine wires this callback to emit `EventType.AGENT_OUTPUT_LINE` events, which the `ConsoleEmitter` renders only while peek is enabled. The `p` keybinding flips that state via `ConsoleEmitter.toggle_peek()`, driven by `KeypressListener` in `_keypress.py`. The listener only activates on a real TTY; in CI or when stdin is piped it silently no-ops.
138138

139-
The compact peek panel (`_IterationPanel` / `_IterationSpinner`) renders the most recent `_MAX_VISIBLE_SCROLL` lines while buffering up to `_MAX_SCROLL_LINES` (`_console_emitter.py`). Shift+P (`FULLSCREEN_PEEK_KEY`) enters a `_FullscreenPeek` view — a Rich `Live` with `screen=True` that renders the full buffer on the alt screen and accepts vim/less-style navigation (`j/k`, `space/b`, `g/G`, `q`). All keys route through a single `ConsoleEmitter.handle_key()` method that owns the keybinding map for both compact and fullscreen modes. Entering fullscreen stops the compact `Live` so only one renderer owns the terminal; exiting (or iteration end) tears the alt screen down and restores the compact panel with its still-growing buffer.
139+
The compact peek panel (`_IterationPanel` / `_IterationSpinner`) renders the most recent `_MAX_VISIBLE_SCROLL` lines while buffering up to `_MAX_SCROLL_LINES` (`_console_emitter.py`). Shift+P (`FULLSCREEN_PEEK_KEY`) enters a `_FullscreenPeek` view — a Rich `Live` with `screen=True` that renders one iteration's full buffer on the alt screen and accepts vim/less-style navigation (`j/k`, `space/b`, `g/G`, `q`) plus iteration browsing (`[` / `]`, `PREV_ITERATION_KEY` / `NEXT_ITERATION_KEY`). All keys route through a single `ConsoleEmitter.handle_key()` method that owns the keybinding map for both compact and fullscreen modes. Entering fullscreen stops the compact `Live` so only one renderer owns the terminal; iteration end **does not** tear the alt screen down — the finished panel is frozen and moved into a bounded ring buffer (`_iteration_history`, capped at `_MAX_HISTORY_ITERATIONS`), and the user can keep browsing it (or the new live iteration) without leaving fullscreen. `console.print` calls from event handlers that fire while fullscreen is active are buffered into `_deferred_renders` and replayed when the user exits, so terminal scrollback isn't punctured by holes for missed iteration rules and status lines. The `_FullscreenPeek` instance holds a navigator (`_IterationNavigator` protocol — implemented by `ConsoleEmitter`) plus the iteration id it's currently displaying; the source panel is resolved per-render so eviction or freeze transitions are picked up automatically.
140140

141141
### Credit trailer
142142

docs/quick-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Each iteration:
157157
| `Ctrl+C` (once) | Finishes the current iteration gracefully, then stops |
158158
| `Ctrl+C` (twice) | Force-kills the agent process and exits immediately |
159159
| `p` | Toggle live peek of the agent's stdout (on by default in an interactive terminal — press to silence, press again to resume) |
160-
| `P` (shift+p) | Open full-screen peek — scroll the entire activity buffer. `j/k` line, `space/b` page, `g/G` top/bottom, `q` or `P` exits |
160+
| `P` (shift+p) | Open full-screen peek — scroll the buffer and browse iterations. `j/k` line, `space/b` page, `g/G` top/bottom, `[/]` prev/next iteration, `q` or `P` exits |
161161
| `-n` limit reached | Stops after the specified number of iterations |
162162
| `--stop-on-error` | Stops if agent exits non-zero or times out |
163163

0 commit comments

Comments
 (0)