opencodekit 0.12.7 → 0.13.0

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 (28) 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/research.md +0 -4
  8. package/dist/template/.opencode/command/start.md +106 -0
  9. package/dist/template/.opencode/command/triage.md +66 -12
  10. package/dist/template/.opencode/memory/project/beads-workflow.md +278 -0
  11. package/dist/template/.opencode/memory/session-context.md +40 -0
  12. package/dist/template/.opencode/opencode.json +557 -496
  13. package/dist/template/.opencode/package.json +1 -1
  14. package/dist/template/.opencode/plugin/compaction.ts +62 -18
  15. package/dist/template/.opencode/plugin/lib/notify.ts +2 -3
  16. package/dist/template/.opencode/plugin/sessions.ts +1 -1
  17. package/dist/template/.opencode/plugin/skill-mcp.ts +11 -12
  18. package/dist/template/.opencode/skill/beads/SKILL.md +44 -0
  19. package/dist/template/.opencode/tool/ast-grep.ts +3 -3
  20. package/dist/template/.opencode/tool/bd-inbox.ts +7 -6
  21. package/dist/template/.opencode/tool/bd-msg.ts +3 -3
  22. package/dist/template/.opencode/tool/bd-release.ts +2 -2
  23. package/dist/template/.opencode/tool/bd-reserve.ts +5 -4
  24. package/dist/template/.opencode/tool/memory-read.ts +2 -2
  25. package/dist/template/.opencode/tool/memory-search.ts +2 -2
  26. package/dist/template/.opencode/tool/memory-update.ts +11 -12
  27. package/dist/template/.opencode/tool/observation.ts +6 -6
  28. package/package.json +5 -2
@@ -0,0 +1,278 @@
1
+ ---
2
+ purpose: Complete beads workflow mapping for OpenCodeKit commands
3
+ updated: 2025-01-07
4
+ ---
5
+
6
+ # Beads Workflow Best Practices
7
+
8
+ Based on Steve Yegge's best practices and official beads documentation.
9
+
10
+ ## Core Principles
11
+
12
+ | Principle | Why | How |
13
+ | ------------------------ | -------------------------------- | ------------------------------------ |
14
+ | One task per session | Fresh context prevents confusion | Restart after `bd close` |
15
+ | Plan outside beads first | Better planning tools exist | Use `/brainstorm` → `/plan` → import |
16
+ | File lots of issues | Track any work >2 minutes | `bd create` liberally |
17
+ | "Land the plane" = PUSH | `bd sync` means git push | Always verify push succeeded |
18
+ | Keep DB small | Performance degrades >500 issues | `bd cleanup --days 7` weekly |
19
+
20
+ ## Maintenance Schedule
21
+
22
+ | Task | Frequency | Command | Why |
23
+ | ------------ | -------------- | --------------------- | -------------------------------------- |
24
+ | Health check | Weekly | `bd doctor --fix` | Repairs orphaned issues, sync problems |
25
+ | Cleanup | Every few days | `bd cleanup --days 7` | Keep DB under 200-500 issues |
26
+ | Upgrade | Weekly | `bd upgrade` | Latest features and fixes |
27
+ | Git hooks | Once per repo | `bd hooks install` | Auto-sync on commit/merge/checkout |
28
+
29
+ ## Command Configuration Best Practices
30
+
31
+ Based on [OpenCode Command Docs](https://opencode.ai/docs/commands/).
32
+
33
+ ### Frontmatter Options
34
+
35
+ ```yaml
36
+ ---
37
+ description: Short description shown in TUI command list
38
+ argument-hint: "<required> [optional] [--flag]"
39
+ agent: build | planner | scout | explore | review | vision
40
+ subtask: true # Run as subagent (doesn't pollute primary context)
41
+ model: gemini-2.5-pro # Override default model
42
+ ---
43
+ ```
44
+
45
+ ### Prompt Syntax
46
+
47
+ | Syntax | Purpose | Example |
48
+ | ------------ | ------------------------ | ----------------------------- |
49
+ | `$ARGUMENTS` | All arguments as string | `/fix $ARGUMENTS` |
50
+ | `$1`, `$2` | Positional arguments | `/start $1` → `/start bd-abc` |
51
+ | `!`command`` | Inject shell output | `!`git status`` |
52
+ | `@filepath` | Include file content | `@src/config.ts` |
53
+ | `$SELECTION` | Current editor selection | For IDE integrations |
54
+
55
+ ### When to Use `subtask: true`
56
+
57
+ **Use subtask for research/analysis** - prevents context pollution in primary agent:
58
+
59
+ | Command Type | `subtask: true`? | Why |
60
+ | ------------------------ | ---------------- | ------------------------------------ |
61
+ | Research/exploration | ✅ Yes | Heavy reads, doesn't need to persist |
62
+ | Code review/analysis | ✅ Yes | Analysis output, not implementation |
63
+ | UI/UX analysis | ✅ Yes | Design feedback, not code changes |
64
+ | Status/dashboard | ✅ Yes | Read-only information gathering |
65
+ | Implementation | ❌ No | Needs full context for edits |
66
+ | Lifecycle (start/finish) | ❌ No | Coordinates state, needs persistence |
67
+ | Generation (artifacts) | ❌ No | Creates files that need tracking |
68
+
69
+ ### Commands by Category
70
+
71
+ #### Research Commands (`subtask: true`)
72
+
73
+ ```
74
+ /research, /analyze-project, /review-codebase, /brainstorm,
75
+ /status, /summarize, /init, /ui-review, /accessibility-check,
76
+ /analyze-mockup, /design-audit, /research-ui, /design
77
+ ```
78
+
79
+ #### Lifecycle Commands (NO subtask)
80
+
81
+ ```
82
+ /triage, /start, /create, /new-feature, /issue, /plan,
83
+ /implement, /commit, /finish, /handoff, /resume, /pr, /fix
84
+ ```
85
+
86
+ #### Generation Commands (NO subtask)
87
+
88
+ ```
89
+ /generate-image, /generate-icon, /generate-diagram,
90
+ /generate-pattern, /generate-storyboard, /edit-image, /restore-image
91
+ ```
92
+
93
+ #### Utility Commands (NO subtask)
94
+
95
+ ```
96
+ /quick-build, /fix-ci, /fix-types, /fix-ui,
97
+ /revert-feature, /integration-test, /skill-create, /skill-optimize
98
+ ```
99
+
100
+ ## Command → Beads Mapping
101
+
102
+ ### Lifecycle Commands (Touch Beads)
103
+
104
+ | Command | Agent | Beads Operations | When to Use |
105
+ | ----------------- | ------- | ------------------------------------------------------ | --------------------------- |
106
+ | `/triage` | build | `bd doctor`, `bd list`, `bd ready`, `bd cleanup` | Start of day, find work |
107
+ | `/triage --quick` | build | `bd ready`, `bd list --status=in_progress` | Fast check, what's next |
108
+ | `/start <id>` | build | `bd update --status in_progress`, `bd hooks install` | Claim a task |
109
+ | `/create` | build | `bd create`, `bd sync` | Create new tracked task |
110
+ | `/new-feature` | planner | `bd create` (epic + subtasks), `bd dep add`, `bd sync` | Complex feature with phases |
111
+ | `/issue <num>` | build | `bd create`, `bd sync`, `gh issue comment` | Import GitHub issue |
112
+ | `/plan <id>` | planner | `bd create` (subtasks), `bd dep add`, `bd sync` | Break down task |
113
+ | `/implement <id>` | build | `bd update --status in_progress`, `bd sync` | Do the work |
114
+ | `/commit [id]` | build | `bd sync` (if bead-id provided) | Commit with traceability |
115
+ | `/finish <id>` | build | `bd close`, `bd sync` | Complete task (asks first) |
116
+ | `/handoff <id>` | build | `bd sync` | Pause work, save context |
117
+ | `/resume <id>` | build | `bd update --status in_progress` | Continue previous work |
118
+ | `/pr <id>` | build | `bd-msg`, `bd sync` | Create pull request |
119
+ | `/fix` | build | `bd sync` (after user confirms commit) | Fix bugs with tracking |
120
+ | `/status` | explore | `bd status`, `bd list`, `bd-inbox`, `bd-release` | Dashboard view |
121
+
122
+ ### Research Commands (Read-Only Beads)
123
+
124
+ | Command | Agent | Beads Operations | Notes |
125
+ | ------------------ | ------- | --------------------- | -------------------------- |
126
+ | `/research <id>` | scout | `bd show` (read-only) | NO `bd sync` - subagent |
127
+ | `/brainstorm` | planner | None | Pure planning, no tracking |
128
+ | `/analyze-project` | explore | None | Codebase exploration |
129
+ | `/summarize` | explore | None | Session/code summary |
130
+ | `/review-codebase` | review | None | Code review |
131
+
132
+ ### Non-Beads Commands
133
+
134
+ | Command | Agent | Purpose |
135
+ | ---------------------- | ------- | ------------------------------ |
136
+ | `/quick-build` | build | Trivial fixes, no bead created |
137
+ | `/design` | planner | Architecture design |
138
+ | `/ui-review` | vision | UI/UX analysis |
139
+ | `/accessibility-check` | vision | A11y audit |
140
+ | `/fix-ci` | build | CI pipeline fixes |
141
+ | `/fix-types` | build | TypeScript errors |
142
+
143
+ ## Workflow Patterns
144
+
145
+ ### Pattern 1: Standard Task (S/M size)
146
+
147
+ ```
148
+ /triage --quick # Find ready work
149
+ /start bd-xxx # Claim task, create branch
150
+ /implement bd-xxx # Do the work
151
+ /finish bd-xxx # Verify, commit (asks first), close
152
+ /pr bd-xxx # Create PR (asks first)
153
+ ```
154
+
155
+ ### Pattern 2: Complex Feature (L/XL size)
156
+
157
+ ```
158
+ /triage # Full triage with health check
159
+ /new-feature "Feature" # Creates epic + spec + plan + subtasks
160
+ /start bd-xxx.1 # Start first subtask
161
+ /implement bd-xxx.1 # Implement
162
+ /finish bd-xxx.1 # Complete subtask
163
+ /start bd-xxx.2 # Next subtask (now unblocked)
164
+ ...
165
+ /finish bd-xxx # Close epic when all subtasks done
166
+ ```
167
+
168
+ ### Pattern 3: Research-First
169
+
170
+ ```
171
+ /create "Complex task" # Create bead with spec
172
+ /research bd-xxx # Gather information (scout agent)
173
+ /plan bd-xxx # Design approach (planner agent)
174
+ /implement bd-xxx # Now implement with full context
175
+ /finish bd-xxx # Complete
176
+ ```
177
+
178
+ ### Pattern 4: Bug Fix
179
+
180
+ ```
181
+ /issue 123 # Import GitHub issue as bead
182
+ /start bd-xxx # Claim
183
+ /fix bd-xxx # Diagnose + fix (asks before commit)
184
+ /finish bd-xxx # Verify + close
185
+ /pr bd-xxx # Create PR
186
+ ```
187
+
188
+ ### Pattern 5: Session Handoff
189
+
190
+ ```
191
+ /implement bd-xxx # Working on task...
192
+ # Context getting large or end of day
193
+ /handoff bd-xxx # Save progress, creates handoff.md
194
+ # New session
195
+ /resume bd-xxx # Load context, continue
196
+ ```
197
+
198
+ ### Pattern 6: Trivial Fix (No Bead)
199
+
200
+ ```
201
+ /quick-build "fix typo" # Single file, <30 min, commits directly
202
+ ```
203
+
204
+ ## Agent Boundaries
205
+
206
+ ### Leader Agents (Touch Beads)
207
+
208
+ | Agent | Can Do | Cannot Do |
209
+ | ------- | ------------------------------- | --------- |
210
+ | `build` | All beads operations, `bd sync` | - |
211
+ | `rush` | All beads operations, `bd sync` | - |
212
+
213
+ ### Subagents (Read-Only Beads)
214
+
215
+ | Agent | Can Do | Cannot Do |
216
+ | --------- | -------------------------------------- | --------------------- |
217
+ | `planner` | `bd show`, `bd list`, create artifacts | `bd sync`, `bd close` |
218
+ | `scout` | `bd show` (read context) | Any writes |
219
+ | `explore` | `bd show`, `bd list` | Any writes |
220
+ | `review` | `bd show` | Any writes |
221
+ | `vision` | None | All beads operations |
222
+
223
+ ## File Locking (Multi-Agent)
224
+
225
+ ```typescript
226
+ // Before editing shared files
227
+ bd - reserve({ paths: ["src/auth.ts"], ttl: 600 });
228
+
229
+ // Do work...
230
+
231
+ // After completing edits
232
+ bd - release({ paths: ["src/auth.ts"] });
233
+
234
+ // Check active locks
235
+ bd - release(); // No args = list locks
236
+ ```
237
+
238
+ ## Commit Message Format
239
+
240
+ Always include bead ID for traceability:
241
+
242
+ ```
243
+ feat(auth): add token refresh (bd-a1b2c3)
244
+
245
+ Implement automatic token refresh when access token expires.
246
+
247
+ Closes: bd-a1b2c3
248
+ ```
249
+
250
+ ## Session End Checklist
251
+
252
+ 1. [ ] All work committed
253
+ 2. [ ] `bd sync` run (pushes to git)
254
+ 3. [ ] If incomplete: `/handoff <id>` created
255
+ 4. [ ] If complete: `/finish <id>` run
256
+ 5. [ ] No stale file locks
257
+
258
+ ## Troubleshooting
259
+
260
+ | Problem | Solution |
261
+ | ---------------------- | --------------------------------------- |
262
+ | "bd command not found" | `npm install -g beads-village` |
263
+ | Orphaned issues | `bd doctor --fix` |
264
+ | DB too large | `bd cleanup --days 3` |
265
+ | Sync conflicts | `bd sync --force` (careful!) |
266
+ | Stale handoff | Check if rebase needed before `/resume` |
267
+ | Task not in `bd ready` | Check blockers: `bd show <id>` |
268
+
269
+ ## Anti-Patterns
270
+
271
+ | Don't | Why | Do Instead |
272
+ | -------------------------------------- | --------------------- | -------------------------------- |
273
+ | Skip `bd sync` at session end | Changes won't persist | Always sync before stopping |
274
+ | Create beads for trivial fixes | DB bloat | Use `/quick-build` |
275
+ | Work on blocked tasks | Wastes time | Use `bd ready` to find unblocked |
276
+ | Subagents running `bd sync` | Coordination issues | Only leader agents sync |
277
+ | Force through complex with quick-build | Technical debt | Proper `/create` workflow |
278
+ | Ignore `bd doctor` warnings | Corruption risk | Fix issues promptly |
@@ -0,0 +1,40 @@
1
+ ---
2
+ purpose: Session continuity state that survives compaction
3
+ updated: 2025-01-08
4
+ ---
5
+
6
+ # Session Context
7
+
8
+ <!--
9
+ Agent-maintained via memory-update tool.
10
+ Update when: goal changes, key decision made, state shifts, uncertainty discovered.
11
+ After compaction: read this file, ask 1-3 targeted questions if gaps exist.
12
+ -->
13
+
14
+ ## Goal
15
+
16
+ <!-- What we're trying to achieve + success criteria -->
17
+
18
+ ## Constraints
19
+
20
+ <!-- User-specified limits, discovered guardrails. Mark UNCONFIRMED if inferred -->
21
+
22
+ ## Decisions
23
+
24
+ <!-- Key choices made this session with brief rationale -->
25
+
26
+ ## State
27
+
28
+ - **Done**:
29
+ - **Now**:
30
+ - **Next**:
31
+
32
+ ## Open Questions
33
+
34
+ <!-- Uncertainties - mark UNCONFIRMED if not verified -->
35
+
36
+ ## Working Set
37
+
38
+ - **Files**:
39
+ - **Bead**:
40
+ - **Branch**: