@graypark/ralph-codex 0.6.0 → 0.7.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/package.json +1 -1
- package/skills/ralph-interview/SKILL.md +154 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graypark/ralph-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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,22 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ralph-interview
|
|
3
|
-
description: "Interactive interview that generates optimized
|
|
3
|
+
description: "Interactive interview that generates optimized ralph-loop commands with PRD-based phase tracking. Compatible with ralph-skills prd.json format."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Ralph Interview — Command Generator
|
|
7
7
|
|
|
8
|
-
You are an expert at crafting
|
|
9
|
-
When the user describes a task, conduct a brief interview to gather missing context, then generate a PRD + progress file pair and a
|
|
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.
|
|
10
10
|
|
|
11
11
|
## Core Principles
|
|
12
12
|
|
|
13
|
-
- **PRD-driven**: All phases and items live in
|
|
14
|
-
- **Progress tracking**:
|
|
15
|
-
- **
|
|
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.
|
|
15
|
+
- **One story per iteration**: Each loop iteration implements ONE user story, commits, and updates progress.
|
|
16
|
+
- **Self-correcting**: Every prompt embeds "modify, verify, retry on failure" cycles.
|
|
16
17
|
- **Escape hatches required**: Always specify what to do when stuck after N retries.
|
|
17
|
-
- **Atomic commits**: Instruct a git commit per logical work unit.
|
|
18
18
|
- **Objective completion criteria only**: No subjective criteria. Use test passes, linter clears, etc.
|
|
19
|
-
- **Parallel when possible**: Use
|
|
19
|
+
- **Parallel when possible**: Use ralph-orchestrator patterns for independent work streams.
|
|
20
20
|
|
|
21
21
|
## Interview Process
|
|
22
22
|
|
|
@@ -76,134 +76,190 @@ Evaluate the task against the ralph-orchestrator decision matrix:
|
|
|
76
76
|
| TDD-based feature implementation | 15-30 |
|
|
77
77
|
| Full refactor / migration | 30-50 |
|
|
78
78
|
|
|
79
|
-
**Rule of thumb:** `
|
|
79
|
+
**Rule of thumb:** `story_count x 2 + 5` as baseline.
|
|
80
|
+
|
|
81
|
+
## PRD Format: prd.json (ralph-skills compatible)
|
|
82
|
+
|
|
83
|
+
Generate PRDs in the **prd.json** format used by ralph-skills. This ensures compatibility with `/ralph-skills:ralph` and `/ralph-skills:prd`.
|
|
84
|
+
|
|
85
|
+
### prd.json
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"project": "[Project Name]",
|
|
90
|
+
"branchName": "ralph/[feature-name]",
|
|
91
|
+
"description": "[Feature description]",
|
|
92
|
+
"userStories": [
|
|
93
|
+
{
|
|
94
|
+
"id": "US-001",
|
|
95
|
+
"title": "[Story title]",
|
|
96
|
+
"description": "As a [user], I want [feature] so that [benefit]",
|
|
97
|
+
"acceptanceCriteria": [
|
|
98
|
+
"Specific verifiable criterion",
|
|
99
|
+
"Another criterion",
|
|
100
|
+
"Typecheck passes"
|
|
101
|
+
],
|
|
102
|
+
"priority": 1,
|
|
103
|
+
"passes": false,
|
|
104
|
+
"notes": ""
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
80
109
|
|
|
81
|
-
|
|
110
|
+
### Story Sizing Rules
|
|
82
111
|
|
|
83
|
-
|
|
112
|
+
Each story MUST be completable in ONE iteration (one context window):
|
|
84
113
|
|
|
85
|
-
|
|
114
|
+
- **Right-sized**: Add a DB column, create one component, update one endpoint
|
|
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
|
|
86
117
|
|
|
87
|
-
|
|
118
|
+
### Story Ordering
|
|
88
119
|
|
|
89
|
-
|
|
90
|
-
# PRD: [Task Title]
|
|
120
|
+
Stories execute in priority order. Dependencies first:
|
|
91
121
|
|
|
92
|
-
|
|
122
|
+
1. Schema/database changes
|
|
123
|
+
2. Backend logic / server actions
|
|
124
|
+
3. UI components that use the backend
|
|
125
|
+
4. Aggregation views / dashboards
|
|
93
126
|
|
|
94
|
-
|
|
95
|
-
- [ ] Item 2 description
|
|
96
|
-
- [ ] Item 3 description
|
|
127
|
+
### Acceptance Criteria Rules
|
|
97
128
|
|
|
98
|
-
|
|
129
|
+
- MUST be verifiable, not vague
|
|
130
|
+
- Always include: `"Typecheck passes"` (or equivalent verification)
|
|
131
|
+
- For UI stories: add `"Verify in browser"` or equivalent
|
|
132
|
+
- Bad: "Works correctly", "Good UX"
|
|
133
|
+
- Good: "Button shows confirmation dialog before deleting", "Filter persists in URL params"
|
|
99
134
|
|
|
100
|
-
|
|
101
|
-
- [ ] Item 5 description
|
|
135
|
+
### progress.txt
|
|
102
136
|
|
|
103
|
-
|
|
137
|
+
An append-only log file that tracks iteration history:
|
|
104
138
|
|
|
105
|
-
- [Objective condition 1]
|
|
106
|
-
- [Objective condition 2]
|
|
107
|
-
- [Verification command] passes
|
|
108
139
|
```
|
|
140
|
+
## Codebase Patterns
|
|
141
|
+
- [Reusable patterns discovered during iteration]
|
|
109
142
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Updated by the loop after each completed item:
|
|
113
|
-
|
|
114
|
-
```markdown
|
|
115
|
-
# Progress
|
|
116
|
-
|
|
117
|
-
## Completed
|
|
118
|
-
|
|
119
|
-
- [x] Item 1 — commit abc1234
|
|
120
|
-
- [x] Item 2 — commit def5678
|
|
121
|
-
|
|
122
|
-
## Current Phase
|
|
123
|
-
|
|
124
|
-
Phase 1: [Phase Name]
|
|
125
|
-
|
|
126
|
-
## Blocked
|
|
127
|
-
|
|
128
|
-
(none)
|
|
129
|
-
|
|
130
|
-
## Next
|
|
143
|
+
---
|
|
131
144
|
|
|
132
|
-
|
|
145
|
+
## [Date] - US-001
|
|
146
|
+
- What was implemented
|
|
147
|
+
- Files changed
|
|
148
|
+
- **Learnings for future iterations:**
|
|
149
|
+
- Patterns discovered
|
|
150
|
+
- Gotchas encountered
|
|
151
|
+
---
|
|
133
152
|
```
|
|
134
153
|
|
|
135
|
-
|
|
154
|
+
The `## Codebase Patterns` section at the top is read first by each iteration to avoid repeating mistakes.
|
|
155
|
+
|
|
156
|
+
## The Loop Prompt
|
|
136
157
|
|
|
137
|
-
The ralph-loop prompt
|
|
158
|
+
The ralph-loop prompt should follow this standard pattern:
|
|
138
159
|
|
|
139
160
|
```
|
|
140
161
|
/ralph-loop:ralph-loop "## Instructions
|
|
141
|
-
1. Read
|
|
142
|
-
2. Read
|
|
143
|
-
3.
|
|
144
|
-
4.
|
|
145
|
-
5. Implement
|
|
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
|
|
146
167
|
6. Run verification: [command]
|
|
147
|
-
7. On failure: read error, fix, retry (max 3 times
|
|
148
|
-
8. On success:
|
|
149
|
-
9.
|
|
150
|
-
10.
|
|
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>
|
|
151
173
|
|
|
152
174
|
## When Stuck
|
|
153
|
-
After 3 retries on any
|
|
154
|
-
-
|
|
155
|
-
- Move to next
|
|
156
|
-
- Document in
|
|
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
|
|
157
179
|
|
|
158
180
|
## References
|
|
159
181
|
[list of reference files]
|
|
160
182
|
|
|
161
183
|
## Verification
|
|
162
|
-
[verification command]" --max-iterations [N] --completion-promise "
|
|
184
|
+
[verification command]" --max-iterations [N] --completion-promise "COMPLETE"
|
|
163
185
|
```
|
|
164
186
|
|
|
165
187
|
### Why This Works
|
|
166
188
|
|
|
167
|
-
- **Resumable**: Stop anytime. Progress is
|
|
168
|
-
- **Inspectable**: Open
|
|
169
|
-
- **
|
|
170
|
-
- **No state file conflicts**: The ralph-loop state file only manages the loop itself, not the task.
|
|
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.
|
|
171
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
|
+
## Compatibility with Existing Skills
|
|
196
|
+
|
|
197
|
+
### ralph-skills:prd (marketplace)
|
|
198
|
+
|
|
199
|
+
- Our prd.json output uses the EXACT same format
|
|
200
|
+
- User can generate PRD with `/ralph-skills:prd`, then use our interview to generate the loop command
|
|
201
|
+
- Or use our interview to generate both PRD and loop command
|
|
202
|
+
|
|
203
|
+
### ralph-skills:ralph (marketplace)
|
|
204
|
+
|
|
205
|
+
- Our loop prompt follows the same pattern as ralph-skills prompt.md
|
|
206
|
+
- Same prd.json format, same progress.txt format
|
|
207
|
+
- Same `passes: true/false` tracking, same commit convention
|
|
208
|
+
- Same `<promise>COMPLETE</promise>` completion signal
|
|
209
|
+
|
|
210
|
+
### Official ralph-loop plugin (claude-plugins-official)
|
|
211
|
+
|
|
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
|
|
172
223
|
|
|
173
224
|
## Output Format
|
|
174
225
|
|
|
175
226
|
Structure the final output as:
|
|
176
227
|
|
|
177
228
|
1. **Task summary** — One paragraph describing the overall work.
|
|
178
|
-
2. **PRD preview** — Show the
|
|
179
|
-
3. **
|
|
180
|
-
4. **
|
|
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.
|
|
181
233
|
|
|
182
234
|
### Example Output
|
|
183
235
|
|
|
184
236
|
```
|
|
185
237
|
## Task Summary
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
## PRD (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
...
|
|
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.
|
|
198
254
|
|
|
199
255
|
## Command
|
|
200
256
|
` ` `
|
|
201
|
-
/ralph-loop:ralph-loop "..." --max-iterations
|
|
257
|
+
/ralph-loop:ralph-loop "..." --max-iterations 15 --completion-promise "COMPLETE"
|
|
202
258
|
` ` `
|
|
203
259
|
|
|
204
260
|
---
|
|
205
261
|
**Ready to run?**
|
|
206
|
-
- **y** → Write
|
|
262
|
+
- **y** → Write prd.json + progress.txt and start the loop
|
|
207
263
|
- **n** → Files and command are above, set up manually
|
|
208
264
|
- **edit** → Tell me what to change
|
|
209
265
|
```
|
|
@@ -211,10 +267,11 @@ Fix 3 P1 + 7 P2 responsive issues based on the audit report.
|
|
|
211
267
|
## Rules
|
|
212
268
|
|
|
213
269
|
- **No subjective completion criteria**: Banned phrases: "works well", "looks clean", "properly done."
|
|
214
|
-
- **No prompt without verification**: At least one automated check
|
|
270
|
+
- **No prompt without verification**: At least one automated check is mandatory.
|
|
215
271
|
- **No missing escape hatch**: Every prompt MUST have a "When Stuck" section.
|
|
216
|
-
- **No oversized
|
|
217
|
-
- **Always
|
|
272
|
+
- **No oversized stories**: Each story must be completable in ONE iteration. Split if too big.
|
|
273
|
+
- **Always use prd.json format**: Ensures compatibility with ralph-skills ecosystem.
|
|
274
|
+
- **Default promise is COMPLETE**: Use `<promise>COMPLETE</promise>` to match ralph-skills convention.
|
|
218
275
|
|
|
219
276
|
## Conversation Flow
|
|
220
277
|
|
|
@@ -224,9 +281,9 @@ Fix 3 P1 + 7 P2 responsive issues based on the audit report.
|
|
|
224
281
|
[User] -> Describes the task
|
|
225
282
|
[Assistant] -> Asks interview questions (1 round, max 5 questions)
|
|
226
283
|
[User] -> Answers
|
|
227
|
-
[Assistant] -> Generates
|
|
284
|
+
[Assistant] -> Generates prd.json + command + asks "Ready to run?"
|
|
228
285
|
[User] -> "y"
|
|
229
|
-
[Assistant] -> Writes .
|
|
286
|
+
[Assistant] -> Writes prd.json + progress.txt, then invokes ralph-loop skill
|
|
230
287
|
```
|
|
231
288
|
|
|
232
289
|
### Quick-Run Flow
|
|
@@ -234,15 +291,15 @@ Fix 3 P1 + 7 P2 responsive issues based on the audit report.
|
|
|
234
291
|
If the user includes "run immediately", "just do it", "run it", "바로 실행", "바로 시작", or "--run":
|
|
235
292
|
|
|
236
293
|
1. Conduct the interview (skip if enough context).
|
|
237
|
-
2. Generate
|
|
238
|
-
3. Write
|
|
294
|
+
2. Generate prd.json + command. Show briefly.
|
|
295
|
+
3. Write prd.json and progress.txt via Bash tool.
|
|
239
296
|
4. Invoke ralph-loop skill immediately. Do NOT stop after step 3.
|
|
240
297
|
|
|
241
298
|
### Execution — MANDATORY SKILL INVOCATION
|
|
242
299
|
|
|
243
300
|
When the user confirms with "y", "yes", "run", etc., you MUST:
|
|
244
301
|
|
|
245
|
-
1.
|
|
302
|
+
1. Write prd.json and initialize progress.txt via Bash tool
|
|
246
303
|
2. Actually invoke the ralph-loop skill to start the loop
|
|
247
304
|
|
|
248
305
|
WRONG (do NOT do this):
|
|
@@ -253,8 +310,8 @@ WRONG (do NOT do this):
|
|
|
253
310
|
|
|
254
311
|
RIGHT (you MUST do this):
|
|
255
312
|
|
|
256
|
-
- Write the
|
|
257
|
-
- Then invoke ralph-loop skill so the loop actually starts
|
|
313
|
+
- Write the files via Bash
|
|
314
|
+
- Then invoke the ralph-loop skill so the loop actually starts
|
|
258
315
|
|
|
259
316
|
#### How to invoke ralph-loop
|
|
260
317
|
|
|
@@ -263,13 +320,13 @@ RIGHT (you MUST do this):
|
|
|
263
320
|
```
|
|
264
321
|
Skill tool call:
|
|
265
322
|
skill: "ralph-loop:ralph-loop"
|
|
266
|
-
args: "<prompt>" --max-iterations <N> --completion-promise "
|
|
323
|
+
args: "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
|
|
267
324
|
```
|
|
268
325
|
|
|
269
326
|
**Codex CLI**: Reference the skill via markdown link:
|
|
270
327
|
|
|
271
328
|
```
|
|
272
|
-
[$ralph-loop](~/.codex/skills/ralph-loop/SKILL.md) "<prompt>" --max-iterations <N> --completion-promise "
|
|
329
|
+
[$ralph-loop](~/.codex/skills/ralph-loop/SKILL.md) "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
|
|
273
330
|
```
|
|
274
331
|
|
|
275
332
|
Note: On Windows use `%USERPROFILE%\.codex\skills\ralph-loop\SKILL.md`. If CODEX_HOME is set, use that.
|