@graypark/ralph-codex 0.5.1 → 0.6.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 CHANGED
@@ -69,16 +69,16 @@ node bin/install.mjs --global
69
69
  /ralph-interview Refactor the auth module across 3 services, run immediately
70
70
  ```
71
71
 
72
- **Multi-phase pipeline:** When multiple phases are generated, choose how to run:
72
+ **Multi-phase tasks:** The interview generates `.ralph/prd.md` + `.ralph/progress.md` files. The loop reads these each iteration to track phases and items:
73
73
 
74
74
  ```
75
- Ready to run?
76
- - y → Pipeline mode: all phases run automatically (1 → 2 → 3)
77
- - step Manual mode: run one phase at a time, confirm between each
78
- - n → Copy-paste commands yourself
79
- - edit → Modify the generated commands
75
+ .ralph/
76
+ ├── prd.md # All phases and work items
77
+ └── progress.md # What's done, what's next, what's blocked
80
78
  ```
81
79
 
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
82
  ### `/ralph-orchestrator` — Multi-Agent Patterns
83
83
 
84
84
  Analyzes your task and recommends the best orchestration strategy:
package/lib/state.mjs CHANGED
@@ -8,7 +8,6 @@ const DEFAULT_STATE = {
8
8
  maxIterations: 20,
9
9
  currentIteration: 0,
10
10
  sessionId: "",
11
- queue: [],
12
11
  };
13
12
 
14
13
  export function getStatePath() {
@@ -75,40 +75,7 @@ export async function processStopHook(hookInput, readStateFn, writeStateFn) {
75
75
  stderr.push(
76
76
  `Ralph loop: max iterations (${state.maxIterations}) reached.\n`,
77
77
  );
78
-
79
- // On max iterations, also check queue for next phase
80
- const queue = Array.isArray(state.queue) ? state.queue : [];
81
- if (queue.length > 0) {
82
- const next = queue.shift();
83
- state.prompt = next.prompt;
84
- state.completionPromise = next.completionPromise || "TADA";
85
- state.maxIterations = next.maxIterations || 20;
86
- state.currentIteration = 0;
87
- state.queue = queue;
88
- await writeStateFn(state);
89
-
90
- stderr.push(
91
- `Ralph loop: advancing to next phase (${queue.length} remaining).\n`,
92
- );
93
- const reason = [
94
- state.prompt,
95
- "",
96
- "---",
97
- `Ralph Loop — new phase started (iteration 1/${state.maxIterations}). Previous phase hit max iterations. Work on the task above.`,
98
- ].join("\n");
99
- const output = { decision: "block", reason };
100
- if (state.completionPromise) {
101
- output.systemMessage = `Ralph phase started (${queue.length} more queued) | To complete: output <promise>${state.completionPromise}</promise>`;
102
- }
103
- return {
104
- exitCode: 0,
105
- stdout: JSON.stringify(output),
106
- stderr: stderr.join(""),
107
- };
108
- }
109
-
110
78
  state.active = false;
111
- state.queue = [];
112
79
  await writeStateFn(state);
113
80
  return { exitCode: 0, stdout: "", stderr: stderr.join("") };
114
81
  }
@@ -124,45 +91,7 @@ export async function processStopHook(hookInput, readStateFn, writeStateFn) {
124
91
  stderr.push(
125
92
  `Ralph loop: completion promise "${state.completionPromise}" detected.\n`,
126
93
  );
127
-
128
- // Check queue for next phase
129
- const queue = Array.isArray(state.queue) ? state.queue : [];
130
- if (queue.length > 0) {
131
- const next = queue.shift();
132
- state.prompt = next.prompt;
133
- state.completionPromise = next.completionPromise || "TADA";
134
- state.maxIterations = next.maxIterations || 20;
135
- state.currentIteration = 0;
136
- state.queue = queue;
137
- await writeStateFn(state);
138
-
139
- const phasesLeft = queue.length;
140
- stderr.push(
141
- `Ralph loop: advancing to next phase (${phasesLeft} remaining in queue).\n`,
142
- );
143
-
144
- const nextIterInfo =
145
- state.maxIterations > 0 ? `1/${state.maxIterations}` : "1";
146
- const reason = [
147
- state.prompt,
148
- "",
149
- "---",
150
- `Ralph Loop — new phase started (iteration ${nextIterInfo}). Work on the task above.`,
151
- ].join("\n");
152
-
153
- const output = { decision: "block", reason };
154
- if (state.completionPromise) {
155
- output.systemMessage = `Ralph phase started (${phasesLeft} more queued) | To complete: output <promise>${state.completionPromise}</promise> (ONLY when TRUE)`;
156
- }
157
- return {
158
- exitCode: 0,
159
- stdout: JSON.stringify(output),
160
- stderr: stderr.join(""),
161
- };
162
- }
163
-
164
94
  state.active = false;
165
- state.queue = [];
166
95
  await writeStateFn(state);
167
96
  return { exitCode: 0, stdout: "", stderr: stderr.join("") };
168
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graypark/ralph-codex",
3
- "version": "0.5.1",
3
+ "version": "0.6.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",
@@ -1,26 +1,27 @@
1
1
  ---
2
2
  name: ralph-interview
3
- description: "Interactive interview that generates optimized /ralph-loop commands from task descriptions"
3
+ description: "Interactive interview that generates optimized /ralph-loop commands with PRD-based phase tracking"
4
4
  ---
5
5
 
6
6
  # Ralph Interview — Command Generator
7
7
 
8
8
  You are an expert at crafting `/ralph-loop:ralph-loop` commands for the Ralph Loop plugin.
9
- When the user describes a task, conduct a brief interview to gather missing context, then generate a copy-paste-ready command.
9
+ When the user describes a task, conduct a brief interview to gather missing context, then generate a PRD + progress file pair and a single ralph-loop command.
10
10
 
11
11
  ## Core Principles
12
12
 
13
- - **Phase separation**: Analysis/research and implementation MUST be separate Phases.
14
- - **Self-correcting loops**: Every prompt must embed a "modify verify retry on failure" cycle.
13
+ - **PRD-driven**: All phases and items live in `.ralph/prd.md`. The loop prompt reads it each iteration.
14
+ - **Progress tracking**: `.ralph/progress.md` tracks what's done. Each iteration reads it to decide what's next.
15
+ - **Self-correcting loops**: Every prompt embeds "modify, verify, retry on failure" cycles.
15
16
  - **Escape hatches required**: Always specify what to do when stuck after N retries.
16
17
  - **Atomic commits**: Instruct a git commit per logical work unit.
17
- - **Objective completion criteria only**: Never use subjective criteria like "make it good." Use test passes, linter clears, checklist completion, or other verifiable conditions.
18
- - **Parallel when possible**: Use the ralph-orchestrator patterns to spawn subagents for independent work streams (exploration, multi-service changes, audits).
18
+ - **Objective completion criteria only**: No subjective criteria. Use test passes, linter clears, etc.
19
+ - **Parallel when possible**: Use the ralph-orchestrator patterns for independent work streams.
19
20
 
20
21
  ## Interview Process
21
22
 
22
23
  When the user provides a task description, ask **concise questions** for any missing items below.
23
- Skip items already covered. Bundle questions — max 35 per round, one round only if possible.
24
+ Skip items already covered. Bundle questions — max 3-5 per round, one round only if possible.
24
25
 
25
26
  ### Required Information
26
27
 
@@ -41,10 +42,10 @@ Skip items already covered. Bundle questions — max 3–5 per round, one round
41
42
 
42
43
  ### When to Split into Phases
43
44
 
44
- - **Research needed first** Phase 1: Analysis, Phase 2: Implementation
45
- - **More than 8 items** Split by nature (e.g., P1/P2, frontend/backend)
46
- - **Dependencies exist** Prerequisite work in a prior Phase
47
- - **5 or fewer simple items** Single Phase is fine
45
+ - **Research needed first** -> Phase 1: Analysis, Phase 2: Implementation
46
+ - **More than 8 items** -> Split by nature (e.g., P1/P2, frontend/backend)
47
+ - **Dependencies exist** -> Prerequisite work in a prior Phase
48
+ - **5 or fewer simple items** -> Single Phase is fine
48
49
 
49
50
  ### When to Use Subagents (via ralph-orchestrator)
50
51
 
@@ -60,160 +61,123 @@ Evaluate the task against the ralph-orchestrator decision matrix:
60
61
  | Needs cross-file understanding | -1 |
61
62
  | Multiple services/repos | +3 |
62
63
 
63
- - **Score >= 3** Use parallel subagents. Pick from orchestrator patterns:
64
- - _Parallel Explore Sequential Implement_ for research-heavy tasks
65
- - _Divide by Ownership_ for multi-service changes
66
- - _Fan-Out / Fan-In_ for comprehensive audits
67
- - _Scout-Then-Execute_ for unfamiliar codebases
68
- - **Score 0–2** → Sequential loop, optional scout phase
69
- - **Score < 0** → Single sequential Ralph Loop
70
-
71
- When subagents are recommended, embed subagent spawn instructions directly in the generated ralph-loop prompt using Codex's experimental multi-agent capabilities.
64
+ - **Score >= 3**: Recommend parallel subagents within the ralph-loop prompt
65
+ - **Score 0-2**: Sequential loop, optional scout phase
66
+ - **Score < 0**: Single sequential Ralph Loop
72
67
 
73
68
  ### Recommended max-iterations
74
69
 
75
70
  | Task type | Iterations |
76
71
  | ---------------------------------------------- | ---------- |
77
- | Research only (file reads, pattern extraction) | 35 |
78
- | Simple fixes, 13 items | 510 |
79
- | Medium scope, 47 items | 1020 |
80
- | Large scope, 8+ items | 2030 |
81
- | TDD-based feature implementation | 1530 |
82
- | Full refactor / migration | 3050 |
72
+ | Research only (file reads, pattern extraction) | 3-5 |
73
+ | Simple fixes, 1-3 items | 5-10 |
74
+ | Medium scope, 4-7 items | 10-20 |
75
+ | Large scope, 8+ items | 20-30 |
76
+ | TDD-based feature implementation | 15-30 |
77
+ | Full refactor / migration | 30-50 |
83
78
 
84
- **Rule of thumb:** `item_count × 2 + 5` as baseline. Add weight for complex verification cycles.
79
+ **Rule of thumb:** `item_count x 2 + 5` as baseline.
85
80
 
86
- ## Prompt Template
81
+ ## PRD + Progress Pattern
87
82
 
88
- Every generated command MUST follow this structure:
83
+ This is the core mechanism for multi-phase work. Instead of embedding all phases in one prompt or chaining state files, generate two files that the loop reads each iteration.
89
84
 
90
- ### Single Phase
85
+ ### .ralph/prd.md
91
86
 
92
- ```
93
- /ralph-loop:ralph-loop "## Goal
94
- [One-line summary of the task]
87
+ Contains all phases and work items:
95
88
 
96
- ## References
97
- [Files, patterns, or docs to consult. Omit section if none.]
98
-
99
- ## Work Cycle (repeat for each item)
100
- 1. [How to pick the next incomplete item]
101
- 2. [Specific modification to make]
102
- 3. [Run verification command]
103
- 4. On failure → read the error, fix, go back to step 3. Max N retries.
104
- 5. On pass → [state update action]
105
- 6. git add -A && git commit -m '[convention-compliant message]'
106
- 7. Return to step 1 for the next item.
107
-
108
- ## Work Items
109
- - [Item 1]
110
- - [Item 2]
111
- - ...
89
+ ```markdown
90
+ # PRD: [Task Title]
112
91
 
113
- ## When Stuck
114
- After [N] retries on any single item:
115
- - [Fallback: document issue / skip with TODO / suggest alternative]
92
+ ## Phase 1: [Phase Name]
93
+
94
+ - [ ] Item 1 description
95
+ - [ ] Item 2 description
96
+ - [ ] Item 3 description
97
+
98
+ ## Phase 2: [Phase Name]
99
+
100
+ - [ ] Item 4 description
101
+ - [ ] Item 5 description
116
102
 
117
103
  ## Completion Criteria
104
+
118
105
  - [Objective condition 1]
119
106
  - [Objective condition 2]
120
107
  - [Verification command] passes
121
-
122
- Output <promise>[PROMISE]</promise>" --max-iterations [N] --completion-promise "[PROMISE]"
123
108
  ```
124
109
 
125
- ### With Subagents
110
+ ### .ralph/progress.md
126
111
 
127
- When the orchestrator score is >= 3, embed subagent instructions in the prompt:
112
+ Updated by the loop after each completed item:
128
113
 
129
- ```
130
- /ralph-loop:ralph-loop "## Goal
131
- [Task summary]
114
+ ```markdown
115
+ # Progress
132
116
 
133
- ## Phase 1 — Parallel Exploration
134
- Spawn these subagents simultaneously:
117
+ ## Completed
135
118
 
136
- 1. Agent 'scan-frontend' (subagent_type: Explore, run_in_background: true):
137
- Search src/frontend/** for [pattern]. Write findings to .ralph/reports/frontend.md
119
+ - [x] Item 1 commit abc1234
120
+ - [x] Item 2 commit def5678
138
121
 
139
- 2. Agent 'scan-backend' (subagent_type: Explore, run_in_background: true):
140
- Search src/backend/** for [pattern]. Write findings to .ralph/reports/backend.md
122
+ ## Current Phase
141
123
 
142
- After ALL agents complete, merge reports into .ralph/reports/merged.md
124
+ Phase 1: [Phase Name]
143
125
 
144
- ## Phase 2 — Sequential Implementation
145
- Read .ralph/reports/merged.md, then for each item:
146
- 1. Apply the fix
147
- 2. Run [verification command]
148
- 3. git commit
126
+ ## Blocked
149
127
 
150
- ## Completion Criteria
151
- - All items from merged.md addressed
152
- - [Verification command] passes
128
+ (none)
153
129
 
154
- Output <promise>[PROMISE]</promise>" --max-iterations [N] --completion-promise "[PROMISE]"
155
- ```
130
+ ## Next
156
131
 
157
- ### Multi-Phase (Pipeline Mode — DEFAULT)
158
-
159
- When a task requires multiple phases, generate a **single** `/ralph-loop:ralph-loop` command with a `queue` in the state file. The stop hook automatically advances to the next phase when a completion promise is detected.
160
-
161
- **How to set up pipeline mode:**
162
-
163
- Create the state file at `.codex/ralph-loop.state.json` with a queue:
164
-
165
- ```json
166
- {
167
- "active": true,
168
- "prompt": "Phase 1 prompt here...",
169
- "completionPromise": "PHASE1_DONE",
170
- "maxIterations": 10,
171
- "currentIteration": 0,
172
- "sessionId": "",
173
- "queue": [
174
- {
175
- "prompt": "Phase 2 prompt here...",
176
- "completionPromise": "PHASE2_DONE",
177
- "maxIterations": 20
178
- },
179
- {
180
- "prompt": "Phase 3 prompt here...",
181
- "completionPromise": "TADA",
182
- "maxIterations": 15
183
- }
184
- ]
185
- }
132
+ Item 3
186
133
  ```
187
134
 
188
- Then start with:
135
+ ### The Loop Prompt
136
+
137
+ The ralph-loop prompt is always the same structure:
189
138
 
190
139
  ```
191
- /ralph-loop:ralph-loop "Phase 1 prompt here..." --max-iterations 10 --completion-promise "PHASE1_DONE"
192
- ```
140
+ /ralph-loop:ralph-loop "## Instructions
141
+ 1. Read .ralph/prd.md for the full task plan
142
+ 2. Read .ralph/progress.md for current status
143
+ 3. Pick the next incomplete item (first unchecked item in current phase)
144
+ 4. If current phase is complete, advance to next phase and update progress
145
+ 5. Implement the item
146
+ 6. Run verification: [command]
147
+ 7. On failure: read error, fix, retry (max 3 times per item)
148
+ 8. On success: update .ralph/progress.md (mark item done, note commit hash)
149
+ 9. git add -A && git commit -m '[convention]: [item description]'
150
+ 10. If ALL items in ALL phases are done and verification passes, output <promise>TADA</promise>
193
151
 
194
- When Phase 1 completes, the stop hook will automatically:
152
+ ## When Stuck
153
+ After 3 retries on any item:
154
+ - Add it to Blocked section in .ralph/progress.md with error details
155
+ - Move to next item
156
+ - Document in .ralph/progress.md
195
157
 
196
- 1. Detect the completion promise
197
- 2. Load Phase 2 from the queue
198
- 3. Re-inject Phase 2's prompt as a new loop — no user intervention needed
158
+ ## References
159
+ [list of reference files]
199
160
 
200
- ### Multi-Phase (Manual Mode)
161
+ ## Verification
162
+ [verification command]" --max-iterations [N] --completion-promise "TADA"
163
+ ```
201
164
 
202
- If the user chooses manual mode, generate each Phase as a separate `/ralph-loop:ralph-loop` command:
165
+ ### Why This Works
203
166
 
204
- - State Phase number and dependencies explicitly.
205
- - Link prior Phase outputs as references in the next Phase.
206
- - Use distinct completion promises per Phase (e.g., `PHASE1_DONE`, `PHASE2_DONE`, `TADA`).
167
+ - **Resumable**: Stop anytime. Progress is on disk. Restart the same command and it picks up where it left off.
168
+ - **Inspectable**: Open `.ralph/progress.md` to see exactly what's done and what's next.
169
+ - **Phase transitions are natural**: The agent reads the PRD, sees Phase 1 is done, moves to Phase 2.
170
+ - **No state file conflicts**: The ralph-loop state file only manages the loop itself, not the task.
171
+ - **Fresh context each iteration**: Agent re-reads PRD and progress, no context rot.
207
172
 
208
173
  ## Output Format
209
174
 
210
175
  Structure the final output as:
211
176
 
212
177
  1. **Task summary** — One paragraph describing the overall work.
213
- 2. **Phase rationale** — One line per Phase explaining why it's separated.
214
- 3. **Command blocks** — Copy-paste-ready code blocks.
215
- 4. **Execution order** — Run order and notes between Phases.
216
- 5. **Cancel reminder** — `/ralph-loop:cancel-ralph`
178
+ 2. **PRD preview** — Show the .ralph/prd.md content.
179
+ 3. **Loop command** — The single ralph-loop command to run.
180
+ 4. **Execution prompt** — Ask how to proceed.
217
181
 
218
182
  ### Example Output
219
183
 
@@ -221,100 +185,93 @@ Structure the final output as:
221
185
  ## Task Summary
222
186
  Fix 3 P1 + 7 P2 responsive issues based on the audit report.
223
187
 
224
- ## Phase Rationale
225
- - Phase 1 (analysis): Extract responsive patterns from codebase to create a reference doc
226
- - Phase 2 (implementation): Apply fixes in P1 → P2 order using the reference
188
+ ## PRD (.ralph/prd.md)
189
+ # PRD: Responsive Fixes
190
+ ## Phase 1: P1 Critical
191
+ - [ ] Fix header overflow on mobile
192
+ - [ ] Fix nav collapse breakpoint
193
+ - [ ] Fix card grid stacking
227
194
 
228
- ### Phase 1 Pattern Analysis
229
- ` ` `
230
- /ralph-loop:ralph-loop "..." --max-iterations 5 --completion-promise "PHASE1_DONE"
231
- ` ` `
195
+ ## Phase 2: P2 Important
196
+ - [ ] Adjust sidebar width at 768px
197
+ ...
232
198
 
233
- ### Phase 2 — P1 + P2 Fixes
199
+ ## Command
234
200
  ` ` `
235
- /ralph-loop:ralph-loop "..." --max-iterations 20 --completion-promise "TADA"
201
+ /ralph-loop:ralph-loop "..." --max-iterations 25 --completion-promise "TADA"
236
202
  ` ` `
237
203
 
238
- ## Execution Order
239
- 1. Run Phase 1 → confirm completion
240
- 2. Run Phase 2
241
- To cancel at any time: `/ralph-loop:cancel-ralph`
204
+ ---
205
+ **Ready to run?**
206
+ - **y** Write PRD + progress files and start the loop
207
+ - **n** Files and command are above, set up manually
208
+ - **edit** → Tell me what to change
242
209
  ```
243
210
 
244
211
  ## Rules
245
212
 
246
- - **No subjective completion criteria**: Banned phrases "works well", "looks clean", "properly done."
213
+ - **No subjective completion criteria**: Banned phrases: "works well", "looks clean", "properly done."
247
214
  - **No prompt without verification**: At least one automated check (tsc, test, lint, build) is mandatory.
248
- - **No missing namespace**: Always write `/ralph-loop:ralph-loop` and `/ralph-loop:cancel-ralph`.
249
- - **No missing escape hatch**: Every Phase MUST have a "When Stuck" section.
250
- - **No oversized single Phase**: Do not put more than 8 independent items in one Phase. Recommend splitting.
215
+ - **No missing escape hatch**: Every prompt MUST have a "When Stuck" section.
216
+ - **No oversized single Phase**: Do not put more than 8 independent items in one Phase. Split them.
217
+ - **Always generate .ralph/prd.md and .ralph/progress.md**: These are mandatory for multi-phase tasks.
251
218
 
252
219
  ## Conversation Flow
253
220
 
254
221
  ### Standard Flow
255
222
 
256
223
  ```
257
- [User] Describes the task
258
- [Assistant] Asks interview questions (1 round, max 5 questions)
259
- [User] Answers
260
- [Assistant] Generates Phase plan + command blocks
261
- [Assistant] → Asks: "Ready to run?" with options
262
- [User] Chooses an option
263
- [Assistant] → Executes accordingly
224
+ [User] -> Describes the task
225
+ [Assistant] -> Asks interview questions (1 round, max 5 questions)
226
+ [User] -> Answers
227
+ [Assistant] -> Generates PRD + command + asks "Ready to run?"
228
+ [User] -> "y"
229
+ [Assistant] -> Writes .ralph/ files via Bash, then invokes ralph-loop skill
264
230
  ```
265
231
 
266
232
  ### Quick-Run Flow
267
233
 
268
- If the user includes phrases like "run immediately", "just do it", "run it", "바로 실행", "바로 시작", or "--run" in their initial message:
234
+ If the user includes "run immediately", "just do it", "run it", "바로 실행", "바로 시작", or "--run":
269
235
 
270
- 1. Conduct the interview as normal (skip if enough context is provided).
271
- 2. Generate the command blocks.
272
- 3. For multi-phase: write state file with queue via Bash.
273
- 4. Show the generated command briefly.
274
- 5. Immediately call the Skill tool with skill="ralph-loop:ralph-loop" and the Phase 1 args. Do NOT wait for user confirmation.
236
+ 1. Conduct the interview (skip if enough context).
237
+ 2. Generate PRD + command. Show briefly.
238
+ 3. Write .ralph/prd.md and .ralph/progress.md via Bash tool.
239
+ 4. Invoke ralph-loop skill immediately. Do NOT stop after step 3.
275
240
 
276
- ### Post-Generation Action
241
+ ### Execution — MANDATORY SKILL INVOCATION
277
242
 
278
- After generating all command blocks, ALWAYS end with this prompt:
243
+ When the user confirms with "y", "yes", "run", etc., you MUST:
279
244
 
280
- **For multi-phase tasks:**
245
+ 1. Create .ralph/ directory and write prd.md + progress.md via Bash tool
246
+ 2. Actually invoke the ralph-loop skill to start the loop
281
247
 
282
- ```
283
- ---
284
- **Ready to run?**
285
- - **y** / **yes** / **실행** → Pipeline mode: run all phases automatically (Phase 1 → 2 → 3, no stops between phases)
286
- - **step** / **단계별** → Manual mode: run Phase 1 only, I'll ask before each next phase
287
- - **n** / **no** / **아니오** → Commands are above, copy-paste when ready
288
- - **edit** / **수정** → Tell me what to change
289
- ```
248
+ WRONG (do NOT do this):
290
249
 
291
- **For single-phase tasks:**
250
+ - Printing the command as text and stopping
251
+ - Writing files and saying "ready" or "set up"
252
+ - Telling the user to copy-paste
292
253
 
293
- ```
294
- ---
295
- **Ready to run?**
296
- - **y** / **yes** / **실행** → Start immediately
297
- - **n** / **no** / **아니오** → Command is above, copy-paste when ready
298
- - **edit** / **수정** → Tell me what to change
299
- ```
300
-
301
- ### Execution Modes
254
+ RIGHT (you MUST do this):
302
255
 
303
- IMPORTANT: When the user confirms execution, you MUST actually start the loop by calling the Skill tool with skill "ralph-loop:ralph-loop" and the generated args. Do NOT just write a state file or print the command. The Skill tool invocation is what triggers the real loop.
256
+ - Write the .ralph/ files via Bash
257
+ - Then invoke ralph-loop skill so the loop actually starts
304
258
 
305
- **Pipeline mode (default for "y"):**
259
+ #### How to invoke ralph-loop
306
260
 
307
- 1. For multi-phase: write the state file with queue via Bash
308
- 2. Call the Skill tool: skill="ralph-loop:ralph-loop", args="<Phase 1 prompt> --max-iterations N --completion-promise PROMISE"
309
- 3. The stop hook handles phase transitions automatically
261
+ **Claude Code**: Use the Skill tool:
310
262
 
311
- **Manual mode ("step"):**
263
+ ```
264
+ Skill tool call:
265
+ skill: "ralph-loop:ralph-loop"
266
+ args: "<prompt>" --max-iterations <N> --completion-promise "TADA"
267
+ ```
312
268
 
313
- 1. Call the Skill tool: skill="ralph-loop:ralph-loop", args="<Phase 1 prompt> --max-iterations N --completion-promise PROMISE"
314
- 2. When Phase 1 completes, ask user before calling Skill tool again for Phase 2
269
+ **Codex CLI**: Reference the skill via markdown link:
315
270
 
316
- **Single-phase ("y"):**
271
+ ```
272
+ [$ralph-loop](~/.codex/skills/ralph-loop/SKILL.md) "<prompt>" --max-iterations <N> --completion-promise "TADA"
273
+ ```
317
274
 
318
- 1. Call the Skill tool: skill="ralph-loop:ralph-loop", args="<prompt> --max-iterations N --completion-promise PROMISE"
275
+ Note: On Windows use `%USERPROFILE%\.codex\skills\ralph-loop\SKILL.md`. If CODEX_HOME is set, use that.
319
276
 
320
- After the user says "y", "yes", or similar, you MUST immediately use the Skill tool. Do not just describe what would happen. Do not tell the user to copy-paste. Actually invoke the skill.
277
+ If you do not actually invoke the skill, the loop will not start.