@graypark/ralph-codex 0.1.0 → 0.2.1
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 +11 -1
- package/bin/install.mjs +17 -6
- package/bin/uninstall.mjs +1 -1
- package/package.json +5 -4
- package/skills/ralph-interview/SKILL.md +186 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npx @graypark/ralph-codex --global
|
|
|
20
20
|
### Option 2: Clone and install
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
git clone https://github.com/
|
|
23
|
+
git clone https://github.com/vcz-Gray/ralph-codex.git
|
|
24
24
|
cd ralph-codex
|
|
25
25
|
node bin/install.mjs --global
|
|
26
26
|
```
|
|
@@ -58,6 +58,16 @@ In Codex CLI, use the slash command:
|
|
|
58
58
|
/cancel-ralph
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Generate a Command with Interview (NEW)
|
|
62
|
+
|
|
63
|
+
Don't know how to write a good ralph-loop prompt? Let the interview skill help:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/ralph-interview
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
It asks 3–5 targeted questions about your task, then generates an optimized `/ralph-loop` command with proper phases, escape hatches, verification steps, and completion criteria.
|
|
70
|
+
|
|
61
71
|
### How It Works
|
|
62
72
|
|
|
63
73
|
1. You invoke `/ralph-loop` with a task prompt
|
package/bin/install.mjs
CHANGED
|
@@ -152,29 +152,40 @@ async function mergeHooksJson() {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async function installSkills() {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
// Command-based skills (ralph-loop, cancel-ralph)
|
|
156
|
+
const commandSkills = ["ralph-loop", "cancel-ralph"];
|
|
157
|
+
for (const name of commandSkills) {
|
|
157
158
|
const skillDir = join(skillsDir, name);
|
|
158
159
|
const skillMd = join(skillDir, "SKILL.md");
|
|
159
|
-
const commandSrc = join(pluginDir, "commands", `${name}.md`);
|
|
160
160
|
|
|
161
161
|
log(">", `Install skill: ${name} -> ${skillDir}`);
|
|
162
162
|
|
|
163
163
|
if (!dryRun) {
|
|
164
164
|
await mkdir(skillDir, { recursive: true });
|
|
165
165
|
|
|
166
|
-
// Read the command markdown and convert to SKILL.md format
|
|
167
166
|
const content = await readFile(
|
|
168
167
|
join(PROJECT_ROOT, "commands", `${name}.md`),
|
|
169
168
|
"utf-8",
|
|
170
169
|
);
|
|
171
170
|
|
|
172
|
-
// Replace ${RALPH_CODEX_ROOT} placeholder with actual install path
|
|
173
171
|
const resolved = content.replaceAll("${RALPH_CODEX_ROOT}", pluginDir);
|
|
174
|
-
|
|
175
172
|
await writeFile(skillMd, resolved, "utf-8");
|
|
176
173
|
}
|
|
177
174
|
}
|
|
175
|
+
|
|
176
|
+
// Standalone skills (ralph-interview, etc.)
|
|
177
|
+
const standaloneSkills = ["ralph-interview"];
|
|
178
|
+
for (const name of standaloneSkills) {
|
|
179
|
+
const srcDir = join(PROJECT_ROOT, "skills", name);
|
|
180
|
+
const destDir = join(skillsDir, name);
|
|
181
|
+
|
|
182
|
+
log(">", `Install skill: ${name} -> ${destDir}`);
|
|
183
|
+
|
|
184
|
+
if (!dryRun) {
|
|
185
|
+
await mkdir(destDir, { recursive: true });
|
|
186
|
+
await cp(srcDir, destDir, { recursive: true });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
178
189
|
}
|
|
179
190
|
|
|
180
191
|
async function main() {
|
package/bin/uninstall.mjs
CHANGED
|
@@ -83,7 +83,7 @@ export async function uninstall({ dryRun = false, local = false } = {}) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// 3. Remove skill directories
|
|
86
|
-
const skillNames = ["ralph-loop", "cancel-ralph"];
|
|
86
|
+
const skillNames = ["ralph-loop", "cancel-ralph", "ralph-interview"];
|
|
87
87
|
for (const name of skillNames) {
|
|
88
88
|
const skillDir = join(skillsDir, name);
|
|
89
89
|
if (await fileExists(skillDir)) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graypark/ralph-codex",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ralph Loop for OpenAI Codex CLI — self-referential iterative development loops via Stop hooks",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "graypark",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/vcz-Gray/ralph-codex"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/vcz-Gray/ralph-codex#readme",
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/vcz-Gray/ralph-codex/issues"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"hooks/",
|
|
25
25
|
"commands/",
|
|
26
26
|
"lib/",
|
|
27
|
+
"skills/",
|
|
27
28
|
"README.md",
|
|
28
29
|
"LICENSE"
|
|
29
30
|
],
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-interview
|
|
3
|
+
description: "Interactive interview that generates optimized /ralph-loop commands from task descriptions"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ralph Interview — Command Generator
|
|
7
|
+
|
|
8
|
+
You are an expert at crafting `/ralph-loop:ralph-loop` commands for Claude Code's 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.
|
|
10
|
+
|
|
11
|
+
## Core Principles
|
|
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.
|
|
15
|
+
- **Escape hatches required**: Always specify what to do when stuck after N retries.
|
|
16
|
+
- **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
|
+
|
|
19
|
+
## Interview Process
|
|
20
|
+
|
|
21
|
+
When the user provides a task description, ask **concise questions** for any missing items below.
|
|
22
|
+
Skip items already covered. Bundle questions — max 3–5 per round, one round only if possible.
|
|
23
|
+
|
|
24
|
+
### Required Information
|
|
25
|
+
|
|
26
|
+
| Category | What to confirm |
|
|
27
|
+
| ------------------------- | ------------------------------------------------------------------------------------ |
|
|
28
|
+
| **Scope** | Single feature? Multi-file? Full refactor? |
|
|
29
|
+
| **Success criteria** | What counts as "done"? (tests pass, build succeeds, spec checklist, etc.) |
|
|
30
|
+
| **Verification commands** | Commands for automated checks (`npx tsc --noEmit`, `npm test`, `npm run lint`, etc.) |
|
|
31
|
+
| **References** | Existing code, files, or patterns to follow? |
|
|
32
|
+
| **Spec file** | Is there a spec document? Path? |
|
|
33
|
+
| **Priority** | P1/P2 or other priority tiers? |
|
|
34
|
+
| **Constraints** | Must not break existing tests? Library restrictions? |
|
|
35
|
+
| **When stuck** | User's preferred fallback (document it? skip? suggest alternative?) |
|
|
36
|
+
| **Commit strategy** | Per-item commits? Bulk? Commit message convention? |
|
|
37
|
+
|
|
38
|
+
## Phase Design
|
|
39
|
+
|
|
40
|
+
### When to Split into Phases
|
|
41
|
+
|
|
42
|
+
- **Research needed first** → Phase 1: Analysis, Phase 2: Implementation
|
|
43
|
+
- **More than 8 items** → Split by nature (e.g., P1/P2, frontend/backend)
|
|
44
|
+
- **Dependencies exist** → Prerequisite work in a prior Phase
|
|
45
|
+
- **5 or fewer simple items** → Single Phase is fine
|
|
46
|
+
|
|
47
|
+
### Recommended max-iterations
|
|
48
|
+
|
|
49
|
+
| Task type | Iterations |
|
|
50
|
+
| ---------------------------------------------- | ---------- |
|
|
51
|
+
| Research only (file reads, pattern extraction) | 3–5 |
|
|
52
|
+
| Simple fixes, 1–3 items | 5–10 |
|
|
53
|
+
| Medium scope, 4–7 items | 10–20 |
|
|
54
|
+
| Large scope, 8+ items | 20–30 |
|
|
55
|
+
| TDD-based feature implementation | 15–30 |
|
|
56
|
+
| Full refactor / migration | 30–50 |
|
|
57
|
+
|
|
58
|
+
**Rule of thumb:** `item_count × 2 + 5` as baseline. Add weight for complex verification cycles.
|
|
59
|
+
|
|
60
|
+
## Prompt Template
|
|
61
|
+
|
|
62
|
+
Every generated command MUST follow this structure:
|
|
63
|
+
|
|
64
|
+
### Single Phase
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
/ralph-loop:ralph-loop "## Goal
|
|
68
|
+
[One-line summary of the task]
|
|
69
|
+
|
|
70
|
+
## References
|
|
71
|
+
[Files, patterns, or docs to consult. Omit section if none.]
|
|
72
|
+
|
|
73
|
+
## Work Cycle (repeat for each item)
|
|
74
|
+
1. [How to pick the next incomplete item]
|
|
75
|
+
2. [Specific modification to make]
|
|
76
|
+
3. [Run verification command]
|
|
77
|
+
4. On failure → read the error, fix, go back to step 3. Max N retries.
|
|
78
|
+
5. On pass → [state update action]
|
|
79
|
+
6. git add -A && git commit -m '[convention-compliant message]'
|
|
80
|
+
7. Return to step 1 for the next item.
|
|
81
|
+
|
|
82
|
+
## Work Items
|
|
83
|
+
- [Item 1]
|
|
84
|
+
- [Item 2]
|
|
85
|
+
- ...
|
|
86
|
+
|
|
87
|
+
## When Stuck
|
|
88
|
+
After [N] retries on any single item:
|
|
89
|
+
- [Fallback: document issue / skip with TODO / suggest alternative]
|
|
90
|
+
|
|
91
|
+
## Completion Criteria
|
|
92
|
+
- [Objective condition 1]
|
|
93
|
+
- [Objective condition 2]
|
|
94
|
+
- [Verification command] passes
|
|
95
|
+
|
|
96
|
+
Output <promise>[PROMISE]</promise>" --max-iterations [N] --completion-promise "[PROMISE]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Multi-Phase
|
|
100
|
+
|
|
101
|
+
Generate each Phase as a separate `/ralph-loop:ralph-loop` command:
|
|
102
|
+
|
|
103
|
+
- State Phase number and dependencies explicitly.
|
|
104
|
+
- Link prior Phase outputs as references in the next Phase.
|
|
105
|
+
- Use distinct completion promises per Phase (e.g., `PHASE1_DONE`, `PHASE2_DONE`, `TADA`).
|
|
106
|
+
|
|
107
|
+
## Output Format
|
|
108
|
+
|
|
109
|
+
Structure the final output as:
|
|
110
|
+
|
|
111
|
+
1. **Task summary** — One paragraph describing the overall work.
|
|
112
|
+
2. **Phase rationale** — One line per Phase explaining why it's separated.
|
|
113
|
+
3. **Command blocks** — Copy-paste-ready code blocks.
|
|
114
|
+
4. **Execution order** — Run order and notes between Phases.
|
|
115
|
+
5. **Cancel reminder** — `/ralph-loop:cancel-ralph`
|
|
116
|
+
|
|
117
|
+
### Example Output
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
## Task Summary
|
|
121
|
+
Fix 3 P1 + 7 P2 responsive issues based on the audit report.
|
|
122
|
+
|
|
123
|
+
## Phase Rationale
|
|
124
|
+
- Phase 1 (analysis): Extract responsive patterns from codebase to create a reference doc
|
|
125
|
+
- Phase 2 (implementation): Apply fixes in P1 → P2 order using the reference
|
|
126
|
+
|
|
127
|
+
### Phase 1 — Pattern Analysis
|
|
128
|
+
` ` `
|
|
129
|
+
/ralph-loop:ralph-loop "..." --max-iterations 5 --completion-promise "PHASE1_DONE"
|
|
130
|
+
` ` `
|
|
131
|
+
|
|
132
|
+
### Phase 2 — P1 + P2 Fixes
|
|
133
|
+
` ` `
|
|
134
|
+
/ralph-loop:ralph-loop "..." --max-iterations 20 --completion-promise "TADA"
|
|
135
|
+
` ` `
|
|
136
|
+
|
|
137
|
+
## Execution Order
|
|
138
|
+
1. Run Phase 1 → confirm completion
|
|
139
|
+
2. Run Phase 2
|
|
140
|
+
To cancel at any time: `/ralph-loop:cancel-ralph`
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Rules
|
|
144
|
+
|
|
145
|
+
- **No subjective completion criteria**: Banned phrases — "works well", "looks clean", "properly done."
|
|
146
|
+
- **No prompt without verification**: At least one automated check (tsc, test, lint, build) is mandatory.
|
|
147
|
+
- **No missing namespace**: Always write `/ralph-loop:ralph-loop` and `/ralph-loop:cancel-ralph`.
|
|
148
|
+
- **No missing escape hatch**: Every Phase MUST have a "When Stuck" section.
|
|
149
|
+
- **No oversized single Phase**: Do not put more than 8 independent items in one Phase. Recommend splitting.
|
|
150
|
+
|
|
151
|
+
## Conversation Flow
|
|
152
|
+
|
|
153
|
+
### Standard Flow
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
[User] → Describes the task
|
|
157
|
+
[Assistant] → Asks interview questions (1 round, max 5 questions)
|
|
158
|
+
[User] → Answers
|
|
159
|
+
[Assistant] → Generates Phase plan + command blocks
|
|
160
|
+
[Assistant] → Asks: "Run Phase 1 now? (y/n)"
|
|
161
|
+
[User] → "y"
|
|
162
|
+
[Assistant] → Executes the /ralph-loop:ralph-loop command immediately via Skill tool
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Quick-Run Flow
|
|
166
|
+
|
|
167
|
+
If the user includes phrases like "run immediately", "just do it", "바로 실행", "바로 시작", or "--run" in their initial message:
|
|
168
|
+
|
|
169
|
+
1. Conduct the interview as normal (skip if enough context is provided).
|
|
170
|
+
2. Generate the command blocks.
|
|
171
|
+
3. **Immediately execute Phase 1** without asking for confirmation.
|
|
172
|
+
4. Show the command that was executed so the user can see what's running.
|
|
173
|
+
|
|
174
|
+
### Post-Generation Action
|
|
175
|
+
|
|
176
|
+
After generating all command blocks, ALWAYS end with this prompt:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
---
|
|
180
|
+
**Ready to run?**
|
|
181
|
+
- **y** / **yes** / **실행** → I'll start Phase 1 immediately
|
|
182
|
+
- **n** / **no** / **아니오** → Commands are above, copy-paste when ready
|
|
183
|
+
- **edit** / **수정** → Tell me what to change
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
When the user confirms, execute the Phase 1 command by invoking the `ralph-loop:ralph-loop` skill with the generated arguments. For multi-phase work, after each Phase completes, prompt to run the next Phase.
|