opencodekit 0.13.0 → 0.13.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.
@@ -1,166 +1,438 @@
1
1
  ---
2
- description: Create implementation plan for a bead
3
- argument-hint: "<bead-id> [--create-beads]"
2
+ description: Create implementation plan for a bead with subtask hierarchy
3
+ argument-hint: "<bead-id> [--create-beads] [--parallel]"
4
4
  agent: planner
5
5
  ---
6
6
 
7
7
  # Plan: $ARGUMENTS
8
8
 
9
- You're creating an implementation plan. Design first, then execute.
9
+ You're creating an implementation plan with proper Epic → Task → Subtask hierarchy and subagent research.
10
10
 
11
- ## Load Context
11
+ ## Parse Arguments
12
12
 
13
- !`bd show $ARGUMENTS`
14
- !`cat .beads/artifacts/$ARGUMENTS/spec.md`
15
- !`cat .beads/artifacts/$ARGUMENTS/research.md 2>/dev/null`
13
+ | Argument | Default | Description |
14
+ | ---------------- | -------- | ----------------------------------------- |
15
+ | `<bead-id>` | required | The bead to plan |
16
+ | `--create-beads` | false | Create child beads after planning |
17
+ | `--parallel` | false | Run aggressive parallel subagent research |
16
18
 
17
- If spec.md missing: "Run `/create $ARGUMENTS` first."
18
- If complexity > M and no research: "Consider `/research $ARGUMENTS` first."
19
+ ## Load Skills & Context
19
20
 
20
- ## Analyze For Decomposition
21
+ ```typescript
22
+ skill({ name: "beads" });
23
+ ```
21
24
 
22
- Should this be one bead or multiple?
25
+ ```bash
26
+ bd show $ARGUMENTS
27
+ ```
23
28
 
24
- **Keep as single bead:**
29
+ Check for existing artifacts:
25
30
 
26
- - Single domain (just frontend OR just backend)
27
- - 2-3 files max
28
- - ~50 tool calls or less
29
- - No natural phases
31
+ ```bash
32
+ cat .beads/artifacts/$ARGUMENTS/spec.md 2>/dev/null || echo "No spec found"
33
+ cat .beads/artifacts/$ARGUMENTS/research.md 2>/dev/null || echo "No research found"
34
+ ```
30
35
 
31
- **Decompose into subtasks:**
36
+ **If spec.md missing:** "Run `/create $ARGUMENTS` first to create a specification."
32
37
 
33
- - Crosses domains (frontend + backend)
34
- - Multiple independent pieces
35
- - Natural phases (setup → implement → test)
36
- - Could benefit from parallel agents
38
+ **If complexity > M and no research:** "Consider `/research $ARGUMENTS` first for better planning."
37
39
 
38
- If decomposition makes sense, ask: "This would benefit from subtasks. Create child beads?"
40
+ ---
39
41
 
40
- ## Generate Design Options
42
+ ## Phase 1: Parallel Subagent Research
43
+
44
+ Gather context before designing. Fire both in parallel:
45
+
46
+ ```typescript
47
+ // Codebase patterns
48
+ Task({
49
+ subagent_type: "explore",
50
+ prompt: `For planning $ARGUMENTS, research the codebase:
51
+ 1. Find similar implementations or patterns
52
+ 2. Identify affected files and their structure
53
+ 3. Find related tests and testing patterns
54
+ 4. Check for potential conflicts with in-progress work
55
+ Return: File paths, code patterns, test approach, conflicts`,
56
+ description: "Explore codebase for planning",
57
+ });
58
+
59
+ // External best practices
60
+ Task({
61
+ subagent_type: "scout",
62
+ prompt: `Research implementation approaches for $ARGUMENTS:
63
+ 1. Best practices from official documentation
64
+ 2. Common patterns in open source projects
65
+ 3. Pitfalls and anti-patterns to avoid
66
+ Return: Recommendations, code examples, warnings`,
67
+ description: "Scout best practices for planning",
68
+ });
69
+ ```
41
70
 
42
- Present 2-3 approaches:
71
+ **Continue working while subagents research.**
72
+
73
+ ---
74
+
75
+ ## Phase 2: Analyze for Decomposition
76
+
77
+ Determine the right level of granularity.
78
+
79
+ ### Hierarchy Decision Tree
43
80
 
44
81
  ```
45
- ## Option A: [Name]
82
+ Is this work...
83
+ ├── Single domain, 2-3 files, ~50 tool calls?
84
+ │ └── Keep as single bead → Skip to "Generate Design Options"
85
+
86
+ ├── Crosses domains (frontend + backend)?
87
+ │ └── Create task per domain
88
+
89
+ ├── Has natural phases (setup → implement → test)?
90
+ │ └── Create task per phase
91
+
92
+ ├── Could benefit from parallel agents?
93
+ │ └── Create independent tasks
94
+
95
+ └── Would take multiple sessions?
96
+ └── Create epic with task breakdown
97
+ ```
98
+
99
+ ### Size Estimation Guide
100
+
101
+ | Size | Tool Calls | Duration | Hierarchy Level |
102
+ | ---- | ---------- | --------- | --------------- |
103
+ | S | ~10 | 30 min | Subtask |
104
+ | M | ~30 | 1-2 hours | Task |
105
+ | L | ~100 | 4-8 hours | Task (or Epic) |
106
+ | XL | 100+ | Days | Epic required |
46
107
 
47
- Approach: [1-2 sentences]
108
+ **If XL detected:** "This requires epic-level decomposition. Creating subtasks is mandatory."
109
+
110
+ ---
111
+
112
+ ## Phase 3: Generate Design Options
113
+
114
+ Present 2-3 implementation approaches:
115
+
116
+ ```markdown
117
+ ## Design Options for $ARGUMENTS
118
+
119
+ ### Option A: [Name]
120
+
121
+ **Approach:** [1-2 sentences]
122
+
123
+ **Changes:**
48
124
 
49
- Changes:
50
125
  - `src/foo.ts` - [what]
51
126
  - `src/bar.ts` - [what]
52
127
 
53
- Pros: [list]
54
- Cons: [list]
55
- Effort: [S/M/L] (~N tool calls)
128
+ **Pros:** [list]
129
+ **Cons:** [list]
130
+ **Effort:** [S/M/L] (~N tool calls)
56
131
 
57
132
  ---
58
133
 
59
- ## Option B: [Name]
134
+ ### Option B: [Name]
135
+
136
+ **Approach:** [1-2 sentences]
137
+
138
+ **Changes:**
60
139
 
61
- [same format]
140
+ - `src/different.ts` - [what]
141
+
142
+ **Pros:** [list]
143
+ **Cons:** [list]
144
+ **Effort:** [S/M/L] (~N tool calls)
62
145
 
63
146
  ---
64
147
 
65
- Recommendation: Option [A/B] because [reason].
148
+ ### Recommendation
149
+
150
+ Option [X] because [reason].
151
+
152
+ Decomposition: [Single bead | X tasks | X tasks with subtasks]
66
153
  ```
67
154
 
68
155
  Save to `.beads/artifacts/$ARGUMENTS/design.md`.
69
156
 
70
157
  **STOP. Wait for user to pick an option.**
71
158
 
72
- ## Create Plan
159
+ ---
160
+
161
+ ## Phase 4: Create Task Hierarchy
162
+
163
+ After user approval, design the hierarchy.
164
+
165
+ ### For Single Bead (S/M size)
73
166
 
74
- After approval, write `.beads/artifacts/$ARGUMENTS/plan.md`:
167
+ Skip hierarchy, go directly to plan.md.
168
+
169
+ ### For Multi-Task Work (L/XL size)
170
+
171
+ Design the decomposition:
75
172
 
76
173
  ```markdown
77
- # Plan: [Title]
174
+ ## Task Breakdown
78
175
 
79
- **Bead:** $ARGUMENTS
80
- **Approach:** [selected option]
81
- **Estimate:** ~N tool calls
176
+ ### Task 1: [Foundation/Setup] [S]
82
177
 
83
- ## Tasks
178
+ **Domain:** [backend/frontend/infra]
179
+ **Blocked by:** None
180
+ **Work:**
84
181
 
85
- ### 1. [Task name]
182
+ - [Specific deliverable]
183
+ - [Specific deliverable]
86
184
 
87
- Files: `src/foo.ts`
88
- Changes:
185
+ ### Task 2: [Core Implementation] [M]
89
186
 
90
- - [ ] [specific change]
91
- - [ ] [specific change]
187
+ **Domain:** [backend/frontend/infra]
188
+ **Blocked by:** Task 1
189
+ **Work:**
92
190
 
93
- Verify: `npm test -- foo.test.ts`
191
+ - [Specific deliverable]
192
+
193
+ **Subtasks (if complex):**
194
+
195
+ - 2.1: [Atomic unit of work] [S]
196
+ - 2.2: [Atomic unit of work] [S] → blocked by 2.1
197
+
198
+ ### Task 3: [Integration/Testing] [S]
199
+
200
+ **Domain:** [testing]
201
+ **Blocked by:** Task 2
202
+ **Work:**
203
+
204
+ - [Specific deliverable]
205
+ ```
94
206
 
95
207
  ---
96
208
 
97
- ### 2. [Task name]
209
+ ## Phase 5: Create Child Beads (if --create-beads)
210
+
211
+ With user approval or `--create-beads` flag:
98
212
 
99
- Depends on: Task 1
100
- Files: `src/bar.ts`
101
- Changes:
213
+ ```bash
214
+ # Get parent bead ID
215
+ PARENT=$ARGUMENTS
216
+
217
+ # Task 1 (no blockers - starts immediately)
218
+ bd create "[Task 1 title]" -t task -p 2
219
+ # Capture: bd-xxx1
220
+
221
+ # Link to parent
222
+ bd dep add bd-xxx1 $PARENT
223
+
224
+ # Task 2 (blocked by Task 1)
225
+ bd create "[Task 2 title]" -t task -p 2
226
+ # Capture: bd-xxx2
227
+
228
+ bd dep add bd-xxx2 $PARENT
229
+ bd dep add bd-xxx2 bd-xxx1 --type blocks
230
+
231
+ # Task 3 (blocked by Task 2)
232
+ bd create "[Task 3 title]" -t task -p 2
233
+ # Capture: bd-xxx3
234
+
235
+ bd dep add bd-xxx3 $PARENT
236
+ bd dep add bd-xxx3 bd-xxx2 --type blocks
237
+ ```
238
+
239
+ ### Create Subtasks (for complex tasks)
240
+
241
+ ```bash
242
+ # For Task 2, create subtasks:
243
+ bd create "[Subtask 2.1 title]" -t subtask -p 2
244
+ # Capture: bd-xxx2.1
102
245
 
103
- - [ ] [specific change]
246
+ bd dep add bd-xxx2.1 bd-xxx2
247
+
248
+ bd create "[Subtask 2.2 title]" -t subtask -p 2
249
+ # Capture: bd-xxx2.2
250
+
251
+ bd dep add bd-xxx2.2 bd-xxx2
252
+ bd dep add bd-xxx2.2 bd-xxx2.1 --type blocks # Sequential dependency
253
+ ```
104
254
 
105
- Verify: `npm test -- bar.test.ts`
255
+ ### Verify Hierarchy
256
+
257
+ ```bash
258
+ bd dep tree $ARGUMENTS
259
+ ```
106
260
 
107
261
  ---
108
262
 
109
- ## Final Verification
263
+ ## Phase 6: Create Plan Document
264
+
265
+ Write `.beads/artifacts/$ARGUMENTS/plan.md`:
266
+
267
+ ```markdown
268
+ # Implementation Plan: [Title]
110
269
 
111
- - [ ] `npm test`
112
- - [ ] `npm run type-check`
270
+ **Bead:** $ARGUMENTS
271
+ **Approach:** [Selected option]
272
+ **Total estimate:** ~N tool calls ([X-Y hours])
273
+
274
+ ## Hierarchy
113
275
  ```
114
276
 
115
- ## If Creating Child Beads
277
+ $ARGUMENTS (Epic/Task)
278
+ ├── bd-xxx1: [Title] [S] ← READY
279
+ ├── bd-xxx2: [Title] [M] → blocked by bd-xxx1
280
+ │ ├── bd-xxx2.1: [Subtask] [S]
281
+ │ └── bd-xxx2.2: [Subtask] [S] → blocked by bd-xxx2.1
282
+ └── bd-xxx3: [Title] [S] → blocked by bd-xxx2
283
+
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Task 1: [Title] [S]
289
+
290
+ **Bead:** bd-xxx1
291
+ **Estimate:** ~10 tool calls (30 min)
292
+ **Blocked by:** None
293
+
294
+ **Files:**
295
+ - `src/foo.ts`
296
+
297
+ **Changes:**
298
+ - [ ] [Specific change with detail]
299
+ - [ ] [Specific change with detail]
300
+
301
+ **Verify:** `npm test -- foo.test.ts`
302
+
303
+ ---
304
+
305
+ ## Task 2: [Title] [M]
306
+
307
+ **Bead:** bd-xxx2
308
+ **Estimate:** ~30 tool calls (1-2 hours)
309
+ **Blocked by:** Task 1
310
+
311
+ **Subtasks:**
312
+
313
+ ### 2.1: [Subtask Title] [S]
314
+
315
+ **Bead:** bd-xxx2.1
316
+ **Files:** `src/bar.ts`
317
+ **Changes:**
318
+ - [ ] [Specific change]
319
+
320
+ **Verify:** `npm test -- bar.test.ts`
321
+
322
+ ### 2.2: [Subtask Title] [S]
323
+
324
+ **Bead:** bd-xxx2.2
325
+ **Blocked by:** 2.1
326
+ **Files:** `src/baz.ts`
327
+ **Changes:**
328
+ - [ ] [Specific change]
116
329
 
117
- With `--create-beads` flag or user approval:
330
+ **Verify:** `npm test -- baz.test.ts`
118
331
 
119
- ````bash
120
- # Task 1 (no blockers)
121
- bd create "[task 1 title]" -t task -p 2
332
+ ---
333
+
334
+ ## Task 3: [Title] [S]
335
+
336
+ **Bead:** bd-xxx3
337
+ **Estimate:** ~10 tool calls (30 min)
338
+ **Blocked by:** Task 2
339
+
340
+ **Files:**
341
+ - `tests/integration/`
342
+
343
+ **Changes:**
344
+ - [ ] [Specific change]
345
+
346
+ **Verify:** `npm run test:integration`
347
+
348
+ ---
122
349
 
123
- # Task 2 (blocked by task 1)
124
- bd create "[task 2 title]" -t task -p 2
125
- bd dep add bd-[task2] bd-[task1] --type blocks
350
+ ## Final Verification
126
351
 
127
- !`bd dep tree $ARGUMENTS`
352
+ - [ ] All acceptance criteria from spec.md met
353
+ - [ ] Full test suite: `npm test`
354
+ - [ ] Type check: `npm run typecheck`
355
+ - [ ] Lint: `npm run lint`
128
356
 
129
- Update plan.md with bead IDs.
357
+ ## Rollback Plan
130
358
 
131
- ## Sync
359
+ If issues detected after deployment:
360
+ 1. [Rollback step 1]
361
+ 2. [Rollback step 2]
362
+ ```
363
+
364
+ ---
365
+
366
+ ## Phase 7: Sync and Report
132
367
 
133
368
  ```bash
134
369
  bd sync
135
- ````
136
-
137
- ## Output
370
+ ```
138
371
 
139
- Without child beads:
372
+ ### Output (without child beads)
140
373
 
141
374
  ```
142
- Plan: $ARGUMENTS
375
+ Plan Complete: $ARGUMENTS
376
+ ━━━━━━━━━━━━━━━━━━━━━━━━
143
377
 
144
- Approach: [selected]
145
- Tasks: [count]
378
+ Approach: [Selected option]
379
+ Tasks: 1 (single bead)
146
380
  Estimate: ~N tool calls
147
381
 
148
382
  Artifacts:
149
- - .beads/artifacts/$ARGUMENTS/design.md
150
- - .beads/artifacts/$ARGUMENTS/plan.md
383
+ ├── .beads/artifacts/$ARGUMENTS/design.md
384
+ └── .beads/artifacts/$ARGUMENTS/plan.md
151
385
 
152
386
  Next: /implement $ARGUMENTS
153
387
  ```
154
388
 
155
- With child beads:
389
+ ### Output (with child beads)
156
390
 
157
391
  ```
158
- Plan: $ARGUMENTS (Epic)
392
+ Plan Complete: $ARGUMENTS (Epic)
393
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
394
+
395
+ Approach: [Selected option]
396
+ Total estimate: ~N tool calls ([X-Y hours])
159
397
 
160
- Subtasks:
161
- ├── bd-[x].1: [title] ← READY
162
- ├── bd-[x].2: [title] blocked by .1
163
- └── bd-[x].3: [title] ← blocked by .2
398
+ Hierarchy:
399
+ ├── bd-xxx1: [Title] [S] ← READY
400
+ ├── bd-xxx2: [Title] [M] blocked by bd-xxx1
401
+ │ ├── bd-xxx2.1: [Subtask] [S]
402
+ │ └── bd-xxx2.2: [Subtask] [S]
403
+ └── bd-xxx3: [Title] [S] → blocked by bd-xxx2
404
+
405
+ Artifacts:
406
+ ├── .beads/artifacts/$ARGUMENTS/design.md
407
+ └── .beads/artifacts/$ARGUMENTS/plan.md
164
408
 
165
- Next: /implement bd-[x].1
409
+ Ready to start: bd-xxx1
410
+
411
+ Next: /start bd-xxx1
166
412
  ```
413
+
414
+ ---
415
+
416
+ ## Subagent Delegation Summary
417
+
418
+ | Phase | Subagent | Purpose |
419
+ | ------------------ | ---------- | ------------------------------------ |
420
+ | Research | `@explore` | Find codebase patterns |
421
+ | Research | `@scout` | Find best practices |
422
+ | Design options | None | Planner creates |
423
+ | Hierarchy creation | None | Planner uses `bd` CLI |
424
+ | Implementation | `@build` | Delegated via `/start`, `/implement` |
425
+
426
+ **Key Rule:** Planner is read-only. Creates structure and artifacts. Build agent executes.
427
+
428
+ ---
429
+
430
+ ## Related Commands
431
+
432
+ | Need | Command |
433
+ | -------------------- | ------------------------ |
434
+ | Create spec first | `/create <bead-id>` |
435
+ | Research before plan | `/research <bead-id>` |
436
+ | Start first task | `/start <first-task-id>` |
437
+ | View hierarchy | `bd dep tree <bead-id>` |
438
+ | Import external plan | `/import-plan` |
@@ -43,8 +43,9 @@ Don't duplicate work that's already been done.
43
43
  1. **Codebase patterns** (highest trust) - How does this project already do it?
44
44
  2. **Official docs** (high trust) - What does the library documentation say?
45
45
  3. **Context7** (high trust) - API usage and examples
46
- 4. **GitHub examples** (medium trust) - Real-world patterns via codesearch/gh_grep
47
- 5. **Web search** (lower trust) - Only if tiers 1-4 don't answer
46
+ 4. **Source code** (high trust) - Library implementation (use `source-code-research` skill)
47
+ 5. **GitHub examples** (medium trust) - Real-world patterns via codesearch/gh_grep
48
+ 6. **Web search** (lower trust) - Only if tiers 1-5 don't answer
48
49
 
49
50
  ## Research
50
51
 
@@ -67,6 +68,32 @@ context7_resolve_library_id({ libraryName: "<lib>", query: "<question>" });
67
68
  context7_query_docs({ libraryId: "<id>", query: "<specific question>" });
68
69
  ```
69
70
 
71
+ ### Source Code (When Docs Insufficient)
72
+
73
+ **Use the `source-code-research` skill when:**
74
+
75
+ - Documentation doesn't explain behavior clearly
76
+ - Need to understand edge cases or internals
77
+ - Library behaving unexpectedly
78
+ - Evaluating library quality/fit
79
+
80
+ ```bash
81
+ # Fetch package source code
82
+ npx opensrc <package> # npm package
83
+ npx opensrc <package>@<version> # specific version
84
+ npx opensrc pypi:<package> # Python
85
+ npx opensrc <owner>/<repo> # GitHub repo
86
+ ```
87
+
88
+ ```typescript
89
+ // Then analyze the source
90
+ glob({ pattern: "opensrc/**/src/**/*.ts" });
91
+ grep({ pattern: "<function-name>", path: "opensrc/" });
92
+ read({ filePath: "opensrc/repos/.../file.ts" });
93
+ ```
94
+
95
+ **See:** `skill({ name: "source-code-research" })` for complete workflow.
96
+
70
97
  ### Code Examples
71
98
 
72
99
  ```typescript