opencodekit 0.13.2 → 0.14.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.
- package/dist/index.js +16 -4
- package/dist/template/.opencode/AGENTS.md +13 -4
- package/dist/template/.opencode/README.md +98 -2
- package/dist/template/.opencode/command/brainstorm.md +25 -2
- package/dist/template/.opencode/command/finish.md +21 -4
- package/dist/template/.opencode/command/handoff.md +17 -0
- package/dist/template/.opencode/command/implement.md +38 -0
- package/dist/template/.opencode/command/plan.md +32 -0
- package/dist/template/.opencode/command/research.md +61 -5
- package/dist/template/.opencode/command/resume.md +31 -0
- package/dist/template/.opencode/command/start.md +31 -0
- package/dist/template/.opencode/command/triage.md +16 -1
- package/dist/template/.opencode/memory/observations/.gitkeep +0 -0
- package/dist/template/.opencode/memory/project/conventions.md +31 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/0-8d00d272-cb80-463b-9774-7120a1c994e7.txn +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/_transactions/1-a3bea825-dad3-47dd-a6d6-ff41b76ff7b0.txn +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/1.manifest +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/_versions/2.manifest +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/data/001010101000000101110001f998d04b63936ff83f9a34152d.lance +0 -0
- package/dist/template/.opencode/memory/vector_db/memories.lance/data/010000101010000000010010701b3840d38c2b5f275da99978.lance +0 -0
- package/dist/template/.opencode/opencode.json +587 -523
- package/dist/template/.opencode/package.json +3 -1
- package/dist/template/.opencode/plugin/memory.ts +610 -0
- package/dist/template/.opencode/tool/memory-embed.ts +183 -0
- package/dist/template/.opencode/tool/memory-index.ts +769 -0
- package/dist/template/.opencode/tool/memory-search.ts +358 -66
- package/dist/template/.opencode/tool/observation.ts +301 -12
- package/dist/template/.opencode/tool/repo-map.ts +451 -0
- package/package.json +16 -4
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.
|
|
753
|
+
version: "0.14.0",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
type: "module",
|
|
756
756
|
repository: {
|
|
@@ -764,7 +764,10 @@ var package_default = {
|
|
|
764
764
|
bin: {
|
|
765
765
|
ock: "dist/index.js"
|
|
766
766
|
},
|
|
767
|
-
files: [
|
|
767
|
+
files: [
|
|
768
|
+
"dist",
|
|
769
|
+
"README.md"
|
|
770
|
+
],
|
|
768
771
|
scripts: {
|
|
769
772
|
dev: "bun run src/index.ts",
|
|
770
773
|
build: "bun run build.ts && mkdir -p dist/template && rsync -av --exclude=node_modules --exclude=dist --exclude=.git --exclude=coverage --exclude=.next --exclude=.turbo --exclude=logs --exclude=package-lock.json .opencode/ dist/template/.opencode/",
|
|
@@ -776,7 +779,14 @@ var package_default = {
|
|
|
776
779
|
lint: "biome check .",
|
|
777
780
|
"lint:fix": "biome check --fix ."
|
|
778
781
|
},
|
|
779
|
-
keywords: [
|
|
782
|
+
keywords: [
|
|
783
|
+
"cli",
|
|
784
|
+
"opencodekit",
|
|
785
|
+
"template",
|
|
786
|
+
"agents",
|
|
787
|
+
"mcp",
|
|
788
|
+
"opencode"
|
|
789
|
+
],
|
|
780
790
|
author: "OpenCodeKit",
|
|
781
791
|
license: "MIT",
|
|
782
792
|
engines: {
|
|
@@ -802,7 +812,9 @@ var package_default = {
|
|
|
802
812
|
"@types/node": "^22.10.1",
|
|
803
813
|
typescript: "^5.7.2"
|
|
804
814
|
},
|
|
805
|
-
trustedDependencies: [
|
|
815
|
+
trustedDependencies: [
|
|
816
|
+
"@beads/bd"
|
|
817
|
+
]
|
|
806
818
|
};
|
|
807
819
|
|
|
808
820
|
// src/commands/agent.ts
|
|
@@ -39,10 +39,19 @@ If yes → Delegate. If no → Execute directly.
|
|
|
39
39
|
|
|
40
40
|
**Rule**: Always `read` before `edit`.
|
|
41
41
|
|
|
42
|
-
1. **LSP (Best)**: `lsp_lsp_document_symbols`
|
|
43
|
-
2. **
|
|
44
|
-
3. **
|
|
45
|
-
4. **
|
|
42
|
+
1. **LSP (Best)**: `lsp_lsp_document_symbols`, `lsp_lsp_goto_definition`. **Follow [LSP NAVIGATION AVAILABLE] nudges immediately.**
|
|
43
|
+
2. **Memory**: `memory-search` (Check past learnings), `repo-map` (Understand structure).
|
|
44
|
+
3. **Structure**: `ast-grep` (Find functions/classes patterns)
|
|
45
|
+
4. **Search**: `grep` (Find text/TODOs)
|
|
46
|
+
5. **Files**: `glob` (Find files)
|
|
47
|
+
|
|
48
|
+
## Active Memory (The Brain)
|
|
49
|
+
|
|
50
|
+
**Rule**: Use memory proactively, not just when asked.
|
|
51
|
+
|
|
52
|
+
- **Start**: `memory-search` to find relevant context and code.
|
|
53
|
+
- **Learn**: `observation` to save decisions, patterns, and gotchas.
|
|
54
|
+
- **Act**: If you see an LSP Nudge, execute it. Don't wait.
|
|
46
55
|
|
|
47
56
|
## Beads (Task Tracking)
|
|
48
57
|
|
|
@@ -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
|
-
- **
|
|
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:
|
|
@@ -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
|
-
|
|
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:
|
|
@@ -166,17 +166,34 @@ Write `.beads/artifacts/$ARGUMENTS/review.md`:
|
|
|
166
166
|
|
|
167
167
|
## Record Learnings
|
|
168
168
|
|
|
169
|
-
If you discovered patterns or
|
|
169
|
+
If you discovered patterns, gotchas, or decisions worth remembering:
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
observation({
|
|
173
|
-
type: "learning",
|
|
174
|
-
title: "[concise title]",
|
|
175
|
-
content: "[what you learned]",
|
|
173
|
+
type: "learning", // or "pattern", "bugfix", "decision", "warning"
|
|
174
|
+
title: "[concise, searchable title]",
|
|
175
|
+
content: "[what you learned - be specific and actionable]",
|
|
176
176
|
bead_id: "$ARGUMENTS",
|
|
177
|
+
files: "[affected files, comma-separated]",
|
|
178
|
+
concepts: "[keywords for semantic search]",
|
|
177
179
|
});
|
|
178
180
|
```
|
|
179
181
|
|
|
182
|
+
**This auto-embeds into the vector store** for future semantic search. Future `/start` and `/implement` commands will find this learning.
|
|
183
|
+
|
|
184
|
+
**When to create observations:**
|
|
185
|
+
|
|
186
|
+
- Discovered a non-obvious gotcha
|
|
187
|
+
- Made a significant architectural decision
|
|
188
|
+
- Found a pattern worth reusing
|
|
189
|
+
- Hit a bug that others might hit
|
|
190
|
+
|
|
191
|
+
**Skip observations for:**
|
|
192
|
+
|
|
193
|
+
- Routine implementations
|
|
194
|
+
- Well-documented patterns
|
|
195
|
+
- Trivial fixes
|
|
196
|
+
|
|
180
197
|
## Output
|
|
181
198
|
|
|
182
199
|
```
|
|
@@ -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
|
|
@@ -98,6 +98,44 @@ search_session({ query: "$ARGUMENTS" });
|
|
|
98
98
|
read_session({ session_reference: "last" });
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
## Load Related Memory (Semantic Search)
|
|
102
|
+
|
|
103
|
+
First, get a quick codebase overview:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Quick overview of relevant directories
|
|
107
|
+
repo-map({ path: "src", format: "compact", maxDepth: 3 });
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then search for relevant patterns and learnings:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// Find similar past work
|
|
114
|
+
memory -
|
|
115
|
+
search({
|
|
116
|
+
query: "[task description from bead]",
|
|
117
|
+
mode: "semantic",
|
|
118
|
+
limit: 3,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Find related gotchas and patterns
|
|
122
|
+
memory -
|
|
123
|
+
search({
|
|
124
|
+
query: "[technology/domain keywords]",
|
|
125
|
+
mode: "semantic",
|
|
126
|
+
type: "observation",
|
|
127
|
+
limit: 3,
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Review findings before implementation.** Past observations may contain:
|
|
132
|
+
|
|
133
|
+
- Gotchas to avoid (save debugging time)
|
|
134
|
+
- Patterns that worked well (reuse them)
|
|
135
|
+
- Decisions already made (don't re-decide)
|
|
136
|
+
|
|
137
|
+
If memory search fails (Ollama not running), continue without it.
|
|
138
|
+
|
|
101
139
|
## Parallel Subagent Research (if --parallel or complex task)
|
|
102
140
|
|
|
103
141
|
**Delegation Pattern: Fire and Continue**
|
|
@@ -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
|
|
@@ -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
|
|
45
|
+
## Check Memory First (Semantic Search)
|
|
46
|
+
|
|
47
|
+
Before hitting external sources, search what we already know:
|
|
33
48
|
|
|
34
49
|
```typescript
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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:
|
|
@@ -172,6 +172,37 @@ list_sessions({ limit: 3 });
|
|
|
172
172
|
|
|
173
173
|
Load context from previous work on this bead.
|
|
174
174
|
|
|
175
|
+
## Load Related Memory (Semantic Search)
|
|
176
|
+
|
|
177
|
+
Search for relevant past work and learnings before starting:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// Find similar past work (semantic similarity)
|
|
181
|
+
memory -
|
|
182
|
+
search({
|
|
183
|
+
query: "[task title/description from bead]",
|
|
184
|
+
mode: "semantic",
|
|
185
|
+
limit: 3,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Find related observations (gotchas, patterns, learnings)
|
|
189
|
+
memory -
|
|
190
|
+
search({
|
|
191
|
+
query: "[task keywords]",
|
|
192
|
+
mode: "semantic",
|
|
193
|
+
type: "observation",
|
|
194
|
+
limit: 3,
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Review findings before diving in.** Past observations may contain:
|
|
199
|
+
|
|
200
|
+
- Gotchas to avoid
|
|
201
|
+
- Patterns that worked well
|
|
202
|
+
- Decisions already made
|
|
203
|
+
|
|
204
|
+
If memory search fails (Ollama not running), continue without it.
|
|
205
|
+
|
|
175
206
|
## Determine Next Step
|
|
176
207
|
|
|
177
208
|
Based on task type and what exists:
|
|
@@ -340,7 +340,22 @@ bd list --status=closed --json | wc -l # Check closed count
|
|
|
340
340
|
|
|
341
341
|
**Best Practice (from Steve Yegge):** Run `bd cleanup` every few days to prevent database bloat.
|
|
342
342
|
|
|
343
|
-
## Phase 10:
|
|
343
|
+
## Phase 10: Check Memory Health
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
memory - index({ action: "status" });
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
If documents count is low or index is stale:
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
⚠️ Vector store may be stale.
|
|
353
|
+
Run: memory-index rebuild
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Optionally trigger background reindex if many observations were created recently.
|
|
357
|
+
|
|
358
|
+
## Phase 11: Sync and Notify
|
|
344
359
|
|
|
345
360
|
```typescript
|
|
346
361
|
|
|
File without changes
|
|
@@ -85,6 +85,37 @@ Always protect these tools from auto-pruning:
|
|
|
85
85
|
]
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
### Prompt Injection Pattern (Nudges)
|
|
89
|
+
|
|
90
|
+
Use `chat.message` hook to inject prompts (nudges) based on user triggers:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
"chat.message": async (input, output) => {
|
|
94
|
+
const { message, parts } = output;
|
|
95
|
+
if (message.role !== "user") return;
|
|
96
|
+
|
|
97
|
+
// 1. Detect trigger keywords
|
|
98
|
+
const fullText = parts.map(p => p.text).join(" ");
|
|
99
|
+
if (!fullText.match(/trigger pattern/)) return;
|
|
100
|
+
|
|
101
|
+
// 2. Inject synthetic prompt
|
|
102
|
+
parts.push({
|
|
103
|
+
type: "text",
|
|
104
|
+
text: "━━━━━━━━\n[TRIGGER DETECTED]\nAction required: ...\n━━━━━━━━",
|
|
105
|
+
synthetic: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This transforms passive detection into active agent behavior (e.g., Memory plugin triggers).
|
|
111
|
+
|
|
112
|
+
## Agent Behavior Rules
|
|
113
|
+
|
|
114
|
+
### Active LSP Nudge
|
|
115
|
+
|
|
116
|
+
When a tool output displays `[LSP NAVIGATION AVAILABLE]`, it means relevant code files were found.
|
|
117
|
+
**Rule**: You MUST immediately execute the suggested `lsp_lsp_*` tool calls to retrieve code context without waiting for user instruction. This ensures you always have the latest code context for your implementation.
|
|
118
|
+
|
|
88
119
|
## Patterns to Avoid
|
|
89
120
|
|
|
90
121
|
### Anti-Pattern: Mixing LSP Systems
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|