opencodekit 0.12.7 → 0.13.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 (32) hide show
  1. package/README.md +2 -2
  2. package/dist/index.js +2753 -508
  3. package/dist/template/.opencode/AGENTS.md +35 -128
  4. package/dist/template/.opencode/README.md +4 -3
  5. package/dist/template/.opencode/command/design.md +1 -0
  6. package/dist/template/.opencode/command/fix.md +28 -1
  7. package/dist/template/.opencode/command/implement.md +195 -39
  8. package/dist/template/.opencode/command/new-feature.md +229 -188
  9. package/dist/template/.opencode/command/plan.md +354 -82
  10. package/dist/template/.opencode/command/research.md +29 -6
  11. package/dist/template/.opencode/command/start.md +227 -0
  12. package/dist/template/.opencode/command/triage.md +66 -12
  13. package/dist/template/.opencode/memory/project/beads-workflow.md +510 -0
  14. package/dist/template/.opencode/memory/session-context.md +40 -0
  15. package/dist/template/.opencode/opencode.json +20 -5
  16. package/dist/template/.opencode/package.json +1 -1
  17. package/dist/template/.opencode/plugin/compaction.ts +62 -18
  18. package/dist/template/.opencode/plugin/lib/notify.ts +2 -3
  19. package/dist/template/.opencode/plugin/sessions.ts +1 -1
  20. package/dist/template/.opencode/plugin/skill-mcp.ts +11 -12
  21. package/dist/template/.opencode/skill/beads/SKILL.md +44 -0
  22. package/dist/template/.opencode/skill/source-code-research/SKILL.md +537 -0
  23. package/dist/template/.opencode/tool/ast-grep.ts +3 -3
  24. package/dist/template/.opencode/tool/bd-inbox.ts +7 -6
  25. package/dist/template/.opencode/tool/bd-msg.ts +3 -3
  26. package/dist/template/.opencode/tool/bd-release.ts +2 -2
  27. package/dist/template/.opencode/tool/bd-reserve.ts +5 -4
  28. package/dist/template/.opencode/tool/memory-read.ts +2 -2
  29. package/dist/template/.opencode/tool/memory-search.ts +2 -2
  30. package/dist/template/.opencode/tool/memory-update.ts +11 -12
  31. package/dist/template/.opencode/tool/observation.ts +6 -6
  32. package/package.json +5 -2
@@ -0,0 +1,227 @@
1
+ ---
2
+ description: Start working on a bead - claim it and prepare context
3
+ argument-hint: "<bead-id> [--worktree] [--research]"
4
+ agent: build
5
+ ---
6
+
7
+ # Start: $ARGUMENTS
8
+
9
+ You're claiming a task and preparing to work on it. This is the entry point before implementation.
10
+
11
+ ## Parse Arguments
12
+
13
+ | Argument | Default | Description |
14
+ | ------------ | -------- | ---------------------------------------------- |
15
+ | `<bead-id>` | required | The bead to start working on |
16
+ | `--worktree` | false | Create isolated git worktree for this work |
17
+ | `--research` | false | Run parallel subagent research before starting |
18
+
19
+ ## Load Skills
20
+
21
+ ```typescript
22
+ skill({ name: "beads" });
23
+ ```
24
+
25
+ ## Ensure Git Hooks Installed
26
+
27
+ First-time setup per repo (prevents stale JSONL issues):
28
+
29
+ ```bash
30
+ bd hooks install 2>/dev/null || echo "Hooks already installed"
31
+ ```
32
+
33
+ ## Current State
34
+
35
+ ### Git Status
36
+
37
+ !`git status --porcelain`
38
+ !`git branch --show-current`
39
+
40
+ ### Active Tasks
41
+
42
+ !`bd list --status=in_progress`
43
+
44
+ If you have uncommitted changes, ask the user:
45
+
46
+ 1. Stash them (`git stash`)
47
+ 2. Commit them first
48
+ 3. Continue anyway (risky)
49
+
50
+ If you already have tasks in_progress, warn the user before claiming another.
51
+
52
+ ## Task Details
53
+
54
+ !`bd show $ARGUMENTS`
55
+
56
+ Identify the task type from the bead:
57
+
58
+ | Type | Hierarchy Level | Typical Scope |
59
+ | --------- | --------------- | --------------------------------- |
60
+ | `epic` | Parent | Multi-session, has subtasks |
61
+ | `task` | Middle | Single session, may have subtasks |
62
+ | `subtask` | Leaf | Single focused unit of work |
63
+
64
+ Check for parent/child relationships:
65
+
66
+ ```bash
67
+ bd dep tree $ARGUMENTS 2>/dev/null || echo "No dependencies"
68
+ ```
69
+
70
+ ## Claim The Task
71
+
72
+ ```bash
73
+ bd update $ARGUMENTS --status in_progress
74
+ ```
75
+
76
+ ## Workspace Setup
77
+
78
+ ### Option A: Feature Branch (default)
79
+
80
+ If not already on a feature branch:
81
+
82
+ ```bash
83
+ git checkout -b $ARGUMENTS
84
+ ```
85
+
86
+ ### Option B: Git Worktree (if --worktree flag)
87
+
88
+ For isolated work that won't conflict with main workspace:
89
+
90
+ ```typescript
91
+ skill({ name: "using-git-worktrees" });
92
+ ```
93
+
94
+ **When to use worktrees:**
95
+
96
+ - Epic-level work spanning multiple sessions
97
+ - Parallel work on different features
98
+ - Need to keep main workspace clean
99
+ - Long-running features with frequent context switches
100
+
101
+ **Worktree setup:**
102
+
103
+ ```bash
104
+ # Verify .gitignore has worktree directory
105
+ grep -q "^\.worktrees/$" .gitignore || echo ".worktrees/" >> .gitignore
106
+
107
+ # Create worktree
108
+ git worktree add .worktrees/$ARGUMENTS -b $ARGUMENTS
109
+
110
+ # Navigate to worktree
111
+ cd .worktrees/$ARGUMENTS
112
+
113
+ # Install dependencies (auto-detect project type)
114
+ [ -f package.json ] && npm install
115
+ [ -f Cargo.toml ] && cargo build
116
+ [ -f requirements.txt ] && pip install -r requirements.txt
117
+ [ -f go.mod ] && go mod download
118
+ ```
119
+
120
+ **Beads in worktrees:** The `.beads/` database is shared with main repo automatically. No special configuration needed unless using `BEADS_DIR` for external storage.
121
+
122
+ ## Parallel Research (if --research flag or epic-level work)
123
+
124
+ For complex tasks, gather context before diving in:
125
+
126
+ ```typescript
127
+ // Fire subagents in parallel - don't wait for results
128
+ Task({
129
+ subagent_type: "explore",
130
+ prompt: `Research codebase patterns for $ARGUMENTS:
131
+ - Find similar implementations
132
+ - Identify affected files
133
+ - Note testing patterns used
134
+ Return: File list, patterns found, testing approach`,
135
+ description: "Explore codebase for task",
136
+ });
137
+
138
+ Task({
139
+ subagent_type: "scout",
140
+ prompt: `Research external docs for $ARGUMENTS:
141
+ - API documentation for libraries involved
142
+ - Best practices for the approach
143
+ - Common pitfalls to avoid
144
+ Return: Key findings, code examples, warnings`,
145
+ description: "Scout external resources",
146
+ });
147
+ ```
148
+
149
+ **Subagent delegation rules:**
150
+
151
+ - Subagents are **read-only** - they don't modify beads state
152
+ - Results return to you (build agent) for integration
153
+ - Use for research, not for implementation
154
+
155
+ ## Existing Artifacts
156
+
157
+ !`ls .beads/artifacts/$ARGUMENTS/ 2>/dev/null || echo "No artifacts yet"`
158
+
159
+ Look for:
160
+
161
+ - `spec.md` - Requirements and constraints
162
+ - `research.md` - Previous research
163
+ - `plan.md` - Implementation plan
164
+ - `handoffs/` - Previous session handoffs
165
+
166
+ ## Check Previous Sessions
167
+
168
+ ```typescript
169
+ search_session({ query: "$ARGUMENTS" });
170
+ list_sessions({ limit: 3 });
171
+ ```
172
+
173
+ Load context from previous work on this bead.
174
+
175
+ ## Determine Next Step
176
+
177
+ Based on task type and what exists:
178
+
179
+ ### For Epics (parent tasks)
180
+
181
+ | State | Next Command |
182
+ | ------------------ | --------------------------------- |
183
+ | No subtasks | `/plan $ARGUMENTS --create-beads` |
184
+ | Has ready subtasks | `/start <first-subtask-id>` |
185
+ | All subtasks done | `/finish $ARGUMENTS` |
186
+
187
+ ### For Tasks/Subtasks (leaf work)
188
+
189
+ | Artifacts Found | Next Command |
190
+ | --------------------- | ----------------------- |
191
+ | Nothing | `/research $ARGUMENTS` |
192
+ | Only spec.md | `/plan $ARGUMENTS` |
193
+ | spec.md + research.md | `/plan $ARGUMENTS` |
194
+ | plan.md exists | `/implement $ARGUMENTS` |
195
+
196
+ ## Output
197
+
198
+ ```
199
+ Started: $ARGUMENTS
200
+ ━━━━━━━━━━━━━━━━━━━
201
+
202
+ Type: [epic/task/subtask]
203
+ Branch: $ARGUMENTS
204
+ Workspace: [main | worktree: .worktrees/$ARGUMENTS]
205
+ Status: in_progress
206
+
207
+ Hierarchy:
208
+ ├── Parent: [parent-id or "none"]
209
+ └── Children: [count or "none"]
210
+
211
+ Artifacts:
212
+ • spec.md: [exists/missing]
213
+ • research.md: [exists/missing]
214
+ • plan.md: [exists/missing]
215
+
216
+ Research: [launched/skipped]
217
+
218
+ Next: [recommended command based on state]
219
+ ```
220
+
221
+ ## Quick Start
222
+
223
+ If `--quick` flag is passed and plan.md exists, skip directly to:
224
+
225
+ ```
226
+ /implement $ARGUMENTS
227
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: AI-powered task triage, prioritization, and workload analysis
3
- argument-hint: "[--auto-assign] [--sla] [--bottleneck]"
3
+ argument-hint: "[--quick] [--auto-assign] [--sla] [--bottleneck]"
4
4
  agent: build
5
5
  ---
6
6
 
@@ -14,11 +14,54 @@ skill({ name: "beads" });
14
14
 
15
15
  Analyze open tasks and optimize prioritization using dependency graph analysis, SLA tracking, and multi-agent coordination.
16
16
 
17
- ## Phase 1: Initialize Beads Connection
17
+ ## Quick Mode
18
+
19
+ If `--quick` flag is passed, skip deep analysis and provide immediate actionable output:
20
+
21
+ ```bash
22
+ bd ready --json
23
+ bd list --status=in_progress --json
24
+ ```
25
+
26
+ **Quick Output:**
27
+
28
+ ```
29
+ Quick Triage
30
+ ━━━━━━━━━━━━
31
+
32
+ Ready to start:
33
+ • bd-abc12: "Task title" (P1)
34
+ • bd-def34: "Task title" (P2)
35
+
36
+ In progress:
37
+ • bd-ghi56: "Task title" - claimed by [agent]
38
+
39
+ Next: /start <bead-id>
40
+ ```
41
+
42
+ Then stop. Don't run full analysis phases.
43
+
44
+ ## Full Triage (Default)
45
+
46
+ ## Phase 1: Health Check
47
+
48
+ Run `bd doctor` to ensure database integrity (recommended weekly):
49
+
50
+ ```bash
51
+ bd doctor --fix 2>/dev/null || bd doctor
52
+ ```
53
+
54
+ This detects and auto-fixes:
55
+
56
+ - Orphaned issues (work committed but issue not closed)
57
+ - Database/JSONL sync issues
58
+ - Migration updates
59
+
60
+ ## Phase 2: Initialize Beads Connection
18
61
 
19
62
  !`bd status`
20
63
 
21
- ## Phase 2: Gather Workspace State
64
+ ## Phase 3: Gather Workspace State
22
65
 
23
66
  Run in parallel:
24
67
 
@@ -27,8 +70,8 @@ Run in parallel:
27
70
 
28
71
  ```typescript
29
72
  // Custom tools (not shell commands)
30
- bd-release(); // Lists active locks when called with no args
31
- bd-inbox({ n: 10, unread: true, to: "all" });
73
+ bd - release(); // Lists active locks when called with no args
74
+ bd - inbox({ n: 10, unread: true, to: "all" });
32
75
 
33
76
  // Search for past discussions on recurring issues
34
77
  search_session({ query: "blocked OR regression OR urgent", limit: 10 });
@@ -43,7 +86,7 @@ Capture:
43
86
  - Pending messages
44
87
  - Past context on recurring issues
45
88
 
46
- ## Phase 3: Analyze Dependencies
89
+ ## Phase 4: Analyze Dependencies
47
90
 
48
91
  Use `bd dep tree` to understand blocking relationships:
49
92
 
@@ -55,7 +98,7 @@ This provides:
55
98
  - **Keystones**: High-impact tasks that unlock multiple paths
56
99
  - **Cycles**: Circular dependencies (must break)
57
100
 
58
- ## Phase 4: Priority Classification
101
+ ## Phase 5: Priority Classification
59
102
 
60
103
  ### Priority Matrix
61
104
 
@@ -112,7 +155,7 @@ const slaStatus =
112
155
  : "OK";
113
156
  ```
114
157
 
115
- ## Phase 5: Bottleneck Analysis
158
+ ## Phase 6: Bottleneck Analysis
116
159
 
117
160
  Identify blocking patterns:
118
161
 
@@ -154,7 +197,7 @@ Resolution Options:
154
197
  Run: bd update <id> --remove-dep <dep-id>
155
198
  ```
156
199
 
157
- ## Phase 6: Generate Triage Report
200
+ ## Phase 7: Generate Triage Report
158
201
 
159
202
  ```
160
203
  ╔══════════════════════════════════════════════════════════════════════════╗
@@ -210,7 +253,7 @@ RECOMMENDATIONS
210
253
  ╚══════════════════════════════════════════════════════════════════════════╝
211
254
  ```
212
255
 
213
- ## Phase 7: Auto-Assignment (Optional)
256
+ ## Phase 8: Auto-Assignment (Optional)
214
257
 
215
258
  If `--auto-assign` flag:
216
259
 
@@ -261,7 +304,7 @@ Skipped:
261
304
  - bd-old88: No matching role detected (manual assignment needed)
262
305
  ```
263
306
 
264
- ## Phase 8: Batch Operations
307
+ ## Phase 9: Batch Operations
265
308
 
266
309
  ### Bulk Priority Update
267
310
 
@@ -286,7 +329,18 @@ console.log("2. Move to P4 backlog");
286
329
  console.log("3. Review individually");
287
330
  ```
288
331
 
289
- ## Phase 9: Sync and Notify
332
+ ### Database Cleanup (Weekly Maintenance)
333
+
334
+ Keep database small for performance (target: under 200-500 issues):
335
+
336
+ ```bash
337
+ bd cleanup --days 7 # Remove closed issues older than 7 days
338
+ bd list --status=closed --json | wc -l # Check closed count
339
+ ```
340
+
341
+ **Best Practice (from Steve Yegge):** Run `bd cleanup` every few days to prevent database bloat.
342
+
343
+ ## Phase 10: Sync and Notify
290
344
 
291
345
  ```typescript
292
346