agentic-loop 3.4.7 → 3.5.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.
@@ -115,250 +115,33 @@ Once the user confirms, write the idea file:
115
115
  - Any unresolved decisions
116
116
  ```
117
117
 
118
- 3. Open the file for review:
119
- ```bash
120
- open -a TextEdit docs/ideas/{feature-name}.md
121
- ```
122
-
123
- 4. Say: "I've written the idea to `docs/ideas/{feature-name}.md`.
118
+ 3. Say: "I've written the idea to `docs/ideas/{feature-name}.md`.
124
119
 
125
120
  Review it and let me know:
126
- - **'approved'** - Ready to split into PRDs
121
+ - **'approved'** - Ready to generate PRD
127
122
  - **'edit [changes]'** - Tell me what to change"
128
123
 
129
124
  **STOP and wait for user response. Do not proceed until they say 'approved' or 'done'.**
130
125
 
131
- ### Step 5: Split into PRDs
126
+ ### Step 5: Generate PRD
132
127
 
133
128
  **Only proceed here after user explicitly approves the idea file.**
134
129
 
135
- Say: "Now I'll split this into executable PRDs for Ralph. Each story will be small enough to complete in one session."
136
-
137
- Break the idea into small, executable PRDs following the JSON structure below.
138
-
139
- ### Step 6: Write PRD
140
-
141
- 1. Ensure .ralph directory exists and allow PRD edit:
142
- ```bash
143
- mkdir -p .ralph && touch .ralph/.prd-edit-allowed
144
- ```
145
-
146
- 2. Write to `.ralph/prd.json` ensuring:
147
- - Valid JSON syntax
148
- - `feature.name` is set (not null/empty)
149
- - `feature.status` is "pending"
150
- - `stories` array is not empty
151
- - Each story has `id`, `title`, and `passes: false`
152
-
153
- 3. Validate the PRD was written correctly:
154
- ```bash
155
- jq -e '.feature.name and (.stories | length > 0) and (.stories | all(.id and .title and .passes == false))' .ralph/prd.json && echo "PRD valid" || echo "PRD invalid"
156
- ```
157
-
158
- 4. Say: "I've created the PRD with {N} stories in `.ralph/prd.json`.
159
-
160
- Review and let me know:
161
- - **'approved'** - Ready for `npx ralph run`
162
- - **'edit [changes]'** - Tell me what to change"
163
-
164
- **STOP and wait for user response. Do not proceed until they approve.**
165
-
166
- ### Step 7: Final Review
167
-
168
- Before finishing, do a quick sanity check on the PRD:
169
-
170
- 1. **Read the PRD back:**
171
- ```bash
172
- cat .ralph/prd.json | jq '.'
173
- ```
174
-
175
- 2. **Review for common issues:**
176
- - Are story IDs sequential and unique?
177
- - Does each story have testable acceptance criteria?
178
- - Are file paths specific (not vague like "src/")?
179
- - Are dependencies correctly ordered?
180
- - Are testSteps actually executable shell commands?
181
- - Is any story too large (>4 acceptance criteria)?
182
-
183
- 3. **If issues found**, say:
184
- "I found some issues with the PRD:
185
- - [issue 1]
186
- - [issue 2]
187
-
188
- Fixing now..."
189
-
190
- Then fix the issues and rewrite the PRD.
191
-
192
- 4. **If no issues**, proceed to final instructions.
193
-
194
- ### Step 8: Final Instructions
130
+ Say: "Now I'll generate the PRD from your idea file."
195
131
 
196
- Once the user approves the PRD, say:
197
-
198
- "Ready for autonomous development!
199
-
200
- **Idea:** `docs/ideas/{feature-name}.md`
201
- **PRD:** `.ralph/prd.json` ({N} stories)
202
-
203
- Run:
204
- ```bash
205
- npx ralph run
132
+ **Use the Skill tool** to invoke `/prd` with the idea file path:
206
133
  ```
207
-
208
- **DO NOT start implementing code. The user will run `npx ralph run` separately.**
209
-
210
- ---
211
-
212
- ## PRD JSON Structure
213
-
214
- ```json
215
- {
216
- "feature": {
217
- "name": "Feature Name",
218
- "ideaFile": "docs/ideas/{feature-name}.md",
219
- "branch": "feature/{feature-name}",
220
- "status": "pending"
221
- },
222
- "metadata": {
223
- "createdAt": "ISO timestamp",
224
- "estimatedStories": 5,
225
- "complexity": "low|medium|high"
226
- },
227
- "stories": [
228
- {
229
- "id": "TASK-001",
230
- "type": "frontend|backend",
231
- "title": "Short description",
232
- "passes": false,
233
-
234
- "files": {
235
- "create": ["paths to new files"],
236
- "modify": ["paths to existing files"],
237
- "reuse": ["existing files to import from"]
238
- },
239
-
240
- "acceptanceCriteria": [
241
- "What it should do"
242
- ],
243
-
244
- "errorHandling": [
245
- "What happens when things fail"
246
- ],
247
-
248
- "testSteps": [
249
- "MUST be executable shell commands - see examples below"
250
- ],
251
-
252
- "dependsOn": [],
253
-
254
- "notes": ""
255
- }
256
- ]
257
- }
134
+ Skill: prd
135
+ Args: docs/ideas/{feature-name}.md
258
136
  ```
259
137
 
260
- ### Frontend stories also need:
261
- - `testUrl` - URL to test
262
- - `loadingState` - What shows during async operations
263
- - `a11y` - Accessibility requirements
264
- - `mobile` - How it works on mobile
138
+ This hands off to `/prd` which handles:
139
+ - Reading the idea file
140
+ - Splitting into stories
141
+ - Writing `.ralph/prd.json`
142
+ - All PRD schema details (testing, testSteps, MCP tools, etc.)
265
143
 
266
- ### E2E Tests
267
- Add `"e2e": true` to **any frontend story where users interact** with the feature:
268
- - Forms, buttons, inputs, modals, wizards → e2e
269
- - Real-time features, drag & drop, file uploads → e2e
270
- - Multi-page flows, navigation → e2e
271
- - Static display-only components (no interaction) → skip e2e
272
-
273
- When `e2e: true`, the story should:
274
- - Create a Playwright test file in `tests/e2e/{story-id}.spec.ts`
275
- - Include the test in `testSteps`: `"npx playwright test tests/e2e/{story-id}.spec.ts"`
276
- - **Skip in CI** (runs nightly instead): Add `test.skip(!!process.env.CI, 'Runs nightly');` at top of test
277
-
278
- Don't ask - if users touch it, test it.
279
-
280
- ### Backend stories also need:
281
- - `apiEndpoints` - Endpoints to test
282
- - `validation` - Input validation rules
283
- - `auth` - Authentication requirements
284
- - `scale` - Rate limiting, pagination (for list endpoints), caching
285
-
286
- ---
287
-
288
- ## Guidelines
289
-
290
- ### Story Guidelines
291
- - **Keep stories small** - Max 3-4 acceptance criteria per story, ~1000 tokens max description
292
- - **Order by dependency** - Stories that depend on others come later
293
- - **Max 10 stories** - If more, suggest splitting into phases
294
- - **Define error handling** - Every story specifies what happens on failure
295
- - **Notes field** - Claude fills this as it works (files created, decisions made, context for next story)
296
-
297
- ### Context Size Limits
298
- Each story must be completable in ONE Claude session without context overflow:
299
- - **Max ~1000 tokens** for story description (title + criteria + error handling)
300
- - **Max 3-4 files** created or modified per story
301
- - If a story feels too big, split it
302
-
303
- ### UI Stories Must Include Browser Verification
304
- For frontend stories, acceptance criteria MUST include:
305
- - "Page loads without console errors"
306
- - "Required elements render" (specify which: header, form, button, etc.)
307
- - "Works on mobile viewport (375px)"
308
-
309
- These get verified by Playwright tests and MCP browser tools.
310
-
311
- ### Test Steps - CRITICAL
312
- **Test steps MUST be executable shell commands.** Ralph runs them with bash.
313
-
314
- ✅ **GOOD test steps (executable):**
315
- ```json
316
- "testSteps": [
317
- "curl -s http://localhost:3000/api/health | jq -e '.status == \"ok\"'",
318
- "curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/api/users | grep 200",
319
- "test -f frontend/src/components/Button.tsx",
320
- "grep -q 'export function Button' frontend/src/components/Button.tsx",
321
- "cd frontend && npx tsc --noEmit",
322
- "docker compose exec -T web python manage.py test app.tests.TestUserAPI",
323
- "npx playwright test tests/e2e/dashboard.spec.ts",
324
- "npx playwright test --grep 'login flow'",
325
- "cd frontend && npm test -- --testPathPattern=Button.test.tsx"
326
- ]
327
- ```
328
-
329
- **For UI/visual verification, use Playwright tests:**
330
- ```json
331
- "testSteps": [
332
- "npx playwright test tests/e2e/chat-panel.spec.ts"
333
- ]
334
- ```
335
-
336
- The Playwright test file can check:
337
- - Element visibility and positioning
338
- - Console errors (no errors in DevTools)
339
- - Network requests completing
340
- - Visual layout (screenshots, viewport checks)
341
- - Accessibility (axe-core integration)
342
-
343
- ❌ **BAD test steps (not executable - will fail):**
344
- ```json
345
- "testSteps": [
346
- "Visit http://localhost:3000/dashboard",
347
- "User can see the dashboard",
348
- "Click the submit button",
349
- "Form validates correctly",
350
- "Chat panel renders in top 60%",
351
- "Check DevTools for errors"
352
- ]
353
- ```
354
-
355
- **If a step can't be automated**, leave it out of testSteps and put it in acceptanceCriteria instead. Claude will verify acceptanceCriteria visually using MCP browser tools.
356
-
357
- ### Architecture Guidelines
358
- - **Domain-driven directories** - Group by feature (`src/contact/`) not type (`src/components/`)
359
- - **Max 300 lines per file** - Split large files
360
- - **Reuse over recreate** - Check for existing utilities first
361
- - **Explicit file paths** - Every story specifies exactly which files
144
+ **DO NOT duplicate the PRD schema or guidelines here - /prd is the single source of truth.**
362
145
 
363
146
  ---
364
147
 
@@ -366,33 +149,40 @@ The Playwright test file can check:
366
149
 
367
150
  - If user provides no arguments, ask what they want to brainstorm
368
151
  - If user abandons mid-flow, the idea file is still saved for later
152
+ - If /prd fails, check the idea file has enough detail
369
153
 
370
- ### If PRD Already Exists
154
+ ---
371
155
 
372
- Before writing to `.ralph/prd.json`, check if it exists:
156
+ ## Guidelines
373
157
 
374
- ```bash
375
- cat .ralph/prd.json 2>/dev/null | jq '{stories: .stories | length, completed: [.stories[] | select(.passes == true)] | length}'
376
- ```
158
+ ### Idea File Quality
377
159
 
378
- If it exists, say:
379
- "📋 `.ralph/prd.json` already exists with {N} stories ({M} completed, {P} pending).
160
+ A good idea file has:
161
+ - **Clear problem statement** - What's broken or missing?
162
+ - **Specific solution** - Not vague ("improve UX") but concrete ("add inline validation")
163
+ - **Scope boundaries** - What's explicitly out of scope?
164
+ - **Architecture hints** - Where do files go? What patterns to follow?
380
165
 
381
- Options:
382
- - **'append'** - Add new stories to existing PRD (recommended)
383
- - **'overwrite'** - Replace entirely
384
- - **'cancel'** - Stop here"
166
+ ### ASCII Art for UI
385
167
 
386
- **STOP and wait for user choice.**
168
+ If the feature involves UI, include ASCII mockups in the idea file:
387
169
 
388
- If **'append'**:
389
- - Find highest existing story number (ignore prefix - could be US-019 or TASK-019)
390
- - **Always use TASK- prefix** for new stories (e.g., if highest is US-019 or TASK-019, new stories start at TASK-020)
391
- - Read existing PRD, add new stories to the `stories` array
392
- - Update `metadata.estimatedStories` count
393
- - Write back to `.ralph/prd.json`
170
+ ```
171
+ ┌─────────────────────────────────────┐
172
+ │ Dashboard [⚙️] │
173
+ ├─────────────────────────────────────┤
174
+ │ │
175
+ │ ┌─────────┐ ┌─────────┐ │
176
+ │ │ Card 1 │ │ Card 2 │ │
177
+ │ │ $1,234 │ │ 89% │ │
178
+ │ └─────────┘ └─────────┘ │
179
+ │ │
180
+ │ ┌─────────────────────────────┐ │
181
+ │ │ Recent Activity │ │
182
+ │ │ • Item 1 │ │
183
+ │ │ • Item 2 │ │
184
+ │ └─────────────────────────────┘ │
185
+ └─────────────────────────────────────┘
186
+ ```
394
187
 
395
- If **'overwrite'**:
396
- - Archive first: `mkdir -p .ralph/archive && mv .ralph/prd.json .ralph/archive/prd-$(date +%Y%m%d-%H%M%S).json`
397
- - Allow edit: `touch .ralph/.prd-edit-allowed`
398
- - Write new PRD
188
+ Ralph will read these from the idea file via `story.contextFiles`.