@ralph-orchestrator/ralph-cli 2.2.4 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/README.md +49 -1294
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<!-- 2026-01-28 -->
|
|
1
2
|
# Ralph Orchestrator
|
|
2
3
|
|
|
3
4
|
[](LICENSE)
|
|
@@ -7,101 +8,18 @@
|
|
|
7
8
|
[](https://github.com/hesreallyhim/awesome-claude-code)
|
|
8
9
|
[](https://mikeyobrien.github.io/ralph-orchestrator/)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
A hat-based orchestration framework that keeps Ralph in a loop until the task is done.
|
|
11
|
+
A hat-based orchestration framework that keeps AI agents in a loop until the task is done.
|
|
12
12
|
|
|
13
13
|
> "Me fail English? That's unpossible!" - Ralph Wiggum
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
|
|
17
|
-
v1.0.0 was ralphed into existence with little oversight and guidance. v2.0.0 is a simpler, more-structured implementation. Looking for the old version? See [v1.2.3](https://github.com/mikeyobrien/ralph-orchestrator/tree/v1.2.3).
|
|
18
|
-
|
|
19
|
-
<img width="912" height="712" alt="Screenshot 2026-01-20 at 10 27 57 AM" src="https://github.com/user-attachments/assets/91b08b47-8b0a-4e2c-b66e-88551c2c5cc6" />
|
|
20
|
-
|
|
21
|
-
## Table of Contents
|
|
22
|
-
|
|
23
|
-
- [What is Ralph?](#what-is-ralph)
|
|
24
|
-
- [Features](#features)
|
|
25
|
-
- [Installation](#installation)
|
|
26
|
-
- [Quick Start](#quick-start)
|
|
27
|
-
- [Configuration](#configuration)
|
|
28
|
-
- [Custom Backends and Per-Hat Configuration](#custom-backends-and-per-hat-configuration)
|
|
29
|
-
- [Presets](#presets)
|
|
30
|
-
- [Key Concepts](#key-concepts)
|
|
31
|
-
- [Orchestration and Coordination Patterns](#orchestration-and-coordination-patterns)
|
|
32
|
-
- [Multi-Loop Concurrency](#multi-loop-concurrency)
|
|
33
|
-
- [CLI Reference](#cli-reference)
|
|
34
|
-
- [Architecture](#architecture)
|
|
35
|
-
- [Building & Testing](#building--testing)
|
|
36
|
-
- [Contributing](#contributing)
|
|
37
|
-
- [License](#license)
|
|
38
|
-
- [Acknowledgments](#acknowledgments)
|
|
39
|
-
|
|
40
|
-
## What is Ralph?
|
|
41
|
-
|
|
42
|
-
Ralph implements the [Ralph Wiggum technique](https://ghuntley.com/ralph/) — autonomous task completion through continuous iteration.
|
|
43
|
-
|
|
44
|
-
> "The orchestrator is a thin coordination layer, not a platform. Ralph is smart; let Ralph do the work."
|
|
45
|
-
|
|
46
|
-
### Two Modes of Operation
|
|
47
|
-
|
|
48
|
-
Ralph supports two orchestration styles:
|
|
49
|
-
|
|
50
|
-
| Mode | Description | Best For |
|
|
51
|
-
|------|-------------|----------|
|
|
52
|
-
| **Traditional** | Simple loop — Ralph iterates until done | Quick tasks, simple automation, minimal config |
|
|
53
|
-
| **Hat-Based** | Ralph can wear many hats — specialized personas coordinate through events | Complex workflows, multi-step processes, role separation |
|
|
54
|
-
|
|
55
|
-
**Traditional mode** is the original Ralph Wiggum approach: start a loop, let it run until it outputs the completion promise. No roles, no events, just iteration.
|
|
56
|
-
|
|
57
|
-
**Hat-based mode** adds structure: specialized personas coordinate through events. You define the roles that fit your workflow — reviewers, testers, documenters, whatever makes sense. Presets provide ready-made patterns like TDD or spec-driven development.
|
|
58
|
-
|
|
59
|
-
### The Ralph Tenets
|
|
60
|
-
|
|
61
|
-
1. **Fresh Context Is Reliability** — Each iteration clears context. Re-read specs, plan, code every cycle.
|
|
62
|
-
2. **Backpressure Over Prescription** — Don't prescribe how; create gates that reject bad work.
|
|
63
|
-
3. **The Plan Is Disposable** — Regeneration costs one planning loop. Cheap.
|
|
64
|
-
4. **Disk Is State, Git Is Memory** — Files are the handoff mechanism.
|
|
65
|
-
5. **Steer With Signals, Not Scripts** — Add signs, not scripts.
|
|
66
|
-
6. **Let Ralph Ralph** — Sit *on* the loop, not *in* it.
|
|
67
|
-
|
|
68
|
-
See [AGENTS.md](AGENTS.md) for the full philosophy.
|
|
69
|
-
|
|
70
|
-
## Features
|
|
71
|
-
|
|
72
|
-
- **Multi-Backend Support** — Works with Claude Code, Kiro, Gemini CLI, Codex, Amp, Copilot CLI, and OpenCode
|
|
73
|
-
- **Hat System** — Specialized Ralph personas with distinct behaviors
|
|
74
|
-
- **Event-Driven Coordination** — Hats communicate through typed events with glob pattern matching
|
|
75
|
-
- **Backpressure Enforcement** — Gates that reject incomplete work (tests, lint, typecheck)
|
|
76
|
-
- **Presets Library** — 20+ pre-configured workflows for common development patterns
|
|
77
|
-
- **Interactive TUI** — Real-time terminal UI for monitoring Ralph's activity (enabled by default)
|
|
78
|
-
- **Memories** — Persistent learning across sessions stored in `.agent/memories.md`
|
|
79
|
-
- **Tasks** — Runtime work tracking stored in `.agent/tasks.jsonl`
|
|
80
|
-
- **Multi-Loop Concurrency** — Run parallel loops in git worktrees with automatic merge workflow
|
|
81
|
-
- **Session Recording** — Record and replay sessions for debugging and testing (experimental)
|
|
15
|
+
**[Documentation](https://mikeyobrien.github.io/ralph-orchestrator/)** | **[Getting Started](https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start/)** | **[Presets](https://mikeyobrien.github.io/ralph-orchestrator/guide/presets/)**
|
|
82
16
|
|
|
83
17
|
## Installation
|
|
84
18
|
|
|
85
|
-
### Prerequisites
|
|
86
|
-
|
|
87
|
-
- [Rust](https://rustup.rs/) 1.75+
|
|
88
|
-
- At least one AI CLI:
|
|
89
|
-
- [Claude Code](https://github.com/anthropics/claude-code) (recommended)
|
|
90
|
-
- [Kiro](https://kiro.dev/)
|
|
91
|
-
- [Gemini CLI](https://github.com/google-gemini/gemini-cli)
|
|
92
|
-
- [Codex](https://github.com/openai/codex)
|
|
93
|
-
- [Amp](https://github.com/sourcegraph/amp)
|
|
94
|
-
- [Copilot CLI](https://docs.github.com/copilot) (`npm install -g @github/copilot`)
|
|
95
|
-
- [OpenCode](https://opencode.ai/) (`curl -fsSL https://opencode.ai/install | bash`)
|
|
96
|
-
|
|
97
19
|
### Via npm (Recommended)
|
|
98
20
|
|
|
99
21
|
```bash
|
|
100
|
-
# Install globally
|
|
101
22
|
npm install -g @ralph-orchestrator/ralph-cli
|
|
102
|
-
|
|
103
|
-
# Or run directly with npx
|
|
104
|
-
npx @ralph-orchestrator/ralph-cli --version
|
|
105
23
|
```
|
|
106
24
|
|
|
107
25
|
### Via Homebrew (macOS)
|
|
@@ -116,1246 +34,89 @@ brew install ralph-orchestrator
|
|
|
116
34
|
cargo install ralph-cli
|
|
117
35
|
```
|
|
118
36
|
|
|
119
|
-
### From Source
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
git clone https://github.com/mikeyobrien/ralph-orchestrator.git
|
|
123
|
-
cd ralph-orchestrator
|
|
124
|
-
cargo build --release
|
|
125
|
-
|
|
126
|
-
# Add to PATH
|
|
127
|
-
export PATH="$PATH:$(pwd)/target/release"
|
|
128
|
-
|
|
129
|
-
# Or create symlink
|
|
130
|
-
sudo ln -s $(pwd)/target/release/ralph /usr/local/bin/ralph
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Verify Installation
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
ralph --version
|
|
137
|
-
ralph --help
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Migrating from v1 (Python)
|
|
141
|
-
|
|
142
|
-
If you have the old Python-based Ralph v1 installed, uninstall it first to avoid conflicts:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# If installed via pip
|
|
146
|
-
pip uninstall ralph-orchestrator
|
|
147
|
-
|
|
148
|
-
# If installed via pipx
|
|
149
|
-
pipx uninstall ralph-orchestrator
|
|
150
|
-
|
|
151
|
-
# If installed via uv
|
|
152
|
-
uv tool uninstall ralph-orchestrator
|
|
153
|
-
|
|
154
|
-
# Verify removal
|
|
155
|
-
which ralph # Should return nothing or point to new Rust version
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The v1 Python version is no longer maintained. See [v1.2.3](https://github.com/mikeyobrien/ralph-orchestrator/tree/v1.2.3) for historical reference.
|
|
159
|
-
|
|
160
37
|
## Quick Start
|
|
161
38
|
|
|
162
|
-
### 1. Initialize a Project
|
|
163
|
-
|
|
164
39
|
```bash
|
|
165
|
-
#
|
|
40
|
+
# 1. Initialize Ralph with your preferred backend
|
|
166
41
|
ralph init --backend claude
|
|
167
42
|
|
|
168
|
-
#
|
|
169
|
-
ralph
|
|
170
|
-
|
|
171
|
-
# Combine preset with different backend
|
|
172
|
-
ralph init --preset spec-driven --backend kiro
|
|
173
|
-
|
|
174
|
-
# See all available presets
|
|
175
|
-
ralph init --list-presets
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
This creates `ralph.yml` in your current directory. Without a preset, you get traditional mode (no hats). With a preset, you get hat-based orchestration.
|
|
179
|
-
|
|
180
|
-
### 2. Define Your Task
|
|
181
|
-
|
|
182
|
-
**Option A:** Create a `PROMPT.md` file:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
cat > PROMPT.md << 'EOF'
|
|
186
|
-
Build a REST API with the following endpoints:
|
|
187
|
-
- POST /users - Create a new user
|
|
188
|
-
- GET /users/:id - Get user by ID
|
|
189
|
-
- PUT /users/:id - Update user
|
|
190
|
-
- DELETE /users/:id - Delete user
|
|
191
|
-
|
|
192
|
-
Use Express.js with TypeScript. Include input validation
|
|
193
|
-
and proper error handling.
|
|
194
|
-
EOF
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
**Option B:** Pass inline prompt when running:
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
ralph run -p "Add input validation to the user API endpoints"
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### 3. Run Ralph
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
# TUI mode (default) — real-time terminal UI for monitoring
|
|
207
|
-
ralph run
|
|
208
|
-
|
|
209
|
-
# With inline prompt
|
|
210
|
-
ralph run -p "Implement the login endpoint with JWT authentication"
|
|
211
|
-
|
|
212
|
-
# Headless mode (no TUI)
|
|
213
|
-
ralph run --no-tui
|
|
214
|
-
|
|
215
|
-
# Resume interrupted session
|
|
216
|
-
ralph run --continue
|
|
217
|
-
|
|
218
|
-
# Dry run (show what would execute)
|
|
219
|
-
ralph run --dry-run
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Alternative: SOP-Driven Sessions
|
|
223
|
-
|
|
224
|
-
For standalone planning and task generation (without Ralph's event loop), use these commands:
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
# Start an interactive PDD planning session
|
|
228
|
-
ralph plan # SOP prompts for input
|
|
229
|
-
ralph plan "build a REST API" # Provide idea inline
|
|
230
|
-
ralph plan --backend kiro "my idea" # Use specific backend
|
|
231
|
-
|
|
232
|
-
# Generate code task files from descriptions
|
|
233
|
-
ralph task # SOP prompts for input
|
|
234
|
-
ralph task "add authentication" # From description
|
|
235
|
-
ralph task specs/feature/plan.md # From PDD plan file
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
These commands spawn an interactive AI session with bundled SOPs — perfect for one-off planning without configuring a full workflow.
|
|
239
|
-
|
|
240
|
-
## Configuration
|
|
241
|
-
|
|
242
|
-
Ralph uses a YAML configuration file (`ralph.yml` by default).
|
|
243
|
-
|
|
244
|
-
### Traditional Mode (No Hats)
|
|
245
|
-
|
|
246
|
-
The simplest configuration — just a loop that runs until completion:
|
|
247
|
-
|
|
248
|
-
```yaml
|
|
249
|
-
# ralph.yml — Traditional mode
|
|
250
|
-
cli:
|
|
251
|
-
backend: "claude"
|
|
252
|
-
|
|
253
|
-
event_loop:
|
|
254
|
-
completion_promise: "LOOP_COMPLETE"
|
|
255
|
-
max_iterations: 100
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
This runs Ralph in a loop. No hats, no events, no role switching. Ralph iterates until it outputs `LOOP_COMPLETE` or hits the iteration limit.
|
|
259
|
-
|
|
260
|
-
### Hat-Based Mode (Specialized Personas)
|
|
261
|
-
|
|
262
|
-
> Ralph can wear many hats.
|
|
263
|
-
|
|
264
|
-
Add a `hats` section to enable role-based orchestration. Hats subscribe to events (triggers) and publish events when done:
|
|
265
|
-
|
|
266
|
-
```yaml
|
|
267
|
-
# ralph.yml — Hat-based mode (example structure)
|
|
268
|
-
cli:
|
|
269
|
-
backend: "claude"
|
|
270
|
-
|
|
271
|
-
event_loop:
|
|
272
|
-
completion_promise: "LOOP_COMPLETE"
|
|
273
|
-
max_iterations: 100
|
|
274
|
-
starting_event: "task.start"
|
|
275
|
-
|
|
276
|
-
hats:
|
|
277
|
-
my_hat:
|
|
278
|
-
name: "🎯 My Hat"
|
|
279
|
-
triggers: ["task.start"] # Events that activate this hat
|
|
280
|
-
publishes: ["work.done"] # Events this hat can emit
|
|
281
|
-
instructions: |
|
|
282
|
-
Your instructions here...
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
With hats, Ralph publishes a starting event, which triggers the matching hat. That hat does its work and publishes an event, potentially triggering other hats. This event-driven handoff continues until completion.
|
|
286
|
-
|
|
287
|
-
> **Tip:** Use `ralph init --preset <name>` to get pre-configured hat workflows. See [Presets](#presets) for ready-made patterns like TDD, spec-driven development, and more.
|
|
288
|
-
|
|
289
|
-
### Full Configuration Reference
|
|
290
|
-
|
|
291
|
-
```yaml
|
|
292
|
-
# Event loop settings
|
|
293
|
-
event_loop:
|
|
294
|
-
completion_promise: "LOOP_COMPLETE" # Output that signals completion
|
|
295
|
-
max_iterations: 100 # Maximum orchestration loops
|
|
296
|
-
max_runtime_seconds: 14400 # 4 hours max runtime
|
|
297
|
-
idle_timeout_secs: 1800 # 30 min idle timeout
|
|
298
|
-
starting_event: "task.start" # First event published
|
|
299
|
-
|
|
300
|
-
# CLI backend settings
|
|
301
|
-
cli:
|
|
302
|
-
backend: "claude" # claude, kiro, gemini, codex, amp, copilot, opencode, custom
|
|
303
|
-
prompt_mode: "arg" # arg (CLI argument) or stdin
|
|
304
|
-
|
|
305
|
-
# Core behaviors (always injected into prompts)
|
|
306
|
-
core:
|
|
307
|
-
scratchpad: ".agent/scratchpad.md" # Shared memory across iterations
|
|
308
|
-
specs_dir: "./specs/" # Directory for specifications
|
|
309
|
-
guardrails: # Rules injected into every prompt
|
|
310
|
-
- "Fresh context each iteration - scratchpad is memory"
|
|
311
|
-
- "Don't assume 'not implemented' - search first"
|
|
312
|
-
- "Backpressure is law - tests/typecheck/lint must pass"
|
|
313
|
-
|
|
314
|
-
# Memories — persistent learning across sessions (enabled by default)
|
|
315
|
-
memories:
|
|
316
|
-
enabled: true # Set false to disable
|
|
317
|
-
inject: auto # auto, manual, or none
|
|
318
|
-
|
|
319
|
-
# Tasks — runtime work tracking (enabled by default)
|
|
320
|
-
tasks:
|
|
321
|
-
enabled: true # Set false to use scratchpad-only mode
|
|
322
|
-
|
|
323
|
-
# Custom hats (omit to use default planner/builder)
|
|
324
|
-
hats:
|
|
325
|
-
my_hat:
|
|
326
|
-
name: "My Hat Name" # Display name
|
|
327
|
-
triggers: ["some.event"] # Events that activate this hat
|
|
328
|
-
publishes: ["other.event"] # Events this hat can emit
|
|
329
|
-
instructions: | # Prompt instructions
|
|
330
|
-
What this hat should do...
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
## Custom Backends and Per-Hat Configuration
|
|
335
|
-
|
|
336
|
-
### Custom Backends
|
|
337
|
-
|
|
338
|
-
Beyond the built-in backends (Claude, Kiro, Gemini, Codex, Amp, Copilot, OpenCode), you can define custom backends to integrate any CLI-based AI agent:
|
|
339
|
-
|
|
340
|
-
```yaml
|
|
341
|
-
cli:
|
|
342
|
-
backend: "custom"
|
|
343
|
-
command: "my-agent"
|
|
344
|
-
args: ["--headless", "--auto-approve"]
|
|
345
|
-
prompt_mode: "arg" # "arg" or "stdin"
|
|
346
|
-
prompt_flag: "-p" # Optional: flag for prompt argument
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
| Field | Description |
|
|
350
|
-
|-------|-------------|
|
|
351
|
-
| `command` | The CLI command to execute |
|
|
352
|
-
| `args` | Arguments inserted before the prompt |
|
|
353
|
-
| `prompt_mode` | How to pass the prompt: `arg` (command-line argument) or `stdin` |
|
|
354
|
-
| `prompt_flag` | Flag preceding the prompt (e.g., `-p`, `--prompt`). If omitted, prompt is positional. |
|
|
355
|
-
|
|
356
|
-
### Per-Hat Backend Configuration
|
|
357
|
-
|
|
358
|
-
Different hats can use different backends, enabling specialized tools for specialized tasks:
|
|
359
|
-
|
|
360
|
-
```yaml
|
|
361
|
-
cli:
|
|
362
|
-
backend: "claude" # Default for Ralph and hats without explicit backend
|
|
363
|
-
|
|
364
|
-
hats:
|
|
365
|
-
builder:
|
|
366
|
-
name: "🔨 Builder"
|
|
367
|
-
description: "Implements code"
|
|
368
|
-
triggers: ["build.task"]
|
|
369
|
-
publishes: ["build.done"]
|
|
370
|
-
backend: "claude" # Explicit: Claude for coding
|
|
371
|
-
|
|
372
|
-
researcher:
|
|
373
|
-
name: "🔍 Researcher"
|
|
374
|
-
description: "Researches technical questions"
|
|
375
|
-
triggers: ["research.task"]
|
|
376
|
-
publishes: ["research.done"]
|
|
377
|
-
backend: # Kiro with custom agent (has MCP tools)
|
|
378
|
-
type: "kiro"
|
|
379
|
-
agent: "researcher"
|
|
380
|
-
|
|
381
|
-
reviewer:
|
|
382
|
-
name: "👀 Reviewer"
|
|
383
|
-
description: "Reviews code changes"
|
|
384
|
-
triggers: ["review.task"]
|
|
385
|
-
publishes: ["review.done"]
|
|
386
|
-
backend: "gemini" # Different model for fresh perspective
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
**Backend Types:**
|
|
390
|
-
|
|
391
|
-
| Type | Syntax | Invocation |
|
|
392
|
-
|------|--------|------------|
|
|
393
|
-
| Named | `backend: "claude"` | Uses standard backend configuration |
|
|
394
|
-
| Kiro Agent | `backend: { type: "kiro", agent: "builder" }` | `kiro-cli --agent builder ...` |
|
|
395
|
-
| Custom | `backend: { command: "...", args: [...] }` | Your custom command |
|
|
396
|
-
|
|
397
|
-
**When to mix backends:**
|
|
398
|
-
|
|
399
|
-
| Scenario | Recommended Backend |
|
|
400
|
-
|----------|---------------------|
|
|
401
|
-
| Complex coding | Claude (best reasoning) |
|
|
402
|
-
| AWS/cloud tasks | Kiro with agent (MCP tools) |
|
|
403
|
-
| Code review | Different model (fresh perspective) |
|
|
404
|
-
| Internal tools | Custom backend |
|
|
405
|
-
| Cost optimization | Faster/cheaper model for simple tasks |
|
|
406
|
-
|
|
407
|
-
Hats without explicit `backend` inherit from `cli.backend`.
|
|
408
|
-
|
|
409
|
-
## Presets
|
|
410
|
-
|
|
411
|
-
Presets are pre-configured workflows for common development patterns.
|
|
412
|
-
|
|
413
|
-
### Development Workflows
|
|
414
|
-
|
|
415
|
-
| Preset | Pattern | Description |
|
|
416
|
-
|--------|---------|-------------|
|
|
417
|
-
| `feature` | Planner-Builder | Standard feature development |
|
|
418
|
-
| `feature-minimal` | Single hat | Minimal feature development |
|
|
419
|
-
| `tdd-red-green` | Test-Implement-Refactor | TDD with red-green-refactor cycle |
|
|
420
|
-
| `spec-driven` | Spec-Build-Verify | Specification-first development |
|
|
421
|
-
| `refactor` | Analyze-Plan-Execute | Code refactoring workflow |
|
|
422
|
-
|
|
423
|
-
### Debugging & Investigation
|
|
424
|
-
|
|
425
|
-
| Preset | Pattern | Description |
|
|
426
|
-
|--------|---------|-------------|
|
|
427
|
-
| `debug` | Investigate-Fix-Verify | Bug investigation and fixing |
|
|
428
|
-
| `incident-response` | Triage-Fix-Postmortem | Production incident handling |
|
|
429
|
-
| `code-archaeology` | Explore-Document-Present | Legacy code understanding |
|
|
430
|
-
|
|
431
|
-
### Review & Quality
|
|
432
|
-
|
|
433
|
-
| Preset | Pattern | Description |
|
|
434
|
-
|--------|---------|-------------|
|
|
435
|
-
| `review` | Analyze-Critique-Suggest | Code review workflow |
|
|
436
|
-
| `pr-review` | Multi-Perspective | PR review with specialized reviewers |
|
|
437
|
-
| `adversarial-review` | Critic-Defender | Devil's advocate review style |
|
|
438
|
-
|
|
439
|
-
### Documentation
|
|
440
|
-
|
|
441
|
-
| Preset | Pattern | Description |
|
|
442
|
-
|--------|---------|-------------|
|
|
443
|
-
| `docs` | Write-Review-Publish | Documentation writing |
|
|
444
|
-
| `documentation-first` | Doc-Implement-Sync | Doc-first development |
|
|
445
|
-
|
|
446
|
-
### Specialized
|
|
447
|
-
|
|
448
|
-
| Preset | Pattern | Description |
|
|
449
|
-
|--------|---------|-------------|
|
|
450
|
-
| `api-design` | Design-Implement-Document | API-first development |
|
|
451
|
-
| `migration-safety` | Analyze-Migrate-Verify | Safe code migrations |
|
|
452
|
-
| `performance-optimization` | Profile-Optimize-Benchmark | Performance tuning |
|
|
453
|
-
| `scientific-method` | Hypothesis-Experiment-Conclude | Experimental approach |
|
|
454
|
-
| `mob-programming` | Rotate roles | Simulated mob programming |
|
|
455
|
-
| `socratic-learning` | Question-Answer-Synthesize | Learning through dialogue |
|
|
456
|
-
| `research` | Gather-Analyze-Synthesize | Research and analysis |
|
|
457
|
-
| `gap-analysis` | Current-Target-Plan | Gap identification |
|
|
458
|
-
|
|
459
|
-
### Using Presets
|
|
460
|
-
|
|
461
|
-
```bash
|
|
462
|
-
# List all available presets
|
|
463
|
-
ralph init --list-presets
|
|
464
|
-
|
|
465
|
-
# Initialize with a preset
|
|
466
|
-
ralph init --preset tdd-red-green
|
|
467
|
-
|
|
468
|
-
# Use preset with different backend
|
|
469
|
-
ralph init --preset spec-driven --backend gemini
|
|
470
|
-
|
|
471
|
-
# Override existing config
|
|
472
|
-
ralph init --preset debug --force
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
## Key Concepts
|
|
476
|
-
|
|
477
|
-
### Hats
|
|
478
|
-
|
|
479
|
-
Hats are specialized Ralph personas. Each hat has:
|
|
480
|
-
|
|
481
|
-
- **Triggers**: Events that activate this hat
|
|
482
|
-
- **Publishes**: Events this hat can emit
|
|
483
|
-
- **Instructions**: Prompt injected when hat is active
|
|
484
|
-
|
|
485
|
-
View event history:
|
|
486
|
-
|
|
487
|
-
```bash
|
|
488
|
-
ralph events
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
## Orchestration and Coordination Patterns
|
|
492
|
-
|
|
493
|
-
Ralph's hat system enables sophisticated multi-agent workflows through event-driven coordination. This section covers the architectural patterns, event routing mechanics, and built-in workflow templates.
|
|
494
|
-
|
|
495
|
-
### How Hat-Based Orchestration Works
|
|
496
|
-
|
|
497
|
-
#### The Event-Driven Model
|
|
498
|
-
|
|
499
|
-
Hats communicate through a **pub/sub event system**:
|
|
500
|
-
|
|
501
|
-
1. **Ralph publishes a starting event** (e.g., `task.start`)
|
|
502
|
-
2. **The matching hat activates** — the hat subscribed to that event takes over
|
|
503
|
-
3. **The hat does its work** and publishes an event when done
|
|
504
|
-
4. **The next hat activates** — triggered by the new event
|
|
505
|
-
5. **The cycle continues** until a termination event or `LOOP_COMPLETE`
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
509
|
-
│ task.start → [Test Writer] → test.written → [Implementer] → │
|
|
510
|
-
│ test.passing → [Refactorer] → refactor.done ──┐ │
|
|
511
|
-
│ │ │
|
|
512
|
-
│ ┌─────────────────────────────────────────────┘ │
|
|
513
|
-
│ └──→ (loops back to Test Writer for next test) │
|
|
514
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
#### Ralph as the Constant Coordinator
|
|
518
|
-
|
|
519
|
-
In hat-based mode, **Ralph is always present**:
|
|
520
|
-
|
|
521
|
-
- Ralph cannot be removed or replaced
|
|
522
|
-
- Custom hats define the **topology** (who triggers whom)
|
|
523
|
-
- Ralph executes with **topology awareness** — knowing which hats exist and their relationships
|
|
524
|
-
- Ralph serves as the **universal fallback** — orphaned events automatically route to Ralph
|
|
525
|
-
|
|
526
|
-
This means custom hats don't execute directly. Instead, Ralph reads all pending events across all hats and decides what to do based on the defined topology. Ralph then either:
|
|
527
|
-
- Delegates to the appropriate hat by publishing an event
|
|
528
|
-
- Handles the work directly if no hat is suited
|
|
529
|
-
|
|
530
|
-
#### Event Routing and Topic Matching
|
|
531
|
-
|
|
532
|
-
Events route to hats using **glob-style pattern matching**:
|
|
533
|
-
|
|
534
|
-
| Pattern | Matches |
|
|
535
|
-
|---------|---------|
|
|
536
|
-
| `task.start` | Exactly `task.start` |
|
|
537
|
-
| `build.*` | `build.done`, `build.blocked`, `build.task`, etc. |
|
|
538
|
-
| `*.done` | `build.done`, `review.done`, `test.done`, etc. |
|
|
539
|
-
| `*` | Everything (global wildcard — used by Ralph as fallback) |
|
|
540
|
-
|
|
541
|
-
**Priority Rules:**
|
|
542
|
-
- Specific patterns take precedence over wildcards
|
|
543
|
-
- If multiple hats have specific subscriptions, that's an error (ambiguous routing)
|
|
544
|
-
- Global wildcard (`*`) only triggers if no specific handler exists
|
|
545
|
-
|
|
546
|
-
### Coordination Patterns
|
|
547
|
-
|
|
548
|
-
Ralph presets implement several proven coordination patterns:
|
|
549
|
-
|
|
550
|
-
#### 1. Linear Pipeline
|
|
551
|
-
|
|
552
|
-
The simplest pattern — work flows through a sequence of specialists.
|
|
553
|
-
|
|
554
|
-
```
|
|
555
|
-
Input → Hat A → Event → Hat B → Event → Hat C → Output
|
|
556
|
-
```
|
|
557
|
-
|
|
558
|
-
**Example: TDD Red-Green-Refactor** (`tdd-red-green.yml`)
|
|
559
|
-
|
|
560
|
-
```yaml
|
|
561
|
-
hats:
|
|
562
|
-
test_writer:
|
|
563
|
-
triggers: ["tdd.start", "refactor.done"]
|
|
564
|
-
publishes: ["test.written"]
|
|
565
|
-
|
|
566
|
-
implementer:
|
|
567
|
-
triggers: ["test.written"]
|
|
568
|
-
publishes: ["test.passing"]
|
|
569
|
-
|
|
570
|
-
refactorer:
|
|
571
|
-
triggers: ["test.passing"]
|
|
572
|
-
publishes: ["refactor.done", "cycle.complete"]
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
```
|
|
576
|
-
tdd.start → 🔴 Test Writer → test.written → 🟢 Implementer →
|
|
577
|
-
test.passing → 🔵 Refactorer → refactor.done ─┐
|
|
578
|
-
│
|
|
579
|
-
┌───────────────────────────────┘
|
|
580
|
-
└──→ (back to Test Writer)
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
**When to use:** Workflows with clear sequential phases where each step builds on the previous.
|
|
584
|
-
|
|
585
|
-
#### 2. Contract-First Pipeline
|
|
586
|
-
|
|
587
|
-
A variant where work must pass validation gates before proceeding.
|
|
588
|
-
|
|
589
|
-
**Example: Spec-Driven Development** (`spec-driven.yml`)
|
|
590
|
-
|
|
591
|
-
```yaml
|
|
592
|
-
hats:
|
|
593
|
-
spec_writer:
|
|
594
|
-
triggers: ["spec.start", "spec.rejected"]
|
|
595
|
-
publishes: ["spec.ready"]
|
|
596
|
-
|
|
597
|
-
spec_reviewer:
|
|
598
|
-
triggers: ["spec.ready"]
|
|
599
|
-
publishes: ["spec.approved", "spec.rejected"]
|
|
600
|
-
|
|
601
|
-
implementer:
|
|
602
|
-
triggers: ["spec.approved", "spec.violated"]
|
|
603
|
-
publishes: ["implementation.done"]
|
|
604
|
-
|
|
605
|
-
verifier:
|
|
606
|
-
triggers: ["implementation.done"]
|
|
607
|
-
publishes: ["task.complete", "spec.violated"]
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
```
|
|
611
|
-
spec.start → 📋 Spec Writer ──→ spec.ready ──→ 🔎 Spec Critic
|
|
612
|
-
↑ │
|
|
613
|
-
└────── spec.rejected ──────────────┤
|
|
614
|
-
↓
|
|
615
|
-
spec.approved
|
|
616
|
-
│
|
|
617
|
-
↓
|
|
618
|
-
task.complete ←── ✅ Verifier ←── impl.done ←── ⚙️ Implementer
|
|
619
|
-
│ ↑
|
|
620
|
-
└──── spec.violated ───────────┘
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
**When to use:** High-stakes changes where the spec must be rock-solid before implementation begins.
|
|
624
|
-
|
|
625
|
-
#### 3. Cyclic Rotation
|
|
626
|
-
|
|
627
|
-
Multiple roles take turns, each bringing a different perspective.
|
|
628
|
-
|
|
629
|
-
**Example: Mob Programming** (`mob-programming.yml`)
|
|
630
|
-
|
|
631
|
-
```yaml
|
|
632
|
-
hats:
|
|
633
|
-
navigator:
|
|
634
|
-
triggers: ["mob.start", "observation.noted"]
|
|
635
|
-
publishes: ["direction.set", "mob.complete"]
|
|
636
|
-
|
|
637
|
-
driver:
|
|
638
|
-
triggers: ["direction.set"]
|
|
639
|
-
publishes: ["code.written"]
|
|
640
|
-
|
|
641
|
-
observer:
|
|
642
|
-
triggers: ["code.written"]
|
|
643
|
-
publishes: ["observation.noted"]
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
```
|
|
647
|
-
mob.start → 🧭 Navigator → direction.set → ⌨️ Driver →
|
|
648
|
-
code.written → 👁️ Observer → observation.noted ─┐
|
|
649
|
-
│
|
|
650
|
-
┌─────────────────────────────────┘
|
|
651
|
-
└──→ (back to Navigator)
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
**When to use:** Complex features that benefit from multiple perspectives and continuous feedback.
|
|
655
|
-
|
|
656
|
-
#### 4. Adversarial Review
|
|
657
|
-
|
|
658
|
-
Two roles with opposing objectives ensure robustness.
|
|
659
|
-
|
|
660
|
-
**Example: Red Team / Blue Team** (`adversarial-review.yml`)
|
|
661
|
-
|
|
662
|
-
```yaml
|
|
663
|
-
hats:
|
|
664
|
-
builder:
|
|
665
|
-
name: "🔵 Blue Team (Builder)"
|
|
666
|
-
triggers: ["security.review", "fix.applied"]
|
|
667
|
-
publishes: ["build.ready"]
|
|
668
|
-
|
|
669
|
-
red_team:
|
|
670
|
-
name: "🔴 Red Team (Attacker)"
|
|
671
|
-
triggers: ["build.ready"]
|
|
672
|
-
publishes: ["vulnerability.found", "security.approved"]
|
|
673
|
-
|
|
674
|
-
fixer:
|
|
675
|
-
triggers: ["vulnerability.found"]
|
|
676
|
-
publishes: ["fix.applied"]
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
```
|
|
680
|
-
security.review → 🔵 Blue Team → build.ready → 🔴 Red Team
|
|
681
|
-
↑ │
|
|
682
|
-
│ ├─→ security.approved ✓
|
|
683
|
-
│ │
|
|
684
|
-
│ └─→ vulnerability.found
|
|
685
|
-
│ │
|
|
686
|
-
└────── fix.applied ←── 🛡️ Fixer ←──────┘
|
|
687
|
-
```
|
|
688
|
-
|
|
689
|
-
**When to use:** Security-sensitive code, authentication systems, or any code where adversarial thinking improves quality.
|
|
690
|
-
|
|
691
|
-
#### 5. Hypothesis-Driven Investigation
|
|
692
|
-
|
|
693
|
-
The scientific method applied to debugging.
|
|
694
|
-
|
|
695
|
-
**Example: Scientific Method** (`scientific-method.yml`)
|
|
696
|
-
|
|
697
|
-
```yaml
|
|
698
|
-
hats:
|
|
699
|
-
observer:
|
|
700
|
-
triggers: ["science.start", "hypothesis.rejected"]
|
|
701
|
-
publishes: ["observation.made"]
|
|
702
|
-
|
|
703
|
-
theorist:
|
|
704
|
-
triggers: ["observation.made"]
|
|
705
|
-
publishes: ["hypothesis.formed"]
|
|
706
|
-
|
|
707
|
-
experimenter:
|
|
708
|
-
triggers: ["hypothesis.formed"]
|
|
709
|
-
publishes: ["hypothesis.confirmed", "hypothesis.rejected"]
|
|
710
|
-
|
|
711
|
-
fixer:
|
|
712
|
-
triggers: ["hypothesis.confirmed"]
|
|
713
|
-
publishes: ["fix.applied"]
|
|
714
|
-
```
|
|
715
|
-
|
|
716
|
-
```
|
|
717
|
-
science.start → 🔬 Observer → observation.made → 🧠 Theorist →
|
|
718
|
-
hypothesis.formed → 🧪 Experimenter ──┬─→ hypothesis.confirmed → 🔧 Fixer
|
|
719
|
-
│
|
|
720
|
-
└─→ hypothesis.rejected ─┐
|
|
721
|
-
│
|
|
722
|
-
┌────────────────────────────────────────────────┘
|
|
723
|
-
└──→ (back to Observer with new data)
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
**When to use:** Complex bugs where the root cause isn't obvious. Forces systematic investigation over random fixes.
|
|
727
|
-
|
|
728
|
-
#### 6. Coordinator-Specialist (Fan-Out)
|
|
729
|
-
|
|
730
|
-
A coordinator delegates to specialists based on the work type.
|
|
731
|
-
|
|
732
|
-
**Example: Gap Analysis** (`gap-analysis.yml`)
|
|
733
|
-
|
|
734
|
-
```yaml
|
|
735
|
-
hats:
|
|
736
|
-
analyzer:
|
|
737
|
-
triggers: ["gap.start", "verify.complete", "report.complete"]
|
|
738
|
-
publishes: ["analyze.spec", "verify.request", "report.request"]
|
|
739
|
-
|
|
740
|
-
verifier:
|
|
741
|
-
triggers: ["analyze.spec", "verify.request"]
|
|
742
|
-
publishes: ["verify.complete"]
|
|
743
|
-
|
|
744
|
-
reporter:
|
|
745
|
-
triggers: ["report.request"]
|
|
746
|
-
publishes: ["report.complete"]
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
```
|
|
750
|
-
┌─→ analyze.spec ──→ 🔍 Verifier ──┐
|
|
751
|
-
│ │
|
|
752
|
-
gap.start → 📊 Analyzer ←── verify.complete ──────────┘
|
|
753
|
-
│
|
|
754
|
-
└─→ report.request ──→ 📝 Reporter ──→ report.complete
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
**When to use:** Work that naturally decomposes into independent specialist tasks (analysis, verification, reporting).
|
|
758
|
-
|
|
759
|
-
#### 7. Adaptive Entry Point
|
|
760
|
-
|
|
761
|
-
A bootstrapping hat detects input type and routes to the appropriate workflow.
|
|
762
|
-
|
|
763
|
-
**Example: Code-Assist** (`code-assist.yml`)
|
|
764
|
-
|
|
765
|
-
```yaml
|
|
766
|
-
hats:
|
|
767
|
-
planner:
|
|
768
|
-
triggers: ["build.start"]
|
|
769
|
-
publishes: ["tasks.ready"]
|
|
770
|
-
# Detects: PDD directory vs. code task file vs. description
|
|
771
|
-
|
|
772
|
-
builder:
|
|
773
|
-
triggers: ["tasks.ready", "validation.failed", "task.complete"]
|
|
774
|
-
publishes: ["implementation.ready", "task.complete"]
|
|
775
|
-
|
|
776
|
-
validator:
|
|
777
|
-
triggers: ["implementation.ready"]
|
|
778
|
-
publishes: ["validation.passed", "validation.failed"]
|
|
779
|
-
|
|
780
|
-
committer:
|
|
781
|
-
triggers: ["validation.passed"]
|
|
782
|
-
publishes: ["commit.complete"]
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
```
|
|
786
|
-
build.start → 📋 Planner ─── (detects input type) ───→ tasks.ready
|
|
787
|
-
│
|
|
788
|
-
┌───────────────────────────────────────────────────────┘
|
|
789
|
-
│
|
|
790
|
-
↓
|
|
791
|
-
⚙️ Builder ←─────────────── validation.failed ←─────┐
|
|
792
|
-
│ │
|
|
793
|
-
├── task.complete ──→ (loop for PDD mode) ──────┤
|
|
794
|
-
│ │
|
|
795
|
-
└── implementation.ready ──→ ✅ Validator ──────┤
|
|
796
|
-
│ │
|
|
797
|
-
└─→ validation.passed
|
|
798
|
-
│
|
|
799
|
-
↓
|
|
800
|
-
📦 Committer → commit.complete
|
|
801
|
-
```
|
|
802
|
-
|
|
803
|
-
**When to use:** Workflows that need to handle multiple input formats or adapt their behavior based on context.
|
|
43
|
+
# 2. Plan your feature (interactive PDD session)
|
|
44
|
+
ralph plan "Add user authentication with JWT"
|
|
45
|
+
# Creates: specs/user-authentication/requirements.md, design.md, implementation-plan.md
|
|
804
46
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
#### Hat Configuration Schema
|
|
808
|
-
|
|
809
|
-
```yaml
|
|
810
|
-
hats:
|
|
811
|
-
my_hat:
|
|
812
|
-
name: "🎯 Display Name" # Shown in TUI and logs
|
|
813
|
-
description: "What this hat does" # REQUIRED — Ralph uses this for delegation
|
|
814
|
-
triggers: ["event.a", "event.b"] # Events that activate this hat
|
|
815
|
-
publishes: ["event.c", "event.d"] # Events this hat can emit
|
|
816
|
-
default_publishes: "event.c" # Fallback if hat forgets to emit
|
|
817
|
-
max_activations: 10 # Optional cap on activations
|
|
818
|
-
backend: "claude" # Optional backend override
|
|
819
|
-
instructions: |
|
|
820
|
-
Prompt injected when this hat is active.
|
|
821
|
-
Tell the hat what to do, not how to do it.
|
|
47
|
+
# 3. Implement the feature
|
|
48
|
+
ralph run -p "Implement the feature in specs/user-authentication/"
|
|
822
49
|
```
|
|
823
50
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
1. **Description is critical** — Ralph uses hat descriptions to decide when to delegate. Make them clear and specific.
|
|
827
|
-
|
|
828
|
-
2. **One hat, one responsibility** — Each hat should have a clear, focused purpose. If you're writing "and" in the description, consider splitting.
|
|
829
|
-
|
|
830
|
-
3. **Events are routing signals, not data** — Keep payloads brief. Store detailed output in files and reference them in events.
|
|
831
|
-
|
|
832
|
-
4. **Design for recovery** — If a hat fails or forgets to publish, Ralph catches the orphaned event. Your topology should handle unexpected states gracefully.
|
|
833
|
-
|
|
834
|
-
5. **Test with simple prompts first** — Complex topologies can have emergent behavior. Start simple, validate the flow, then add complexity.
|
|
835
|
-
|
|
836
|
-
#### Validation Rules
|
|
837
|
-
|
|
838
|
-
Ralph validates hat configurations:
|
|
839
|
-
|
|
840
|
-
- **Required description**: Every hat must have a description (Ralph needs it for delegation context)
|
|
841
|
-
- **Reserved triggers**: `task.start` and `task.resume` are reserved for Ralph
|
|
842
|
-
- **No ambiguous routing**: Each trigger pattern must map to exactly one hat
|
|
843
|
-
|
|
844
|
-
```
|
|
845
|
-
ERROR: Ambiguous routing for trigger 'build.done'.
|
|
846
|
-
Both 'planner' and 'reviewer' trigger on 'build.done'.
|
|
847
|
-
```
|
|
51
|
+
Ralph iterates until it outputs `LOOP_COMPLETE` or hits the iteration limit.
|
|
848
52
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
Hats emit events to signal completion or hand off work:
|
|
53
|
+
For simpler tasks, skip planning and run directly:
|
|
852
54
|
|
|
853
55
|
```bash
|
|
854
|
-
|
|
855
|
-
ralph emit "build.done" "tests: pass, lint: pass"
|
|
856
|
-
|
|
857
|
-
# Event with JSON payload
|
|
858
|
-
ralph emit "review.done" --json '{"status": "approved", "issues": 0}'
|
|
859
|
-
|
|
860
|
-
# Direct handoff to specific hat (bypasses routing)
|
|
861
|
-
ralph emit "handoff" --target reviewer "Please review the changes"
|
|
862
|
-
```
|
|
863
|
-
|
|
864
|
-
**In agent output**, events are embedded as XML tags:
|
|
865
|
-
|
|
866
|
-
```xml
|
|
867
|
-
<event topic="impl.done">Implementation complete</event>
|
|
868
|
-
<event topic="handoff" target="reviewer">Please review</event>
|
|
56
|
+
ralph run -p "Add input validation to the /users endpoint"
|
|
869
57
|
```
|
|
870
58
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
| Scenario | Recommended Pattern | Preset |
|
|
874
|
-
|----------|---------------------|--------|
|
|
875
|
-
| Sequential workflow with clear phases | Linear Pipeline | `tdd-red-green` |
|
|
876
|
-
| Spec must be approved before coding | Contract-First | `spec-driven` |
|
|
877
|
-
| Need multiple perspectives | Cyclic Rotation | `mob-programming` |
|
|
878
|
-
| Security review required | Adversarial | `adversarial-review` |
|
|
879
|
-
| Debugging complex issues | Hypothesis-Driven | `scientific-method` |
|
|
880
|
-
| Work decomposes into specialist tasks | Coordinator-Specialist | `gap-analysis` |
|
|
881
|
-
| Multiple input formats | Adaptive Entry | `code-assist` |
|
|
882
|
-
| Standard feature development | Basic delegation | `feature` |
|
|
883
|
-
|
|
884
|
-
### When Not to Use Hats
|
|
885
|
-
|
|
886
|
-
Hat-based orchestration adds complexity. Use **traditional mode** (no hats) when:
|
|
887
|
-
|
|
888
|
-
- The task is straightforward and single-focused
|
|
889
|
-
- You don't need role separation or handoffs
|
|
890
|
-
- You're prototyping and want minimal configuration
|
|
891
|
-
- The work doesn't naturally decompose into distinct phases
|
|
892
|
-
|
|
893
|
-
Traditional mode is just Ralph in a loop until completion — simpler, faster to set up, and often sufficient.
|
|
894
|
-
|
|
895
|
-
### Memories and Tasks
|
|
59
|
+
## Web Dashboard (Alpha)
|
|
896
60
|
|
|
897
|
-
|
|
61
|
+
> **Alpha:** The web dashboard is under active development. Expect rough edges and breaking changes.
|
|
898
62
|
|
|
899
|
-
|
|
900
|
-
- Codebase patterns and conventions discovered
|
|
901
|
-
- Architectural decisions and rationale
|
|
902
|
-
- Recurring problem solutions (fixes)
|
|
903
|
-
- Project-specific context
|
|
63
|
+
<img width="1513" height="1128" alt="image" src="https://github.com/user-attachments/assets/ce5f072f-3d81-44d8-8f2f-88b42b33a3be" />
|
|
904
64
|
|
|
905
|
-
|
|
906
|
-
- Create, list, and close tasks during orchestration
|
|
907
|
-
- Track dependencies between tasks
|
|
908
|
-
- Used for loop completion verification
|
|
909
|
-
|
|
910
|
-
When memories and tasks are enabled, they replace the scratchpad for state management. Set `memories.enabled: false` and `tasks.enabled: false` to use the legacy scratchpad-only mode.
|
|
911
|
-
|
|
912
|
-
### Scratchpad (Legacy Mode)
|
|
913
|
-
|
|
914
|
-
When memories/tasks are disabled, all hats share `.agent/scratchpad.md` — persistent memory across iterations. This enables hats to build on previous work rather than starting fresh.
|
|
915
|
-
|
|
916
|
-
The scratchpad is the primary mechanism for:
|
|
917
|
-
- Task tracking (with `[ ]`, `[x]`, `[~]` markers)
|
|
918
|
-
- Context preservation between iterations
|
|
919
|
-
- Handoff between hats
|
|
920
|
-
|
|
921
|
-
### Backpressure
|
|
922
|
-
|
|
923
|
-
Ralph enforces quality gates through backpressure. When a builder publishes `build.done`, it must include evidence:
|
|
924
|
-
|
|
925
|
-
```
|
|
926
|
-
tests: pass, lint: pass, typecheck: pass
|
|
927
|
-
```
|
|
928
|
-
|
|
929
|
-
## Multi-Loop Concurrency
|
|
930
|
-
|
|
931
|
-
Ralph supports running multiple orchestration loops in parallel using git worktrees for filesystem isolation. This enables working on multiple tasks simultaneously without conflicts.
|
|
932
|
-
|
|
933
|
-
### How It Works
|
|
934
|
-
|
|
935
|
-
When you start a Ralph loop:
|
|
936
|
-
|
|
937
|
-
1. **First loop** acquires `.ralph/loop.lock` and runs in-place (the primary loop)
|
|
938
|
-
2. **Additional loops** automatically spawn into `.worktrees/<loop-id>/`
|
|
939
|
-
3. **Each loop** has isolated events, tasks, and scratchpad
|
|
940
|
-
4. **Memories are shared** — symlinked back to the main repo's `.agent/memories.md`
|
|
941
|
-
5. **On completion**, worktree loops automatically spawn a merge-ralph to integrate changes
|
|
942
|
-
|
|
943
|
-
```
|
|
944
|
-
┌─────────────────────────────────────────────────────────────────────┐
|
|
945
|
-
│ Terminal 1 │ Terminal 2 │
|
|
946
|
-
│ ralph run -p "Add auth" │ ralph run -p "Add logging" │
|
|
947
|
-
│ [acquires lock, runs in-place]│ [spawns to worktree] │
|
|
948
|
-
│ ↓ │ ↓ │
|
|
949
|
-
│ Primary loop │ .worktrees/ralph-20250124-a3f2/ │
|
|
950
|
-
│ ↓ │ ↓ │
|
|
951
|
-
│ LOOP_COMPLETE │ LOOP_COMPLETE → auto-merge │
|
|
952
|
-
└─────────────────────────────────────────────────────────────────────┘
|
|
953
|
-
```
|
|
954
|
-
|
|
955
|
-
### Usage
|
|
65
|
+
Ralph includes a web dashboard for monitoring and managing orchestration loops.
|
|
956
66
|
|
|
957
67
|
```bash
|
|
958
|
-
#
|
|
959
|
-
ralph
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
ralph run -p "Add logging"
|
|
963
|
-
|
|
964
|
-
# Check running loops
|
|
965
|
-
ralph loops
|
|
966
|
-
|
|
967
|
-
# View logs from a specific loop
|
|
968
|
-
ralph loops logs <loop-id>
|
|
969
|
-
ralph loops logs <loop-id> --follow # Real-time streaming
|
|
970
|
-
|
|
971
|
-
# Force sequential execution (wait for lock)
|
|
972
|
-
ralph run --exclusive -p "Task that needs main workspace"
|
|
973
|
-
|
|
974
|
-
# Skip auto-merge (keep worktree for manual handling)
|
|
975
|
-
ralph run --no-auto-merge -p "Experimental feature"
|
|
68
|
+
ralph web # starts both servers + opens browser
|
|
69
|
+
ralph web --no-open # skip browser auto-open
|
|
70
|
+
ralph web --backend-port 4000 # custom backend port
|
|
71
|
+
ralph web --frontend-port 8080 # custom frontend port
|
|
976
72
|
```
|
|
977
73
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
| State | Description |
|
|
981
|
-
|-------|-------------|
|
|
982
|
-
| `running` | Loop is actively executing |
|
|
983
|
-
| `queued` | Completed, waiting for merge |
|
|
984
|
-
| `merging` | Merge operation in progress |
|
|
985
|
-
| `merged` | Successfully merged to main |
|
|
986
|
-
| `needs-review` | Merge failed, requires manual resolution |
|
|
987
|
-
| `crashed` | Process died unexpectedly |
|
|
988
|
-
| `orphan` | Worktree exists but not tracked |
|
|
989
|
-
| `discarded` | Explicitly abandoned by user |
|
|
74
|
+
**Requirements:** Node.js >= 18 and npm. On first run, `ralph web` will auto-detect missing `node_modules` and run `npm install` for you.
|
|
990
75
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
```
|
|
994
|
-
project/
|
|
995
|
-
├── .ralph/
|
|
996
|
-
│ ├── loop.lock # Primary loop indicator
|
|
997
|
-
│ ├── loops.json # Loop registry
|
|
998
|
-
│ ├── merge-queue.jsonl # Merge event log
|
|
999
|
-
│ └── events.jsonl # Primary loop events
|
|
1000
|
-
├── .agent/
|
|
1001
|
-
│ └── memories.md # Shared across all loops
|
|
1002
|
-
└── .worktrees/
|
|
1003
|
-
└── ralph-20250124-a3f2/
|
|
1004
|
-
├── .ralph/events.jsonl # Loop-isolated
|
|
1005
|
-
├── .agent/
|
|
1006
|
-
│ ├── memories.md → ../../.agent/memories.md # Symlink
|
|
1007
|
-
│ └── scratchpad.md # Loop-isolated
|
|
1008
|
-
└── [project files]
|
|
1009
|
-
```
|
|
1010
|
-
|
|
1011
|
-
### Managing Loops
|
|
76
|
+
To set up Node.js:
|
|
1012
77
|
|
|
1013
78
|
```bash
|
|
1014
|
-
#
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
# View loop output
|
|
1018
|
-
ralph loops logs <id> # Full output
|
|
1019
|
-
ralph loops logs <id> --follow # Stream real-time
|
|
1020
|
-
|
|
1021
|
-
# View event history
|
|
1022
|
-
ralph loops history <id> # Formatted table
|
|
1023
|
-
ralph loops history <id> --json # Raw JSONL
|
|
1024
|
-
|
|
1025
|
-
# Show changes from merge-base
|
|
1026
|
-
ralph loops diff <id> # Full diff
|
|
1027
|
-
ralph loops diff <id> --stat # Summary only
|
|
79
|
+
# Option 1: nvm (recommended)
|
|
80
|
+
nvm install # reads .nvmrc
|
|
1028
81
|
|
|
1029
|
-
#
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
# Re-run merge for failed loop
|
|
1033
|
-
ralph loops retry <id>
|
|
1034
|
-
|
|
1035
|
-
# Stop a running loop
|
|
1036
|
-
ralph loops stop <id> # SIGTERM
|
|
1037
|
-
ralph loops stop <id> --force # SIGKILL
|
|
1038
|
-
|
|
1039
|
-
# Abandon loop and cleanup
|
|
1040
|
-
ralph loops discard <id> # With confirmation
|
|
1041
|
-
ralph loops discard <id> -y # Skip confirmation
|
|
1042
|
-
|
|
1043
|
-
# Clean up stale loops (crashed processes)
|
|
1044
|
-
ralph loops prune
|
|
82
|
+
# Option 2: direct install
|
|
83
|
+
# https://nodejs.org/
|
|
1045
84
|
```
|
|
1046
85
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
When a worktree loop completes, it queues itself for merge. The primary loop processes this queue when it finishes:
|
|
86
|
+
For development:
|
|
1050
87
|
|
|
1051
|
-
```
|
|
1052
|
-
┌──────────────────────────────────────────────────────────────────────┐
|
|
1053
|
-
│ Worktree Loop Primary Loop │
|
|
1054
|
-
│ ───────────── ───────────── │
|
|
1055
|
-
│ LOOP_COMPLETE │
|
|
1056
|
-
│ ↓ │
|
|
1057
|
-
│ Queue for merge ─────────────────────→ [continues working] │
|
|
1058
|
-
│ ↓ ↓ │
|
|
1059
|
-
│ Exit cleanly LOOP_COMPLETE │
|
|
1060
|
-
│ ↓ │
|
|
1061
|
-
│ Process merge queue │
|
|
1062
|
-
│ ↓ │
|
|
1063
|
-
│ Spawn merge-ralph │
|
|
1064
|
-
└──────────────────────────────────────────────────────────────────────┘
|
|
1065
|
-
```
|
|
1066
|
-
|
|
1067
|
-
The merge-ralph process uses a **hat collection** with specialized roles:
|
|
1068
|
-
|
|
1069
|
-
| Hat | Trigger | Purpose |
|
|
1070
|
-
|-----|---------|---------|
|
|
1071
|
-
| `merger` | `merge.start` | Performs `git merge`, runs tests |
|
|
1072
|
-
| `resolver` | `conflict.detected` | Resolves merge conflicts by understanding intent |
|
|
1073
|
-
| `tester` | `conflict.resolved` | Verifies tests pass after conflict resolution |
|
|
1074
|
-
| `cleaner` | `merge.done` | Removes worktree and branch |
|
|
1075
|
-
| `failure_handler` | `*failed`, `unresolvable` | Marks loop for manual review |
|
|
1076
|
-
|
|
1077
|
-
The workflow handles conflicts intelligently:
|
|
1078
|
-
1. **No conflicts**: Merge → Run tests → Clean up → Done
|
|
1079
|
-
2. **With conflicts**: Detect → AI resolves → Run tests → Clean up → Done
|
|
1080
|
-
3. **Unresolvable**: Abort → Mark for review → Keep worktree for manual fix
|
|
1081
|
-
|
|
1082
|
-
### Conflict Resolution
|
|
1083
|
-
|
|
1084
|
-
When merge conflicts occur, the AI resolver:
|
|
1085
|
-
|
|
1086
|
-
1. Examines conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`)
|
|
1087
|
-
2. Understands the **intent** of both sides (not just the code)
|
|
1088
|
-
3. Resolves by preserving both intents when possible
|
|
1089
|
-
4. Prefers the loop's changes when directly contradictory (newer work)
|
|
1090
|
-
|
|
1091
|
-
**Conflicts marked `needs-review`:**
|
|
1092
|
-
- Major architectural changes on both sides
|
|
1093
|
-
- Complex refactoring that can't be automatically reconciled
|
|
1094
|
-
- Business logic contradictions requiring human judgment
|
|
1095
|
-
|
|
1096
|
-
To manually resolve:
|
|
1097
88
|
```bash
|
|
1098
|
-
#
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
git add . && git commit -m "Manual conflict resolution"
|
|
1103
|
-
|
|
1104
|
-
# Retry the merge
|
|
1105
|
-
ralph loops retry <loop-id>
|
|
1106
|
-
|
|
1107
|
-
# Or discard if unneeded
|
|
1108
|
-
ralph loops discard <loop-id>
|
|
89
|
+
npm install # install dependencies
|
|
90
|
+
npm run dev # run both servers (backend:3000, frontend:5173)
|
|
91
|
+
npm run test:server # backend tests
|
|
92
|
+
npm run test # all tests
|
|
1109
93
|
```
|
|
1110
94
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
**When to use parallel loops:**
|
|
1114
|
-
- ✅ Independent features with minimal file overlap
|
|
1115
|
-
- ✅ Bug fixes while feature work continues
|
|
1116
|
-
- ✅ Documentation updates parallel to code changes
|
|
1117
|
-
- ✅ Test additions that don't conflict with active development
|
|
1118
|
-
|
|
1119
|
-
**When to use `--exclusive` (sequential):**
|
|
1120
|
-
- ⚠️ Large refactoring touching many files
|
|
1121
|
-
- ⚠️ Database migrations or schema changes
|
|
1122
|
-
- ⚠️ Tasks that modify shared configuration files
|
|
1123
|
-
- ⚠️ Work that depends on changes from another in-progress loop
|
|
1124
|
-
|
|
1125
|
-
**Tips for reducing conflicts:**
|
|
1126
|
-
- Keep loops focused on distinct areas of the codebase
|
|
1127
|
-
- Use separate files when adding new features
|
|
1128
|
-
- Avoid modifying the same functions in parallel loops
|
|
1129
|
-
- Let one loop complete before starting conflicting work
|
|
1130
|
-
|
|
1131
|
-
### Troubleshooting
|
|
1132
|
-
|
|
1133
|
-
**Loop stuck in `queued` state:**
|
|
1134
|
-
```bash
|
|
1135
|
-
# Check if primary loop is still running
|
|
1136
|
-
ralph loops
|
|
1137
|
-
|
|
1138
|
-
# If primary finished but merge didn't start, manually trigger
|
|
1139
|
-
ralph loops retry <loop-id>
|
|
1140
|
-
```
|
|
1141
|
-
|
|
1142
|
-
**Merge keeps failing:**
|
|
1143
|
-
```bash
|
|
1144
|
-
# View merge-ralph logs
|
|
1145
|
-
ralph loops logs <loop-id>
|
|
1146
|
-
|
|
1147
|
-
# Check what changes conflict
|
|
1148
|
-
ralph loops diff <loop-id>
|
|
1149
|
-
|
|
1150
|
-
# Manually resolve in worktree
|
|
1151
|
-
ralph loops attach <loop-id>
|
|
1152
|
-
```
|
|
1153
|
-
|
|
1154
|
-
**Orphaned worktrees:**
|
|
1155
|
-
```bash
|
|
1156
|
-
# List and clean up orphans
|
|
1157
|
-
ralph loops prune
|
|
1158
|
-
|
|
1159
|
-
# Force cleanup of specific worktree
|
|
1160
|
-
git worktree remove .worktrees/<loop-id> --force
|
|
1161
|
-
git branch -D ralph/<loop-id>
|
|
1162
|
-
```
|
|
1163
|
-
|
|
1164
|
-
**Lock file issues:**
|
|
1165
|
-
```bash
|
|
1166
|
-
# Check who holds the lock
|
|
1167
|
-
cat .ralph/loop.lock
|
|
1168
|
-
|
|
1169
|
-
# If process is dead, remove stale lock
|
|
1170
|
-
rm .ralph/loop.lock
|
|
1171
|
-
```
|
|
1172
|
-
|
|
1173
|
-
### Environment Variables
|
|
1174
|
-
|
|
1175
|
-
| Variable | Description |
|
|
1176
|
-
|----------|-------------|
|
|
1177
|
-
| `RALPH_MERGE_LOOP_ID` | Set by auto-merge to identify which loop to merge |
|
|
1178
|
-
| `RALPH_DIAGNOSTICS=1` | Enable detailed diagnostic logging |
|
|
1179
|
-
| `RALPH_VERBOSE=1` | Verbose output mode |
|
|
1180
|
-
| `RALPH_DEBUG_LOG=1` | Write debug logs to `.agent/ralph.log` |
|
|
1181
|
-
|
|
1182
|
-
## CLI Reference
|
|
1183
|
-
|
|
1184
|
-
### Commands
|
|
1185
|
-
|
|
1186
|
-
| Command | Description |
|
|
1187
|
-
|---------|-------------|
|
|
1188
|
-
| `ralph run` | Run the orchestration loop (default) |
|
|
1189
|
-
| `ralph resume` | Resume from existing scratchpad |
|
|
1190
|
-
| `ralph plan` | Start an interactive PDD planning session |
|
|
1191
|
-
| `ralph task` | Start an interactive code-task-generator session |
|
|
1192
|
-
| `ralph events` | View event history |
|
|
1193
|
-
| `ralph init` | Initialize configuration file |
|
|
1194
|
-
| `ralph clean` | Clean up `.agent/` directory |
|
|
1195
|
-
| `ralph emit` | Emit an event to the event log |
|
|
1196
|
-
| `ralph tools` | Runtime tools for memories and tasks (agent-facing) |
|
|
1197
|
-
| `ralph loops` | Manage parallel loops (list, logs, stop, merge) |
|
|
1198
|
-
|
|
1199
|
-
### Global Options
|
|
1200
|
-
|
|
1201
|
-
| Option | Description |
|
|
1202
|
-
|--------|-------------|
|
|
1203
|
-
| `-c, --config <FILE>` | Config file path (default: `ralph.yml`) |
|
|
1204
|
-
| `-v, --verbose` | Verbose output |
|
|
1205
|
-
| `--color <MODE>` | Color output: `auto`, `always`, `never` |
|
|
1206
|
-
|
|
1207
|
-
### `ralph run` Options
|
|
1208
|
-
|
|
1209
|
-
| Option | Description |
|
|
1210
|
-
|--------|-------------|
|
|
1211
|
-
| `-p, --prompt <TEXT>` | Inline prompt text |
|
|
1212
|
-
| `-P, --prompt-file <FILE>` | Prompt file path |
|
|
1213
|
-
| `--max-iterations <N>` | Override max iterations |
|
|
1214
|
-
| `--completion-promise <TEXT>` | Override completion trigger |
|
|
1215
|
-
| `--dry-run` | Show what would execute |
|
|
1216
|
-
| `--no-tui` | Disable TUI mode (TUI is enabled by default) |
|
|
1217
|
-
| `-a, --autonomous` | Force headless mode |
|
|
1218
|
-
| `--idle-timeout <SECS>` | TUI idle timeout (default: 30) |
|
|
1219
|
-
| `--record-session <FILE>` | Record session to JSONL |
|
|
1220
|
-
| `-q, --quiet` | Suppress output (for CI) |
|
|
1221
|
-
| `--continue` | Resume from existing scratchpad |
|
|
1222
|
-
| `--exclusive` | Wait for primary loop slot instead of spawning worktree |
|
|
1223
|
-
| `--no-auto-merge` | Skip automatic merge after worktree loop completes |
|
|
1224
|
-
|
|
1225
|
-
### `ralph init` Options
|
|
1226
|
-
|
|
1227
|
-
| Option | Description |
|
|
1228
|
-
|--------|-------------|
|
|
1229
|
-
| `--backend <NAME>` | Backend: `claude`, `kiro`, `gemini`, `codex`, `amp`, `copilot`, `opencode` |
|
|
1230
|
-
| `--preset <NAME>` | Use preset configuration |
|
|
1231
|
-
| `--list-presets` | List available presets |
|
|
1232
|
-
| `--force` | Overwrite existing config |
|
|
1233
|
-
|
|
1234
|
-
### `ralph plan` Options
|
|
1235
|
-
|
|
1236
|
-
| Option | Description |
|
|
1237
|
-
|--------|-------------|
|
|
1238
|
-
| `<IDEA>` | Optional rough idea to develop (SOP prompts if not provided) |
|
|
1239
|
-
| `-b, --backend <BACKEND>` | Backend to use (overrides config and auto-detection) |
|
|
1240
|
-
|
|
1241
|
-
### `ralph task` Options
|
|
1242
|
-
|
|
1243
|
-
| Option | Description |
|
|
1244
|
-
|--------|-------------|
|
|
1245
|
-
| `<INPUT>` | Optional description text or path to PDD plan file |
|
|
1246
|
-
| `-b, --backend <BACKEND>` | Backend to use (overrides config and auto-detection) |
|
|
1247
|
-
|
|
1248
|
-
### `ralph tools` Subcommands
|
|
1249
|
-
|
|
1250
|
-
The `tools` command provides agent-facing utilities for runtime state management:
|
|
1251
|
-
|
|
1252
|
-
```bash
|
|
1253
|
-
# Memory management (persistent learning)
|
|
1254
|
-
ralph tools memory add "content" -t pattern --tags tag1,tag2
|
|
1255
|
-
ralph tools memory search "query"
|
|
1256
|
-
ralph tools memory list
|
|
1257
|
-
ralph tools memory show <id>
|
|
1258
|
-
ralph tools memory delete <id>
|
|
1259
|
-
|
|
1260
|
-
# Task management (runtime tracking)
|
|
1261
|
-
ralph tools task add "Title" -p 2 # Create task (priority 1-5)
|
|
1262
|
-
ralph tools task add "X" --blocked-by Y # With dependency
|
|
1263
|
-
ralph tools task list # All tasks
|
|
1264
|
-
ralph tools task ready # Unblocked tasks only
|
|
1265
|
-
ralph tools task close <id> # Mark complete
|
|
1266
|
-
```
|
|
1267
|
-
|
|
1268
|
-
### `ralph loops` Subcommands
|
|
1269
|
-
|
|
1270
|
-
Manage parallel loops running in git worktrees:
|
|
1271
|
-
|
|
1272
|
-
| Subcommand | Description |
|
|
1273
|
-
|------------|-------------|
|
|
1274
|
-
| `list` | Show all loops with status (default) |
|
|
1275
|
-
| `logs <ID>` | View loop output (`--follow` for real-time) |
|
|
1276
|
-
| `history <ID>` | Show event history (`--json` for raw JSONL) |
|
|
1277
|
-
| `retry <ID>` | Re-run merge for `needs-review` loop |
|
|
1278
|
-
| `discard <ID>` | Abandon loop and cleanup worktree (`-y` to skip confirm) |
|
|
1279
|
-
| `stop <ID>` | Terminate running loop (`--force` for SIGKILL) |
|
|
1280
|
-
| `prune` | Clean up stale loops (crashed processes) |
|
|
1281
|
-
| `attach <ID>` | Open shell in loop's worktree |
|
|
1282
|
-
| `diff <ID>` | Show changes from merge-base (`--stat` for summary) |
|
|
1283
|
-
|
|
1284
|
-
## Architecture
|
|
1285
|
-
|
|
1286
|
-
Ralph is organized as a Cargo workspace with seven crates:
|
|
1287
|
-
|
|
1288
|
-
| Crate | Purpose |
|
|
1289
|
-
|-------|---------|
|
|
1290
|
-
| `ralph-proto` | Protocol types: Event, Hat, Topic, Error |
|
|
1291
|
-
| `ralph-core` | Business logic: EventLoop, HatRegistry, Config |
|
|
1292
|
-
| `ralph-adapters` | CLI backend integrations (Claude, Kiro, Gemini, etc.) |
|
|
1293
|
-
| `ralph-tui` | Terminal UI with ratatui |
|
|
1294
|
-
| `ralph-cli` | Binary entry point and CLI parsing |
|
|
1295
|
-
| `ralph-e2e` | End-to-end test harness for backend validation |
|
|
1296
|
-
| `ralph-bench` | Benchmarking harness (dev-only) |
|
|
1297
|
-
|
|
1298
|
-
## Building & Testing
|
|
1299
|
-
|
|
1300
|
-
### Build
|
|
1301
|
-
|
|
1302
|
-
```bash
|
|
1303
|
-
cargo build # Debug build
|
|
1304
|
-
cargo build --release # Release build
|
|
1305
|
-
```
|
|
1306
|
-
|
|
1307
|
-
### Test
|
|
1308
|
-
|
|
1309
|
-
```bash
|
|
1310
|
-
# Run all tests (includes smoke tests with JSONL replay)
|
|
1311
|
-
cargo test
|
|
1312
|
-
|
|
1313
|
-
# Run smoke tests specifically
|
|
1314
|
-
cargo test -p ralph-core smoke_runner
|
|
1315
|
-
|
|
1316
|
-
# Run Kiro-specific smoke tests
|
|
1317
|
-
cargo test -p ralph-core kiro
|
|
1318
|
-
```
|
|
1319
|
-
|
|
1320
|
-
### Smoke Tests
|
|
1321
|
-
|
|
1322
|
-
Smoke tests use recorded JSONL fixtures instead of live API calls — fast, free, and deterministic.
|
|
1323
|
-
|
|
1324
|
-
**Fixture locations:**
|
|
1325
|
-
- `crates/ralph-core/tests/fixtures/basic_session.jsonl` — Claude CLI session
|
|
1326
|
-
- `crates/ralph-core/tests/fixtures/kiro/` — Kiro CLI sessions
|
|
95
|
+
## What is Ralph?
|
|
1327
96
|
|
|
1328
|
-
|
|
97
|
+
Ralph implements the [Ralph Wiggum technique](https://ghuntley.com/ralph/) — autonomous task completion through continuous iteration. It supports:
|
|
1329
98
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
99
|
+
- **Multi-Backend Support** — Claude Code, Kiro, Gemini CLI, Codex, Amp, Copilot CLI, OpenCode
|
|
100
|
+
- **Hat System** — Specialized personas coordinating through events
|
|
101
|
+
- **Backpressure** — Gates that reject incomplete work (tests, lint, typecheck)
|
|
102
|
+
- **Memories & Tasks** — Persistent learning and runtime work tracking
|
|
103
|
+
- **31 Presets** — TDD, spec-driven, debugging, and more
|
|
1333
104
|
|
|
1334
|
-
|
|
1335
|
-
claude -p "your prompt" 2>&1 | tee output.txt
|
|
1336
|
-
```
|
|
105
|
+
## Documentation
|
|
1337
106
|
|
|
1338
|
-
|
|
107
|
+
Full documentation is available at **[mikeyobrien.github.io/ralph-orchestrator](https://mikeyobrien.github.io/ralph-orchestrator/)**:
|
|
1339
108
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
109
|
+
- [Installation](https://mikeyobrien.github.io/ralph-orchestrator/getting-started/installation/)
|
|
110
|
+
- [Quick Start](https://mikeyobrien.github.io/ralph-orchestrator/getting-started/quick-start/)
|
|
111
|
+
- [Configuration](https://mikeyobrien.github.io/ralph-orchestrator/guide/configuration/)
|
|
112
|
+
- [CLI Reference](https://mikeyobrien.github.io/ralph-orchestrator/guide/cli-reference/)
|
|
113
|
+
- [Presets](https://mikeyobrien.github.io/ralph-orchestrator/guide/presets/)
|
|
114
|
+
- [Concepts: Hats & Events](https://mikeyobrien.github.io/ralph-orchestrator/concepts/hats-and-events/)
|
|
115
|
+
- [Architecture](https://mikeyobrien.github.io/ralph-orchestrator/advanced/architecture/)
|
|
1344
116
|
|
|
1345
117
|
## Contributing
|
|
1346
118
|
|
|
1347
|
-
Contributions are welcome!
|
|
1348
|
-
|
|
1349
|
-
1. Fork the repository
|
|
1350
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
1351
|
-
3. Write tests for new functionality
|
|
1352
|
-
4. Ensure `cargo test` passes
|
|
1353
|
-
5. Run `cargo clippy` and `cargo fmt`
|
|
1354
|
-
6. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
1355
|
-
7. Push to the branch (`git push origin feature/amazing-feature`)
|
|
1356
|
-
8. Open a Pull Request
|
|
1357
|
-
|
|
1358
|
-
See [AGENTS.md](AGENTS.md) for development philosophy and conventions.
|
|
119
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community standards.
|
|
1359
120
|
|
|
1360
121
|
## License
|
|
1361
122
|
|
|
@@ -1364,15 +125,9 @@ MIT License — See [LICENSE](LICENSE) for details.
|
|
|
1364
125
|
## Acknowledgments
|
|
1365
126
|
|
|
1366
127
|
- **[Geoffrey Huntley](https://ghuntley.com/ralph/)** — Creator of the Ralph Wiggum technique
|
|
1367
|
-
- **[
|
|
1368
|
-
- **[Strands Agent SOPs](https://github.com/strands-agents/agent-sop)** — Natural language workflows that enable AI agents to perform complex, multi-step tasks with consistency and reliability.
|
|
128
|
+
- **[Strands Agents SOP](https://github.com/strands-agents/agent-sop)** — Agent SOP framework
|
|
1369
129
|
- **[ratatui](https://ratatui.rs/)** — Terminal UI framework
|
|
1370
|
-
- **[portable-pty](https://crates.io/crates/portable-pty)** — Cross-platform PTY support
|
|
1371
130
|
|
|
1372
131
|
---
|
|
1373
132
|
|
|
1374
133
|
*"I'm learnding!" - Ralph Wiggum*
|
|
1375
|
-
|
|
1376
|
-
---
|
|
1377
|
-
|
|
1378
|
-
[](https://www.star-history.com/#mikeyobrien/ralph-orchestrator&type=date&legend=top-left)
|