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
package/dist/index.js CHANGED
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
750
750
  // package.json
751
751
  var package_default = {
752
752
  name: "opencodekit",
753
- version: "0.13.2",
753
+ version: "0.14.1",
754
754
  description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
755
755
  type: "module",
756
756
  repository: {
@@ -3765,6 +3765,7 @@ import {
3765
3765
  readdirSync as readdirSync3,
3766
3766
  writeFileSync as writeFileSync4
3767
3767
  } from "node:fs";
3768
+ import { homedir, platform } from "node:os";
3768
3769
  import { basename as basename2, dirname, join as join4 } from "node:path";
3769
3770
  import { fileURLToPath } from "node:url";
3770
3771
  var import_picocolors8 = __toESM(require_picocolors(), 1);
@@ -3783,6 +3784,15 @@ var EXCLUDED_FILES = [
3783
3784
  "yarn.lock",
3784
3785
  "pnpm-lock.yaml"
3785
3786
  ];
3787
+ function getGlobalConfigDir() {
3788
+ const os = platform();
3789
+ if (os === "win32") {
3790
+ const appData = process.env.APPDATA || process.env.LOCALAPPDATA || join4(homedir(), "AppData", "Roaming");
3791
+ return join4(appData, "opencode");
3792
+ }
3793
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join4(homedir(), ".config");
3794
+ return join4(xdgConfig, "opencode");
3795
+ }
3786
3796
  function detectMode(targetDir) {
3787
3797
  const opencodeDir = join4(targetDir, ".opencode");
3788
3798
  if (existsSync4(opencodeDir)) {
@@ -3842,9 +3852,46 @@ async function copyOpenCodeOnly(templateRoot, targetDir) {
3842
3852
  async function initCommand(options = {}) {
3843
3853
  if (process.argv.includes("--quiet"))
3844
3854
  return;
3855
+ oe(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" OpenCodeKit ")));
3856
+ if (options.global) {
3857
+ const globalDir = getGlobalConfigDir();
3858
+ const os = platform();
3859
+ const osName = os === "win32" ? "Windows" : os === "darwin" ? "macOS" : "Linux";
3860
+ f2.info(`Installing to global config (${osName})`);
3861
+ f2.info(`Target: ${import_picocolors8.default.cyan(globalDir)}`);
3862
+ const templateRoot2 = getTemplateRoot();
3863
+ if (!templateRoot2) {
3864
+ f2.error("Template not found. Please reinstall opencodekit.");
3865
+ $e(import_picocolors8.default.red("Failed"));
3866
+ process.exit(1);
3867
+ }
3868
+ if (existsSync4(globalDir) && !options.force) {
3869
+ f2.warn(`Global config already exists at ${globalDir}`);
3870
+ f2.info(`Use ${import_picocolors8.default.cyan("--force")} to overwrite`);
3871
+ $e("Nothing to do");
3872
+ return;
3873
+ }
3874
+ const s2 = de();
3875
+ s2.start("Copying to global config");
3876
+ const opencodeSrc = join4(templateRoot2, ".opencode");
3877
+ if (!existsSync4(opencodeSrc)) {
3878
+ s2.stop("Failed");
3879
+ f2.error("Template .opencode/ not found");
3880
+ $e(import_picocolors8.default.red("Failed"));
3881
+ process.exit(1);
3882
+ }
3883
+ await copyDir(opencodeSrc, globalDir);
3884
+ s2.stop("Done");
3885
+ le(`Global config installed at:
3886
+ ${globalDir}
3887
+
3888
+ This provides default agents, skills, and tools
3889
+ for all OpenCode projects on this machine.`, "Global Installation Complete");
3890
+ $e(import_picocolors8.default.green("Ready!"));
3891
+ return;
3892
+ }
3845
3893
  const targetDir = process.cwd();
3846
3894
  const mode = detectMode(targetDir);
3847
- oe(import_picocolors8.default.bgCyan(import_picocolors8.default.black(" OpenCodeKit ")));
3848
3895
  if (mode === "already-initialized" && !options.force) {
3849
3896
  f2.warn("Already initialized (.opencode/ exists)");
3850
3897
  f2.info(`Use ${import_picocolors8.default.cyan("--force")} to reinitialize`);
@@ -5998,7 +6045,7 @@ var cli = cac("ock");
5998
6045
  cli.option("--verbose", "Enable verbose logging");
5999
6046
  cli.option("--quiet", "Suppress all output");
6000
6047
  cli.version(`${packageVersion}`);
6001
- cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").action(initCommand);
6048
+ cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").option("--global", "Install to global OpenCode config (~/.config/opencode/)").action(initCommand);
6002
6049
  cli.command("agent [action]", "Manage agents (list, add, view)").action(async (action) => {
6003
6050
  if (!action) {
6004
6051
  console.log(`
@@ -20,6 +20,41 @@ Everything else is guidelines, not laws.
20
20
 
21
21
  If yes → Delegate. If no → Execute directly.
22
22
 
23
+ ## Question Tool
24
+
25
+ **Rule**: Use `question` tool to gather user input when interpretation matters.
26
+
27
+ ### When to Use
28
+
29
+ Use the question tool when ambiguous requests could lead to significantly different implementations—if "add auth" could mean OAuth, JWT, or session-based, ask before building the wrong thing. Use it when multiple valid approaches exist and user preference matters, like choosing between frameworks or patterns. Always ask before destructive operations like deleting branches, resetting hard, or force pushing. When user preferences affect the outcome—naming conventions, file structure, coding style—let them choose. For gathering multiple selections at once, use `multiple: true` to let users pick several options.
30
+
31
+ ### When NOT to Use
32
+
33
+ Skip the question tool for trivial decisions where any reasonable choice works. If you already have enough context from the conversation, just proceed. When you can make a sensible default, mention what you're doing and continue—don't stop for permission on every small choice. Subagents like explore, scout, and review should never ask questions; they report findings back to the leader agent who decides what to do.
34
+
35
+ ### Question Design
36
+
37
+ ```typescript
38
+ question({
39
+ questions: [
40
+ {
41
+ header: "Auth Type", // Max 12 chars
42
+ question: "Which authentication approach?",
43
+ multiple: false, // true for multi-select
44
+ options: [
45
+ { label: "JWT (Recommended)", description: "Stateless, scalable" },
46
+ { label: "Session-based", description: "Traditional, server-side" },
47
+ { label: "OAuth 2.0", description: "Third-party providers" },
48
+ ],
49
+ },
50
+ ],
51
+ });
52
+ ```
53
+
54
+ ** Design Rule**: Use `question` tool to gather user input when interpretation matters.
55
+
56
+ Put your recommended option first with "(Recommended)" in the label. Keep options to 3-5 choices—more than that overwhelms users. Write short, clear descriptions that explain the tradeoff. Users can always select "Other" to provide custom input, so you don't need to cover every edge case.
57
+
23
58
  ## Anti-Hallucination (The Truth)
24
59
 
25
60
  - **Check First**: Run `bd show <id>` before starting major work.
@@ -39,18 +74,27 @@ If yes → Delegate. If no → Execute directly.
39
74
 
40
75
  **Rule**: Always `read` before `edit`.
41
76
 
42
- 1. **LSP (Best)**: `lsp_lsp_document_symbols` (outline), `lsp_lsp_hover` (types), `lsp_lsp_goto_definition`.
43
- 2. **Structure**: `ast-grep` (Find functions/classes patterns)
44
- 3. **Search**: `grep` (Find text/TODOs)
45
- 4. **Files**: `glob` (Find files)
77
+ 1. **LSP (Best)**: `lsp_lsp_document_symbols`, `lsp_lsp_goto_definition`. **Follow [LSP NAVIGATION AVAILABLE] nudges immediately.**
78
+ 2. **Memory**: `memory-search` (Check past learnings), `repo-map` (Understand structure).
79
+ 3. **Structure**: `ast-grep` (Find functions/classes patterns)
80
+ 4. **Search**: `grep` (Find text/TODOs)
81
+ 5. **Files**: `glob` (Find files)
82
+
83
+ ## Active Memory (The Brain)
84
+
85
+ **Rule**: Use memory proactively, not just when asked.
86
+
87
+ - **Start**: `memory-search` to find relevant context and code.
88
+ - **Learn**: `observation` to save decisions, patterns, and gotchas.
89
+ - **Act**: If you see an LSP Nudge, execute it. Don't wait.
46
90
 
47
91
  ## Beads (Task Tracking)
48
92
 
49
93
  **Leader Only**: `build` and `rush` agents own the DB. Subagents read-only.
50
94
 
51
- - **Start**: `bd_init()` → `bd_claim()`
52
- - **Work**: `bd_reserve()` (Lock files!) → Edit
53
- - **Finish**: `bd_done()` → **RESTART SESSION**
95
+ - **Start**: `bd ready` → `bd update <id> --status in_progress`
96
+ - **Work**: `bd-reserve({ paths: [...] })` (Lock files!) → Edit
97
+ - **Finish**: `bd close <id> --reason "..."` → `bd sync` → **RESTART SESSION**
54
98
 
55
99
  ## Core Constraints
56
100
 
@@ -161,10 +161,106 @@ Plugins run automatically in every session:
161
161
 
162
162
  - **memory-read** - Load previous context, templates
163
163
  - **memory-update** - Save learnings, handoffs
164
- - **memory-search** - Search across all memory files
165
- - **observation** - Create structured observations
164
+ - **memory-search** - Search across all memory files (keyword, semantic, hybrid)
165
+ - **memory-index** - Rebuild vector store for semantic search
166
+ - **memory-embed** - Generate embeddings using Ollama
167
+ - **observation** - Create structured observations (auto-embedded)
166
168
  - **ast-grep** - Semantic code search/replace (AST-based)
167
169
 
170
+ ---
171
+
172
+ ## Semantic Memory Setup (Ollama)
173
+
174
+ Semantic search requires Ollama running locally. Zero API keys needed.
175
+
176
+ **Model:** `qwen3-embedding:0.6b` (639MB)
177
+
178
+ - State-of-the-art quality (MTEB #1 for 8B version)
179
+ - Code-aware (optimized for code retrieval)
180
+ - Multilingual (100+ languages including Vietnamese)
181
+ - 32K context, 1024 dimensions
182
+
183
+ ### Installation
184
+
185
+ **macOS:**
186
+
187
+ ```bash
188
+ brew install ollama
189
+ ```
190
+
191
+ **Linux:**
192
+
193
+ ```bash
194
+ curl -fsSL https://ollama.com/install.sh | sh
195
+ ```
196
+
197
+ **Windows:**
198
+
199
+ 1. Download from https://ollama.com/download/windows
200
+ 2. Run the installer
201
+ 3. Ollama runs as a background service automatically
202
+
203
+ ### Setup
204
+
205
+ ```bash
206
+ # Start Ollama (macOS/Linux - if not running as service)
207
+ ollama serve
208
+
209
+ # Pull embedding model (one-time, ~639MB)
210
+ ollama pull qwen3-embedding:0.6b
211
+
212
+ # Verify
213
+ ollama list # Should show qwen3-embedding:0.6b
214
+ ```
215
+
216
+ **Linux:**
217
+
218
+ ```bash
219
+ curl -fsSL https://ollama.com/install.sh | sh
220
+ ```
221
+
222
+ **Windows:**
223
+
224
+ 1. Download from https://ollama.com/download/windows
225
+ 2. Run the installer
226
+ 3. Ollama runs as a background service automatically
227
+
228
+ ### Setup
229
+
230
+ ```bash
231
+ # Start Ollama (macOS/Linux - if not running as service)
232
+ ollama serve
233
+
234
+ # Pull embedding model (one-time, ~274MB)
235
+ ollama pull nomic-embed-text
236
+
237
+ # Verify
238
+ ollama list # Should show nomic-embed-text
239
+ ```
240
+
241
+ ### Custom Host (Optional)
242
+
243
+ If Ollama runs on a different machine:
244
+
245
+ ```bash
246
+ export OLLAMA_HOST=http://192.168.1.100:11434
247
+ ```
248
+
249
+ ### Usage
250
+
251
+ ```bash
252
+ # Rebuild vector index (after adding new observations)
253
+ memory-index action=rebuild
254
+
255
+ # Search with semantic similarity
256
+ memory-search query="authentication patterns" mode=semantic
257
+
258
+ # Hybrid search (keyword + semantic)
259
+ memory-search query="auth" mode=hybrid
260
+ ```
261
+
262
+ ---
263
+
168
264
  ### AST-Grep Usage
169
265
 
170
266
  Semantic code operations - smarter than regex:
@@ -62,7 +62,50 @@ Before ANY action on a new request, do two things.
62
62
 
63
63
  **First, check skills.** If the request matches a skill trigger phrase, invoke that skill immediately. Skills are specialized workflows that handle specific tasks better than manual orchestration. Don't proceed until you've checked.
64
64
 
65
- **Second, classify the request.** Trivial requests (single file, known location) get direct tool use. Explicit requests (specific file and line, clear command) get immediate execution. Exploratory requests ("how does X work?") get delegated to @explore. Open-ended requests ("improve this", "add a feature") require codebase assessment first. Ambiguous requests where interpretations differ by 2x or more in effort require clarification—ask ONE question.
65
+ **Second, classify the request.** Trivial requests (single file, known location) get direct tool use. Explicit requests (specific file and line, clear command) get immediate execution. Exploratory requests ("how does X work?") get delegated to @explore. Open-ended requests ("improve this", "add a feature") require codebase assessment first. Ambiguous requests where interpretations differ by 2x or more in effort require clarification—use the `question` tool to ask ONE focused question.
66
+
67
+ ## Using the Question Tool
68
+
69
+ Use `question` when user intent is unclear and wrong interpretation wastes significant effort.
70
+
71
+ **Good triggers:**
72
+
73
+ - "Add auth" → Ask: OAuth vs JWT vs session-based?
74
+ - "Refactor this" → Ask: Performance? Readability? Testability?
75
+ - "Build a dashboard" → Ask: Which metrics? What layout?
76
+
77
+ **Bad triggers (just proceed):**
78
+
79
+ - "Fix this typo" → Just fix it
80
+ - "Run tests" → Just run them
81
+ - User already specified details → Don't re-ask
82
+
83
+ **Question design:**
84
+
85
+ ```typescript
86
+ question({
87
+ questions: [
88
+ {
89
+ header: "Approach", // Max 12 chars
90
+ question: "Which authentication method should I implement?",
91
+ multiple: false,
92
+ options: [
93
+ { label: "JWT (Recommended)", description: "Stateless, good for APIs" },
94
+ {
95
+ label: "Session cookies",
96
+ description: "Traditional, server-side state",
97
+ },
98
+ {
99
+ label: "OAuth 2.0",
100
+ description: "Third-party login (Google, GitHub)",
101
+ },
102
+ ],
103
+ },
104
+ ],
105
+ });
106
+ ```
107
+
108
+ Put recommended option first. Keep to 3-5 options. Users can always pick "Other" for custom input.
66
109
 
67
110
  ## Codebase Assessment
68
111
 
@@ -9,6 +9,7 @@ tools:
9
9
  bash: false
10
10
  todowrite: false
11
11
  memory-update: false
12
+ question: false
12
13
  ---
13
14
 
14
15
  # Explore Agent
@@ -84,7 +84,46 @@ Tool results and user messages may include `<system-reminder>` tags. These conta
84
84
 
85
85
  1. Collect all agent responses
86
86
  2. Note critical files that should be read before implementation
87
- 3. Ask user questions about tradeoffs and preferences
87
+ 3. Use the `question` tool to gather user decisions on tradeoffs:
88
+
89
+ ```typescript
90
+ question({
91
+ questions: [
92
+ {
93
+ header: "Architecture",
94
+ question: "Which approach should we use for the data layer?",
95
+ multiple: false,
96
+ options: [
97
+ {
98
+ label: "Repository pattern (Recommended)",
99
+ description: "Clean separation, testable",
100
+ },
101
+ {
102
+ label: "Direct DB access",
103
+ description: "Simpler, fewer abstractions",
104
+ },
105
+ {
106
+ label: "ORM with models",
107
+ description: "Type-safe, migrations included",
108
+ },
109
+ ],
110
+ },
111
+ ],
112
+ });
113
+ ```
114
+
115
+ **When to use question tool in planning:**
116
+
117
+ - Multiple valid architectures exist
118
+ - Trade-offs affect future work significantly
119
+ - User hasn't specified preferences
120
+ - Need to gather multiple feature selections (use `multiple: true`)
121
+
122
+ **Don't ask when:**
123
+
124
+ - User already specified approach
125
+ - One option is clearly superior
126
+ - Question can be deferred to implementation phase
88
127
 
89
128
  ### Phase 4: Final Plan
90
129
 
@@ -6,6 +6,7 @@ maxSteps: 50
6
6
  tools:
7
7
  edit: false
8
8
  write: false
9
+ question: false
9
10
  permission:
10
11
  bash:
11
12
  "*": allow
@@ -46,8 +46,43 @@ Before acting, answer three questions in your head:
46
46
 
47
47
  **Is this mine to do?** Rush handles well-defined, localized (1-3 files), greenfield tasks. If any of these fail—ambiguous scope, system-wide changes, or legacy code with hidden invariants—delegate immediately. Don't power through complexity; avoid it.
48
48
 
49
+ **Do I need to clarify?** If the request is ambiguous and wrong interpretation wastes significant effort, use the `question` tool to ask ONE focused question. But keep it rare—Rush moves fast. If you're unsure, delegate to @build who handles complexity better.
50
+
49
51
  **Do I need to read first?** If you're about to edit a file you haven't seen, stop. Read it. Never speculate about uninspected code.
50
52
 
53
+ ## Using the Question Tool (Sparingly)
54
+
55
+ Rush uses questions rarely—only when wrong interpretation would waste significant effort AND the task is still small enough for Rush.
56
+
57
+ **Good triggers (still ask fast):**
58
+
59
+ - "Delete this" → Ask: Which files/branches specifically?
60
+ - "Rename X" → Ask: New name preference?
61
+ - Binary choice that user must decide
62
+
63
+ **Bad triggers (delegate instead):**
64
+
65
+ - "Add auth" → Too complex for Rush, delegate to @build
66
+ - Multiple design decisions → Delegate to @planner
67
+ - Research needed → Delegate to @scout
68
+
69
+ **If you need to ask more than ONE question, the task is too complex for Rush. Delegate.**
70
+
71
+ ```typescript
72
+ question({
73
+ questions: [
74
+ {
75
+ header: "Confirm",
76
+ question: "Delete feature/old-auth branch?",
77
+ options: [
78
+ { label: "Yes, delete it", description: "Removes remote and local" },
79
+ { label: "No, keep it", description: "Abort operation" },
80
+ ],
81
+ },
82
+ ],
83
+ });
84
+ ```
85
+
51
86
  ## Bail Triggers
52
87
 
53
88
  Delegate immediately when you hit any of these:
@@ -8,6 +8,7 @@ tools:
8
8
  write: false
9
9
  bash: false
10
10
  memory-update: false
11
+ question: false
11
12
  ---
12
13
 
13
14
  # Scout Agent
@@ -33,12 +33,35 @@ If `$ARGUMENTS` is a bead ID:
33
33
 
34
34
  Load constraints from `.beads/artifacts/<bead-id>/spec.md` if it exists.
35
35
 
36
- **Check for prior thinking:**
36
+ **Check for prior thinking (Semantic Search):**
37
37
 
38
38
  ```typescript
39
- memory - search({ query: "[topic keywords]" });
39
+ // Search for related ideas and past brainstorms
40
+ memory -
41
+ search({
42
+ query: "[topic keywords]",
43
+ mode: "semantic",
44
+ limit: 5,
45
+ });
46
+
47
+ // Find related observations
48
+ memory -
49
+ search({
50
+ query: "[topic]",
51
+ mode: "semantic",
52
+ type: "observation",
53
+ limit: 3,
54
+ });
40
55
  ```
41
56
 
57
+ Review findings for:
58
+
59
+ - Previous brainstorms on similar topics
60
+ - Related decisions and patterns
61
+ - Ideas that were considered before
62
+
63
+ If memory search fails (Ollama not running), continue without it.
64
+
42
65
  ## Phase 2: Set Boundaries
43
66
 
44
67
  Before brainstorming, establish:
@@ -252,7 +275,56 @@ bd create "[Idea name]" -t task -p 2
252
275
 
253
276
  ## Output
254
277
 
278
+ ```markdown
279
+ Brainstorm Complete: $ARGUMENTS
280
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
281
+
282
+ Duration: [N] minutes
283
+ Ideas generated: [N]
284
+ Ideas evaluated: [N]
285
+
286
+ Top 3:
287
+
288
+ 1. [Idea 1] - Score: [N]
289
+ 2. [Idea 2] - Score: [N]
290
+ 3. [Idea 3] - Score: [N]
291
+
292
+ Recommendation: [Chosen approach]
293
+ Confidence: [High/Medium/Low]
294
+
295
+ Artifacts:
296
+
297
+ - .beads/artifacts/<bead-id>/brainstorm.md (if bead)
298
+ - Observation created ✓
299
+
300
+ Follow-up beads: [N] created
301
+ ```
302
+
303
+ **Use question tool for next steps:**
304
+
305
+ ```typescript
306
+ question({
307
+ questions: [
308
+ {
309
+ header: "Next Step",
310
+ question: "What should we do next with $ARGUMENTS?",
311
+ options: [
312
+ {
313
+ label: "Research approach (Recommended)",
314
+ description: "Validate with /research",
315
+ },
316
+ { label: "Create implementation plan", description: "Plan with /plan" },
317
+ {
318
+ label: "Explore more",
319
+ description: "Continue brainstorming other aspects",
320
+ },
321
+ { label: "Done for now", description: "Save findings, revisit later" },
322
+ ],
323
+ },
324
+ ],
325
+ });
255
326
  ```
327
+
256
328
  Brainstorm Complete: $ARGUMENTS
257
329
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
258
330
 
@@ -261,6 +333,7 @@ Ideas generated: [N]
261
333
  Ideas evaluated: [N]
262
334
 
263
335
  Top 3:
336
+
264
337
  1. [Idea 1] - Score: [N]
265
338
  2. [Idea 2] - Score: [N]
266
339
  3. [Idea 3] - Score: [N]
@@ -269,21 +342,25 @@ Recommendation: [Chosen approach]
269
342
  Confidence: [High/Medium/Low]
270
343
 
271
344
  Artifacts:
345
+
272
346
  - .beads/artifacts/<bead-id>/brainstorm.md (if bead)
273
347
  - Observation created ✓
274
348
 
275
349
  Follow-up beads: [N] created
350
+
276
351
  ```
277
352
 
278
353
  **Next steps:**
279
354
 
280
355
  ```
356
+
281
357
  If ready to proceed:
282
- /research <bead-id> # Validate approach
283
- /plan <bead-id> # Create implementation plan
358
+ /research <bead-id> # Validate approach
359
+ /plan <bead-id> # Create implementation plan
284
360
 
285
361
  If need more exploration:
286
- /brainstorm <new-aspect> # Continue ideation
362
+ /brainstorm <new-aspect> # Continue ideation
363
+
287
364
  ```
288
365
 
289
366
  ## Anti-Patterns
@@ -293,3 +370,4 @@ If need more exploration:
293
370
  - ❌ **Infinite brainstorming** - Time box and decide
294
371
  - ❌ **No decision** - Brainstorming must produce a recommendation
295
372
  - ❌ **No capture** - Undocumented ideas are lost ideas
373
+ ```
@@ -116,17 +116,27 @@ git commit -m "$ARGUMENTS: [what was done]
116
116
  Closes: $ARGUMENTS"
117
117
  ```
118
118
 
119
- ## Close The Task (Ask First)
119
+ ## Close The Task (Use Question Tool)
120
120
 
121
- **Ask the user:**
122
-
123
- ```
124
- Close bead $ARGUMENTS?
125
- - Yes, close it
126
- - No, keep it open for now
121
+ ```typescript
122
+ question({
123
+ questions: [
124
+ {
125
+ header: "Close",
126
+ question: "Should I close bead $ARGUMENTS?",
127
+ options: [
128
+ {
129
+ label: "Yes, close it (Recommended)",
130
+ description: "All gates passed, task complete",
131
+ },
132
+ { label: "No, keep open", description: "Need more work or review" },
133
+ ],
134
+ },
135
+ ],
136
+ });
127
137
  ```
128
138
 
129
- If user confirms:
139
+ If user confirms close:
130
140
 
131
141
  ```bash
132
142
  bd close $ARGUMENTS --reason "Completed: [1-line summary]"
@@ -166,17 +176,34 @@ Write `.beads/artifacts/$ARGUMENTS/review.md`:
166
176
 
167
177
  ## Record Learnings
168
178
 
169
- If you discovered patterns or gotchas worth remembering:
179
+ If you discovered patterns, gotchas, or decisions worth remembering:
170
180
 
171
181
  ```typescript
172
182
  observation({
173
- type: "learning",
174
- title: "[concise title]",
175
- content: "[what you learned]",
183
+ type: "learning", // or "pattern", "bugfix", "decision", "warning"
184
+ title: "[concise, searchable title]",
185
+ content: "[what you learned - be specific and actionable]",
176
186
  bead_id: "$ARGUMENTS",
187
+ files: "[affected files, comma-separated]",
188
+ concepts: "[keywords for semantic search]",
177
189
  });
178
190
  ```
179
191
 
192
+ **This auto-embeds into the vector store** for future semantic search. Future `/start` and `/implement` commands will find this learning.
193
+
194
+ **When to create observations:**
195
+
196
+ - Discovered a non-obvious gotcha
197
+ - Made a significant architectural decision
198
+ - Found a pattern worth reusing
199
+ - Hit a bug that others might hit
200
+
201
+ **Skip observations for:**
202
+
203
+ - Routine implementations
204
+ - Well-documented patterns
205
+ - Trivial fixes
206
+
180
207
  ## Output
181
208
 
182
209
  ```