opencodekit 0.8.0 → 0.9.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.
- package/README.md +35 -43
- package/dist/index.js +16 -4
- package/dist/template/.opencode/AGENTS.md +5 -6
- package/dist/template/.opencode/README.md +24 -25
- package/dist/template/.opencode/agent/build.md +20 -6
- package/dist/template/.opencode/agent/explore.md +18 -18
- package/dist/template/.opencode/agent/planner.md +4 -7
- package/dist/template/.opencode/agent/review.md +1 -2
- package/dist/template/.opencode/agent/rush.md +13 -6
- package/dist/template/.opencode/agent/scout.md +45 -38
- package/dist/template/.opencode/agent/vision.md +16 -24
- package/dist/template/.opencode/command/handoff.md +8 -12
- package/dist/template/.opencode/command/research.md +10 -10
- package/dist/template/.opencode/command/status.md +4 -6
- package/dist/template/.opencode/opencode.json +1 -23
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/compaction.ts +87 -4
- package/dist/template/.opencode/plugin/skill-mcp.ts +458 -0
- package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +88 -0
- package/dist/template/.opencode/skill/figma/SKILL.md +214 -0
- package/dist/template/.opencode/skill/playwright/SKILL.md +187 -0
- package/dist/template/.opencode/skill/polar/SKILL.md +92 -0
- package/package.json +63 -51
package/README.md
CHANGED
|
@@ -24,22 +24,13 @@ A pre-configured OpenCode distribution featuring:
|
|
|
24
24
|
### Option 1: Using CLI (Recommended)
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
# 1.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ock init
|
|
35
|
-
cd my-opencode-project
|
|
36
|
-
|
|
37
|
-
# 3. Configure OpenCodeKit
|
|
38
|
-
ock setup
|
|
39
|
-
|
|
40
|
-
# 4. Explore
|
|
41
|
-
ock agent list
|
|
42
|
-
ock skill list
|
|
27
|
+
# 1. Create new project with npx
|
|
28
|
+
npx opencodekit init my-project
|
|
29
|
+
cd my-project
|
|
30
|
+
|
|
31
|
+
# 2. Or install globally
|
|
32
|
+
npm install -g opencodekit
|
|
33
|
+
ock init my-project
|
|
43
34
|
```
|
|
44
35
|
|
|
45
36
|
**See [CLI.md](./CLI.md) for complete CLI documentation**
|
|
@@ -73,13 +64,12 @@ create test.txt with "Hello OpenCodeKit"
|
|
|
73
64
|
|
|
74
65
|
```
|
|
75
66
|
build (Primary Orchestrator - 70% of work)
|
|
76
|
-
├→ @
|
|
77
|
-
├→ @
|
|
78
|
-
├→ @
|
|
79
|
-
├→ @
|
|
80
|
-
├→ @
|
|
81
|
-
├→ @
|
|
82
|
-
├→ @orchestrator (Multi-agent coordination)
|
|
67
|
+
├→ @rush (Fast agent for simple tasks)
|
|
68
|
+
├→ @planner (Complex planning ≥3 phases)
|
|
69
|
+
├→ @review (Code review + security + debugging)
|
|
70
|
+
├→ @scout (External research, library docs, GitHub patterns)
|
|
71
|
+
├→ @explore (Fast codebase search)
|
|
72
|
+
├→ @vision (UI/UX, mockups, visual analysis)
|
|
83
73
|
└→ @general (Fallback)
|
|
84
74
|
|
|
85
75
|
Background Plugins:
|
|
@@ -88,10 +78,10 @@ Background Plugins:
|
|
|
88
78
|
• truncator (Dynamic output truncation)
|
|
89
79
|
|
|
90
80
|
Supporting:
|
|
91
|
-
•
|
|
92
|
-
•
|
|
93
|
-
•
|
|
94
|
-
• Custom Tools (memory-*, observation, ast-grep)
|
|
81
|
+
• 30+ Skills (domain expertise loaded on-demand)
|
|
82
|
+
• 26+ Commands (workflow shortcuts)
|
|
83
|
+
• 3 MCP Services (context7, exa, gh_grep) + skill-embedded MCPs
|
|
84
|
+
• Custom Tools (memory-*, observation, ast-grep, lsp-*)
|
|
95
85
|
• Beads task tracking (`bd` CLI for multi-session workflows)
|
|
96
86
|
• Manual Handoffs (clean phase transitions)
|
|
97
87
|
```
|
|
@@ -181,20 +171,21 @@ session({
|
|
|
181
171
|
Is it a simple task?
|
|
182
172
|
✓ → Use build directly (70% of work)
|
|
183
173
|
|
|
174
|
+
Need speed over depth?
|
|
175
|
+
✓ → @rush (fast agent, same capabilities)
|
|
176
|
+
|
|
184
177
|
Complex task (≥3 phases)?
|
|
185
|
-
✓ → @
|
|
178
|
+
✓ → @planner (creates implementation plan)
|
|
186
179
|
|
|
187
180
|
Need research?
|
|
188
|
-
✓ → @
|
|
189
|
-
✓ → @
|
|
190
|
-
✓ → @docs (quick API reference)
|
|
191
|
-
✓ → @finder (codebase search)
|
|
181
|
+
✓ → @scout (library docs + GitHub patterns)
|
|
182
|
+
✓ → @explore (codebase search)
|
|
192
183
|
|
|
193
184
|
Quality gate before deployment?
|
|
194
|
-
✓ → @
|
|
185
|
+
✓ → @review (security + code review + debugging)
|
|
195
186
|
|
|
196
|
-
|
|
197
|
-
✓ → @
|
|
187
|
+
UI/UX work?
|
|
188
|
+
✓ → @vision (mockups, visual analysis, accessibility)
|
|
198
189
|
|
|
199
190
|
Everything else?
|
|
200
191
|
✓ → @general (fallback)
|
|
@@ -226,15 +217,15 @@ Everything else?
|
|
|
226
217
|
|
|
227
218
|
You've successfully set up OpenCodeKit when:
|
|
228
219
|
|
|
229
|
-
- ✅
|
|
220
|
+
- ✅ Agent files in place (.opencode/agent/\*.md)
|
|
230
221
|
- ✅ Build handles 70%+ directly
|
|
231
|
-
- ✅ Commands work (
|
|
232
|
-
- ✅ Skills load
|
|
222
|
+
- ✅ Commands work (/commit, /pr, /design, /fix, /implement)
|
|
223
|
+
- ✅ Skills load on-demand (30+ skills)
|
|
233
224
|
- ✅ Delegation is clear (build → specialized subagents)
|
|
234
225
|
- ✅ `/handoff` creates portable bundles (.opencode/memory/handoffs/)
|
|
235
|
-
- ✅ MCP services configured (
|
|
226
|
+
- ✅ MCP services configured (context7, gh_grep + skill-embedded)
|
|
236
227
|
- ✅ Background plugins active (enforcer, compactor, truncator)
|
|
237
|
-
- ✅ Custom tools available (memory
|
|
228
|
+
- ✅ Custom tools available (memory-_, observation, ast-grep, lsp-_)
|
|
238
229
|
- ✅ Environment variables set (.opencode/.env with API keys)
|
|
239
230
|
|
|
240
231
|
---
|
|
@@ -260,9 +251,10 @@ You've successfully set up OpenCodeKit when:
|
|
|
260
251
|
|
|
261
252
|
---
|
|
262
253
|
|
|
263
|
-
**OpenCodeKit v0.
|
|
254
|
+
**OpenCodeKit v0.9.1**
|
|
264
255
|
**Architecture**: Two-layer (Memory + Beads + Git)
|
|
265
|
-
**
|
|
256
|
+
**Package**: `npx opencodekit` to scaffold new projects
|
|
257
|
+
**New in v0.9.1**: Memory & Compaction plugin merge, session.start auto-load hook
|
|
266
258
|
**Ready for**: Daily production use
|
|
267
259
|
|
|
268
|
-
Enjoy your streamlined agent system with clean phase transitions!
|
|
260
|
+
Enjoy your streamlined agent system with clean phase transitions!
|
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.9.1",
|
|
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 build src/index.ts --outdir dist --target node && 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: {
|
|
@@ -799,7 +809,9 @@ var package_default = {
|
|
|
799
809
|
"@types/node": "^22.10.1",
|
|
800
810
|
typescript: "^5.7.2"
|
|
801
811
|
},
|
|
802
|
-
trustedDependencies: [
|
|
812
|
+
trustedDependencies: [
|
|
813
|
+
"@beads/bd"
|
|
814
|
+
]
|
|
803
815
|
};
|
|
804
816
|
|
|
805
817
|
// src/commands/agent.ts
|
|
@@ -79,13 +79,12 @@ Specify depth when delegating to control tool call budget:
|
|
|
79
79
|
|
|
80
80
|
## Tool Priority
|
|
81
81
|
|
|
82
|
-
**
|
|
82
|
+
**LSP tools → AST tools → Built-in tools**
|
|
83
83
|
|
|
84
|
-
1. `
|
|
85
|
-
2. `
|
|
86
|
-
3. `
|
|
87
|
-
4. `
|
|
88
|
-
5. `read`, `edit`, `write` - File operations
|
|
84
|
+
1. `lsp_rename`, `lsp_code_actions`, `lsp_organize_imports` - Semantic refactoring (LSP-based)
|
|
85
|
+
2. `ast-grep` - Semantic code search/replace (AST-based)
|
|
86
|
+
3. `grep`, `glob` - Pattern matching, file discovery
|
|
87
|
+
4. `read`, `edit`, `write` - File operations
|
|
89
88
|
|
|
90
89
|
**Rule**: Always `read` before `edit` to verify content.
|
|
91
90
|
|
|
@@ -144,11 +144,9 @@ Memory (Permanent) → Beads (Multi-session) → Git (Audit Trail)
|
|
|
144
144
|
|
|
145
145
|
Plugins run automatically in every session:
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
| **compactor** | Warns at 70%, 85%, 95% context usage - prevents rushed work |
|
|
151
|
-
| **truncator** | Dynamic output truncation based on context remaining |
|
|
147
|
+
- **enforcer** - OS notification when session idles with incomplete TODOs
|
|
148
|
+
- **compactor** - Warns at 70%, 85%, 95% context usage - prevents rushed work
|
|
149
|
+
- **truncator** - Dynamic output truncation based on context remaining
|
|
152
150
|
|
|
153
151
|
**Compactor thresholds**:
|
|
154
152
|
|
|
@@ -160,13 +158,11 @@ Plugins run automatically in every session:
|
|
|
160
158
|
|
|
161
159
|
## Custom Tools
|
|
162
160
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
| **observation** | Create structured observations |
|
|
169
|
-
| **ast-grep** | Semantic code search/replace (AST-based) |
|
|
161
|
+
- **memory-read** - Load previous context, templates
|
|
162
|
+
- **memory-update** - Save learnings, handoffs
|
|
163
|
+
- **memory-search** - Search across all memory files
|
|
164
|
+
- **observation** - Create structured observations
|
|
165
|
+
- **ast-grep** - Semantic code search/replace (AST-based)
|
|
170
166
|
|
|
171
167
|
### AST-Grep Usage
|
|
172
168
|
|
|
@@ -190,7 +186,7 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
190
186
|
|
|
191
187
|
## MCP Services
|
|
192
188
|
|
|
193
|
-
**Enabled by default (
|
|
189
|
+
**Enabled by default (3 total):**
|
|
194
190
|
|
|
195
191
|
1. **context7** - Up-to-date library documentation (37.6k+ libraries)
|
|
196
192
|
- Requires: CONTEXT7_API_KEY
|
|
@@ -204,17 +200,19 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
204
200
|
- No API key needed (public service)
|
|
205
201
|
- GitHub: https://github.com/Shachlan/grep.app-mcp
|
|
206
202
|
|
|
207
|
-
|
|
208
|
-
- No API key needed (runs locally on port 27495)
|
|
209
|
-
- Docs: https://gitlab-org.gitlab.io/rust/knowledge-graph/
|
|
210
|
-
- Install: Follow https://gitlab-org.gitlab.io/rust/knowledge-graph/getting-started/install/
|
|
203
|
+
**Skill-Embedded MCP (load on-demand):**
|
|
211
204
|
|
|
212
|
-
**
|
|
213
|
-
|
|
214
|
-
5. **Framelink MCP for Figma** - Extract Figma layouts and design tokens
|
|
205
|
+
4. **figma** - Extract Figma layouts and design tokens
|
|
215
206
|
- Requires: FIGMA_API_KEY
|
|
216
|
-
-
|
|
217
|
-
|
|
207
|
+
- Use: `skill({ name: "figma" })` then `skill_mcp()`
|
|
208
|
+
|
|
209
|
+
5. **playwright** - Browser automation for testing
|
|
210
|
+
- No API key needed
|
|
211
|
+
- Use: `skill({ name: "playwright" })` then `skill_mcp()`
|
|
212
|
+
|
|
213
|
+
6. **chrome-devtools** - DevTools for debugging and performance
|
|
214
|
+
- No API key needed
|
|
215
|
+
- Use: `skill({ name: "chrome-devtools" })` then `skill_mcp()`
|
|
218
216
|
|
|
219
217
|
---
|
|
220
218
|
|
|
@@ -331,7 +329,8 @@ fi
|
|
|
331
329
|
|
|
332
330
|
---
|
|
333
331
|
|
|
334
|
-
**OpenCodeKit v0.
|
|
332
|
+
**OpenCodeKit v0.9.1**
|
|
335
333
|
**Architecture:** Two-Layer (Memory + Beads + Git)
|
|
336
|
-
**New in v0.
|
|
337
|
-
**
|
|
334
|
+
**New in v0.9.1:** Memory & Compaction plugin merge, session.start auto-load hook
|
|
335
|
+
**Package:** `npx opencodekit` to scaffold new projects
|
|
336
|
+
**Last Updated:** January 2, 2026
|
|
@@ -14,7 +14,6 @@ tools:
|
|
|
14
14
|
webfetch: true
|
|
15
15
|
websearch: true
|
|
16
16
|
codesearch: true
|
|
17
|
-
gkg*: true
|
|
18
17
|
ast-grep*: true
|
|
19
18
|
lsp*: true
|
|
20
19
|
context7*: true
|
|
@@ -47,11 +46,10 @@ Primary orchestrator. Execute-first. Autonomous task completion until resolved.
|
|
|
47
46
|
|
|
48
47
|
## Tool Priority
|
|
49
48
|
|
|
50
|
-
1. **
|
|
51
|
-
2. **
|
|
52
|
-
3. **
|
|
53
|
-
4. **
|
|
54
|
-
5. **Bash** for running tests, builds, commands
|
|
49
|
+
1. **LSP tools** for semantic refactoring (rename, code actions, organize imports)
|
|
50
|
+
2. **AST-Grep** for semantic code search/replace
|
|
51
|
+
3. **Built-in tools** for pattern matching (grep, glob, read)
|
|
52
|
+
4. **Bash** for running tests, builds, commands
|
|
55
53
|
|
|
56
54
|
### LSP Tools
|
|
57
55
|
|
|
@@ -59,6 +57,22 @@ Use LSP tools for safe, semantic refactoring. Use `lsp_rename` to rename functio
|
|
|
59
57
|
|
|
60
58
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
61
59
|
|
|
60
|
+
### AST-Grep
|
|
61
|
+
|
|
62
|
+
Semantic code search/replace - smarter than regex:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
# Search patterns
|
|
66
|
+
ast-grep pattern="console.log($$$)" # Find all console.log
|
|
67
|
+
ast-grep pattern="async function $NAME($$$) { $$$ }" # Find async functions
|
|
68
|
+
ast-grep pattern="const [$S, $SET] = useState($$$)" # Find React hooks
|
|
69
|
+
|
|
70
|
+
# Replace (dry run first)
|
|
71
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
75
|
+
|
|
62
76
|
## Anti-Hallucination
|
|
63
77
|
|
|
64
78
|
**Before work:** Check bead spec if doing feature work (`bd show <id>`)
|
|
@@ -13,7 +13,7 @@ tools:
|
|
|
13
13
|
list: true
|
|
14
14
|
todoread: false
|
|
15
15
|
todowrite: false
|
|
16
|
-
|
|
16
|
+
ast-grep*: true
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Explore Agent
|
|
@@ -25,7 +25,7 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
25
25
|
- Finding files using glob patterns
|
|
26
26
|
- Searching code with regex patterns
|
|
27
27
|
- Reading and analyzing file contents
|
|
28
|
-
- Semantic code search with
|
|
28
|
+
- Semantic code search with AST-Grep
|
|
29
29
|
|
|
30
30
|
## Guidelines
|
|
31
31
|
|
|
@@ -37,30 +37,30 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
37
37
|
|
|
38
38
|
## Tool Priority
|
|
39
39
|
|
|
40
|
-
**Use
|
|
40
|
+
**Use AST-Grep for semantic search, then fall back to built-in tools.**
|
|
41
41
|
|
|
42
|
-
###
|
|
42
|
+
### AST-Grep (Semantic Search)
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
`ast-grep` finds functions, classes, and patterns semantically.
|
|
45
|
+
|
|
46
|
+
**Pattern syntax:** `$NAME` = single node, `$$$` = zero or more nodes
|
|
47
|
+
|
|
48
|
+
**Examples:**
|
|
49
|
+
|
|
50
|
+
- `ast-grep pattern="function $NAME($$$) { $$$ }"` - Find all functions
|
|
51
|
+
- `ast-grep pattern="console.log($$$)"` - Find all console.log calls
|
|
52
|
+
- `ast-grep pattern="const [$S, $SET] = useState($$$)"` - Find React hooks
|
|
51
53
|
|
|
52
54
|
### Built-in Tools (Pattern Matching)
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
| `grep` | Search file contents with regex |
|
|
58
|
-
| `read` | Read specific file contents |
|
|
56
|
+
- `glob` - Find files by pattern (`**/*.ts`)
|
|
57
|
+
- `grep` - Search file contents with regex
|
|
58
|
+
- `read` - Read specific file contents
|
|
59
59
|
|
|
60
60
|
## Thoroughness Levels
|
|
61
61
|
|
|
62
|
-
**Quick**: Single
|
|
62
|
+
**Quick**: Single ast-grep or glob. Read 1-3 files. Return immediately.
|
|
63
63
|
|
|
64
|
-
**Medium**:
|
|
64
|
+
**Medium**: AST-grep + grep verification. Check 2-3 naming conventions. Read 3-5 files.
|
|
65
65
|
|
|
66
66
|
**Very Thorough**: Comprehensive search across multiple terms and locations. Build dependency map. Report with file:line references.
|
|
@@ -16,7 +16,6 @@ tools:
|
|
|
16
16
|
task: true
|
|
17
17
|
todowrite: true
|
|
18
18
|
todoread: true
|
|
19
|
-
gkg*: true
|
|
20
19
|
context7*: true
|
|
21
20
|
codesearch: true
|
|
22
21
|
gh_grep*: true
|
|
@@ -60,12 +59,10 @@ Use **Facts/Guesses/Plans** in bead notes:
|
|
|
60
59
|
|
|
61
60
|
## Agent Assignments
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
| Code review, debugging | @review |
|
|
68
|
-
| Implementation | @build |
|
|
62
|
+
- Codebase search → @explore
|
|
63
|
+
- Library docs, patterns → @scout
|
|
64
|
+
- Code review, debugging → @review
|
|
65
|
+
- Implementation → @build
|
|
69
66
|
|
|
70
67
|
**Typical chain**: research → plan → build → review
|
|
71
68
|
|
|
@@ -11,7 +11,6 @@ tools:
|
|
|
11
11
|
grep: true
|
|
12
12
|
read: true
|
|
13
13
|
list: true
|
|
14
|
-
gkg*: true
|
|
15
14
|
webfetch: true
|
|
16
15
|
websearch: true
|
|
17
16
|
context7*: true
|
|
@@ -70,7 +69,7 @@ bd create "[type]: [description]" -t bug -p [0-4] -d "[details, file:line]"
|
|
|
70
69
|
|
|
71
70
|
## Tool Priority
|
|
72
71
|
|
|
73
|
-
**Codebase**:
|
|
72
|
+
**Codebase**: grep → ast-grep → read
|
|
74
73
|
**Verification**: bash (tests, lint, type-check)
|
|
75
74
|
**History**: `git log -p`, `git blame`
|
|
76
75
|
|
|
@@ -13,7 +13,6 @@ tools:
|
|
|
13
13
|
list: true
|
|
14
14
|
webfetch: true
|
|
15
15
|
websearch: true
|
|
16
|
-
gkg*: true
|
|
17
16
|
ast-grep*: true
|
|
18
17
|
lsp*: true
|
|
19
18
|
context7*: true
|
|
@@ -46,12 +45,11 @@ Fast execute-first agent. Speed over depth. Delegate anything complex.
|
|
|
46
45
|
|
|
47
46
|
## Tool Priority
|
|
48
47
|
|
|
49
|
-
**
|
|
48
|
+
**LSP tools FIRST, then AST-Grep, then built-in tools.**
|
|
50
49
|
|
|
51
|
-
1. `
|
|
52
|
-
2. `
|
|
53
|
-
3. `
|
|
54
|
-
4. `grep`, `glob` - Text search, file patterns
|
|
50
|
+
1. `lsp_rename`, `lsp_organize_imports` - Semantic refactoring
|
|
51
|
+
2. `ast-grep` - Semantic code search/replace
|
|
52
|
+
3. `grep`, `glob` - Text search, file patterns
|
|
55
53
|
|
|
56
54
|
### LSP Tools (Fast Refactoring)
|
|
57
55
|
|
|
@@ -59,6 +57,15 @@ Use `lsp_rename` to rename symbols across the codebase - faster than manual find
|
|
|
59
57
|
|
|
60
58
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
61
59
|
|
|
60
|
+
### AST-Grep (Semantic Search/Replace)
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
ast-grep pattern="console.log($$$)" # Find console.log
|
|
64
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" # Replace function calls
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
68
|
+
|
|
62
69
|
## Pre-Action Checks
|
|
63
70
|
|
|
64
71
|
Before mutations (edit, write, delete):
|
|
@@ -11,7 +11,6 @@ tools:
|
|
|
11
11
|
grep: false
|
|
12
12
|
read: false
|
|
13
13
|
list: false
|
|
14
|
-
gkg*: false
|
|
15
14
|
webfetch: true
|
|
16
15
|
websearch: true
|
|
17
16
|
context7*: true
|
|
@@ -32,62 +31,70 @@ External research: library docs, GitHub patterns, framework analysis.
|
|
|
32
31
|
- Cross-repository analysis
|
|
33
32
|
- Best practices research
|
|
34
33
|
|
|
35
|
-
##
|
|
34
|
+
## First: Classify the Request
|
|
35
|
+
|
|
36
|
+
Before searching, identify what you're dealing with.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
- No emojis in responses
|
|
39
|
-
- Explain WHAT, WHY, HOW in deep mode
|
|
40
|
-
- Compare implementations across repositories
|
|
38
|
+
**Conceptual questions** sound like "how do I use X", "what's the best practice for Y", or "docs for Z". These need official documentation plus recent web sources. Run context7 and websearch in parallel.
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
**Implementation questions** sound like "how does X implement Y", "show me the source of Z", or "internal logic of W". These need actual source code with permalinks. Clone the repo, find the code, construct a permalink.
|
|
43
41
|
|
|
44
|
-
**
|
|
42
|
+
**Context questions** sound like "why was this changed", "history of X", or "what issues led to Y". These need git history, issues, and PRs. Search issues and PRs, check git blame, find the discussion.
|
|
45
43
|
|
|
46
|
-
**
|
|
44
|
+
**Comprehensive questions** are complex or ambiguous. Hit everything in parallel: docs, web search, GitHub code search, and source analysis.
|
|
47
45
|
|
|
48
46
|
## Quick Mode
|
|
49
47
|
|
|
50
|
-
For API lookups, syntax help, configuration guides.
|
|
48
|
+
For API lookups, syntax help, configuration guides. Triggered by: "how to", "syntax for", "API for", "docs for".
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
1. context7_resolve_library_id("library")
|
|
54
|
-
2. context7_get_library_docs(libraryID, topic)
|
|
55
|
-
3. Return: API signature + example + source link
|
|
56
|
-
```
|
|
50
|
+
Start with context7 to resolve the library ID, then query the specific topic. If context7 lacks coverage, fall back to websearch or codesearch. Return the API signature, a minimal example, and the source link.
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
**Performance**: <10 seconds
|
|
52
|
+
Run at least 2-3 tool calls in parallel. Output should be 2-3 sentences plus a code example. Target under 10 seconds.
|
|
60
53
|
|
|
61
54
|
## Deep Mode
|
|
62
55
|
|
|
63
|
-
For cross-repository analysis
|
|
56
|
+
For cross-repository analysis and pattern comparison. Triggered by: "how do others", "compare", "best practices", "production patterns".
|
|
57
|
+
|
|
58
|
+
Search GitHub for real implementations using gh_grep_searchGitHub. Vary your queries to hit different angles of the same concept. Compare 3-5 implementations from different repositories. Synthesize the common patterns and note the tradeoffs.
|
|
59
|
+
|
|
60
|
+
Run at least 4-6 tool calls in parallel. Output should include a summary, multiple code examples, tradeoffs, and a recommendation.
|
|
61
|
+
|
|
62
|
+
## Permalink Protocol
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
1. gh_grep_searchGitHub(pattern, language)
|
|
67
|
-
2. context7 for official docs
|
|
68
|
-
3. Compare 3-5 implementations
|
|
69
|
-
4. Synthesize patterns
|
|
70
|
-
```
|
|
64
|
+
Every code reference must include a GitHub permalink. Never link to a branch or tag that can change.
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
To construct a permalink: clone the repo with depth 1, get the commit SHA with `git rev-parse HEAD`, then build the URL as `https://github.com/owner/repo/blob/<sha>/path/to/file#L10-L20`.
|
|
67
|
+
|
|
68
|
+
When citing code, format it as the claim, then the evidence with a permalink, then the code block, then a brief explanation of why this matters.
|
|
74
69
|
|
|
75
70
|
## Tool Priority
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
Use context7 first for official documentation. It's fastest and most authoritative for library APIs.
|
|
73
|
+
|
|
74
|
+
Use gh_grep_searchGitHub for real GitHub code patterns. Vary your queries: search for the function name, then the configuration key, then the error message.
|
|
75
|
+
|
|
76
|
+
Use codesearch for code examples when you need broader coverage than a single repo.
|
|
77
|
+
|
|
78
|
+
Use websearch for best practices, comparisons, and recent articles. Always append the current year to avoid stale results.
|
|
79
|
+
|
|
80
|
+
Use webfetch for specific URLs: official docs, RFCs, blog posts the user shared.
|
|
81
|
+
|
|
82
|
+
## When Things Fail
|
|
83
|
+
|
|
84
|
+
If context7 doesn't find the library, clone the repo directly and read the source plus README.
|
|
85
|
+
|
|
86
|
+
If gh_grep returns nothing, broaden your query. Search for concepts instead of exact function names.
|
|
87
|
+
|
|
88
|
+
If you hit API rate limits, work from already-cloned repos in the temp directory.
|
|
89
|
+
|
|
90
|
+
If you're uncertain, say so explicitly. Propose a hypothesis but flag it as unverified.
|
|
91
|
+
|
|
92
|
+
## Guidelines
|
|
82
93
|
|
|
83
|
-
|
|
94
|
+
Cite sources with links. No emojis. Explain what the code does, why it's designed that way, and how to use it.
|
|
84
95
|
|
|
85
|
-
|
|
86
|
-
**Deep**: "how do others", "compare", "best practices", "production patterns"
|
|
96
|
+
Compare implementations across repositories when doing deep research. Note which patterns are common versus unique.
|
|
87
97
|
|
|
88
98
|
## Delegation
|
|
89
99
|
|
|
90
|
-
|
|
91
|
-
- Complex reasoning → @review
|
|
92
|
-
- Code generation → @build
|
|
93
|
-
- Architecture planning → @planner
|
|
100
|
+
If the task requires local codebase search, hand off to @explore. If it requires complex reasoning or debugging, hand off to @review. If it requires code generation, hand off to the main agent. If it requires architecture planning, hand off to @planner.
|