agentic-loop 3.23.0 → 3.27.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.
@@ -0,0 +1,74 @@
1
+ ---
2
+ description: Pick the terminal background color Ralph uses to distinguish its terminal from Claude Code.
3
+ ---
4
+
5
+ # Terminal Color
6
+
7
+ The user wants to change Ralph's terminal background tint - the color applied during `npx agentic-loop run` to visually distinguish Ralph's terminal from Claude Code.
8
+
9
+ > **Note:** This only works in macOS Terminal.app. On other terminals (iTerm2, VS Code, Linux), Ralph skips tinting automatically.
10
+
11
+ ## Step 1: Show Current Color
12
+
13
+ Read `.ralph/config.json` and check for `terminalTint`. Show the current setting:
14
+ - If set: "Current tint: `{value}`"
15
+ - If not set: "Current tint: `#1a2e2e` (default dark teal)"
16
+
17
+ ## Step 2: Ask Color Preference
18
+
19
+ Use AskUserQuestion:
20
+
21
+ **Question:** "What color should Ralph's terminal background be?"
22
+ **Header:** "Tint color"
23
+ **Options:**
24
+ - **Dark Teal (default)** - "`#1a2e2e` - subtle blue-green, easy on the eyes"
25
+ - **Dark Purple** - "`#1a1a2e` - cool and distinct from standard dark themes"
26
+ - **Dark Red** - "`#2e1a1a` - warm undertone, clearly different"
27
+ - **Off** - "Disable terminal tinting entirely"
28
+
29
+ If the user selects "Other", ask them to provide a hex color (e.g., `#2e2e1a`).
30
+
31
+ ## Step 3: Validate (if custom hex)
32
+
33
+ If the user provided a custom hex:
34
+ - Must match `#` followed by exactly 6 hex characters (`/^#[0-9a-fA-F]{6}$/`)
35
+ - If invalid, say "That doesn't look like a valid hex color (e.g., `#1a2e2e`). Try again." and re-ask.
36
+
37
+ ## Step 4: Save to Config
38
+
39
+ Read `.ralph/config.json`, set the `terminalTint` field, and write it back.
40
+
41
+ - **If a color was chosen:** Set `"terminalTint": "#xxxxxx"`
42
+ - **If "Off" was chosen:** Set `"terminalTint": "off"`
43
+
44
+ Use jq to update:
45
+ ```bash
46
+ jq --arg color "THE_HEX_VALUE" '.terminalTint = $color' .ralph/config.json > .ralph/config.json.tmp && mv .ralph/config.json.tmp .ralph/config.json
47
+ ```
48
+
49
+ ## Step 5: Preview (macOS Terminal.app only)
50
+
51
+ If running in Terminal.app, apply the color immediately so the user can see it:
52
+
53
+ ```bash
54
+ # Apply preview (will be restored when Claude session ends)
55
+ osascript -e 'tell application "Terminal" to set background color of front window to {R, G, B}' 2>/dev/null
56
+ ```
57
+
58
+ Where R, G, B are the hex values converted to 16-bit (multiply each 8-bit value by 257).
59
+
60
+ If "Off" was chosen, skip the preview.
61
+
62
+ ## Step 6: Confirm
63
+
64
+ Say:
65
+
66
+ "Done! Ralph will use `#xxxxxx` as the terminal tint.
67
+
68
+ Next time you run `npx agentic-loop run`, the terminal background will change to this color. It restores to your original background when the loop ends.
69
+
70
+ Run `/color` again anytime to change it."
71
+
72
+ If "Off" was chosen, say:
73
+
74
+ "Done! Terminal tinting is now disabled. Ralph will run without changing your terminal background."
@@ -0,0 +1,76 @@
1
+ ---
2
+ description: Rename the current terminal tab so you can tell your Claude Code tabs apart.
3
+ ---
4
+
5
+ # Tab Rename
6
+
7
+ The user wants to rename the current terminal tab. This is useful when you have multiple Claude Code sessions open and every tab just shows "...skip-permissions".
8
+
9
+ ## Step 1: Determine the Tab Name
10
+
11
+ Check if the user provided an argument: `$ARGUMENTS`
12
+
13
+ - **If provided:** Use it as the tab name (e.g., `/tab-rename my-api` → tab name is "my-api").
14
+ - **If not provided:** Auto-detect a sensible name from the project. Read the `name` field from `package.json` if it exists, or use the current directory's basename. Then ask the user to confirm or customize:
15
+
16
+ Use AskUserQuestion:
17
+
18
+ **Question:** "What should this tab be called?"
19
+ **Header:** "Tab name"
20
+ **Options:**
21
+ - **{detected_name}** - "Auto-detected from the project"
22
+ - **Claude: {detected_name}** - "Prefixed to distinguish from Ralph's terminal"
23
+
24
+ If the user selects "Other", use their custom text as the tab name.
25
+
26
+ ## Step 2: Set the Tab Title
27
+
28
+ Use `$TERM_PROGRAM` (via Bash: `echo $TERM_PROGRAM`) to detect the terminal, then apply the right method. **Important:** Escape any double quotes in the tab name before embedding in AppleScript strings.
29
+
30
+ ### iTerm2 (`TERM_PROGRAM=iTerm.app`)
31
+
32
+ Use iTerm2's proprietary escape sequence — this is the most reliable method:
33
+
34
+ ```bash
35
+ printf '\033]1337;SetUserVar=tab_title=%s\007' "$(echo -n 'TAB_NAME' | base64)"
36
+ ```
37
+
38
+ Then also set the session name via osascript as a fallback:
39
+
40
+ ```bash
41
+ osascript -e 'tell application "iTerm2" to tell current session of current window to set name to "TAB_NAME"' 2>/dev/null
42
+ ```
43
+
44
+ ### Terminal.app (`TERM_PROGRAM=Apple_Terminal`)
45
+
46
+ Terminal.app requires **two steps** — set the custom title AND enable the custom title display (otherwise the shell's auto-title overrides it):
47
+
48
+ ```bash
49
+ osascript -e '
50
+ tell application "Terminal"
51
+ set t to selected tab of front window
52
+ set custom title of t to "TAB_NAME"
53
+ end tell' 2>/dev/null
54
+ ```
55
+
56
+ Then use the ANSI escape to set the window/tab title (this is what actually sticks):
57
+
58
+ ```bash
59
+ printf '\033]0;TAB_NAME\007'
60
+ ```
61
+
62
+ ### Other terminals / fallback
63
+
64
+ Use the standard ANSI escape sequence:
65
+
66
+ ```bash
67
+ printf '\033]0;TAB_NAME\007'
68
+ ```
69
+
70
+ ## Step 3: Confirm
71
+
72
+ If the rename succeeded, say:
73
+
74
+ "Tab renamed to **{tab_name}**."
75
+
76
+ > **Tip:** If your shell resets the title on each prompt (common with oh-my-zsh), add `export DISABLE_AUTO_TITLE="true"` to your `~/.zshrc`, then restart your shell.
@@ -337,7 +337,7 @@ Quick Reference
337
337
  ───────────────
338
338
 
339
339
  Workflow:
340
- /idea [feature] Brainstorm → PRD
340
+ /prd [feature] Brainstorm → PRD
341
341
  npx ralph run Execute autonomously
342
342
  npx ralph status Check progress
343
343
  npx ralph stop Stop after current story
@@ -354,4 +354,4 @@ Other:
354
354
  /vibe-help Full cheatsheet
355
355
  ```
356
356
 
357
- Say: "You're all set! Run `/idea [your next feature]` to get started."
357
+ Say: "You're all set! Run `/prd [your next feature]` to get started."
@@ -11,7 +11,7 @@ Print this cheatsheet for the user. Do not add any commentary or explanation.
11
11
  ## The Loop
12
12
 
13
13
  ```
14
- /idea [feature] brainstorm & generate PRD
14
+ /prd [feature] brainstorm & generate PRD
15
15
  npx ralph run autonomous coding loop (live activity feed)
16
16
  npx ralph run --quiet same, but suppress activity feed
17
17
  npx ralph status check progress
@@ -12,7 +12,7 @@ Print this complete reference for the user. Do not add any commentary.
12
12
 
13
13
  | Command | Description |
14
14
  |---------|-------------|
15
- | `/idea [feature]` | Brainstorm in plan mode, generate PRD for Ralph |
15
+ | `/prd [feature]` | Brainstorm feature, generate executable PRD for Ralph |
16
16
  | `/setup-review` | Review config against project, fix mismatches |
17
17
  | `/sign` | Add a learned pattern for Ralph to remember |
18
18
  | `/my-dna` | Set up your personal style preferences |
@@ -90,7 +90,7 @@ Print this complete reference for the user. Do not add any commentary.
90
90
  ## The Loop
91
91
 
92
92
  ```
93
- /idea [feature] Brainstorm → PRD
93
+ /prd [feature] Brainstorm → PRD
94
94
  npx ralph run Autonomous coding
95
95
  npx ralph status Check progress
96
96
  npx ralph stop Stop after current story
@@ -100,10 +100,10 @@ npx ralph stop Stop after current story
100
100
 
101
101
  ## Slash Command Details
102
102
 
103
- ### /idea [feature description]
104
- Brainstorm in plan mode, explore codebase, ask clarifying questions.
105
- - Writes idea to `docs/ideas/{feature}.md`
106
- - On approval, splits into PRD stories
103
+ ### /prd [feature description]
104
+ Brainstorm feature, explore codebase, ask clarifying questions.
105
+ - Accepts a description or plan file (`docs/ideas/{feature}.md`)
106
+ - Splits into executable PRD stories
107
107
  - Writes to `.ralph/prd.json`
108
108
 
109
109
  ### /review [file or selection]
@@ -206,7 +206,7 @@ npx ralph unsign "camelCase"
206
206
 
207
207
  CLAUDE.md # Project standards (shared with team)
208
208
  PROMPT.md # Base prompt for Ralph sessions
209
- docs/ideas/ # Brainstorm outputs from /idea
209
+ docs/ideas/ # Brainstorm outputs from /prd
210
210
 
211
211
  # Global files (your home directory)
212
212
  ~/.claude/
@@ -0,0 +1,74 @@
1
+ ---
2
+ description: Pick the terminal background color Ralph uses to distinguish its terminal from Claude Code.
3
+ ---
4
+
5
+ # Terminal Color
6
+
7
+ The user wants to change Ralph's terminal background tint - the color applied during `npx agentic-loop run` to visually distinguish Ralph's terminal from Claude Code.
8
+
9
+ > **Note:** This only works in macOS Terminal.app. On other terminals (iTerm2, VS Code, Linux), Ralph skips tinting automatically.
10
+
11
+ ## Step 1: Show Current Color
12
+
13
+ Read `.ralph/config.json` and check for `terminalTint`. Show the current setting:
14
+ - If set: "Current tint: `{value}`"
15
+ - If not set: "Current tint: `#1a2e2e` (default dark teal)"
16
+
17
+ ## Step 2: Ask Color Preference
18
+
19
+ Use AskUserQuestion:
20
+
21
+ **Question:** "What color should Ralph's terminal background be?"
22
+ **Header:** "Tint color"
23
+ **Options:**
24
+ - **Dark Teal (default)** - "`#1a2e2e` - subtle blue-green, easy on the eyes"
25
+ - **Dark Purple** - "`#1a1a2e` - cool and distinct from standard dark themes"
26
+ - **Dark Red** - "`#2e1a1a` - warm undertone, clearly different"
27
+ - **Off** - "Disable terminal tinting entirely"
28
+
29
+ If the user selects "Other", ask them to provide a hex color (e.g., `#2e2e1a`).
30
+
31
+ ## Step 3: Validate (if custom hex)
32
+
33
+ If the user provided a custom hex:
34
+ - Must match `#` followed by exactly 6 hex characters (`/^#[0-9a-fA-F]{6}$/`)
35
+ - If invalid, say "That doesn't look like a valid hex color (e.g., `#1a2e2e`). Try again." and re-ask.
36
+
37
+ ## Step 4: Save to Config
38
+
39
+ Read `.ralph/config.json`, set the `terminalTint` field, and write it back.
40
+
41
+ - **If a color was chosen:** Set `"terminalTint": "#xxxxxx"`
42
+ - **If "Off" was chosen:** Set `"terminalTint": "off"`
43
+
44
+ Use jq to update:
45
+ ```bash
46
+ jq --arg color "THE_HEX_VALUE" '.terminalTint = $color' .ralph/config.json > .ralph/config.json.tmp && mv .ralph/config.json.tmp .ralph/config.json
47
+ ```
48
+
49
+ ## Step 5: Preview (macOS Terminal.app only)
50
+
51
+ If running in Terminal.app, apply the color immediately so the user can see it:
52
+
53
+ ```bash
54
+ # Apply preview (will be restored when Claude session ends)
55
+ osascript -e 'tell application "Terminal" to set background color of front window to {R, G, B}' 2>/dev/null
56
+ ```
57
+
58
+ Where R, G, B are the hex values converted to 16-bit (multiply each 8-bit value by 257).
59
+
60
+ If "Off" was chosen, skip the preview.
61
+
62
+ ## Step 6: Confirm
63
+
64
+ Say:
65
+
66
+ "Done! Ralph will use `#xxxxxx` as the terminal tint.
67
+
68
+ Next time you run `npx agentic-loop run`, the terminal background will change to this color. It restores to your original background when the loop ends.
69
+
70
+ Run `/color` again anytime to change it."
71
+
72
+ If "Off" was chosen, say:
73
+
74
+ "Done! Terminal tinting is now disabled. Ralph will run without changing your terminal background."
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Generate an executable PRD for Ralph from an idea file or description.
2
+ description: Brainstorm, harden, and generate an executable PRD for Ralph from a description, idea file, or plan file.
3
3
  ---
4
4
 
5
5
  # /prd - Generate PRD for Ralph
@@ -19,21 +19,29 @@ $ARGUMENTS
19
19
  ### Step 1: Determine Input Type
20
20
 
21
21
  **If `$ARGUMENTS` is empty:**
22
- 1. Check for idea files:
22
+ 1. Scan for existing source files:
23
23
  ```bash
24
- ls docs/ideas/*.md 2>/dev/null || echo "No ideas found"
24
+ ls docs/ideas/*.md 2>/dev/null || echo "No idea files found"
25
+ ls docs/plans/*.md 2>/dev/null || echo "No plan files found"
25
26
  ```
26
- 2. Ask: "Would you like to:
27
- - Convert an idea file (e.g., `/prd auth` for `docs/ideas/auth.md`)
28
- - Describe a feature directly (e.g., `/prd 'Add user logout button'`)"
27
+ 2. If source files exist, use AskUserQuestion to let the user pick:
28
+ - **Question:** "What should I build the PRD from?"
29
+ - **Header:** "PRD source"
30
+ - **Options:** List discovered idea/plan files (up to 3-4 most relevant), plus a "Describe a feature" option that says "Type a description directly (e.g., 'Add user logout button')"
31
+ - If no source files found, skip AskUserQuestion and just say: "Describe the feature you'd like to build (e.g., `/prd 'Add user logout button'`)"
29
32
 
30
- **If `$ARGUMENTS` looks like a file reference** (no spaces, matches `docs/ideas/*.md`):
33
+ **If `$ARGUMENTS` looks like a plan file** (`plans/` prefix, `docs/plans/` path, or full path to a plan file):
31
34
  - If it's a full path, use it directly
32
- - If it's just a name like `content-engine`, look for `docs/ideas/content-engine.md`
35
+ - If it's `plans/name` or just a prefix, look for `docs/plans/{name}.md`
36
+ - Proceed to "Read and Understand the Plan"
37
+
38
+ **If `$ARGUMENTS` looks like an idea file reference** (no spaces, matches `docs/ideas/*.md`):
39
+ - If it's a full path, use it directly
40
+ - If it's just a name like `content-engine`, check `docs/ideas/content-engine.md` first, fall back to `docs/plans/content-engine.md`
33
41
  - Proceed to "Read and Understand the Idea"
34
42
 
35
43
  **If `$ARGUMENTS` is a description** (has spaces, is a sentence):
36
- - This is the **quick PRD flow** - no `docs/ideas/` file created
44
+ - This is the **quick PRD flow** - no source file created
37
45
  - Good for small features that don't need documentation
38
46
  - Skip to "Confirm Understanding" below
39
47
 
@@ -48,9 +56,9 @@ Say: "I've read `{path}`. Here's my understanding:
48
56
  **Solution:** {one line}
49
57
  **Scope:** {key items}
50
58
 
51
- I'll now split this into {N} stories for Ralph. Continue?"
59
+ I'll now ask a few hardening questions before generating stories."
52
60
 
53
- **STOP and wait for user confirmation.**
61
+ **Proceed to Step 2.5.**
54
62
 
55
63
  ### Step 2b: Confirm Understanding (from description)
56
64
 
@@ -65,14 +73,64 @@ Use the detected tech stack, test runners, and constraints when building each st
65
73
 
66
74
  Then say: "I'll create a PRD for: **{description}**
67
75
 
68
- Before I generate stories, quick questions:
69
- 1. **Type:** Frontend or backend?
70
- 2. **Scale:** Any specific limits (users, items, rate limits)?
71
- 3. **Anything else** I should know?
76
+ Here's what I found in your codebase: [brief summary of tech stack, existing patterns]
77
+
78
+ I'll now ask a few hardening questions before generating stories."
79
+
80
+ **Proceed to Step 2.5.**
81
+
82
+ ### Step 2c: Read and Understand the Plan (from plan file)
83
+
84
+ Read the plan file and summarize:
85
+
86
+ Say: "I've read `{path}`. Here's my understanding:
87
+
88
+ **Feature/Goal:** {name}
89
+ **Approach:** {summary of approach}
90
+ **Key Files:** {files mentioned}
91
+ **Scope:** {key items}
92
+
93
+ I'll now ask a few hardening questions before generating stories."
94
+
95
+ **Proceed to Step 2.5.**
96
+
97
+ ### Step 2.5: Harden the Requirements
98
+
99
+ **This step runs for ALL input types** (idea file, plan file, or description). Review what you already know from the input and ask ONLY about gaps — skip questions the input already answers.
72
100
 
73
- (Or say 'go' to proceed with defaults)"
101
+ Say: "Before I generate stories, I want to make sure we've covered the key areas:"
74
102
 
75
- **STOP and wait for user input** (can be brief or 'go').
103
+ **Scope & UX** (always ask):
104
+ - What's in scope vs out of scope?
105
+ - Is this user-facing? What does the user see/do?
106
+ - What are the edge cases?
107
+ - **Responsive design** (if frontend): Must it work on mobile/tablet? What breakpoints? Any layout changes between screen sizes?
108
+
109
+ **Security** (ask if feature involves auth, user input, or sensitive data):
110
+ - Authentication: Who can access this? Login required?
111
+ - Passwords: How stored? (must be hashed, never plain text)
112
+ - User input: What validation needed? (SQL injection, XSS)
113
+ - Sensitive data: What should NEVER be in API responses?
114
+ - Rate limiting: Should this be rate limited?
115
+
116
+ **Scale** (ask if feature involves lists, data, or APIs):
117
+ - How many items expected? (10s, 1000s, millions?)
118
+ - Pagination needed? What's the max per page?
119
+ - Caching needed? How fresh must data be?
120
+ - Database indexes: What will be queried/sorted frequently?
121
+
122
+ **Migration** (ask if feature involves restructuring or moving code):
123
+ - Source → destination mapping: Where does code currently live? Where should it end up?
124
+ - Phases: What's the logical order?
125
+ - Verification: What commands prove each phase worked?
126
+
127
+ After presenting the hardening questions, use AskUserQuestion:
128
+ - **Question:** "Answer the questions above, or proceed with sensible defaults?"
129
+ - **Header:** "Hardening"
130
+ - **Options:**
131
+ - **"Go with defaults"** — "Proceed with sensible defaults for unanswered questions"
132
+ - **"Let me answer"** — "I'll respond to the questions above"
133
+ - If the user selects "Let me answer" or "Other", **STOP and wait for their response** before continuing.
76
134
 
77
135
  ### Step 3: Check for Existing PRD
78
136
 
@@ -81,16 +139,11 @@ cat .ralph/prd.json 2>/dev/null
81
139
  ```
82
140
 
83
141
  If it exists, read it and say:
84
- "`.ralph/prd.json` exists with {N} stories ({M} completed, {P} pending).
142
+ "`.ralph/prd.json` exists with {N} stories ({M} completed, {P} pending). I'll append new stories to it."
85
143
 
86
- Options:
87
- - **'append'** - Add new stories to the existing PRD (recommended)
88
- - **'overwrite'** - Replace it entirely
89
- - **'cancel'** - Stop here"
144
+ **Default behavior is append** — just proceed. Do NOT ask for confirmation unless the user explicitly says "overwrite" or "replace".
90
145
 
91
- **STOP and wait for user choice.**
92
-
93
- If user chooses **'append'**:
146
+ When appending:
94
147
  - Find highest existing story number (ignore prefix - could be US-005 or TASK-005)
95
148
  - **Always use TASK- prefix** for new stories (e.g., if highest is US-005 or TASK-005, new stories start at TASK-006)
96
149
  - New stories will be added after existing ones
@@ -176,7 +229,7 @@ Does acceptanceCriteria include:
176
229
  - Large datasets → "Database query uses index on [column]"
177
230
 
178
231
  #### 6e. Context (for all stories)
179
- - Does `contextFiles` include the idea file (has ASCII mockups)?
232
+ - Does `contextFiles` include the source file (idea or plan file, especially if it has ASCII mockups)?
180
233
  - Does `contextFiles` include styleguide (if exists)?
181
234
  - Does `techStack` include the relevant stack for this story?
182
235
  - Does `constraints` include any rules this story must follow?
@@ -192,6 +245,26 @@ If the feature has ANY frontend stories that add or modify user-facing UI:
192
245
  - The E2E story should be the LAST story (depends on all others) to test the full integrated flow
193
246
  - If no E2E story exists, CREATE one as the final story
194
247
 
248
+ #### 6h. Responsive Design (for frontend stories)
249
+ Every frontend story that creates or modifies user-facing UI MUST include:
250
+ - `acceptanceCriteria` with responsive behavior: "Layout adapts to mobile (< 768px), tablet (768-1024px), and desktop (> 1024px)"
251
+ - `testSteps` with a viewport resize check OR Playwright test that validates mobile layout
252
+ - `notes` with Playwright MCP instructions to screenshot at mobile and desktop widths
253
+
254
+ **Example acceptanceCriteria:**
255
+ ```
256
+ "Component renders in single-column layout on mobile (< 768px)",
257
+ "Navigation collapses to hamburger menu on mobile",
258
+ "Touch targets are at least 44x44px on mobile"
259
+ ```
260
+
261
+ **Example testSteps:**
262
+ ```
263
+ "npx playwright test tests/e2e/dashboard.spec.ts --project=mobile"
264
+ ```
265
+
266
+ If a frontend story has no responsive criteria and the feature is user-facing, add them.
267
+
195
268
  #### 6g. Test Scenario Specificity
196
269
  Every story's `notes` field MUST include **3+ specific test scenarios** that describe what to test and how. Vague notes like "Test the service methods" are not acceptable.
197
270
 
@@ -214,7 +287,7 @@ Bad example:
214
287
  | Story depends on something not created | Reorder or add missing dependency |
215
288
  | Auth story missing security criteria | Add password hashing, rate limiting to acceptanceCriteria |
216
289
  | List endpoint missing pagination | Add pagination criteria to acceptanceCriteria |
217
- | Frontend missing contextFiles | Add idea file + styleguide paths |
290
+ | Frontend missing contextFiles | Add source file (idea or plan) + styleguide paths |
218
291
  | Frontend missing testUrl | Add URL from config |
219
292
  | Frontend missing mcp | Add `"mcp": ["playwright", "devtools"]` |
220
293
  | Frontend notes missing Playwright MCP guidance | Add visual verification instructions to notes (see Playwright MCP section) |
@@ -223,6 +296,7 @@ Bad example:
223
296
  | testSteps use import-checks (`python -c "from X import Y"`) | Replace with curl, pytest, or real behavioral tests |
224
297
  | No E2E story for user-facing feature | Add a final E2E story with Playwright tests |
225
298
  | Story notes lack specific test scenarios | Add 3+ concrete scenarios with inputs, expected outputs, and fixture references |
299
+ | Frontend story missing responsive design | Add mobile/tablet/desktop acceptanceCriteria and viewport test steps |
226
300
 
227
301
  ### Step 7: Reorder if Needed
228
302
 
@@ -259,14 +333,18 @@ Open the PRD for review:
259
333
  open -a TextEdit .ralph/prd.json
260
334
  ```
261
335
 
262
- Say: "I've {created|updated} the PRD with {N} stories and opened it in TextEdit.
336
+ Say: "I've {created|updated} the PRD with {N} stories and opened it in TextEdit."
263
337
 
264
- Review the PRD and let me know:
265
- - **'approved'** - Ready to run in your other terminal
266
- - **'edit [changes]'** - Tell me what to change
267
- - Or edit the JSON directly and say **'done'**"
338
+ Then use AskUserQuestion with **multiSelect: true**:
339
+ - **Question:** "How does the PRD look?"
340
+ - **Header:** "PRD review"
341
+ - **multiSelect:** true
342
+ - **Options:**
343
+ - **"Approved"** — "PRD is good — ready to run with Ralph"
344
+ - **"Edit"** — "I'll tell you what to change"
345
+ - **"I edited the JSON"** — "I made changes directly in the file, re-validate it"
268
346
 
269
- **STOP and wait for user response.**
347
+ If the user selects "Edit" (with or without other selections), **STOP and wait for their changes**. If "I edited the JSON" is selected, re-read and re-validate the PRD. If only "Approved" is selected, proceed to Step 9.
270
348
 
271
349
  ### Step 9: Final Instructions
272
350
 
@@ -274,7 +352,7 @@ Once approved, say:
274
352
 
275
353
  "PRD is ready!
276
354
 
277
- **Source:** `{idea-file-path}`
355
+ **Source:** `{source-file-path}`
278
356
  **PRD:** `.ralph/prd.json` ({N} stories)
279
357
 
280
358
  To start autonomous development, open another terminal and run:
@@ -296,7 +374,7 @@ Ralph will work through each story, running tests and committing as it goes."
296
374
  {
297
375
  "feature": {
298
376
  "name": "Feature Name",
299
- "ideaFile": "docs/ideas/{feature-name}.md",
377
+ "ideaFile": "docs/ideas/{feature-name}.md or docs/plans/{feature-name}.md",
300
378
  "branch": "feature/{feature-name}",
301
379
  "status": "pending"
302
380
  },
@@ -404,7 +482,7 @@ Ralph will work through each story, running tests and committing as it goes."
404
482
 
405
483
  | Field | Required | Description |
406
484
  |-------|----------|-------------|
407
- | `feature` | Yes | Feature name, ideaFile, branch, status |
485
+ | `feature` | Yes | Feature name, ideaFile (idea or plan path), branch, status |
408
486
  | `metadata` | Yes | Created date, estimated stories, complexity |
409
487
 
410
488
  **Note:** URLs come from `.ralph/config.json`, not the PRD. Use `{config.urls.backend}` in testSteps.
@@ -786,6 +864,7 @@ Use `contextFiles` to point Claude to important reference material:
786
864
  ```json
787
865
  "contextFiles": [
788
866
  "docs/ideas/dashboard.md",
867
+ "docs/plans/auth-feature.md",
789
868
  "src/styles/styleguide.html",
790
869
  "docs/api-spec.md"
791
870
  ]
@@ -807,7 +886,9 @@ This is where ASCII mockups, design specs, and detailed requirements live. Claud
807
886
  ### UI Stories Must Include
808
887
  - `testUrl` - Where to verify
809
888
  - `mcp: ["playwright", "devtools"]` - Browser tools
810
- - Acceptance criteria for: page loads, elements render, mobile works
889
+ - Acceptance criteria for: page loads, elements render correctly
890
+ - **Responsive design criteria**: layout adapts at mobile (< 768px), tablet (768-1024px), desktop (> 1024px) breakpoints
891
+ - Playwright test or MCP verification at multiple viewport widths
811
892
 
812
893
  ### API Stories Must Include
813
894
  - `apiContract` - Expected request/response
@@ -4,7 +4,7 @@ description: Run PRD validation to check story quality, test coverage, and struc
4
4
 
5
5
  # PRD Check
6
6
 
7
- Run PRD validation on demand to check story quality, test coverage, and structure before starting the autonomous loop.
7
+ Run PRD validation on demand to check story quality, test coverage, and structure before starting the autonomous loop. Cross-references against learned signs and past failure patterns.
8
8
 
9
9
  ## Instructions
10
10
 
@@ -17,32 +17,89 @@ ls -la .ralph/prd.json 2>/dev/null || echo "NOT_FOUND"
17
17
  ```
18
18
 
19
19
  If no PRD exists, tell the user:
20
- > No PRD found at `.ralph/prd.json`. Generate one first with `/idea` or `/prd`.
20
+ > No PRD found at `.ralph/prd.json`. Generate one first with `/prd`.
21
21
 
22
22
  **STOP** if no PRD found.
23
23
 
24
- ### Step 2: Run Validation (dry-run)
24
+ ### Step 2: Load Project Knowledge
25
25
 
26
- Run validation without auto-fix so you can present results and let the user decide:
26
+ Read the project's accumulated knowledge:
27
+
28
+ 1. Read signs:
29
+ ```bash
30
+ cat .ralph/signs.json 2>/dev/null
31
+ ```
32
+
33
+ 2. Read suggested signs (last 50 lines — file can be huge):
34
+ ```bash
35
+ tail -50 .ralph/suggested-signs.txt 2>/dev/null
36
+ ```
37
+
38
+ 3. Read recent progress for failure patterns:
39
+ ```bash
40
+ tail -100 .ralph/progress.txt 2>/dev/null
41
+ ```
42
+
43
+ ### Step 3: Run Structural Validation (dry-run)
27
44
 
28
45
  ```bash
29
46
  npx ralph prd-check --dry-run 2>&1
30
47
  ```
31
48
 
32
- ### Step 3: Present Results
49
+ Present any structural issues found.
50
+
51
+ ### Step 4: Cross-Reference Against Signs
52
+
53
+ Read `.ralph/prd.json` and for each story, check if any sign applies:
54
+
55
+ - **Backend signs** → check against backend stories
56
+ - **Frontend signs** → check against frontend stories
57
+ - **General signs** → check against all stories
58
+
59
+ For each applicable sign, verify the story's `acceptanceCriteria`, `constraints`,
60
+ `notes`, or `testSteps` reflect the pattern. Flag stories that should account for
61
+ a sign but don't.
62
+
63
+ **Examples:**
64
+ - Sign: "Always use bcrypt cost 10+ for passwords" → Flag auth stories missing
65
+ bcrypt in acceptanceCriteria
66
+ - Sign: "Use date-fns instead of moment.js" → Flag frontend stories that create
67
+ date utilities without this constraint
68
+ - Sign: "Add data-testid for Playwright selectors" → Flag frontend stories missing
69
+ this in constraints
70
+
71
+ ### Step 5: Check Against Suggested Learnings
72
+
73
+ Scan `suggested-signs.txt` for patterns relevant to the current PRD's feature area.
74
+ Flag any recurring failure patterns that the PRD's stories don't address.
75
+
76
+ ### Step 6: Present Results
77
+
78
+ Summarize all findings in categories:
33
79
 
34
- Show the validation output to the user. If there are issues, summarize them clearly.
80
+ > **Structural Issues** (from prd-check):
81
+ > - [list]
82
+ >
83
+ > **Sign Conflicts** (stories that don't account for known patterns):
84
+ > - TASK-003: Missing sign "bcrypt cost 10+" in auth story
85
+ > - TASK-005: Missing sign "data-testid attributes" in frontend story
86
+ >
87
+ > **Suggested Improvements** (from past learnings):
88
+ > - [relevant patterns from suggested-signs.txt]
35
89
 
36
- If issues were found, ask:
37
- > "Would you like me to fix these issues in the PRD?"
90
+ Ask: "Would you like me to fix these issues in the PRD?"
38
91
 
39
92
  **STOP and wait for user response.**
40
93
 
41
- If the user says yes, read `.ralph/prd.json`, fix the issues following PRD best practices (executable testSteps with curl/pytest/playwright, apiContract for backends, testUrl for frontends, security criteria for auth stories, pagination for list endpoints), and write the fixed file back.
94
+ If yes, update `.ralph/prd.json`:
95
+ - Add missing sign patterns to relevant story `constraints` or `acceptanceCriteria`
96
+ - Fix structural issues per PRD best practices
97
+ - Write the fixed file back
42
98
 
43
99
  ## Notes
44
100
 
45
- - This is the same validation that runs automatically at `ralph run` startup
101
+ - This is the same structural validation that runs automatically at `ralph run` startup
46
102
  - `--dry-run` skips auto-fix so you have control over what changes
47
103
  - Custom checks in `.ralph/checks/prd/` are also evaluated
104
+ - Signs cross-referencing catches patterns that structural validation can't
48
105
  - Run this before `ralph run` to catch and fix issues interactively