opencodekit 0.15.21 → 0.16.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.
Files changed (144) hide show
  1. package/dist/index.js +5 -7
  2. package/dist/template/.opencode/AGENTS.md +85 -23
  3. package/dist/template/.opencode/agent/build.md +88 -7
  4. package/dist/template/.opencode/agent/explore.md +1 -1
  5. package/dist/template/.opencode/agent/general.md +54 -4
  6. package/dist/template/.opencode/agent/looker.md +1 -1
  7. package/dist/template/.opencode/agent/painter.md +1 -1
  8. package/dist/template/.opencode/agent/plan.md +52 -0
  9. package/dist/template/.opencode/agent/review.md +1 -1
  10. package/dist/template/.opencode/agent/scout.md +3 -3
  11. package/dist/template/.opencode/agent/vision.md +1 -1
  12. package/dist/template/.opencode/command/create.md +231 -91
  13. package/dist/template/.opencode/command/design.md +40 -7
  14. package/dist/template/.opencode/command/handoff.md +22 -0
  15. package/dist/template/.opencode/command/init.md +49 -78
  16. package/dist/template/.opencode/command/plan.md +36 -16
  17. package/dist/template/.opencode/command/pr.md +15 -0
  18. package/dist/template/.opencode/command/research.md +3 -0
  19. package/dist/template/.opencode/command/resume.md +8 -18
  20. package/dist/template/.opencode/command/review-codebase.md +30 -0
  21. package/dist/template/.opencode/command/ship.md +199 -0
  22. package/dist/template/.opencode/command/start.md +316 -28
  23. package/dist/template/.opencode/command/status.md +24 -1
  24. package/dist/template/.opencode/command/ui-review.md +36 -7
  25. package/dist/template/.opencode/command/verify.md +307 -0
  26. package/dist/template/.opencode/memory/_templates/prd.md +29 -0
  27. package/dist/template/.opencode/memory/_templates/proposal.md +38 -0
  28. package/dist/template/.opencode/memory/_templates/spec.md +66 -0
  29. package/dist/template/.opencode/memory/_templates/tasks.md +198 -0
  30. package/dist/template/.opencode/memory/_templates/tech-stack.md +50 -0
  31. package/dist/template/.opencode/memory/project/tech-stack.md +53 -0
  32. package/dist/template/.opencode/memory/research/ccpm-analysis.md +334 -0
  33. package/dist/template/.opencode/memory/research/openspec-analysis.md +226 -0
  34. package/dist/template/.opencode/memory.db +0 -0
  35. package/dist/template/.opencode/memory.db-shm +0 -0
  36. package/dist/template/.opencode/memory.db-wal +0 -0
  37. package/dist/template/.opencode/opencode.json +18 -4
  38. package/dist/template/.opencode/package.json +1 -0
  39. package/dist/template/.opencode/plans/1770006237537-mighty-otter.md +418 -0
  40. package/dist/template/.opencode/plans/1770006913647-glowing-forest.md +170 -0
  41. package/dist/template/.opencode/plans/1770013678126-witty-planet.md +278 -0
  42. package/dist/template/.opencode/plugin/lib/memory-db.ts +828 -0
  43. package/dist/template/.opencode/plugin/memory.ts +38 -1
  44. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +76 -31
  45. package/dist/template/.opencode/skill/memory-system/SKILL.md +110 -55
  46. package/dist/template/.opencode/skill/tool-priority/SKILL.md +2 -2
  47. package/dist/template/.opencode/tool/memory-get.ts +143 -0
  48. package/dist/template/.opencode/tool/memory-maintain.ts +167 -0
  49. package/dist/template/.opencode/tool/memory-migrate.ts +319 -0
  50. package/dist/template/.opencode/tool/memory-read.ts +17 -46
  51. package/dist/template/.opencode/tool/memory-search.ts +131 -28
  52. package/dist/template/.opencode/tool/memory-timeline.ts +105 -0
  53. package/dist/template/.opencode/tool/memory-update.ts +21 -26
  54. package/dist/template/.opencode/tool/observation.ts +112 -100
  55. package/dist/template/.opencode/tsconfig.json +19 -19
  56. package/package.json +1 -1
  57. package/dist/template/.opencode/command/accessibility-check.md +0 -331
  58. package/dist/template/.opencode/command/agent-browser.md +0 -21
  59. package/dist/template/.opencode/command/analyze-mockup.md +0 -423
  60. package/dist/template/.opencode/command/analyze-project.md +0 -295
  61. package/dist/template/.opencode/command/brainstorm.md +0 -373
  62. package/dist/template/.opencode/command/cloudflare.md +0 -70
  63. package/dist/template/.opencode/command/commit.md +0 -245
  64. package/dist/template/.opencode/command/complete-next-task.md +0 -77
  65. package/dist/template/.opencode/command/design-audit.md +0 -480
  66. package/dist/template/.opencode/command/edit-image.md +0 -242
  67. package/dist/template/.opencode/command/finish.md +0 -255
  68. package/dist/template/.opencode/command/fix-ci.md +0 -109
  69. package/dist/template/.opencode/command/fix-types.md +0 -104
  70. package/dist/template/.opencode/command/fix-ui.md +0 -117
  71. package/dist/template/.opencode/command/fix.md +0 -168
  72. package/dist/template/.opencode/command/frontend-design.md +0 -21
  73. package/dist/template/.opencode/command/generate-diagram.md +0 -349
  74. package/dist/template/.opencode/command/generate-icon.md +0 -283
  75. package/dist/template/.opencode/command/generate-image.md +0 -246
  76. package/dist/template/.opencode/command/generate-pattern.md +0 -247
  77. package/dist/template/.opencode/command/generate-storyboard.md +0 -250
  78. package/dist/template/.opencode/command/implement.md +0 -609
  79. package/dist/template/.opencode/command/import-plan.md +0 -406
  80. package/dist/template/.opencode/command/index-knowledge.md +0 -25
  81. package/dist/template/.opencode/command/integration-test.md +0 -424
  82. package/dist/template/.opencode/command/issue.md +0 -102
  83. package/dist/template/.opencode/command/new-feature.md +0 -651
  84. package/dist/template/.opencode/command/opensrc.md +0 -58
  85. package/dist/template/.opencode/command/quick-build.md +0 -238
  86. package/dist/template/.opencode/command/ralph.md +0 -41
  87. package/dist/template/.opencode/command/research-and-implement.md +0 -148
  88. package/dist/template/.opencode/command/research-ui.md +0 -466
  89. package/dist/template/.opencode/command/restore-image.md +0 -424
  90. package/dist/template/.opencode/command/revert-feature.md +0 -386
  91. package/dist/template/.opencode/command/skill-create.md +0 -517
  92. package/dist/template/.opencode/command/skill-optimize.md +0 -556
  93. package/dist/template/.opencode/command/summarize.md +0 -412
  94. package/dist/template/.opencode/command/triage.md +0 -398
  95. package/dist/template/.opencode/memory/_templates/README.md +0 -35
  96. package/dist/template/.opencode/memory/_templates/observation.md +0 -39
  97. package/dist/template/.opencode/memory/_templates/project/architecture.md +0 -60
  98. package/dist/template/.opencode/memory/_templates/project/commands.md +0 -72
  99. package/dist/template/.opencode/memory/_templates/project/conventions.md +0 -68
  100. package/dist/template/.opencode/memory/_templates/project/gotchas.md +0 -41
  101. package/dist/template/.opencode/memory/_templates/prompt-engineering.md +0 -333
  102. package/dist/template/.opencode/memory/observations/2026-01-22-decision-agents-md-prompt-engineering-improvement.md +0 -29
  103. package/dist/template/.opencode/memory/observations/2026-01-25-decision-agent-roles-build-orchestrates-general-e.md +0 -14
  104. package/dist/template/.opencode/memory/observations/2026-01-25-decision-simplified-swarm-helper-tool-to-fix-type.md +0 -20
  105. package/dist/template/.opencode/memory/observations/2026-01-25-decision-use-beads-as-swarm-board-source-of-truth.md +0 -14
  106. package/dist/template/.opencode/memory/observations/2026-01-25-learning-user-wants-real-swarm-coordination-guida.md +0 -15
  107. package/dist/template/.opencode/memory/observations/2026-01-28-decision-created-deep-research-skill-for-thorough.md +0 -29
  108. package/dist/template/.opencode/memory/observations/2026-01-28-decision-gh-grep-mcp-wrapper-vs-native-grep-searc.md +0 -21
  109. package/dist/template/.opencode/memory/observations/2026-01-28-decision-oracle-tool-optimal-usage-patterns.md +0 -32
  110. package/dist/template/.opencode/memory/observations/2026-01-28-learning-ampcode-deep-mode-research-integration-w.md +0 -42
  111. package/dist/template/.opencode/memory/observations/2026-01-28-pattern-research-delegation-pattern-explore-for-.md +0 -32
  112. package/dist/template/.opencode/memory/observations/2026-01-29-decision-copilot-auth-plugin-rate-limit-handling.md +0 -27
  113. package/dist/template/.opencode/memory/observations/2026-01-29-decision-spec-driven-approach-for-opencodekit.md +0 -21
  114. package/dist/template/.opencode/memory/observations/2026-01-29-learning-karpathy-llm-coding-insights-dec-2025.md +0 -44
  115. package/dist/template/.opencode/memory/observations/2026-01-30-decision-github-copilot-claude-routing-keep-disab.md +0 -32
  116. package/dist/template/.opencode/memory/observations/2026-01-30-discovery-context-management-research-critical-gap.md +0 -14
  117. package/dist/template/.opencode/memory/observations/2026-01-30-discovery-kimi-k2-5-agent-swarm-architecture-patte.md +0 -45
  118. package/dist/template/.opencode/memory/observations/2026-01-30-pattern-swarm-tools-architecture.md +0 -28
  119. package/dist/template/.opencode/memory/observations/2026-01-31-decision-copilot-auth-plugin-updated-with-baseurl.md +0 -63
  120. package/dist/template/.opencode/memory/observations/2026-01-31-decision-created-dedicated-worker-agent-for-swarm.md +0 -20
  121. package/dist/template/.opencode/memory/observations/2026-01-31-decision-rollback-to-v1-1-47-for-copilot-claude-r.md +0 -21
  122. package/dist/template/.opencode/memory/observations/2026-01-31-decision-simplified-swarm-to-task-tool-pattern.md +0 -44
  123. package/dist/template/.opencode/memory/observations/2026-01-31-decision-swarm-architecture-task-tool-over-tmux.md +0 -33
  124. package/dist/template/.opencode/memory/observations/2026-01-31-decision-worker-skills-defined-for-swarm-delegati.md +0 -30
  125. package/dist/template/.opencode/memory/observations/2026-01-31-learning-gpt-reasoning-config-for-github-copilot.md +0 -51
  126. package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-copilot-auth-comparison-finding.md +0 -61
  127. package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-copilot-reasoning-architecture-.md +0 -66
  128. package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-custom-tools-api.md +0 -48
  129. package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-v1-1-48-skills-as-slash-command.md +0 -21
  130. package/dist/template/.opencode/memory/observations/2026-01-31-learning-swarm-system-simplified-removed-mailbox-.md +0 -30
  131. package/dist/template/.opencode/memory/observations/2026-01-31-learning-v1-1-48-native-copilot-reasoning-via-pr-.md +0 -45
  132. package/dist/template/.opencode/memory/observations/2026-01-31-warning-cannot-add-custom-config-to-opencode-jso.md +0 -18
  133. package/dist/template/.opencode/memory/observations/2026-01-31-warning-copilot-claude-v1-endpoint-returns-404-c.md +0 -48
  134. package/dist/template/.opencode/memory/observations/2026-01-31-warning-opencode-v1-1-48-claude-thinking-block-s.md +0 -51
  135. package/dist/template/.opencode/memory/project/architecture.md +0 -60
  136. package/dist/template/.opencode/memory/project/commands.md +0 -72
  137. package/dist/template/.opencode/memory/project/conventions.md +0 -68
  138. package/dist/template/.opencode/memory/project/gotchas.md +0 -41
  139. package/dist/template/.opencode/skill/notebooklm/SKILL.md +0 -272
  140. package/dist/template/.opencode/skill/notebooklm/references/setup.md +0 -353
  141. package/dist/template/.opencode/tool/notebooklm.ts +0 -488
  142. package/dist/template/.opencode/tool/oracle.ts +0 -240
  143. /package/dist/template/.opencode/memory/{user.example.md → _templates/user.md} +0 -0
  144. /package/dist/template/.opencode/memory/{user.md → project/user.md} +0 -0
@@ -1,609 +0,0 @@
1
- ---
2
- description: Implement a bead - load context, delegate research, make changes, verify
3
- argument-hint: "<bead-id> [--parallel] [--swarm]"
4
- agent: build
5
- ---
6
-
7
- # Implement: $ARGUMENTS
8
-
9
- You're implementing a tracked task. Stay focused, delegate research, verify as you go, hand off if you hit limits.
10
-
11
- ## Parse Arguments
12
-
13
- | Argument | Default | Description |
14
- | ------------ | -------- | ----------------------------------------- |
15
- | `<bead-id>` | required | The bead to implement |
16
- | `--parallel` | false | Run aggressive parallel subagent research |
17
- | `--swarm` | false | Use swarm coordination for parallel tasks |
18
-
19
- ## First: Load Skills & Context
20
-
21
- ```typescript
22
- skill({ name: "beads" });
23
- skill({ name: "test-driven-development" });
24
- skill({ name: "verification-before-completion" });
25
- skill({ name: "swarm-coordination" }); // For swarm mode with Kimi K2.5 PARL patterns
26
- skill({ name: "beads-bridge" }); // For cross-session todo persistence
27
- ```
28
-
29
- Get the task details and check hierarchy:
30
-
31
- ```bash
32
- bd show $ARGUMENTS
33
- bd dep tree $ARGUMENTS 2>/dev/null || echo "No dependencies"
34
- bd list --status=in_progress # See what else is active
35
- ```
36
-
37
- Check for messages from other agents:
38
-
39
- ```bash
40
- bd inbox --unread -n 5
41
- ```
42
-
43
- ## Check Hierarchy Position
44
-
45
- Identify where this task sits:
46
-
47
- | Type | Action |
48
- | --------- | ------------------------------------------- |
49
- | `epic` | Don't implement directly - work on subtasks |
50
- | `task` | May implement or delegate to subtasks |
51
- | `subtask` | Implement directly - this is leaf work |
52
-
53
- **If this is an epic with subtasks:**
54
-
55
- ```bash
56
- bd ready --json | grep -q "$ARGUMENTS"
57
- ```
58
-
59
- → Work on ready subtasks instead: `/implement <subtask-id>`
60
-
61
- **Or use SWARM MODE for parallel execution (recommended for 3+ subtasks):**
62
-
63
- ## Swarm Mode Execution (--swarm flag or auto-detect with PARL)
64
-
65
- When the task has 3+ independent subtasks, use Kimi K2.5 PARL swarm coordination:
66
-
67
- ### Step 0a: Task Analysis (Anti-Serial-Collapse)
68
-
69
- ```typescript
70
- // 1. Analyze the actual task
71
- const subtasks = await getSubtasks($ARGUMENTS); // Get all subtask IDs
72
- const files = await getFilesForSubtasks(subtasks); // Detect relevant files
73
-
74
- const analysis = await swarm_plan({
75
- operation: "analyze",
76
- task: "Implement " + $ARGUMENTS + " with " + subtasks.length + " subtasks",
77
- files: files.join(","),
78
- });
79
-
80
- // 2. Check for serial collapse
81
- const check = await swarm_plan({
82
- operation: "check",
83
- task: "Implement " + $ARGUMENTS,
84
- files: String(subtasks.length),
85
- recommended_agents: analysis.classification.recommended_agents,
86
- });
87
-
88
- if (check.serial_collapse_detected) {
89
- console.log(`⚠️ Serial collapse detected: ${check.warning_signs.join(", ")}`);
90
- console.log(`✓ Adjusting to ${check.suggested_agents} agents`);
91
- }
92
-
93
- // 3. Use classification to guide swarm setup
94
- const { type, recommended_agents, phases } = analysis.classification;
95
- console.log(`Task type: ${type}, Agents: ${recommended_agents}, Phases: ${phases.length}`);
96
- ```
97
-
98
- ### Step 1: Sync Beads to OpenCode Todos
99
-
100
- Before spawning workers, sync beads state to make it visible to subagents:
101
-
102
- ```typescript
103
- // Push beads state to OpenCode todos
104
- beads_sync({ operation: "push" });
105
- ```
106
-
107
- ### Step 2: Create Delegation Packets
108
-
109
- For each parallelizable subtask:
110
-
111
- ```typescript
112
- swarm_delegate({
113
- bead_id: "<subtask-id>",
114
- title: "Subtask title from bead",
115
- expected_outcome: "Measurable completion criteria",
116
- required_tools: "read, grep, lsp, edit, bash",
117
- must_do: "LSP before edits, run project verification commands",
118
- must_not_do: "No new deps, don't edit files outside scope",
119
- acceptance_checks: "typecheck: npm run typecheck, lint: npm run lint, test: npm test",
120
- context: "Part of epic $ARGUMENTS. See spec for requirements.",
121
- write: true,
122
- });
123
- ```
124
-
125
- ### Step 3: Reserve File Sets
126
-
127
- Prevent conflicts between workers:
128
-
129
- ```bash
130
- # Reserve files for each worker
131
- bd reserve "src/domain-a/*" --reason "swarm: subtask-1"
132
- bd reserve "src/domain-b/*" --reason "swarm: subtask-2"
133
- ```
134
-
135
- ### Step 4: Spawn Worker Swarm
136
-
137
- Launch all workers in parallel (multiple Task calls in one message):
138
-
139
- ```typescript
140
- // All run simultaneously
141
- Task({
142
- subagent_type: "general",
143
- description: "Execute subtask-1",
144
- prompt: `Execute bead <subtask-1>: <title>
145
-
146
- ## Delegation
147
- Read: .beads/artifacts/<subtask-1>/delegation.md
148
-
149
- ## Coordination
150
- Team: $ARGUMENTS-swarm
151
- Worker: worker-1
152
-
153
- ## Protocol
154
- 1. Read delegation packet FIRST
155
- 2. Report START: swarm-monitor({ operation: "progress_update", team_name: "$ARGUMENTS-swarm", worker_id: "worker-<N>", phase: "<phase>", progress: 0, status: "working" })
156
- 3. Execute following MUST DO / avoiding MUST NOT DO
157
- 4. Report PROGRESS (every 25%): swarm-monitor({ operation: "progress_update", ...progress: 25/50/75, file: "current-file.ts" })
158
- 5. Run ALL acceptance checks
159
- 6. Report DONE: swarm-monitor({ operation: "progress_update", ...progress: 100, status: "completed" })
160
-
161
- Return format:
162
- - DONE: <summary of completed work>
163
- - ERROR: <issue description> (if failed)`,
164
- });
165
-
166
- Task({
167
- subagent_type: "general",
168
- description: "Execute subtask-2",
169
- prompt: `Execute bead <subtask-2>: <title>
170
- ...same pattern, different worker name...`,
171
- });
172
-
173
- Task({
174
- subagent_type: "general",
175
- description: "Execute subtask-3",
176
- prompt: `Execute bead <subtask-3>: <title>
177
- ...same pattern, different worker name...`,
178
- });
179
- // Results available when all complete
180
- ```
181
-
182
- ### Step 5: Monitor Progress (Real-time TUI)
183
-
184
- Monitor with beautiful block UI:
185
-
186
- ```typescript
187
- // Render beautiful TUI block
188
- const ui = await swarm_monitor({
189
- operation: "render_block",
190
- team_name: "$ARGUMENTS-swarm",
191
- });
192
- console.log(ui); // Markdown block with tables, emojis, progress
193
-
194
- // Check detailed status
195
- const status = await swarm_monitor({
196
- operation: "status",
197
- team_name: "$ARGUMENTS-swarm",
198
- });
199
- const stats = JSON.parse(status).summary;
200
- ```
201
-
202
- ### Step 6: Handle Worker Results
203
-
204
- Task tool returns results when all workers complete. Parse each result:
205
-
206
- | Result Type | Detection | Action |
207
- | ----------- | ------------------------ | -------------------------------------- |
208
- | DONE | Result contains "DONE:" | Mark subtask complete, check progress |
209
- | ERROR | Result contains "ERROR:" | Analyze, fix locally or respawn worker |
210
-
211
- ```typescript
212
- // Results are returned directly from Task tool
213
- // Each task returns its completion status
214
- // Example: "DONE: Implemented auth endpoint with JWT validation"
215
- // Example: "ERROR: TypeScript errors in user.ts line 42"
216
- ```
217
-
218
- ### Step 7: Final Verification
219
-
220
- After all workers complete:
221
-
222
- ```bash
223
- # Full verification suite
224
- npm run typecheck && npm run lint && npm test
225
- ```
226
-
227
- ### Step 8: Close Epic & Cleanup
228
-
229
- ```typescript
230
- // Clear swarm data
231
- await swarm_monitor({
232
- operation: "clear",
233
- team_name: "$ARGUMENTS-swarm",
234
- });
235
-
236
- // Sync completed todos back to beads
237
- beads_sync({ operation: "pull" });
238
- ```
239
-
240
- ```bash
241
- # Close the epic
242
- bd close $ARGUMENTS --reason "Swarm completed all subtasks: <summary>"
243
- ```
244
-
245
- **Or execute READY subtasks sequentially (non-swarm mode):**
246
-
247
- ```typescript
248
- // Get all READY subtasks for this epic
249
- // bd list --parent $ARGUMENTS --status=open --json
250
-
251
- // Fire all READY subtasks in parallel using Task tool
252
- // Multiple Task calls in one message run simultaneously
253
- Task({
254
- subagent_type: "general",
255
- description: "Execute subtask 1",
256
- prompt: `Execute bd-subtask1: [Subtask description]
257
-
258
- Context: Part of epic $ARGUMENTS
259
-
260
- Requirements:
261
- - Complete all work items
262
- - Run verification commands
263
- - Commit with bead ID in message
264
- - Close the bead when done: bd close bd-subtask1 --reason "Completed: ..."`,
265
- });
266
-
267
- Task({
268
- subagent_type: "general",
269
- description: "Execute subtask 2",
270
- prompt: `Execute bd-subtask2: [Subtask description]
271
- ...same pattern...`,
272
- });
273
-
274
- // Results available immediately after all complete
275
- // Check newly unblocked subtasks
276
- bd ready // → Next wave now READY
277
- ```
278
-
279
- ## Git State Check
280
-
281
- ```bash
282
- git status --porcelain
283
- git branch --show-current
284
- ```
285
-
286
- If dirty, ask whether to stash, commit, or continue.
287
-
288
- Create a branch if not already on one for this task:
289
-
290
- ```bash
291
- # Get current branch (parent branch)
292
- PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
293
-
294
- # Get task title for readable branch name
295
- BEAD_INFO=$(bd show $ARGUMENTS --json 2>/dev/null)
296
- BEAD_TITLE=$(echo "$BEAD_INFO" | jq -r '.title // ""' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
297
- BEAD_TYPE=$(echo "$BEAD_INFO" | jq -r '.type // "task"')
298
-
299
- # Map bead type to branch prefix
300
- case "$BEAD_TYPE" in
301
- "bug") PREFIX="fix" ;;
302
- "feature"|"epic") PREFIX="feat" ;;
303
- "refactor") PREFIX="refactor" ;;
304
- *) PREFIX="feat" ;;
305
- esac
306
-
307
- # Create branch: <parent>/<type>/<bead-id>-<description>
308
- BRANCH_NAME="${PARENT_BRANCH}/${PREFIX}/$ARGUMENTS-${BEAD_TITLE}"
309
- git checkout -b "$BRANCH_NAME" 2>/dev/null || echo "Already on branch"
310
- ```
311
-
312
- Mark the task in progress (if not already):
313
-
314
- ```bash
315
- bd update $ARGUMENTS --status in_progress
316
- ```
317
-
318
- ## Load Artifacts
319
-
320
- Check what context exists:
321
-
322
- ```bash
323
- ls .beads/artifacts/$ARGUMENTS/ 2>/dev/null || echo "No artifacts"
324
- ```
325
-
326
- | Found | Action |
327
- | ------------- | ------------------------------------ |
328
- | `plan.md` | Follow it step by step |
329
- | `spec.md` | Implement directly from requirements |
330
- | `research.md` | Use findings to guide implementation |
331
- | Nothing | Work from bead description |
332
-
333
- Check for previous session work:
334
-
335
- ```typescript
336
- search_session({ query: "$ARGUMENTS" });
337
- read_session({ session_reference: "last" });
338
- ```
339
-
340
- ## Load Related Memory (Semantic Search)
341
-
342
- First, get a quick codebase overview:
343
-
344
- ```typescript
345
- // Quick overview of relevant directories
346
- repo - map({ path: "src", format: "compact", maxDepth: 3 });
347
- ```
348
-
349
- Then search for relevant patterns and learnings:
350
-
351
- ```typescript
352
- // Find similar past work
353
- memory -
354
- search({
355
- query: "[task description from bead]",
356
- mode: "semantic",
357
- limit: 3,
358
- });
359
-
360
- // Find related gotchas and patterns
361
- memory -
362
- search({
363
- query: "[technology/domain keywords]",
364
- mode: "semantic",
365
- type: "observation",
366
- limit: 3,
367
- });
368
- ```
369
-
370
- **Review findings before implementation.** Past observations may contain:
371
-
372
- - Gotchas to avoid (save debugging time)
373
- - Patterns that worked well (reuse them)
374
- - Decisions already made (don't re-decide)
375
-
376
- If memory search fails (Ollama not running), continue without it.
377
-
378
- ## Parallel Subagent Research (if --parallel or complex task)
379
-
380
- **Delegation Pattern: Parallel Task Calls**
381
-
382
- For complex tasks, launch research subagents in parallel before diving into code.
383
- Multiple Task calls in a single message run simultaneously:
384
-
385
- ```typescript
386
- // Codebase patterns - find similar implementations
387
- Task({
388
- subagent_type: "explore",
389
- description: "Find codebase patterns",
390
- prompt: `For implementing $ARGUMENTS, find:
391
- 1. Similar patterns in this codebase (grep)
392
- 2. Related test files and testing patterns
393
- 3. Configuration or setup requirements
394
- Return: File paths, code patterns, test approach`,
395
- });
396
-
397
- // External best practices - library docs
398
- Task({
399
- subagent_type: "scout",
400
- description: "Research best practices",
401
- prompt: `Research best practices for $ARGUMENTS:
402
- 1. Official documentation for libraries involved
403
- 2. Common implementation patterns (Context7, GitHub)
404
- 3. Known pitfalls or gotchas
405
- Return: Code examples, API usage, warnings`,
406
- });
407
-
408
- // Both run in parallel, results available immediately
409
- ```
410
-
411
- **Subagent Tools:**
412
- | Tool | Purpose |
413
- | ---- | ------- |
414
- | `Task` | Delegate to subagent, runs in parallel when multiple calls in one message |
415
-
416
- **Subagent Rules:**
417
- | Agent | Use For | Can Do | Cannot Do |
418
- | -------- | ------------------------------ | ---------------- | ---------------- |
419
- | `explore`| Codebase search, patterns | Read, grep, glob | Edit, bd sync |
420
- | `scout` | External docs, best practices | Fetch, search | Edit, bd sync |
421
- | `review` | Code review, debugging | Read, analyze | Edit, bd sync |
422
- | `plan` | Architecture, decomposition | Read, plan | Edit, bd sync |
423
-
424
- **You (build agent) are the leader:**
425
-
426
- - Subagents return results to you
427
- - Only you modify files and update beads
428
- - Integrate subagent findings into your implementation
429
-
430
- ## Estimate Your Budget
431
-
432
- Look at the task complexity and set limits:
433
-
434
- | Size | Tool Calls | Scope |
435
- | ------ | ---------- | ----------------------------------- |
436
- | Small | ~10 | Simple change, one file, clear path |
437
- | Medium | ~30 | Multiple files, some exploration |
438
- | Large | ~100 | Cross-cutting, needs checkpoints |
439
- | XL | Stop | Decompose into subtasks first |
440
-
441
- **If XL detected:**
442
-
443
- ```
444
- This task is too large for a single session.
445
- Recommend: /plan $ARGUMENTS --create-beads
446
- ```
447
-
448
- If you hit 80% of budget without finishing, create a handoff. Don't push past limits.
449
-
450
- ## Lock Files Before Editing
451
-
452
- For shared files or multi-agent coordination:
453
-
454
- ```bash
455
- bd reserve src/file-to-edit.ts --ttl 600
456
- ```
457
-
458
- Release after completing edits:
459
-
460
- ```bash
461
- bd release src/file-to-edit.ts
462
- ```
463
-
464
- ## Do The Work
465
-
466
- Detect project type and know your verification commands:
467
-
468
- ```bash
469
- ls package.json Cargo.toml pyproject.toml go.mod Makefile 2>/dev/null
470
- ```
471
-
472
- | Project | Test Command | Lint Command |
473
- | ------- | --------------- | ----------------------------------- |
474
- | Node/TS | `npm test` | `npm run lint && npm run typecheck` |
475
- | Rust | `cargo test` | `cargo clippy -- -D warnings` |
476
- | Python | `pytest` | `ruff check . && mypy .` |
477
- | Go | `go test ./...` | `golangci-lint run` |
478
-
479
- **Rules while implementing:**
480
-
481
- 1. **Read before edit.** Always.
482
- 2. **Run verification** after each logical change
483
- 3. **Delegate when stuck**: If blocked on understanding, launch `@explore` or `@scout`
484
- 4. **Checkpoint** after significant progress: `git commit -m "WIP: $ARGUMENTS - [step]"`
485
- 5. **Create child beads** for discovered subtasks:
486
- ```bash
487
- bd create "Discovered: [subtask]" -t subtask -p 2
488
- bd dep add <new-id> $ARGUMENTS --type blocks
489
- ```
490
-
491
- **Progress tracking** - every 10 tool calls:
492
-
493
- - Am I on track?
494
- - Should I checkpoint?
495
- - Am I approaching budget?
496
- - Need to delegate research?
497
-
498
- ## Subtask Coordination (if parent task)
499
-
500
- If implementing a task with subtasks:
501
-
502
- ```bash
503
- # Check which subtasks are ready
504
- bd ready --json | jq '.[] | select(.parent == "$ARGUMENTS")'
505
-
506
- # Work on ready subtasks in order
507
- # When subtask done:
508
- bd close <subtask-id> --reason "Completed: description"
509
-
510
- # Check if parent can close
511
- bd dep tree $ARGUMENTS
512
- ```
513
-
514
- **Pattern: Complete subtasks before parent**
515
-
516
- ## Before Claiming Done
517
-
518
- Verify against success criteria in the spec:
519
-
520
- ```bash
521
- cat .beads/artifacts/$ARGUMENTS/spec.md | grep -A 20 "Success Criteria" || \
522
- cat .beads/artifacts/$ARGUMENTS/spec.md | grep -A 20 "Acceptance Criteria"
523
- ```
524
-
525
- Run each verification command. All must pass. No exceptions.
526
-
527
- Run the full test suite one more time:
528
-
529
- ```bash
530
- # Whatever your project uses
531
- npm test && npm run typecheck
532
- ```
533
-
534
- ## Complete
535
-
536
- If all gates pass, show what was done:
537
-
538
- ```bash
539
- git add -A
540
- git status
541
- git diff --cached --stat
542
- ```
543
-
544
- **Use question tool to get commit decision:**
545
-
546
- ```typescript
547
- question({
548
- questions: [
549
- {
550
- header: "Commit",
551
- question: "Implementation Complete: $ARGUMENTS. What should I do next?",
552
- options: [
553
- {
554
- label: "Commit changes (Recommended)",
555
- description: "Git commit and bd sync",
556
- },
557
- {
558
- label: "Show diff first",
559
- description: "Review changes before committing",
560
- },
561
- {
562
- label: "Skip commit",
563
- description: "I'll review and commit manually",
564
- },
565
- ],
566
- },
567
- ],
568
- });
569
- ```
570
-
571
- If user confirms:
572
-
573
- ```bash
574
- git commit -m "$ARGUMENTS: [summary]"
575
- bd sync
576
- ```
577
-
578
- Suggest next step based on hierarchy:
579
-
580
- | Situation | Next Command |
581
- | -------------------- | --------------------------- |
582
- | Subtask done | `/implement <next-subtask>` |
583
- | All subtasks done | `/finish <parent-task>` |
584
- | Task done, no parent | `/finish $ARGUMENTS` |
585
- | Need PR | `/pr $ARGUMENTS` |
586
-
587
- ```
588
- Next: [recommended command]
589
- ```
590
-
591
- If gates fail, fix them. Don't proceed with broken code.
592
-
593
- ## If You Can't Finish
594
-
595
- Hit budget limit or context getting too large? Create a handoff:
596
-
597
- ```
598
- /handoff $ARGUMENTS "Stopped at [step]. Next: [what to do]"
599
- ```
600
-
601
- Then start a fresh session. Don't grind past diminishing returns.
602
-
603
- ## Release File Locks
604
-
605
- Before ending session:
606
-
607
- ```bash
608
- bd release --all # Release all your locks
609
- ```