@graypark/ralph-codex 0.7.0 → 0.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graypark/ralph-codex",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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",
@@ -6,12 +6,12 @@ description: "Interactive interview that generates optimized ralph-loop commands
6
6
  # Ralph Interview — Command Generator
7
7
 
8
8
  You are an expert at crafting 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 PRD + progress file pair and a ralph-loop command.
9
+ When the user describes a task, conduct a brief interview to gather missing context, then generate a PRD, activate the loop, and start working immediately.
10
10
 
11
11
  ## Core Principles
12
12
 
13
- - **PRD-driven**: All phases and items live in a PRD file. The loop reads it each iteration.
14
- - **Progress tracking**: A progress file tracks what's done. Each iteration reads it to decide what's next.
13
+ - **PRD-driven**: All phases and items live in prd.json. The loop reads it each iteration.
14
+ - **Progress tracking**: progress.txt tracks what is done. Each iteration reads it to decide what is next.
15
15
  - **One story per iteration**: Each loop iteration implements ONE user story, commits, and updates progress.
16
16
  - **Self-correcting**: Every prompt embeds "modify, verify, retry on failure" cycles.
17
17
  - **Escape hatches required**: Always specify what to do when stuck after N retries.
@@ -113,7 +113,7 @@ Each story MUST be completable in ONE iteration (one context window):
113
113
 
114
114
  - **Right-sized**: Add a DB column, create one component, update one endpoint
115
115
  - **Too big (split)**: "Build entire dashboard", "Add authentication", "Refactor API"
116
- - **Rule of thumb**: If you can't describe the change in 2-3 sentences, split it
116
+ - **Rule of thumb**: If you cannot describe the change in 2-3 sentences, split it
117
117
 
118
118
  ### Story Ordering
119
119
 
@@ -153,45 +153,6 @@ An append-only log file that tracks iteration history:
153
153
 
154
154
  The `## Codebase Patterns` section at the top is read first by each iteration to avoid repeating mistakes.
155
155
 
156
- ## The Loop Prompt
157
-
158
- The ralph-loop prompt should follow this standard pattern:
159
-
160
- ```
161
- /ralph-loop:ralph-loop "## Instructions
162
- 1. Read prd.json for the full task plan
163
- 2. Read progress.txt for current status (check Codebase Patterns first)
164
- 3. Check you are on the correct branch from branchName. If not, create it from main.
165
- 4. Pick the highest priority story where passes is false
166
- 5. Implement that ONE story
167
- 6. Run verification: [command]
168
- 7. On failure: read error, fix, retry (max 3 times)
169
- 8. On success: commit with message 'feat: [Story ID] - [Story Title]'
170
- 9. Update prd.json to set passes: true for completed story
171
- 10. Append progress to progress.txt with learnings
172
- 11. If ALL stories have passes: true, output <promise>COMPLETE</promise>
173
-
174
- ## When Stuck
175
- After 3 retries on any story:
176
- - Set notes field in prd.json with error details
177
- - Move to next story by priority
178
- - Document in progress.txt
179
-
180
- ## References
181
- [list of reference files]
182
-
183
- ## Verification
184
- [verification command]" --max-iterations [N] --completion-promise "COMPLETE"
185
- ```
186
-
187
- ### Why This Works
188
-
189
- - **Resumable**: Stop anytime. Progress is in prd.json and progress.txt. Restart and it picks up the next `passes: false` story.
190
- - **Inspectable**: Open prd.json to see status of every story. Open progress.txt for detailed history.
191
- - **Compatible**: Works with ralph-skills:ralph, ralph-skills:prd, and the official ralph-loop plugin.
192
- - **Fresh context each iteration**: Agent re-reads PRD and progress, no context rot.
193
- - **One story per iteration**: Keeps each iteration focused and within context limits.
194
-
195
156
  ## Compatibility with Existing Skills
196
157
 
197
158
  ### ralph-skills:prd (marketplace)
@@ -209,60 +170,8 @@ After 3 retries on any story:
209
170
 
210
171
  ### Official ralph-loop plugin (claude-plugins-official)
211
172
 
212
- - Our stop hook (Node.js) and the official stop hook (bash) can conflict if both installed
213
- - If the official ralph-loop plugin is installed, our interview should generate commands using `/ralph-loop:ralph-loop` (official namespace) instead of ours
214
- - The PRD and progress files work with either stop hook
215
-
216
- ### Detection and Adaptation
217
-
218
- When generating commands, check which ralph-loop is available:
219
-
220
- 1. If official `ralph-loop:ralph-loop` is in available skills -> use it
221
- 2. If only our ralph-codex is installed -> use our commands
222
- 3. PRD format is the same regardless of which loop engine is used
223
-
224
- ## Output Format
225
-
226
- Structure the final output as:
227
-
228
- 1. **Task summary** — One paragraph describing the overall work.
229
- 2. **PRD preview** — Show the prd.json content.
230
- 3. **Story count** — "N stories across M phases"
231
- 4. **Loop command** — The ralph-loop command to run.
232
- 5. **Execution prompt** — Ask how to proceed.
233
-
234
- ### Example Output
235
-
236
- ```
237
- ## Task Summary
238
- Add task priority system with database field, UI badges, and filtering.
239
-
240
- ## PRD (prd.json)
241
- {
242
- "project": "TaskApp",
243
- "branchName": "ralph/task-priority",
244
- "description": "Task priority system",
245
- "userStories": [
246
- { "id": "US-001", "title": "Add priority field to tasks table", ... },
247
- { "id": "US-002", "title": "Display priority badges", ... },
248
- { "id": "US-003", "title": "Add priority selector", ... },
249
- { "id": "US-004", "title": "Filter by priority", ... }
250
- ]
251
- }
252
-
253
- 4 stories, ~10 iterations recommended.
254
-
255
- ## Command
256
- ` ` `
257
- /ralph-loop:ralph-loop "..." --max-iterations 15 --completion-promise "COMPLETE"
258
- ` ` `
259
-
260
- ---
261
- **Ready to run?**
262
- - **y** → Write prd.json + progress.txt and start the loop
263
- - **n** → Files and command are above, set up manually
264
- - **edit** → Tell me what to change
265
- ```
173
+ - If the official plugin is installed, this interview works with its stop hook
174
+ - PRD and progress files work with either stop hook
266
175
 
267
176
  ## Rules
268
177
 
@@ -275,60 +184,84 @@ Add task priority system with database field, UI badges, and filtering.
275
184
 
276
185
  ## Conversation Flow
277
186
 
278
- ### Standard Flow
279
-
280
187
  ```
281
- [User] -> Describes the task
282
- [Assistant] -> Asks interview questions (1 round, max 5 questions)
188
+ [User] -> /ralph-interview "build X feature"
189
+ [Assistant] -> Interview questions (1 round, skip if context is sufficient)
283
190
  [User] -> Answers
284
- [Assistant] -> Generates prd.json + command + asks "Ready to run?"
191
+ [Assistant] -> Shows PRD briefly, asks "Ready?"
285
192
  [User] -> "y"
286
- [Assistant] -> Writes prd.json + progress.txt, then invokes ralph-loop skill
193
+ [Assistant] -> Writes files + activates loop + starts US-001 IN THE SAME RESPONSE
287
194
  ```
288
195
 
289
- ### Quick-Run Flow
196
+ ### Quick-Run
290
197
 
291
198
  If the user includes "run immediately", "just do it", "run it", "바로 실행", "바로 시작", or "--run":
199
+ Skip the "Ready?" prompt. Go straight to activation after showing the PRD briefly.
292
200
 
293
- 1. Conduct the interview (skip if enough context).
294
- 2. Generate prd.json + command. Show briefly.
295
- 3. Write prd.json and progress.txt via Bash tool.
296
- 4. Invoke ralph-loop skill immediately. Do NOT stop after step 3.
201
+ ## Activation Sequence
297
202
 
298
- ### Execution MANDATORY SKILL INVOCATION
203
+ When the user confirms (or quick-run), execute ALL of these steps in a SINGLE response. Do NOT stop between steps.
299
204
 
300
- When the user confirms with "y", "yes", "run", etc., you MUST:
205
+ ### Step 1: Write prd.json via Bash
301
206
 
302
- 1. Write prd.json and initialize progress.txt via Bash tool
303
- 2. Actually invoke the ralph-loop skill to start the loop
207
+ ```bash
208
+ cat > prd.json << 'EOF'
209
+ { ... generated PRD ... }
210
+ EOF
211
+ ```
304
212
 
305
- WRONG (do NOT do this):
213
+ ### Step 2: Write progress.txt via Bash
306
214
 
307
- - Printing the command as text and stopping
308
- - Writing files and saying "ready" or "set up"
309
- - Telling the user to copy-paste
215
+ ```bash
216
+ cat > progress.txt << 'EOF'
217
+ ## Codebase Patterns
218
+ (none yet)
219
+ EOF
220
+ ```
310
221
 
311
- RIGHT (you MUST do this):
222
+ ### Step 3: Activate the stop hook via Bash
312
223
 
313
- - Write the files via Bash
314
- - Then invoke the ralph-loop skill so the loop actually starts
224
+ Write the ralph-loop state file that makes the stop hook intercept session exits:
315
225
 
316
- #### How to invoke ralph-loop
226
+ ```bash
227
+ mkdir -p .codex
228
+ cat > .codex/ralph-loop.state.json << 'EOF'
229
+ {
230
+ "active": true,
231
+ "prompt": "Read prd.json for task plan. Read progress.txt for status (Codebase Patterns first). Check correct branch from branchName. If not on it, create from main. Pick highest priority story where passes is false. Implement that ONE story. Run verification: <VERIFY_CMD>. On failure: fix and retry, max 3 times. On success: commit with feat: [Story ID] - [Title]. Update prd.json: set passes to true. Append to progress.txt with learnings. If ALL stories pass: output <promise>COMPLETE</promise>. When stuck: set notes in prd.json, skip to next story.",
232
+ "completionPromise": "COMPLETE",
233
+ "maxIterations": <N>,
234
+ "currentIteration": 0,
235
+ "sessionId": ""
236
+ }
237
+ EOF
238
+ ```
317
239
 
318
- **Claude Code**: Use the Skill tool:
240
+ Replace `<VERIFY_CMD>` with the actual verification command and `<N>` with the recommended max iterations.
319
241
 
320
- ```
321
- Skill tool call:
322
- skill: "ralph-loop:ralph-loop"
323
- args: "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
324
- ```
242
+ ### Step 4: START WORKING ON US-001 IMMEDIATELY
325
243
 
326
- **Codex CLI**: Reference the skill via markdown link:
244
+ This is the critical step. After writing files, you MUST begin actual work in the SAME response:
327
245
 
328
- ```
329
- [$ralph-loop](~/.codex/skills/ralph-loop/SKILL.md) "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
330
- ```
246
+ 1. Read the prd.json you just wrote
247
+ 2. Create/checkout the branch from branchName
248
+ 3. Pick the first story (US-001)
249
+ 4. Implement it — write real code, make real changes
250
+ 5. Run the verification command
251
+ 6. Commit the changes
252
+ 7. Update prd.json (set passes: true)
253
+ 8. Append to progress.txt
254
+
255
+ Do NOT:
256
+
257
+ - Say "loop is now active" and stop
258
+ - Say "starting work on US-001" and stop
259
+ - Print a summary and wait for user input
260
+ - Ask if the user wants to proceed
331
261
 
332
- Note: On Windows use `%USERPROFILE%\.codex\skills\ralph-loop\SKILL.md`. If CODEX_HOME is set, use that.
262
+ DO:
333
263
 
334
- If you do not actually invoke the skill, the loop will not start.
264
+ - Actually write code
265
+ - Actually run tests
266
+ - Actually commit
267
+ - The stop hook will handle continuation to US-002 when you finish