opencodekit 0.14.0 → 0.14.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.
Files changed (54) hide show
  1. package/dist/index.js +53 -18
  2. package/dist/template/.opencode/.background-tasks.json +96 -0
  3. package/dist/template/.opencode/.ralph-state.json +12 -0
  4. package/dist/template/.opencode/AGENTS.md +112 -6
  5. package/dist/template/.opencode/agent/build.md +60 -8
  6. package/dist/template/.opencode/agent/explore.md +1 -0
  7. package/dist/template/.opencode/agent/looker.md +124 -0
  8. package/dist/template/.opencode/agent/planner.md +40 -1
  9. package/dist/template/.opencode/agent/review.md +1 -0
  10. package/dist/template/.opencode/agent/rush.md +53 -6
  11. package/dist/template/.opencode/agent/scout.md +1 -1
  12. package/dist/template/.opencode/agent/vision.md +0 -1
  13. package/dist/template/.opencode/command/brainstorm.md +58 -3
  14. package/dist/template/.opencode/command/finish.md +18 -8
  15. package/dist/template/.opencode/command/fix.md +24 -15
  16. package/dist/template/.opencode/command/implement.md +95 -29
  17. package/dist/template/.opencode/command/import-plan.md +30 -8
  18. package/dist/template/.opencode/command/new-feature.md +105 -14
  19. package/dist/template/.opencode/command/plan.md +78 -11
  20. package/dist/template/.opencode/command/pr.md +25 -15
  21. package/dist/template/.opencode/command/ralph-loop.md +97 -0
  22. package/dist/template/.opencode/command/revert-feature.md +15 -3
  23. package/dist/template/.opencode/command/skill-optimize.md +71 -7
  24. package/dist/template/.opencode/command/start.md +63 -15
  25. package/dist/template/.opencode/dcp.jsonc +11 -7
  26. package/dist/template/.opencode/memory/{project/beads-workflow.md → beads-workflow.md} +53 -0
  27. package/dist/template/.opencode/memory/observations/2026-01-09-pattern-ampcode-mcp-json-includetools-pattern.md +42 -0
  28. package/dist/template/.opencode/memory/project/conventions.md +53 -3
  29. package/dist/template/.opencode/memory/project/gotchas.md +52 -5
  30. package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/{0-8d00d272-cb80-463b-9774-7120a1c994e7.txn → 0-0d25ba80-ba3b-4209-9046-b45d6093b4da.txn} +0 -0
  31. package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/1.manifest +0 -0
  32. package/dist/template/.opencode/memory/vector_db/memories.lance/data/{001010101000000101110001f998d04b63936ff83f9a34152d.lance → 1111100101010101011010004a9ef34df6b29f36a9a53a2892.lance} +0 -0
  33. package/dist/template/.opencode/opencode.json +529 -587
  34. package/dist/template/.opencode/package.json +2 -1
  35. package/dist/template/.opencode/plugin/lsp.ts +299 -0
  36. package/dist/template/.opencode/plugin/memory.ts +77 -1
  37. package/dist/template/.opencode/plugin/package.json +1 -1
  38. package/dist/template/.opencode/plugin/ralph-wiggum.ts +182 -0
  39. package/dist/template/.opencode/plugin/skill-mcp.ts +155 -36
  40. package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +43 -65
  41. package/dist/template/.opencode/skill/chrome-devtools/mcp.json +19 -0
  42. package/dist/template/.opencode/skill/executing-plans/SKILL.md +32 -2
  43. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +42 -17
  44. package/dist/template/.opencode/skill/playwright/SKILL.md +58 -133
  45. package/dist/template/.opencode/skill/playwright/mcp.json +16 -0
  46. package/dist/template/.opencode/tool/background.ts +461 -0
  47. package/dist/template/.opencode/tool/memory-search.ts +2 -2
  48. package/dist/template/.opencode/tool/ralph.ts +203 -0
  49. package/package.json +4 -16
  50. package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/1-a3bea825-dad3-47dd-a6d6-ff41b76ff7b0.txn +0 -0
  51. package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/2.manifest +0 -0
  52. package/dist/template/.opencode/memory/vector_db/memories.lance/data/010000101010000000010010701b3840d38c2b5f275da99978.lance +0 -0
  53. /package/dist/template/.opencode/memory/{project/README.md → README.md} +0 -0
  54. /package/dist/template/.opencode/plugin/{notification.ts → notification.ts.bak} +0 -0
@@ -73,31 +73,35 @@ If memory search fails (Ollama not running), continue to subagent research.
73
73
 
74
74
  ## Phase 1: Parallel Subagent Research
75
75
 
76
- Gather context before designing. Fire both in parallel:
76
+ Gather context before designing. Fire both in background:
77
77
 
78
78
  ```typescript
79
79
  // Codebase patterns
80
- Task({
81
- subagent_type: "explore",
80
+ background_start({
81
+ agent: "explore",
82
82
  prompt: `For planning $ARGUMENTS, research the codebase:
83
83
  1. Find similar implementations or patterns
84
84
  2. Identify affected files and their structure
85
85
  3. Find related tests and testing patterns
86
86
  4. Check for potential conflicts with in-progress work
87
87
  Return: File paths, code patterns, test approach, conflicts`,
88
- description: "Explore codebase for planning",
89
- });
88
+ title: "explore-for-plan",
89
+ }); // → bg_123_abc
90
90
 
91
91
  // External best practices
92
- Task({
93
- subagent_type: "scout",
92
+ background_start({
93
+ agent: "scout",
94
94
  prompt: `Research implementation approaches for $ARGUMENTS:
95
95
  1. Best practices from official documentation
96
96
  2. Common patterns in open source projects
97
97
  3. Pitfalls and anti-patterns to avoid
98
98
  Return: Recommendations, code examples, warnings`,
99
- description: "Scout best practices for planning",
100
- });
99
+ title: "scout-for-plan",
100
+ }); // → bg_456_def
101
+
102
+ // Collect when ready
103
+ background_output({ taskId: "bg_123_abc" });
104
+ background_output({ taskId: "bg_456_def" });
101
105
  ```
102
106
 
103
107
  **Continue working while subagents research.**
@@ -186,7 +190,25 @@ Decomposition: [Single bead | X tasks | X tasks with subtasks]
186
190
 
187
191
  Save to `.beads/artifacts/$ARGUMENTS/design.md`.
188
192
 
189
- **STOP. Wait for user to pick an option.**
193
+ **STOP. Use question tool to ask user to pick an option:**
194
+
195
+ ```typescript
196
+ question({
197
+ questions: [
198
+ {
199
+ header: "Design",
200
+ question: "Which implementation approach should I use for $ARGUMENTS?",
201
+ options: [
202
+ { label: "Option A (Recommended)", description: "[Option A summary]" },
203
+ { label: "Option B", description: "[Option B summary]" },
204
+ { label: "Option C", description: "[Option C summary]" },
205
+ ],
206
+ },
207
+ ],
208
+ });
209
+ ```
210
+
211
+ Wait for user's answer before proceeding.
190
212
 
191
213
  ---
192
214
 
@@ -395,7 +417,52 @@ If issues detected after deployment:
395
417
 
396
418
  ---
397
419
 
398
- ## Phase 7: Sync and Report
420
+ ## Phase 7: Parallel Task Execution (if --parallel)
421
+
422
+ After creating hierarchy, execute READY tasks in parallel:
423
+
424
+ ```bash
425
+ # Check what's ready to start
426
+ bd ready --json
427
+ ```
428
+
429
+ ```typescript
430
+ // Fire all READY tasks in parallel with beads integration
431
+ for (const task of readyTasks) {
432
+ background_start({
433
+ agent: "build",
434
+ prompt: `Execute ${task.id}: ${task.title}
435
+
436
+ Context: Part of plan for $ARGUMENTS
437
+ Spec: See .beads/artifacts/$ARGUMENTS/plan.md
438
+
439
+ Requirements:
440
+ - Complete work items for this task
441
+ - Run verification commands from plan
442
+ - Commit with bead ID in message
443
+
444
+ Return: Changes made, verification results`,
445
+ beadId: task.id,
446
+ autoCloseBead: true,
447
+ title: `exec-${task.id}`
448
+ })
449
+ }
450
+
451
+ // Collect results
452
+ for (const taskId of backgroundTaskIds) {
453
+ background_output({ taskId }) // → beadClosed: true
454
+ }
455
+
456
+ // Check newly unblocked tasks
457
+ bd ready // → Next wave of tasks now READY
458
+
459
+ // Cleanup
460
+ background_cancel({ all: true })
461
+ ```
462
+
463
+ ---
464
+
465
+ ## Phase 8: Sync and Report
399
466
 
400
467
  ```bash
401
468
  bd sync
@@ -120,23 +120,33 @@ git log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || git l
120
120
  git diff --stat origin/$(git branch --show-current)..HEAD 2>/dev/null || git diff --stat HEAD~3..HEAD
121
121
  ```
122
122
 
123
- **Present to user:**
123
+ **Use question tool to get push/PR decision:**
124
124
 
125
+ ```typescript
126
+ question({
127
+ questions: [
128
+ {
129
+ header: "Push",
130
+ question: "Ready to push and create PR for $ARGUMENTS. What should I do?",
131
+ options: [
132
+ {
133
+ label: "Push & create PR (Recommended)",
134
+ description: "Push branch and create PR",
135
+ },
136
+ { label: "Push & draft PR", description: "Create as draft for review" },
137
+ {
138
+ label: "Show diff first",
139
+ description: "Review changes before pushing",
140
+ },
141
+ {
142
+ label: "Skip (I'll push manually)",
143
+ description: "Handle PR creation manually",
144
+ },
145
+ ],
146
+ },
147
+ ],
148
+ });
125
149
  ```
126
- Ready to Push & Create PR
127
- ━━━━━━━━━━━━━━━━━━━━━━━━━
128
-
129
- Branch: [current branch]
130
- Commits: [N commits ahead of origin]
131
-
132
- Would you like me to:
133
- 1. Push and create PR
134
- 2. Push and create draft PR
135
- 3. Show full diff first
136
- 4. Skip (I'll push manually)
137
- ```
138
-
139
- **Wait for user confirmation before proceeding.**
140
150
 
141
151
  If user confirms, push:
142
152
 
@@ -0,0 +1,97 @@
1
+ ---
2
+ description: Start Ralph Wiggum autonomous loop for task completion
3
+ argument-hint: "<task> [--prd <file>] [--max <iterations>] [--afk]"
4
+ agent: build
5
+ ---
6
+
7
+ # Ralph Wiggum Loop
8
+
9
+ You are starting a Ralph Wiggum autonomous loop. This pattern enables you to work autonomously on a task list until completion.
10
+
11
+ ## Task
12
+
13
+ $ARGUMENTS
14
+
15
+ ## Setup
16
+
17
+ 1. **Start the loop** by calling the `ralph-start` tool:
18
+
19
+ ```typescript
20
+ ralph -
21
+ start({
22
+ task: "$1",
23
+ prdFile: "$2" || null, // Optional: PRD.md, tasks.md, etc.
24
+ progressFile: "progress.txt",
25
+ maxIterations: 50,
26
+ mode: "hitl", // or "afk" for autonomous
27
+ });
28
+ ```
29
+
30
+ 2. **Create progress.txt** if it doesn't exist:
31
+
32
+ ```markdown
33
+ # Progress Log
34
+
35
+ ## Session Started: [date]
36
+
37
+ ### Completed Tasks
38
+
39
+ (none yet)
40
+
41
+ ### Notes for Next Iteration
42
+
43
+ - Starting fresh
44
+ ```
45
+
46
+ ## Loop Behavior
47
+
48
+ After each iteration, the loop will automatically:
49
+
50
+ 1. Check if you output `<promise>COMPLETE</promise>`
51
+ 2. If yes → Loop ends, success!
52
+ 3. If no → Send continuation prompt for next iteration
53
+ 4. Repeat until completion or max iterations
54
+
55
+ ## Your Instructions
56
+
57
+ For each iteration:
58
+
59
+ 1. **Review** the PRD/task list and progress file
60
+ 2. **Choose** the highest-priority incomplete task (YOU decide, not first in list)
61
+ 3. **Implement** ONE feature only (small steps prevent context rot)
62
+ 4. **Validate** with feedback loops:
63
+ - `npm run typecheck` (must pass)
64
+ - `npm run test` (must pass)
65
+ - `npm run lint` (must pass)
66
+ 5. **Commit** if all pass
67
+ 6. **Update** progress.txt with:
68
+ - Task completed
69
+ - Key decisions made
70
+ - Files changed
71
+ - Notes for next iteration
72
+
73
+ ## Exit Conditions
74
+
75
+ Output `<promise>COMPLETE</promise>` when:
76
+
77
+ - ALL tasks in the PRD are complete
78
+ - ALL feedback loops pass
79
+ - Code is committed
80
+
81
+ The loop will also stop if:
82
+
83
+ - Max iterations reached
84
+ - You call `ralph-stop` tool
85
+ - An error occurs
86
+
87
+ ## Best Practices
88
+
89
+ - **Small steps**: One feature per iteration
90
+ - **Quality over speed**: Never skip tests
91
+ - **Explicit scope**: Vague tasks loop forever
92
+ - **Track progress**: Update progress.txt every iteration
93
+ - **Prioritize risk**: Hard tasks first, easy wins last
94
+
95
+ ## Start Now
96
+
97
+ Call `ralph-start` with the task description to begin the loop.
@@ -99,7 +99,7 @@ Before reverting, check what depends on this:
99
99
 
100
100
  ### Downstream Report
101
101
 
102
- ```
102
+ ````
103
103
  Downstream Impact Analysis
104
104
  ━━━━━━━━━━━━━━━━━━━━━━━━━━
105
105
 
@@ -119,8 +119,20 @@ Feature flags:
119
119
  - AUTH_ENABLED flag in production
120
120
 
121
121
  CAUTION: Reverting may break dependent features.
122
- Proceed? (yes/abort/revert-cascade)
123
- ```
122
+
123
+ ```typescript
124
+ question({
125
+ questions: [{
126
+ header: "Confirm",
127
+ question: "Ready to revert $ARGUMENTS? Breaking changes detected.",
128
+ options: [
129
+ { label: "Proceed with revert", description: "Execute revert with backups" },
130
+ { label: "Abort", description: "Cancel this operation" },
131
+ { label: "Revert cascade", description: "Revert dependent features too" }
132
+ ]
133
+ }]
134
+ });
135
+ ````
124
136
 
125
137
  ---
126
138
 
@@ -150,7 +150,37 @@ Rules:
150
150
 
151
151
  ### Clarification Techniques
152
152
 
153
- ```
153
+ ````
154
+ BEFORE (vague):
155
+ ──────────────
156
+ "Check that the configuration is correct."
157
+
158
+ AFTER (specific):
159
+ ────────────────
160
+ "Verify config:
161
+ 1. Run: `npm run config:check`
162
+ 2. Confirm output shows: 'Configuration valid'
163
+ 3. If errors, check [specific file] for [specific issue]"
164
+
165
+ Rules:
166
+ - Replace "check" with specific verification command
167
+ - Include expected output
168
+ - Add troubleshooting for failures
169
+
170
+ Use question tool to confirm:
171
+ ```typescript
172
+ question({
173
+ questions: [{
174
+ header: "Verify",
175
+ question: "Configuration verified. Ready to continue?",
176
+ options: [
177
+ { label: "Yes, continue", description: "Proceed with optimization" },
178
+ { label: "No, fix issues", description: "Address validation errors first" }
179
+ ]
180
+ }]
181
+ });
182
+ ````
183
+
154
184
  BEFORE (vague):
155
185
  ───────────────
156
186
  "Check that the configuration is correct."
@@ -158,19 +188,23 @@ BEFORE (vague):
158
188
  AFTER (specific):
159
189
  ─────────────────
160
190
  "Verify config:
191
+
161
192
  1. Run: `npm run config:check`
162
193
  2. Confirm output shows: 'Configuration valid'
163
194
  3. If errors, check [specific file] for [specific issue]"
164
195
 
165
196
  Rules:
197
+
166
198
  - Replace "check" with specific verification command
167
199
  - Include expected output
168
200
  - Add troubleshooting for failures
201
+
169
202
  ```
170
203
 
171
204
  ### Hardening Techniques
172
205
 
173
206
  ```
207
+
174
208
  BEFORE (soft):
175
209
  ──────────────
176
210
  "You should generally avoid committing directly to main."
@@ -180,20 +214,24 @@ AFTER (hardened):
180
214
  "NEVER commit directly to main. ALWAYS use feature branches.
181
215
 
182
216
  If tempted to commit to main because 'it's just a small fix':
217
+
183
218
  - STOP
184
219
  - Create branch anyway: git checkout -b fix/small-fix
185
220
  - This is NOT optional"
186
221
 
187
222
  Rules:
223
+
188
224
  - Add MUST/NEVER to critical rules
189
225
  - Anticipate rationalizations
190
226
  - Explicitly reject common excuses
191
227
  - Name the anti-pattern
228
+
192
229
  ```
193
230
 
194
231
  ### Expansion Techniques
195
232
 
196
233
  ```
234
+
197
235
  BEFORE (incomplete):
198
236
  ────────────────────
199
237
  "Handle errors appropriately."
@@ -203,23 +241,28 @@ AFTER (comprehensive):
203
241
  "Error Handling:
204
242
 
205
243
  Network Errors:
244
+
206
245
  - Retry 2x with exponential backoff
207
246
  - If still failing, log and surface to user
208
247
 
209
248
  Validation Errors:
249
+
210
250
  - Display specific field errors
211
251
  - Do NOT proceed with invalid data
212
252
 
213
253
  Permission Errors:
254
+
214
255
  - Log with full context
215
256
  - Display user-friendly message
216
257
  - Do NOT expose internal details"
217
258
 
218
259
  Rules:
260
+
219
261
  - List specific error categories
220
262
  - Provide handling for each
221
263
  - Include what NOT to do
222
- ```
264
+
265
+ ````
223
266
 
224
267
  ## Phase 5: Test Optimizations
225
268
 
@@ -232,9 +275,9 @@ task({
232
275
  description: "Test original skill",
233
276
  prompt: `
234
277
  Load skill: skill({ name: "$ARGUMENTS" })
235
-
278
+
236
279
  Scenario: [test scenario]
237
-
280
+
238
281
  Follow the skill and report each step.
239
282
  `,
240
283
  });
@@ -245,13 +288,13 @@ task({
245
288
  description: "Test optimized skill",
246
289
  prompt: `
247
290
  Load skill: skill({ name: "$ARGUMENTS" })
248
-
291
+
249
292
  Scenario: [same test scenario]
250
-
293
+
251
294
  Follow the skill and report each step.
252
295
  `,
253
296
  });
254
- ```
297
+ ````
255
298
 
256
299
  ### Compare Results
257
300
 
@@ -367,6 +410,27 @@ write({
367
410
  skill({ name: "$ARGUMENTS" });
368
411
  ```
369
412
 
413
+ ```typescript
414
+ question({
415
+ questions: [
416
+ {
417
+ header: "Verify",
418
+ question: "Skill optimized and saved. Ready to deploy?",
419
+ options: [
420
+ {
421
+ label: "Yes, deploy (Recommended)",
422
+ description: "All verifications passed",
423
+ },
424
+ {
425
+ label: "No, fix issues",
426
+ description: "Need to address verification failures",
427
+ },
428
+ ],
429
+ },
430
+ ],
431
+ });
432
+ ```
433
+
370
434
  Confirm:
371
435
 
372
436
  - [ ] Skill loads without error
@@ -75,14 +75,40 @@ bd update $ARGUMENTS --status in_progress
75
75
 
76
76
  ## Workspace Setup
77
77
 
78
- ### Option A: Feature Branch (default)
78
+ ### Create Feature Branch
79
79
 
80
- If not already on a feature branch:
80
+ Extract task info and parent branch for a readable branch name:
81
81
 
82
82
  ```bash
83
- git checkout -b $ARGUMENTS
83
+ # Get current branch (parent branch)
84
+ PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
85
+
86
+ # Get task title and type from bead
87
+ BEAD_INFO=$(bd show $ARGUMENTS --json 2>/dev/null)
88
+ BEAD_TITLE=$(echo "$BEAD_INFO" | jq -r '.title // ""' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
89
+ BEAD_TYPE=$(echo "$BEAD_INFO" | jq -r '.type // "task"')
90
+
91
+ # Map bead type to branch prefix
92
+ case "$BEAD_TYPE" in
93
+ "bug") PREFIX="fix" ;;
94
+ "feature"|"epic") PREFIX="feat" ;;
95
+ "refactor") PREFIX="refactor" ;;
96
+ "chore") PREFIX="chore" ;;
97
+ *) PREFIX="feat" ;;
98
+ esac
99
+
100
+ # Create branch: <parent>/<type>/<bead-id>-<description>
101
+ BRANCH_NAME="${PARENT_BRANCH}/${PREFIX}/$ARGUMENTS-${BEAD_TITLE}"
102
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || echo "Branch already exists or already on it"
84
103
  ```
85
104
 
105
+ **Branch naming convention:**
106
+ | Parent Branch | Bead Type | Example |
107
+ |---------------|-----------|---------|
108
+ | main | bug | `main/fix/bd-a1b2-login-error` |
109
+ | develop | feature | `develop/feat/bd-c3d4-user-auth` |
110
+ | release-v2 | chore | `release-v2/chore/bd-e5f6-update-deps` |
111
+
86
112
  ### Option B: Git Worktree (if --worktree flag)
87
113
 
88
114
  For isolated work that won't conflict with main workspace:
@@ -101,11 +127,30 @@ skill({ name: "using-git-worktrees" });
101
127
  **Worktree setup:**
102
128
 
103
129
  ```bash
130
+ # Get current branch (parent branch)
131
+ PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
132
+
133
+ # Get task title for readable worktree name
134
+ BEAD_INFO=$(bd show $ARGUMENTS --json 2>/dev/null)
135
+ BEAD_TITLE=$(echo "$BEAD_INFO" | jq -r '.title // ""' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
136
+ BEAD_TYPE=$(echo "$BEAD_INFO" | jq -r '.type // "task"')
137
+
138
+ # Map bead type to branch prefix
139
+ case "$BEAD_TYPE" in
140
+ "bug") PREFIX="fix" ;;
141
+ "feature"|"epic") PREFIX="feat" ;;
142
+ "refactor") PREFIX="refactor" ;;
143
+ *) PREFIX="feat" ;;
144
+ esac
145
+
146
+ # Create branch: <parent>/<type>/<bead-id>-<description>
147
+ BRANCH_NAME="${PARENT_BRANCH}/${PREFIX}/$ARGUMENTS-${BEAD_TITLE}"
148
+
104
149
  # Verify .gitignore has worktree directory
105
150
  grep -q "^\.worktrees/$" .gitignore || echo ".worktrees/" >> .gitignore
106
151
 
107
- # Create worktree
108
- git worktree add .worktrees/$ARGUMENTS -b $ARGUMENTS
152
+ # Create worktree with readable branch name
153
+ git worktree add ".worktrees/$ARGUMENTS" -b "$BRANCH_NAME"
109
154
 
110
155
  # Navigate to worktree
111
156
  cd .worktrees/$ARGUMENTS
@@ -124,33 +169,36 @@ cd .worktrees/$ARGUMENTS
124
169
  For complex tasks, gather context before diving in:
125
170
 
126
171
  ```typescript
127
- // Fire subagents in parallel - don't wait for results
128
- Task({
129
- subagent_type: "explore",
172
+ // Fire subagents in background - don't wait for results
173
+ background_start({
174
+ agent: "explore",
130
175
  prompt: `Research codebase patterns for $ARGUMENTS:
131
176
  - Find similar implementations
132
177
  - Identify affected files
133
178
  - Note testing patterns used
134
179
  Return: File list, patterns found, testing approach`,
135
- description: "Explore codebase for task",
136
- });
180
+ title: "explore-codebase",
181
+ }); // → bg_123_abc
137
182
 
138
- Task({
139
- subagent_type: "scout",
183
+ background_start({
184
+ agent: "scout",
140
185
  prompt: `Research external docs for $ARGUMENTS:
141
186
  - API documentation for libraries involved
142
187
  - Best practices for the approach
143
188
  - Common pitfalls to avoid
144
189
  Return: Key findings, code examples, warnings`,
145
- description: "Scout external resources",
146
- });
190
+ title: "scout-docs",
191
+ }); // → bg_456_def
192
+
193
+ // Collect later with: background_output({ taskId: "bg_123_abc" })
147
194
  ```
148
195
 
149
196
  **Subagent delegation rules:**
150
197
 
151
198
  - Subagents are **read-only** - they don't modify beads state
152
- - Results return to you (build agent) for integration
199
+ - Results collected via `background_output({ taskId })` when ready
153
200
  - Use for research, not for implementation
201
+ - Cleanup at session end: `background_cancel({ all: true })`
154
202
 
155
203
  ## Existing Artifacts
156
204
 
@@ -14,28 +14,32 @@
14
14
  // Nudge every 8 tool calls (slightly more aggressive than default 10)
15
15
  "nudgeFrequency": 8,
16
16
  // Protect state-modifying and critical workflow tools
17
+ // Updated for v1.1.8: Added question tool, removed legacy bd_* (use CLI)
17
18
  "protectedTools": [
18
19
  "write",
19
20
  "edit",
21
+ "question",
20
22
  "memory-read",
21
23
  "memory-update",
22
24
  "memory-search",
23
25
  "observation",
24
26
  "skill",
25
27
  "skill_mcp",
28
+ "task",
29
+ "batch",
30
+ "todowrite",
31
+ "todoread",
32
+ "lsp",
26
33
  "lsp_lsp_rename",
27
34
  "lsp_lsp_find_references",
28
35
  "lsp_lsp_goto_definition",
29
36
  "lsp_lsp_code_actions",
30
37
  "lsp_lsp_code_action_apply",
31
38
  "lsp_lsp_organize_imports",
32
- "bd_init",
33
- "bd_claim",
34
- "bd_done",
35
- "bd_show",
36
- "bd_reserve",
37
- "bd_reservations",
38
- "bd_sync"
39
+ "bd-reserve",
40
+ "bd-release",
41
+ "bd-msg",
42
+ "bd-inbox"
39
43
  ]
40
44
  },
41
45
  "discard": {
@@ -426,6 +426,59 @@ git worktree remove .worktrees/bd-epic # Cleanup worktree
426
426
  /finish bd-epic
427
427
  ```
428
428
 
429
+ ### Pattern 8: Ralph Wiggum Autonomous Loop
430
+
431
+ For tasks that can run autonomously until completion. The agent loops until it outputs `<promise>COMPLETE</promise>` or hits max iterations.
432
+
433
+ ```
434
+ /ralph-loop "Migrate all Jest tests to Vitest"
435
+ # Or with PRD file:
436
+ /ralph-loop "Complete PRD tasks" --prd PRD.md --max 50
437
+
438
+ # Agent automatically:
439
+ # 1. Picks highest-priority incomplete task
440
+ # 2. Implements ONE feature
441
+ # 3. Runs feedback loops (typecheck, test, lint)
442
+ # 4. Commits if all pass
443
+ # 5. Updates progress.txt
444
+ # 6. Loops until <promise>COMPLETE</promise> or max iterations
445
+ ```
446
+
447
+ **When to use Ralph:**
448
+
449
+ | Scenario | Use Ralph? | Why |
450
+ | ------------------------- | ---------- | ------------------------------------ |
451
+ | Test coverage improvement | ✅ Yes | Clear success criteria, safe to loop |
452
+ | Linting fixes | ✅ Yes | Deterministic, feedback-driven |
453
+ | Migration (Jest→Vitest) | ✅ Yes | Repetitive, well-defined end state |
454
+ | Feature implementation | ⚠️ HITL | Need oversight for design decisions |
455
+ | Architectural changes | ❌ No | Too risky for autonomous work |
456
+ | Vague "improve X" tasks | ❌ No | No clear completion criteria |
457
+
458
+ **Ralph + Beads Integration:**
459
+
460
+ ```bash
461
+ # Create PRD from beads
462
+ bd list --status=open --json > PRD.json
463
+
464
+ # Start Ralph loop
465
+ /ralph-loop "Complete all open tasks" --prd PRD.json
466
+
467
+ # Ralph will work through tasks, you can:
468
+ ralph-status # Check progress
469
+ ralph-stop # Stop gracefully
470
+
471
+ # After completion, sync beads
472
+ bd sync
473
+ ```
474
+
475
+ **Key constraints:**
476
+
477
+ - ONE feature per iteration (prevents context rot)
478
+ - MUST pass all feedback loops before commit
479
+ - Small steps > large changes
480
+ - Always cap iterations (never infinite loops)
481
+
429
482
  ## Agent Boundaries
430
483
 
431
484
  ### Leader Agents (Touch Beads)