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 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. Install CLI
28
- bun install -g opencodekit-cli
29
- # or use local version
30
- bun install
31
- bun run dev init
32
-
33
- # 2. Create new project
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
- ├→ @plan (Complex planning ≥3 phases)
77
- ├→ @code-auditor (Review + security + testing)
78
- ├→ @oracle (Deep analysis, debugging, architecture review)
79
- ├→ @librarian (Cross-repo GitHub search, framework internals)
80
- ├→ @docs (Quick API documentation)
81
- ├→ @finder (Fast codebase search)
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
- 24 Skills (loaded via commands: 8 core, 7 stack, 9 specialized)
92
- 45+ Commands (workflow shortcuts, includes /handoff)
93
- 5 MCP Services (context7, exa, gkg, gh_grep, figma*) + augment-context-engine
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
- ✓ → @plan (creates task ledger)
178
+ ✓ → @planner (creates implementation plan)
186
179
 
187
180
  Need research?
188
- ✓ → @oracle (complex debugging/architecture)
189
- ✓ → @librarian (cross-repo GitHub search)
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
- ✓ → @code-auditor (security + review + test)
185
+ ✓ → @review (security + code review + debugging)
195
186
 
196
- 5+ phases + 3+ agents?
197
- ✓ → @orchestrator (progress tracking)
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
- - ✅ 10 agent files (.opencode/agent/\*.md)
220
+ - ✅ Agent files in place (.opencode/agent/\*.md)
230
221
  - ✅ Build handles 70%+ directly
231
- - ✅ Commands work (45+ total, including `/handoff`)
232
- - ✅ Skills load via commands (24 skills: 8 core, 7 stack, 9 specialized)
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 (6 total: 5 enabled, 1 optional)
226
+ - ✅ MCP services configured (context7, gh_grep + skill-embedded)
236
227
  - ✅ Background plugins active (enforcer, compactor, truncator)
237
- - ✅ Custom tools available (memory-\*, observation, ast-grep)
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.3.0**
254
+ **OpenCodeKit v0.9.1**
264
255
  **Architecture**: Two-layer (Memory + Beads + Git)
265
- **New in v0.3.0**: Background plugins (enforcer, compactor, truncator) + ast-grep semantic code tool
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.8.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: ["dist", "README.md"],
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: ["cli", "opencodekit", "template", "agents", "mcp", "opencode"],
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: ["@beads/bd"]
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
- **GKG tools → LSP tools → AST tools → Built-in tools**
82
+ **LSP tools → AST tools → Built-in tools**
83
83
 
84
- 1. `gkg_search_codebase_definitions`, `gkg_get_references`, `gkg_repo_map` - Find symbols, usages, API overview
85
- 2. `lsp_rename`, `lsp_code_actions`, `lsp_organize_imports` - Semantic refactoring (LSP-based)
86
- 3. `ast-grep` - Semantic code search/replace (AST-based)
87
- 4. `grep`, `glob` - Pattern matching, file discovery
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
- | Plugin | What it does |
148
- | ------------- | ----------------------------------------------------------- |
149
- | **enforcer** | OS notification when session idles with incomplete TODOs |
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
- | Tool | Purpose |
164
- | ----------------- | ---------------------------------------- |
165
- | **memory-read** | Load previous context, templates |
166
- | **memory-update** | Save learnings, handoffs |
167
- | **memory-search** | Search across all memory files |
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 (5 total):**
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
- 4. **gkg** - GitLab Knowledge Graph (local codebase semantic search)
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
- **Optional (disabled by default):**
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
- - GitHub: https://github.com/GLips/Figma-Context-MCP (11.9k+ stars)
217
- - Enable: Set `"Framelink MCP for Figma": { "enabled": true }` in opencode.json
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.7.0**
332
+ **OpenCodeKit v0.9.1**
335
333
  **Architecture:** Two-Layer (Memory + Beads + Git)
336
- **New in v0.7.0:** Native skill tool integration, Beads Village MCP, 27 skills, enhanced commands
337
- **Last Updated:** December 30, 2025
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. **GKG tools** for code search (definitions, references, repo map)
51
- 2. **LSP tools** for semantic refactoring (rename, code actions, organize imports)
52
- 3. **AST-Grep** for semantic code search/replace
53
- 4. **Built-in tools** for pattern matching (grep, glob, read)
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
- gkg*: true
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 GKG tools
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 GKG tools FIRST, then fall back to built-in tools.**
40
+ **Use AST-Grep for semantic search, then fall back to built-in tools.**
41
41
 
42
- ### GKG Tools (Semantic Search)
42
+ ### AST-Grep (Semantic Search)
43
43
 
44
- | Tool | Use For |
45
- | --------------------------------- | ------------------------------------------ |
46
- | `gkg_search_codebase_definitions` | Find functions, classes, constants by name |
47
- | `gkg_get_references` | Find all callers/usages of a symbol |
48
- | `gkg_read_definitions` | Read function/class body only |
49
- | `gkg_get_definition` | Jump to definition from usage |
50
- | `gkg_repo_map` | API-level overview of directories |
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
- | Tool | Use For |
55
- | ------ | --------------------------------- |
56
- | `glob` | Find files by pattern (`**/*.ts`) |
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 GKG search or glob. Read 1-3 files. Return immediately.
62
+ **Quick**: Single ast-grep or glob. Read 1-3 files. Return immediately.
63
63
 
64
- **Medium**: GKG + grep verification. Check 2-3 naming conventions. Read 3-5 files.
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
- | Task Type | Agent |
64
- | ---------------------- | -------- |
65
- | Codebase search | @explore |
66
- | Library docs, patterns | @scout |
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**: gkg_searchgkg_get_references → read → grep
72
+ **Codebase**: grepast-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
- **GKG tools FIRST, then LSP, then AST-Grep, then built-in tools.**
48
+ **LSP tools FIRST, then AST-Grep, then built-in tools.**
50
49
 
51
- 1. `gkg_search_codebase_definitions`, `gkg_get_references` - Find symbols, usages
52
- 2. `lsp_rename`, `lsp_organize_imports` - Semantic refactoring
53
- 3. `ast-grep` - Semantic code search/replace
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
- ## Guidelines
34
+ ## First: Classify the Request
35
+
36
+ Before searching, identify what you're dealing with.
36
37
 
37
- - Cite sources with links
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
- ## Responsibility
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
- **DO**: Library docs, API references, GitHub code search, framework deep dives.
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
- **DON'T**: Local codebase search, code generation, implementation.
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
- **Output**: 2-3 sentences + syntax example + link
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, pattern comparison.
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
- **Output**: Summary + code examples + tradeoffs + recommendations
73
- **Performance**: 30-60 seconds
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
- 1. **context7**: Official documentation
78
- 2. **gh_grep_searchGitHub**: Real GitHub code
79
- 3. **codesearch**: Code examples
80
- 4. **websearch**: Best practices, comparisons
81
- 5. **webfetch**: Official docs, RFCs, specific URLs
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
- ## Mode Detection
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
- **Quick**: "how to", "syntax for", "API for", "docs for"
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
- - Local codebase @explore
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.