@graypark/ralph-codex 0.7.2 → 0.8.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/README.md +170 -170
- package/package.json +1 -1
- package/skills/ralph-interview/SKILL.md +3 -0
package/README.md
CHANGED
|
@@ -1,15 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/vcz-Gray/ralph-codex/main/assets/ralph-codex-banner.svg" alt="ralph-codex" width="600" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@graypark/ralph-codex"><img src="https://img.shields.io/npm/v/@graypark/ralph-codex.svg?style=flat-square&color=blue" alt="npm version" /></a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/@graypark/ralph-codex"><img src="https://img.shields.io/npm/dm/@graypark/ralph-codex.svg?style=flat-square&color=green" alt="npm downloads" /></a>
|
|
8
|
+
<a href="https://github.com/vcz-Gray/ralph-codex/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="license" /></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg?style=flat-square" alt="node version" />
|
|
10
|
+
<img src="https://img.shields.io/badge/platform-Codex%20CLI%20%7C%20Claude%20Code-purple.svg?style=flat-square" alt="platform" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<b>Iterative AI development loops with PRD-driven task tracking, multi-agent orchestration, and interactive command generation.</b>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
4
18
|
|
|
5
19
|
## What is Ralph Loop?
|
|
6
20
|
|
|
7
|
-
An AI agent works on a task in a continuous loop
|
|
21
|
+
An AI agent works on a task in a continuous loop. Each iteration starts with **fresh context** — reading the PRD and progress files to decide what to do next. The agent implements one story, commits, updates progress, and exits. The stop hook intercepts the exit and re-injects the prompt. Repeat until all stories pass.
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
┌──────────────────────┐
|
|
25
|
+
│ /ralph-interview │
|
|
26
|
+
│ Describe your task │
|
|
27
|
+
└──────────┬───────────┘
|
|
28
|
+
│
|
|
29
|
+
┌──────────▼───────────┐
|
|
30
|
+
│ Generate prd.json │
|
|
31
|
+
│ + progress.txt │
|
|
32
|
+
└──────────┬───────────┘
|
|
33
|
+
│
|
|
34
|
+
┌────────────────▼────────────────┐
|
|
35
|
+
│ Ralph Loop │
|
|
36
|
+
│ │
|
|
37
|
+
│ 1. Read prd.json + progress │
|
|
38
|
+
│ 2. Pick next story (passes=false)│
|
|
39
|
+
│ 3. Implement + verify │
|
|
40
|
+
│ 4. Commit + update progress │
|
|
41
|
+
│ 5. Exit attempt │
|
|
42
|
+
│ │ │
|
|
43
|
+
│ Stop Hook intercepts │
|
|
44
|
+
│ Re-injects prompt │
|
|
45
|
+
│ │ │
|
|
46
|
+
│ Back to step 1 ──────────────┘
|
|
47
|
+
│ │
|
|
48
|
+
│ All stories pass? │
|
|
49
|
+
│ → <promise>COMPLETE</promise> │
|
|
50
|
+
└─────────────────────────────────┘
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx @graypark/ralph-codex --global
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then in your AI coding session:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/ralph-interview Add user authentication with JWT, bcrypt, and login UI
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
That's it. The interview generates a PRD, activates the loop, and starts implementing story by story.
|
|
8
66
|
|
|
9
|
-
##
|
|
67
|
+
## Features
|
|
10
68
|
|
|
11
|
-
|
|
12
|
-
|
|
69
|
+
| Feature | Description |
|
|
70
|
+
| ----------------------------- | -------------------------------------------------------------------------- |
|
|
71
|
+
| **PRD-driven loops** | `prd.json` + `progress.txt` — resumable, inspectable, git-friendly |
|
|
72
|
+
| **Interactive interview** | `/ralph-interview` asks targeted questions, generates optimized commands |
|
|
73
|
+
| **Multi-agent orchestration** | `/ralph-orchestrator` — 5 patterns for parallel work streams |
|
|
74
|
+
| **One story per iteration** | Focused context, clean commits, no context rot |
|
|
75
|
+
| **Cross-platform** | Node.js stop hook — Windows, macOS, Linux without WSL |
|
|
76
|
+
| **Ecosystem compatible** | Works with `ralph-skills:prd`, `ralph-skills:ralph`, official `ralph-loop` |
|
|
77
|
+
| **Stop & resume** | Stop anytime. Restart the same command — picks up where it left off |
|
|
13
78
|
|
|
14
79
|
## Installation
|
|
15
80
|
|
|
@@ -19,7 +84,7 @@ An AI agent works on a task in a continuous loop, seeing its own previous work e
|
|
|
19
84
|
npx @graypark/ralph-codex --global
|
|
20
85
|
```
|
|
21
86
|
|
|
22
|
-
###
|
|
87
|
+
### Clone & install
|
|
23
88
|
|
|
24
89
|
```bash
|
|
25
90
|
git clone https://github.com/vcz-Gray/ralph-codex.git
|
|
@@ -27,19 +92,18 @@ cd ralph-codex
|
|
|
27
92
|
node bin/install.mjs --global
|
|
28
93
|
```
|
|
29
94
|
|
|
30
|
-
|
|
95
|
+
| Flag | Description |
|
|
96
|
+
| ----------- | --------------------------------------- |
|
|
97
|
+
| `--global` | Install to `~/.codex/` (default) |
|
|
98
|
+
| `--local` | Install to `.codex/` in current project |
|
|
99
|
+
| `--dry-run` | Preview without changes |
|
|
100
|
+
| `--force` | Overwrite existing |
|
|
31
101
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| `--global` | Install to `~/.codex/` or `~/.claude/` (default) |
|
|
35
|
-
| `--local` | Install to `.codex/` in current project |
|
|
36
|
-
| `--dry-run` | Preview changes without modifying anything |
|
|
37
|
-
| `--force` | Overwrite existing installation |
|
|
38
|
-
|
|
39
|
-
### What Gets Installed
|
|
102
|
+
<details>
|
|
103
|
+
<summary>What gets installed</summary>
|
|
40
104
|
|
|
41
105
|
```
|
|
42
|
-
~/.codex/
|
|
106
|
+
~/.codex/
|
|
43
107
|
├── plugins/ralph-codex/ # Core plugin files
|
|
44
108
|
├── hooks.json # Stop hook (merged with existing)
|
|
45
109
|
└── skills/
|
|
@@ -49,218 +113,148 @@ node bin/install.mjs --global
|
|
|
49
113
|
└── ralph-orchestrator/ # /ralph-orchestrator — multi-agent patterns
|
|
50
114
|
```
|
|
51
115
|
|
|
116
|
+
</details>
|
|
117
|
+
|
|
52
118
|
## Commands
|
|
53
119
|
|
|
54
|
-
### `/ralph-interview` —
|
|
120
|
+
### `/ralph-interview` — The Main Entry Point
|
|
55
121
|
|
|
56
|
-
|
|
122
|
+
Interviews you about your task, generates a PRD with right-sized stories, activates the loop, and starts working immediately.
|
|
57
123
|
|
|
58
124
|
```
|
|
59
|
-
/ralph-interview
|
|
125
|
+
/ralph-interview Refactor auth module across frontend and backend
|
|
60
126
|
```
|
|
61
127
|
|
|
62
|
-
|
|
63
|
-
2. Answer 3–5 targeted questions (scope, verification, parallelism potential, etc.)
|
|
64
|
-
3. Get a ready-to-run command with phases, escape hatches, and orchestration
|
|
65
|
-
|
|
66
|
-
**Auto-execute:** Add "run immediately" or "바로 실행" to start without confirmation:
|
|
128
|
+
**What happens:**
|
|
67
129
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
130
|
+
1. 3-5 targeted questions (scope, verification, parallelism, etc.)
|
|
131
|
+
2. Generates `prd.json` with properly sized and ordered stories
|
|
132
|
+
3. Writes `progress.txt` for iteration tracking
|
|
133
|
+
4. Activates stop hook and starts implementing US-001
|
|
71
134
|
|
|
72
|
-
**
|
|
135
|
+
**Quick-run** — skip the "Ready?" prompt:
|
|
73
136
|
|
|
74
137
|
```
|
|
75
|
-
|
|
76
|
-
├── prd.md # All phases and work items
|
|
77
|
-
└── progress.md # What's done, what's next, what's blocked
|
|
138
|
+
/ralph-interview Add pagination to users API, run immediately
|
|
78
139
|
```
|
|
79
140
|
|
|
80
|
-
The loop naturally transitions between phases by reading progress. Stop anytime — restart the same command and it picks up where it left off.
|
|
81
|
-
|
|
82
141
|
### `/ralph-orchestrator` — Multi-Agent Patterns
|
|
83
142
|
|
|
84
|
-
|
|
143
|
+
Recommends the best execution strategy based on your task structure:
|
|
85
144
|
|
|
86
|
-
| Pattern
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
145
|
+
| Pattern | When to use |
|
|
146
|
+
| --------------------------------------- | ---------------------------------------- |
|
|
147
|
+
| Parallel Explore → Sequential Implement | Research across large codebase, then fix |
|
|
148
|
+
| Divide by Ownership | Multi-service changes (fe + be + auth) |
|
|
149
|
+
| Fan-Out / Fan-In | Parallel audits (security + perf + a11y) |
|
|
150
|
+
| Scout-Then-Execute | Unfamiliar codebase |
|
|
151
|
+
| Pipeline with Checkpoints | Multi-stage transformations |
|
|
93
152
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
Files span 3+ directories → +2
|
|
98
|
-
Items are independent → +2
|
|
99
|
-
Multiple services/repos → +3
|
|
100
|
-
10+ similar items → +1
|
|
101
|
-
Need full context → -2
|
|
102
|
-
Order matters → -2
|
|
103
|
-
|
|
104
|
-
Score >= 3 → Parallel subagents
|
|
105
|
-
Score 0–2 → Sequential + optional scout
|
|
106
|
-
Score < 0 → Single loop
|
|
107
|
-
```
|
|
153
|
+
### `/ralph-loop` — Direct Loop
|
|
108
154
|
|
|
109
|
-
|
|
155
|
+
If you already have a PRD or want to write your own prompt:
|
|
110
156
|
|
|
111
157
|
```
|
|
112
|
-
/ralph-loop "
|
|
158
|
+
/ralph-loop "Read prd.json, pick next story, implement, verify, commit" --max-iterations 20 --completion-promise "COMPLETE"
|
|
113
159
|
```
|
|
114
160
|
|
|
115
|
-
|
|
116
|
-
| --------------------------- | ---------- | ------------------------------ |
|
|
117
|
-
| `PROMPT` | (required) | Task description |
|
|
118
|
-
| `--max-iterations N` | 20 | Max iterations (0 = unlimited) |
|
|
119
|
-
| `--completion-promise TEXT` | "TADA" | Phrase that signals completion |
|
|
120
|
-
|
|
121
|
-
### `/cancel-ralph` — Stop the Loop
|
|
161
|
+
### `/cancel-ralph` — Stop
|
|
122
162
|
|
|
123
163
|
```
|
|
124
164
|
/cancel-ralph
|
|
125
165
|
```
|
|
126
166
|
|
|
127
|
-
##
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
│ │ re-inject prompt │ │
|
|
153
|
-
│ └─────────┬─────────┘ │
|
|
154
|
-
│ │ │
|
|
155
|
-
│ ┌──────────────┐ │
|
|
156
|
-
│ │ Sees previous │──── loop ────┘
|
|
157
|
-
│ │ work in files │
|
|
158
|
-
│ └──────────────┘
|
|
167
|
+
## PRD Format
|
|
168
|
+
|
|
169
|
+
ralph-codex uses the **ralph-skills compatible** `prd.json` format:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"project": "MyApp",
|
|
174
|
+
"branchName": "ralph/auth-system",
|
|
175
|
+
"description": "JWT authentication with login UI",
|
|
176
|
+
"userStories": [
|
|
177
|
+
{
|
|
178
|
+
"id": "US-001",
|
|
179
|
+
"title": "Add users table with password hash",
|
|
180
|
+
"description": "As a developer, I need user storage for auth",
|
|
181
|
+
"acceptanceCriteria": [
|
|
182
|
+
"Users table with email, password_hash columns",
|
|
183
|
+
"Migration runs successfully",
|
|
184
|
+
"Typecheck passes"
|
|
185
|
+
],
|
|
186
|
+
"priority": 1,
|
|
187
|
+
"passes": false,
|
|
188
|
+
"notes": ""
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
159
192
|
```
|
|
160
193
|
|
|
161
|
-
|
|
194
|
+
Each story is sized to complete in **one iteration** (one context window). Dependencies are ordered by priority.
|
|
162
195
|
|
|
163
|
-
|
|
196
|
+
## Ecosystem Compatibility
|
|
164
197
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
198
|
+
ralph-codex works seamlessly with existing Ralph tools:
|
|
199
|
+
|
|
200
|
+
| Tool | Compatibility |
|
|
201
|
+
| ---------------------------- | -------------------------------------------------------------------- |
|
|
202
|
+
| `ralph-skills:prd` | Same `prd.json` format — generate PRD there, loop here |
|
|
203
|
+
| `ralph-skills:ralph` | Same `progress.txt`, same `passes` tracking, same `COMPLETE` promise |
|
|
204
|
+
| Official `ralph-loop` plugin | PRD files work with either stop hook |
|
|
205
|
+
| `snarktank/ralph` | Compatible PRD structure and iteration pattern |
|
|
206
|
+
|
|
207
|
+
## Multi-Agent Orchestration
|
|
170
208
|
|
|
171
|
-
|
|
172
|
-
└── Ralph Loop: Read all reports → create prioritized fix plan
|
|
209
|
+
For tasks spanning multiple services or requiring broad exploration:
|
|
173
210
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
├── Agent "
|
|
177
|
-
|
|
211
|
+
```
|
|
212
|
+
Phase 1 — Parallel Scan (3 agents):
|
|
213
|
+
├── Agent "fe-scan": Search frontend/** for auth gaps
|
|
214
|
+
├── Agent "be-scan": Search backend/** for auth gaps
|
|
215
|
+
└── Agent "db-scan": Review schema for missing constraints
|
|
178
216
|
|
|
179
|
-
Phase
|
|
180
|
-
└──
|
|
217
|
+
Phase 2 — Sequential Fix (ralph-loop):
|
|
218
|
+
└── Read merged findings → implement fixes story by story
|
|
181
219
|
```
|
|
182
220
|
|
|
183
|
-
The
|
|
221
|
+
The interview automatically evaluates parallelism potential using a scoring matrix.
|
|
184
222
|
|
|
185
223
|
## Updating
|
|
186
224
|
|
|
187
|
-
To update to the latest version:
|
|
188
|
-
|
|
189
225
|
```bash
|
|
190
226
|
npx @graypark/ralph-codex --global --force
|
|
191
227
|
```
|
|
192
228
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
cd ralph-codex
|
|
197
|
-
git pull
|
|
198
|
-
node bin/install.mjs --global --force
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Windows Support
|
|
202
|
-
|
|
203
|
-
Works natively on Windows without WSL or Git Bash:
|
|
204
|
-
|
|
205
|
-
- All paths use `path.join()` (no hardcoded slashes)
|
|
206
|
-
- Installer copies files instead of symlinks on Windows
|
|
207
|
-
- State files use JSON (no Unix-specific formats)
|
|
208
|
-
- Hooks use `node` as the interpreter (cross-platform)
|
|
209
|
-
|
|
210
|
-
## Uninstall
|
|
229
|
+
## Uninstalling
|
|
211
230
|
|
|
212
231
|
```bash
|
|
213
232
|
npx @graypark/ralph-codex uninstall
|
|
214
233
|
```
|
|
215
234
|
|
|
216
|
-
## Claude Code Plugin
|
|
217
|
-
|
|
218
|
-
This package includes a `.claude-plugin/plugin.json` manifest for Claude Code marketplace compatibility. To use as a Claude Code plugin:
|
|
219
|
-
|
|
220
|
-
1. Clone the repo to your machine
|
|
221
|
-
2. In Claude Code, reference the plugin directory
|
|
222
|
-
3. Skills (`ralph-interview`, `ralph-orchestrator`, etc.) will be auto-discovered
|
|
223
|
-
|
|
224
235
|
## Architecture
|
|
225
236
|
|
|
226
237
|
```
|
|
227
238
|
ralph-codex/
|
|
228
|
-
├── .claude-plugin/
|
|
229
|
-
│ └── plugin.json # Claude Code marketplace manifest
|
|
239
|
+
├── .claude-plugin/plugin.json # Claude Code marketplace manifest
|
|
230
240
|
├── bin/
|
|
231
|
-
│ ├── install.mjs
|
|
232
|
-
│ └── uninstall.mjs
|
|
241
|
+
│ ├── install.mjs # Cross-platform installer
|
|
242
|
+
│ └── uninstall.mjs # Clean uninstaller
|
|
233
243
|
├── hooks/
|
|
234
|
-
│
|
|
235
|
-
│ └── stop-hook.mjs # Stop hook — core loop engine
|
|
244
|
+
│ └── stop-hook.mjs # Core loop engine (Node.js)
|
|
236
245
|
├── commands/
|
|
237
|
-
│ ├── ralph-loop.md
|
|
238
|
-
│ └── cancel-ralph.md
|
|
246
|
+
│ ├── ralph-loop.md # /ralph-loop command
|
|
247
|
+
│ └── cancel-ralph.md # /cancel-ralph command
|
|
239
248
|
├── skills/
|
|
240
|
-
│ ├── ralph-interview/
|
|
241
|
-
│
|
|
242
|
-
│ └── ralph-orchestrator/
|
|
243
|
-
│ └── SKILL.md # Multi-agent orchestration patterns
|
|
249
|
+
│ ├── ralph-interview/SKILL.md # Interactive command generator
|
|
250
|
+
│ └── ralph-orchestrator/SKILL.md # Multi-agent patterns
|
|
244
251
|
├── lib/
|
|
245
|
-
│ ├── paths.mjs
|
|
246
|
-
│ ├── state.mjs
|
|
247
|
-
│ └── stop-hook-core.mjs
|
|
248
|
-
|
|
249
|
-
└── package.json
|
|
252
|
+
│ ├── paths.mjs # Cross-platform paths
|
|
253
|
+
│ ├── state.mjs # Loop state management
|
|
254
|
+
│ └── stop-hook-core.mjs # Testable hook logic
|
|
255
|
+
└── tests/ # 32 test cases (vitest)
|
|
250
256
|
```
|
|
251
257
|
|
|
252
|
-
## Comparison
|
|
253
|
-
|
|
254
|
-
| Feature | Claude Code (official) | Codex CLI (builtin) | ralph-codex (this) |
|
|
255
|
-
| ---------------------- | ---------------------- | ------------------- | ------------------------ |
|
|
256
|
-
| Runtime | Bash (sh/perl) | Rust | Node.js (cross-platform) |
|
|
257
|
-
| Windows | WSL required | Experimental | Native |
|
|
258
|
-
| Hook protocol | JSON | JSON | Same |
|
|
259
|
-
| Command generator | None | None | `/ralph-interview` |
|
|
260
|
-
| Multi-agent | Manual | Experimental | `/ralph-orchestrator` |
|
|
261
|
-
| Orchestration patterns | None | None | 5 built-in patterns |
|
|
262
|
-
| Plugin format | `.claude-plugin` | `.codex/skills` | Both |
|
|
263
|
-
|
|
264
258
|
## Development
|
|
265
259
|
|
|
266
260
|
```bash
|
|
@@ -272,3 +266,9 @@ npx vitest # watch mode
|
|
|
272
266
|
## License
|
|
273
267
|
|
|
274
268
|
MIT
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
<p align="center">
|
|
273
|
+
Built for <a href="https://github.com/openai/codex">Codex CLI</a> and <a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a>
|
|
274
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graypark/ralph-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ralph Loop for Codex CLI & Claude Code — iterative dev loops with multi-agent orchestration, interactive interview, and stop hooks",
|
|
6
6
|
"license": "MIT",
|
|
@@ -181,6 +181,7 @@ The `## Codebase Patterns` section at the top is read first by each iteration to
|
|
|
181
181
|
- **No oversized stories**: Each story must be completable in ONE iteration. Split if too big.
|
|
182
182
|
- **Always use prd.json format**: Ensures compatibility with ralph-skills ecosystem.
|
|
183
183
|
- **Default promise is COMPLETE**: Use `<promise>COMPLETE</promise>` to match ralph-skills convention.
|
|
184
|
+
- **Always overwrite**: Never ask before overwriting prd.json or progress.txt. Just write them.
|
|
184
185
|
|
|
185
186
|
## Conversation Flow
|
|
186
187
|
|
|
@@ -202,6 +203,8 @@ Skip the "Ready?" prompt. Go straight to activation after showing the PRD briefl
|
|
|
202
203
|
|
|
203
204
|
When the user confirms (or quick-run), execute ALL of these steps in a SINGLE response. Do NOT stop between steps.
|
|
204
205
|
|
|
206
|
+
IMPORTANT: Always overwrite existing prd.json and progress.txt without asking. Do NOT check if they exist. Do NOT ask the user for confirmation before overwriting. Do NOT archive old files. Just write them.
|
|
207
|
+
|
|
205
208
|
### Step 1: Write prd.json via Bash
|
|
206
209
|
|
|
207
210
|
```bash
|