@graypark/ralph-codex 0.5.2 → 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/README.md +6 -6
- package/lib/state.mjs +0 -1
- package/lib/stop-hook-core.mjs +0 -71
- package/package.json +1 -1
- package/skills/ralph-interview/SKILL.md +195 -202
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
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
package/lib/stop-hook-core.mjs
CHANGED
|
@@ -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.
|
|
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,26 +1,27 @@
|
|
|
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
|
|
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
|
-
- **
|
|
14
|
-
- **
|
|
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.
|
|
15
17
|
- **Escape hatches required**: Always specify what to do when stuck after N retries.
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
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 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 3
|
|
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**
|
|
45
|
-
- **More than 8 items**
|
|
46
|
-
- **Dependencies exist**
|
|
47
|
-
- **5 or fewer simple items**
|
|
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,282 +61,274 @@ 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
|
|
64
|
-
|
|
65
|
-
|
|
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) | 3
|
|
78
|
-
| Simple fixes, 1
|
|
79
|
-
| Medium scope, 4
|
|
80
|
-
| Large scope, 8+ items | 20
|
|
81
|
-
| TDD-based feature implementation | 15
|
|
82
|
-
| Full refactor / migration | 30
|
|
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:** `
|
|
79
|
+
**Rule of thumb:** `story_count x 2 + 5` as baseline.
|
|
85
80
|
|
|
86
|
-
##
|
|
81
|
+
## PRD Format: prd.json (ralph-skills compatible)
|
|
87
82
|
|
|
88
|
-
|
|
83
|
+
Generate PRDs in the **prd.json** format used by ralph-skills. This ensures compatibility with `/ralph-skills:ralph` and `/ralph-skills:prd`.
|
|
89
84
|
|
|
90
|
-
###
|
|
85
|
+
### prd.json
|
|
91
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
|
+
}
|
|
92
108
|
```
|
|
93
|
-
/ralph-loop:ralph-loop "## Goal
|
|
94
|
-
[One-line summary of the task]
|
|
95
109
|
|
|
96
|
-
|
|
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
|
-
- ...
|
|
110
|
+
### Story Sizing Rules
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
After [N] retries on any single item:
|
|
115
|
-
- [Fallback: document issue / skip with TODO / suggest alternative]
|
|
112
|
+
Each story MUST be completable in ONE iteration (one context window):
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
- [Verification command] passes
|
|
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
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
### Story Ordering
|
|
119
|
+
|
|
120
|
+
Stories execute in priority order. Dependencies first:
|
|
121
|
+
|
|
122
|
+
1. Schema/database changes
|
|
123
|
+
2. Backend logic / server actions
|
|
124
|
+
3. UI components that use the backend
|
|
125
|
+
4. Aggregation views / dashboards
|
|
126
|
+
|
|
127
|
+
### Acceptance Criteria Rules
|
|
128
|
+
|
|
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"
|
|
134
|
+
|
|
135
|
+
### progress.txt
|
|
124
136
|
|
|
125
|
-
|
|
137
|
+
An append-only log file that tracks iteration history:
|
|
126
138
|
|
|
127
|
-
|
|
139
|
+
```
|
|
140
|
+
## Codebase Patterns
|
|
141
|
+
- [Reusable patterns discovered during iteration]
|
|
142
|
+
|
|
143
|
+
---
|
|
128
144
|
|
|
145
|
+
## [Date] - US-001
|
|
146
|
+
- What was implemented
|
|
147
|
+
- Files changed
|
|
148
|
+
- **Learnings for future iterations:**
|
|
149
|
+
- Patterns discovered
|
|
150
|
+
- Gotchas encountered
|
|
151
|
+
---
|
|
129
152
|
```
|
|
130
|
-
/ralph-loop:ralph-loop "## Goal
|
|
131
|
-
[Task summary]
|
|
132
153
|
|
|
133
|
-
|
|
134
|
-
Spawn these subagents simultaneously:
|
|
154
|
+
The `## Codebase Patterns` section at the top is read first by each iteration to avoid repeating mistakes.
|
|
135
155
|
|
|
136
|
-
|
|
137
|
-
Search src/frontend/** for [pattern]. Write findings to .ralph/reports/frontend.md
|
|
156
|
+
## The Loop Prompt
|
|
138
157
|
|
|
139
|
-
|
|
140
|
-
Search src/backend/** for [pattern]. Write findings to .ralph/reports/backend.md
|
|
158
|
+
The ralph-loop prompt should follow this standard pattern:
|
|
141
159
|
|
|
142
|
-
|
|
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>
|
|
143
173
|
|
|
144
|
-
##
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
|
149
179
|
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
- [Verification command] passes
|
|
180
|
+
## References
|
|
181
|
+
[list of reference files]
|
|
153
182
|
|
|
154
|
-
|
|
183
|
+
## Verification
|
|
184
|
+
[verification command]" --max-iterations [N] --completion-promise "COMPLETE"
|
|
155
185
|
```
|
|
156
186
|
|
|
157
|
-
###
|
|
187
|
+
### Why This Works
|
|
158
188
|
|
|
159
|
-
|
|
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.
|
|
160
194
|
|
|
161
|
-
|
|
195
|
+
## Compatibility with Existing Skills
|
|
162
196
|
|
|
163
|
-
|
|
197
|
+
### ralph-skills:prd (marketplace)
|
|
164
198
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
}
|
|
186
|
-
```
|
|
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
|
|
187
202
|
|
|
188
|
-
|
|
203
|
+
### ralph-skills:ralph (marketplace)
|
|
189
204
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
|
193
209
|
|
|
194
|
-
|
|
210
|
+
### Official ralph-loop plugin (claude-plugins-official)
|
|
195
211
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
199
215
|
|
|
200
|
-
###
|
|
216
|
+
### Detection and Adaptation
|
|
201
217
|
|
|
202
|
-
|
|
218
|
+
When generating commands, check which ralph-loop is available:
|
|
203
219
|
|
|
204
|
-
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
|
207
223
|
|
|
208
224
|
## Output Format
|
|
209
225
|
|
|
210
226
|
Structure the final output as:
|
|
211
227
|
|
|
212
228
|
1. **Task summary** — One paragraph describing the overall work.
|
|
213
|
-
2. **
|
|
214
|
-
3. **
|
|
215
|
-
4. **
|
|
216
|
-
5. **
|
|
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.
|
|
217
233
|
|
|
218
234
|
### Example Output
|
|
219
235
|
|
|
220
236
|
```
|
|
221
237
|
## Task Summary
|
|
222
|
-
|
|
238
|
+
Add task priority system with database field, UI badges, and filtering.
|
|
223
239
|
|
|
224
|
-
##
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
227
252
|
|
|
228
|
-
|
|
229
|
-
` ` `
|
|
230
|
-
/ralph-loop:ralph-loop "..." --max-iterations 5 --completion-promise "PHASE1_DONE"
|
|
231
|
-
` ` `
|
|
253
|
+
4 stories, ~10 iterations recommended.
|
|
232
254
|
|
|
233
|
-
|
|
255
|
+
## Command
|
|
234
256
|
` ` `
|
|
235
|
-
/ralph-loop:ralph-loop "..." --max-iterations
|
|
257
|
+
/ralph-loop:ralph-loop "..." --max-iterations 15 --completion-promise "COMPLETE"
|
|
236
258
|
` ` `
|
|
237
259
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
|
242
265
|
```
|
|
243
266
|
|
|
244
267
|
## Rules
|
|
245
268
|
|
|
246
|
-
- **No subjective completion criteria**: Banned phrases
|
|
247
|
-
- **No prompt without verification**: At least one automated check
|
|
248
|
-
- **No missing
|
|
249
|
-
- **No
|
|
250
|
-
- **
|
|
269
|
+
- **No subjective completion criteria**: Banned phrases: "works well", "looks clean", "properly done."
|
|
270
|
+
- **No prompt without verification**: At least one automated check is mandatory.
|
|
271
|
+
- **No missing escape hatch**: Every prompt MUST have a "When Stuck" section.
|
|
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.
|
|
251
275
|
|
|
252
276
|
## Conversation Flow
|
|
253
277
|
|
|
254
278
|
### Standard Flow
|
|
255
279
|
|
|
256
280
|
```
|
|
257
|
-
[User]
|
|
258
|
-
[Assistant]
|
|
259
|
-
[User]
|
|
260
|
-
[Assistant]
|
|
261
|
-
[
|
|
262
|
-
[
|
|
263
|
-
[Assistant] → Executes accordingly
|
|
281
|
+
[User] -> Describes the task
|
|
282
|
+
[Assistant] -> Asks interview questions (1 round, max 5 questions)
|
|
283
|
+
[User] -> Answers
|
|
284
|
+
[Assistant] -> Generates prd.json + command + asks "Ready to run?"
|
|
285
|
+
[User] -> "y"
|
|
286
|
+
[Assistant] -> Writes prd.json + progress.txt, then invokes ralph-loop skill
|
|
264
287
|
```
|
|
265
288
|
|
|
266
289
|
### Quick-Run Flow
|
|
267
290
|
|
|
268
|
-
If the user includes
|
|
269
|
-
|
|
270
|
-
1. Conduct the interview as normal (skip if enough context is provided).
|
|
271
|
-
2. Generate the command blocks. Show them briefly.
|
|
272
|
-
3. For multi-phase: write state file with queue via Bash tool.
|
|
273
|
-
4. Make the Skill tool call: skill="ralph-loop:ralph-loop", args=Phase 1 prompt+flags.
|
|
274
|
-
Do NOT stop after step 3. You MUST proceed to step 4.
|
|
291
|
+
If the user includes "run immediately", "just do it", "run it", "바로 실행", "바로 시작", or "--run":
|
|
275
292
|
|
|
276
|
-
|
|
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.
|
|
277
297
|
|
|
278
|
-
|
|
298
|
+
### Execution — MANDATORY SKILL INVOCATION
|
|
279
299
|
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
```
|
|
300
|
+
When the user confirms with "y", "yes", "run", etc., you MUST:
|
|
290
301
|
|
|
291
|
-
|
|
292
|
-
|
|
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 — MANDATORY TOOL CALL
|
|
302
|
-
|
|
303
|
-
When the user confirms with "y", "yes", "step", "run", "바로 실행", etc., you MUST perform an actual Skill tool call. This is NON-NEGOTIABLE.
|
|
302
|
+
1. Write prd.json and initialize progress.txt via Bash tool
|
|
303
|
+
2. Actually invoke the ralph-loop skill to start the loop
|
|
304
304
|
|
|
305
305
|
WRONG (do NOT do this):
|
|
306
306
|
|
|
307
|
-
- Printing the
|
|
308
|
-
- Writing
|
|
307
|
+
- Printing the command as text and stopping
|
|
308
|
+
- Writing files and saying "ready" or "set up"
|
|
309
309
|
- Telling the user to copy-paste
|
|
310
|
-
- Saying "Phase 1 is set up"
|
|
311
310
|
|
|
312
311
|
RIGHT (you MUST do this):
|
|
313
312
|
|
|
314
|
-
-
|
|
313
|
+
- Write the files via Bash
|
|
314
|
+
- Then invoke the ralph-loop skill so the loop actually starts
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
#### How to invoke ralph-loop
|
|
317
|
+
|
|
318
|
+
**Claude Code**: Use the Skill tool:
|
|
317
319
|
|
|
318
320
|
```
|
|
319
|
-
|
|
321
|
+
Skill tool call:
|
|
320
322
|
skill: "ralph-loop:ralph-loop"
|
|
321
|
-
args: "<
|
|
323
|
+
args: "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
|
|
322
324
|
```
|
|
323
325
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
**Pipeline mode ("y"):**
|
|
327
|
-
|
|
328
|
-
1. For multi-phase: first write state file with queue via Bash tool
|
|
329
|
-
2. Then IMMEDIATELY make the Skill tool call for Phase 1
|
|
330
|
-
3. Stop hook handles the rest
|
|
331
|
-
|
|
332
|
-
**Manual mode ("step"):**
|
|
326
|
+
**Codex CLI**: Reference the skill via markdown link:
|
|
333
327
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
**Single-phase ("y"):**
|
|
328
|
+
```
|
|
329
|
+
[$ralph-loop](~/.codex/skills/ralph-loop/SKILL.md) "<prompt>" --max-iterations <N> --completion-promise "COMPLETE"
|
|
330
|
+
```
|
|
338
331
|
|
|
339
|
-
|
|
332
|
+
Note: On Windows use `%USERPROFILE%\.codex\skills\ralph-loop\SKILL.md`. If CODEX_HOME is set, use that.
|
|
340
333
|
|
|
341
|
-
If you do not
|
|
334
|
+
If you do not actually invoke the skill, the loop will not start.
|