opencodekit 0.13.2 → 0.14.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 (49) hide show
  1. package/dist/index.js +50 -3
  2. package/dist/template/.opencode/AGENTS.md +51 -7
  3. package/dist/template/.opencode/README.md +98 -2
  4. package/dist/template/.opencode/agent/build.md +44 -1
  5. package/dist/template/.opencode/agent/explore.md +1 -0
  6. package/dist/template/.opencode/agent/planner.md +40 -1
  7. package/dist/template/.opencode/agent/review.md +1 -0
  8. package/dist/template/.opencode/agent/rush.md +35 -0
  9. package/dist/template/.opencode/agent/scout.md +1 -0
  10. package/dist/template/.opencode/command/brainstorm.md +83 -5
  11. package/dist/template/.opencode/command/finish.md +39 -12
  12. package/dist/template/.opencode/command/fix.md +24 -15
  13. package/dist/template/.opencode/command/handoff.md +17 -0
  14. package/dist/template/.opencode/command/implement.md +81 -18
  15. package/dist/template/.opencode/command/import-plan.md +30 -8
  16. package/dist/template/.opencode/command/new-feature.md +37 -4
  17. package/dist/template/.opencode/command/plan.md +51 -1
  18. package/dist/template/.opencode/command/pr.md +25 -15
  19. package/dist/template/.opencode/command/research.md +61 -5
  20. package/dist/template/.opencode/command/resume.md +31 -0
  21. package/dist/template/.opencode/command/revert-feature.md +15 -3
  22. package/dist/template/.opencode/command/skill-optimize.md +71 -7
  23. package/dist/template/.opencode/command/start.md +81 -5
  24. package/dist/template/.opencode/command/triage.md +16 -1
  25. package/dist/template/.opencode/dcp.jsonc +11 -7
  26. package/dist/template/.opencode/memory/observations/.gitkeep +0 -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 +31 -0
  29. package/dist/template/.opencode/memory/project/gotchas.md +52 -5
  30. package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/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/1111100101010101011010004a9ef34df6b29f36a9a53a2892.lance +0 -0
  33. package/dist/template/.opencode/opencode.json +5 -3
  34. package/dist/template/.opencode/package.json +3 -1
  35. package/dist/template/.opencode/plugin/memory.ts +686 -0
  36. package/dist/template/.opencode/plugin/package.json +1 -1
  37. package/dist/template/.opencode/plugin/skill-mcp.ts +155 -36
  38. package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +43 -65
  39. package/dist/template/.opencode/skill/chrome-devtools/mcp.json +19 -0
  40. package/dist/template/.opencode/skill/executing-plans/SKILL.md +32 -2
  41. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +42 -17
  42. package/dist/template/.opencode/skill/playwright/SKILL.md +58 -133
  43. package/dist/template/.opencode/skill/playwright/mcp.json +16 -0
  44. package/dist/template/.opencode/tool/memory-embed.ts +183 -0
  45. package/dist/template/.opencode/tool/memory-index.ts +769 -0
  46. package/dist/template/.opencode/tool/memory-search.ts +358 -66
  47. package/dist/template/.opencode/tool/observation.ts +301 -12
  48. package/dist/template/.opencode/tool/repo-map.ts +451 -0
  49. package/package.json +1 -1
@@ -115,23 +115,32 @@ git status
115
115
  git diff --cached --stat
116
116
  ```
117
117
 
118
- **Present to user:**
118
+ **Use question tool to get commit decision:**
119
119
 
120
+ ```typescript
121
+ question({
122
+ questions: [
123
+ {
124
+ header: "Commit",
125
+ question: "Fix Complete: $ARGUMENTS. What should I do next?",
126
+ options: [
127
+ {
128
+ label: "Commit changes (Recommended)",
129
+ description: "Git commit and bd sync",
130
+ },
131
+ {
132
+ label: "Show diff first",
133
+ description: "Review changes before committing",
134
+ },
135
+ {
136
+ label: "Skip commit",
137
+ description: "I'll review and commit manually",
138
+ },
139
+ ],
140
+ },
141
+ ],
142
+ });
120
143
  ```
121
- Fix Complete: $ARGUMENTS
122
- ━━━━━━━━━━━━━━━━━━━━━━━
123
-
124
- Root cause: [brief]
125
- Changes: [files]
126
- Tests: Pass ✓
127
-
128
- Would you like me to:
129
- 1. Commit these changes
130
- 2. Show full diff first
131
- 3. Skip commit (I'll review manually)
132
- ```
133
-
134
- **Wait for user confirmation before committing.**
135
144
 
136
145
  If user confirms:
137
146
 
@@ -46,6 +46,23 @@ git commit -m "WIP: $ARGUMENTS - [where you stopped]"
46
46
 
47
47
  Don't leave uncommitted work. The next session needs a clean starting point.
48
48
 
49
+ ## Record Key Learnings (Before Handoff)
50
+
51
+ If you discovered important patterns or gotchas during this session:
52
+
53
+ ```typescript
54
+ observation({
55
+ type: "learning", // or "pattern", "decision", "warning"
56
+ title: "[concise, searchable title]",
57
+ content: "[what you learned - specific and actionable]",
58
+ bead_id: "$ARGUMENTS",
59
+ files: "[affected files]",
60
+ concepts: "[keywords for semantic search]",
61
+ });
62
+ ```
63
+
64
+ **This auto-embeds** into the vector store. The next `/resume` will find it.
65
+
49
66
  ## Create The Handoff
50
67
 
51
68
  ```bash
@@ -67,7 +67,25 @@ If dirty, ask whether to stash, commit, or continue.
67
67
  Create a branch if not already on one for this task:
68
68
 
69
69
  ```bash
70
- git checkout -b $ARGUMENTS 2>/dev/null || echo "Already on branch"
70
+ # Get current branch (parent branch)
71
+ PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
72
+
73
+ # Get task title for readable branch name
74
+ BEAD_INFO=$(bd show $ARGUMENTS --json 2>/dev/null)
75
+ BEAD_TITLE=$(echo "$BEAD_INFO" | jq -r '.title // ""' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
76
+ BEAD_TYPE=$(echo "$BEAD_INFO" | jq -r '.type // "task"')
77
+
78
+ # Map bead type to branch prefix
79
+ case "$BEAD_TYPE" in
80
+ "bug") PREFIX="fix" ;;
81
+ "feature"|"epic") PREFIX="feat" ;;
82
+ "refactor") PREFIX="refactor" ;;
83
+ *) PREFIX="feat" ;;
84
+ esac
85
+
86
+ # Create branch: <parent>/<type>/<bead-id>-<description>
87
+ BRANCH_NAME="${PARENT_BRANCH}/${PREFIX}/$ARGUMENTS-${BEAD_TITLE}"
88
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || echo "Already on branch"
71
89
  ```
72
90
 
73
91
  Mark the task in progress (if not already):
@@ -98,6 +116,44 @@ search_session({ query: "$ARGUMENTS" });
98
116
  read_session({ session_reference: "last" });
99
117
  ```
100
118
 
119
+ ## Load Related Memory (Semantic Search)
120
+
121
+ First, get a quick codebase overview:
122
+
123
+ ```typescript
124
+ // Quick overview of relevant directories
125
+ repo - map({ path: "src", format: "compact", maxDepth: 3 });
126
+ ```
127
+
128
+ Then search for relevant patterns and learnings:
129
+
130
+ ```typescript
131
+ // Find similar past work
132
+ memory -
133
+ search({
134
+ query: "[task description from bead]",
135
+ mode: "semantic",
136
+ limit: 3,
137
+ });
138
+
139
+ // Find related gotchas and patterns
140
+ memory -
141
+ search({
142
+ query: "[technology/domain keywords]",
143
+ mode: "semantic",
144
+ type: "observation",
145
+ limit: 3,
146
+ });
147
+ ```
148
+
149
+ **Review findings before implementation.** Past observations may contain:
150
+
151
+ - Gotchas to avoid (save debugging time)
152
+ - Patterns that worked well (reuse them)
153
+ - Decisions already made (don't re-decide)
154
+
155
+ If memory search fails (Ollama not running), continue without it.
156
+
101
157
  ## Parallel Subagent Research (if --parallel or complex task)
102
158
 
103
159
  **Delegation Pattern: Fire and Continue**
@@ -258,26 +314,33 @@ git status
258
314
  git diff --cached --stat
259
315
  ```
260
316
 
261
- **Present to user:**
262
-
263
- ```
264
- Implementation Complete: $ARGUMENTS
265
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
266
-
267
- Type: [epic/task/subtask]
268
- Tests: Pass ✓
269
- Changes: [files modified]
317
+ **Use question tool to get commit decision:**
270
318
 
271
- Subtasks: [N completed / M total] (if applicable)
272
-
273
- Would you like me to:
274
- 1. Commit these changes
275
- 2. Show full diff first
276
- 3. Skip commit (I'll review manually)
319
+ ```typescript
320
+ question({
321
+ questions: [
322
+ {
323
+ header: "Commit",
324
+ question: "Implementation Complete: $ARGUMENTS. What should I do next?",
325
+ options: [
326
+ {
327
+ label: "Commit changes (Recommended)",
328
+ description: "Git commit and bd sync",
329
+ },
330
+ {
331
+ label: "Show diff first",
332
+ description: "Review changes before committing",
333
+ },
334
+ {
335
+ label: "Skip commit",
336
+ description: "I'll review and commit manually",
337
+ },
338
+ ],
339
+ },
340
+ ],
341
+ });
277
342
  ```
278
343
 
279
- **Wait for user confirmation before committing.**
280
-
281
344
  If user confirms:
282
345
 
283
346
  ```bash
@@ -46,7 +46,7 @@ Before importing, check for existing beads with similar titles:
46
46
 
47
47
  Compare plan titles against existing beads:
48
48
 
49
- ```
49
+ ````
50
50
  Duplicate Check:
51
51
  ━━━━━━━━━━━━━━━━
52
52
 
@@ -59,8 +59,19 @@ Options:
59
59
  2. Force import (create duplicates)
60
60
  3. Cancel import
61
61
 
62
- Select option (1/2/3):
63
- ```
62
+ ```typescript
63
+ question({
64
+ questions: [{
65
+ header: "Duplicates",
66
+ question: "Potential duplicates found. What should I do?",
67
+ options: [
68
+ { label: "Skip duplicates (Recommended)", description: "Import only new items" },
69
+ { label: "Force import", description: "Create duplicate beads anyway" },
70
+ { label: "Cancel import", description: "Stop and review plan" }
71
+ ]
72
+ }]
73
+ });
74
+ ````
64
75
 
65
76
  If `--force` flag set, skip this check and import everything.
66
77
 
@@ -78,7 +89,7 @@ Parse the plan for:
78
89
 
79
90
  Report:
80
91
 
81
- ```
92
+ ````
82
93
  Plan Analysis: [filename]
83
94
  ━━━━━━━━━━━━━━━━━━━━━━━━
84
95
 
@@ -95,10 +106,21 @@ Structure:
95
106
  │ └── [Issue 1] [L] → depends on [Epic 1/Issue 2]
96
107
  └── ...
97
108
 
98
- Proceed with import? (yes/modify/cancel)
99
- ```
100
-
101
- **STOP and wait for approval** (unless `--dry-run`, then just show preview).
109
+ ```typescript
110
+ question({
111
+ questions: [{
112
+ header: "Import",
113
+ question: "Plan analyzed. Should I proceed with import?",
114
+ options: [
115
+ { label: "Proceed with import (Recommended)", description: "Create epics and issues" },
116
+ { label: "Modify plan", description: "Need changes before importing" },
117
+ { label: "Cancel", description: "Stop and review plan" }
118
+ ]
119
+ }]
120
+ });
121
+ ````
122
+
123
+ **STOP and wait for user approval** (unless `--dry-run`, then just show preview).
102
124
 
103
125
  ---
104
126
 
@@ -142,10 +142,34 @@ Key risks identified:
142
142
  - [Risk 1]: Mitigation: [...]
143
143
  - [Risk 2]: Mitigation: [...]
144
144
 
145
- Proceed with spec? (yes/modify/explore-more)
146
145
  ```
147
146
 
148
- **STOP and wait for approval** before proceeding.
147
+ **STOP. Use question tool to get user approval:**
148
+
149
+ ```typescript
150
+ question({
151
+ questions: [
152
+ {
153
+ header: "Approve",
154
+ question:
155
+ "Should I proceed with creating the specification for $ARGUMENTS?",
156
+ options: [
157
+ {
158
+ label: "Yes, proceed",
159
+ description: "Approach looks good, create spec",
160
+ },
161
+ {
162
+ label: "Modify approach",
163
+ description: "Need changes to brainstorming",
164
+ },
165
+ { label: "Explore more", description: "Need more research first" },
166
+ ],
167
+ },
168
+ ],
169
+ });
170
+ ```
171
+
172
+ **Wait for user's answer before proceeding to spec creation.**
149
173
 
150
174
  ---
151
175
 
@@ -398,8 +422,17 @@ skill({ name: "using-git-worktrees" });
398
422
  # Ensure .gitignore has worktree directory
399
423
  grep -q "^\.worktrees/$" .gitignore || echo ".worktrees/" >> .gitignore
400
424
 
401
- # Create worktree for the epic
402
- git worktree add .worktrees/[epic-id] -b feature/[feature-name]
425
+ # Get current branch (parent branch)
426
+ PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
427
+
428
+ # Create readable branch name from feature name
429
+ FEATURE_SLUG=$(echo "[feature-name]" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
430
+
431
+ # Create branch: <parent>/feat/<epic-id>-<description>
432
+ BRANCH_NAME="${PARENT_BRANCH}/feat/[epic-id]-${FEATURE_SLUG}"
433
+
434
+ # Create worktree for the epic with readable branch
435
+ git worktree add ".worktrees/[epic-id]" -b "$BRANCH_NAME"
403
436
 
404
437
  # Setup in worktree
405
438
  cd .worktrees/[epic-id]
@@ -37,6 +37,38 @@ cat .beads/artifacts/$ARGUMENTS/research.md 2>/dev/null || echo "No research fou
37
37
 
38
38
  **If complexity > M and no research:** "Consider `/research $ARGUMENTS` first for better planning."
39
39
 
40
+ ## Check Memory First (Semantic Search)
41
+
42
+ Before subagent research, check what we already know:
43
+
44
+ ```typescript
45
+ // Find similar past plans
46
+ memory -
47
+ search({
48
+ query: "[bead title/description]",
49
+ mode: "semantic",
50
+ type: "bead",
51
+ limit: 3,
52
+ });
53
+
54
+ // Find related patterns and decisions
55
+ memory -
56
+ search({
57
+ query: "[domain keywords]",
58
+ mode: "semantic",
59
+ type: "observation",
60
+ limit: 3,
61
+ });
62
+ ```
63
+
64
+ Review findings for:
65
+
66
+ - Similar plans that worked well (reuse structure)
67
+ - Patterns and decisions already made
68
+ - Gotchas to avoid in planning
69
+
70
+ If memory search fails (Ollama not running), continue to subagent research.
71
+
40
72
  ---
41
73
 
42
74
  ## Phase 1: Parallel Subagent Research
@@ -154,7 +186,25 @@ Decomposition: [Single bead | X tasks | X tasks with subtasks]
154
186
 
155
187
  Save to `.beads/artifacts/$ARGUMENTS/design.md`.
156
188
 
157
- **STOP. Wait for user to pick an option.**
189
+ **STOP. Use question tool to ask user to pick an option:**
190
+
191
+ ```typescript
192
+ question({
193
+ questions: [
194
+ {
195
+ header: "Design",
196
+ question: "Which implementation approach should I use for $ARGUMENTS?",
197
+ options: [
198
+ { label: "Option A (Recommended)", description: "[Option A summary]" },
199
+ { label: "Option B", description: "[Option B summary]" },
200
+ { label: "Option C", description: "[Option C summary]" },
201
+ ],
202
+ },
203
+ ],
204
+ });
205
+ ```
206
+
207
+ Wait for user's answer before proceeding.
158
208
 
159
209
  ---
160
210
 
@@ -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
 
@@ -17,6 +17,19 @@ You're gathering information before implementation. Find answers, document findi
17
17
 
18
18
  ## Load Context
19
19
 
20
+ ### Get Quick Codebase Overview
21
+
22
+ First, understand the codebase structure:
23
+
24
+ ```typescript
25
+ // Quick overview of relevant directories
26
+ repo-map({ path: "src", format: "compact", maxDepth: 3 });
27
+ ```
28
+
29
+ This helps identify relevant directories and files before diving deeper.
30
+
31
+ ### Load Bead Details
32
+
20
33
  !`bd show $ARGUMENTS`
21
34
  !`cat .beads/artifacts/$ARGUMENTS/spec.md`
22
35
 
@@ -29,14 +42,38 @@ Extract questions that need answering from spec.
29
42
 
30
43
  Extract the questions that need answering from the spec.
31
44
 
32
- ## Check For Previous Research
45
+ ## Check Memory First (Semantic Search)
46
+
47
+ Before hitting external sources, search what we already know:
33
48
 
34
49
  ```typescript
35
- search_session({ query: "[topic keywords]" });
36
- list_sessions({ project: "current", since: "this week", limit: 5 });
50
+ // Search past research and observations on similar topics
51
+ memory -
52
+ search({
53
+ query: "[research question/topic]",
54
+ mode: "semantic",
55
+ limit: 5,
56
+ });
57
+
58
+ // Search for related gotchas and learnings
59
+ memory -
60
+ search({
61
+ query: "[topic keywords]",
62
+ mode: "semantic",
63
+ type: "observation",
64
+ limit: 3,
65
+ });
37
66
  ```
38
67
 
39
- Don't duplicate work that's already been done.
68
+ **If memory has high-confidence answers, you may skip external research.**
69
+
70
+ Review findings for:
71
+
72
+ - Previous research on this exact topic
73
+ - Related patterns and decisions
74
+ - Known gotchas to avoid
75
+
76
+ If memory search fails (Ollama not running), continue to external sources.
40
77
 
41
78
  ## Source Priority
42
79
 
@@ -49,7 +86,26 @@ Don't duplicate work that's already been done.
49
86
 
50
87
  ## Research
51
88
 
52
- ### Internal Codebase
89
+ ### Internal Codebase - Get Quick Overview
90
+
91
+ First, generate a compact repository map to understand the codebase structure:
92
+
93
+ ```typescript
94
+ // Quick overview of relevant directories
95
+ repo-map({ path: "src", format: "compact", maxDepth: 3 });
96
+
97
+ // For specific feature area
98
+ repo-map({ path: "src/commands", format: "tree", maxDepth: 2 });
99
+ ```
100
+
101
+ **Use repo-map when:**
102
+
103
+ - Starting research on a new area of the codebase
104
+ - Need to understand file organization before diving deep
105
+ - Looking for relevant files to investigate
106
+ - Want quick symbol overview for a directory
107
+
108
+ ### Deep Dive
53
109
 
54
110
  ```typescript
55
111
  // Find similar patterns
@@ -71,6 +71,37 @@ Extract from session:
71
71
  - Where work stopped
72
72
  - Problems encountered
73
73
 
74
+ ## Load Related Memory (Semantic Search)
75
+
76
+ Search for relevant observations and past work:
77
+
78
+ ```typescript
79
+ // Find observations related to this bead
80
+ memory -
81
+ search({
82
+ query: "$ARGUMENTS [bead title/description]",
83
+ mode: "semantic",
84
+ type: "observation",
85
+ limit: 5,
86
+ });
87
+
88
+ // Find similar past work
89
+ memory -
90
+ search({
91
+ query: "[bead description keywords]",
92
+ mode: "semantic",
93
+ limit: 3,
94
+ });
95
+ ```
96
+
97
+ **Review findings** - past observations may contain:
98
+
99
+ - Gotchas discovered during previous sessions
100
+ - Decisions already made
101
+ - Patterns that worked
102
+
103
+ If memory search fails (Ollama not running), continue without it.
104
+
74
105
  ## Load Artifacts
75
106
 
76
107
  Read all available context:
@@ -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