open-codebase-index 0.21.0-bootstrap.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.
Files changed (39) hide show
  1. package/.claude-plugin/marketplace.json +16 -0
  2. package/.claude-plugin/plugin.json +35 -0
  3. package/.codex-plugin/plugin.json +43 -0
  4. package/.mcp.json +15 -0
  5. package/LICENSE +21 -0
  6. package/README.md +235 -0
  7. package/THIRD_PARTY_LICENSES.md +92 -0
  8. package/commands/call-graph.md +29 -0
  9. package/commands/definition.md +24 -0
  10. package/commands/find.md +25 -0
  11. package/commands/index.md +27 -0
  12. package/commands/peek.md +28 -0
  13. package/commands/pr-impact.md +23 -0
  14. package/commands/reindex.md +25 -0
  15. package/commands/search.md +28 -0
  16. package/commands/status.md +19 -0
  17. package/commands/visualize.md +30 -0
  18. package/dist/cli.cjs +19978 -0
  19. package/dist/cli.cjs.map +1 -0
  20. package/dist/cli.js +19970 -0
  21. package/dist/cli.js.map +1 -0
  22. package/dist/index.cjs +18530 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.js +18529 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/pi-extension.cjs +15070 -0
  27. package/dist/pi-extension.cjs.map +1 -0
  28. package/dist/pi-extension.js +15070 -0
  29. package/dist/pi-extension.js.map +1 -0
  30. package/hooks/hooks.json +17 -0
  31. package/native/codebase-index-native.darwin-arm64.node +0 -0
  32. package/native/codebase-index-native.darwin-x64.node +0 -0
  33. package/native/codebase-index-native.linux-arm64-gnu.node +0 -0
  34. package/native/codebase-index-native.linux-x64-gnu.node +0 -0
  35. package/native/codebase-index-native.win32-x64-msvc.node +0 -0
  36. package/package.json +147 -0
  37. package/scripts/link-local-mcp-bin.mjs +25 -0
  38. package/skill/SKILL.md +139 -0
  39. package/skills/codebase-search/SKILL.md +43 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "helweg-plugins",
3
+ "owner": {
4
+ "name": "Kenneth",
5
+ "email": "kenneth@example.com",
6
+ "url": "https://github.com/Helweg/opencode-codebase-index"
7
+ },
8
+ "plugins": [
9
+ {
10
+ "name": "codebase-index",
11
+ "description": "Semantic code search and codebase graph tools for Claude Code",
12
+ "source": "./",
13
+ "version": "0.21.0"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "codebase-index",
3
+ "version": "0.21.0",
4
+ "description": "Semantic code search and codebase graph tools for Claude Code",
5
+ "displayName": "Codebase Index",
6
+ "author": {
7
+ "name": "Kenneth",
8
+ "email": "kenneth@example.com",
9
+ "url": "https://github.com/Helweg/opencode-codebase-index"
10
+ },
11
+ "homepage": "https://github.com/Helweg/opencode-codebase-index",
12
+ "repository": "https://github.com/Helweg/opencode-codebase-index",
13
+ "license": "MIT",
14
+ "keywords": [
15
+ "codebase-index",
16
+ "semantic search",
17
+ "claude",
18
+ "claude-code",
19
+ "mcp"
20
+ ],
21
+ "skills": "./skills/",
22
+ "mcpServers": {
23
+ "codebase-index": {
24
+ "command": "npx",
25
+ "args": [
26
+ "-y",
27
+ "--package",
28
+ "open-codebase-index",
29
+ "open-codebase-index-mcp",
30
+ "--host",
31
+ "claude"
32
+ ]
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "codebase-index",
3
+ "version": "0.21.0",
4
+ "description": "Semantic code search and codebase graph tools for Codex",
5
+ "author": {
6
+ "name": "Kenneth",
7
+ "email": "kenneth@example.com",
8
+ "url": "https://github.com/Helweg/opencode-codebase-index"
9
+ },
10
+ "homepage": "https://github.com/Helweg/opencode-codebase-index",
11
+ "repository": "https://github.com/Helweg/opencode-codebase-index",
12
+ "license": "MIT",
13
+ "keywords": [
14
+ "codebase-index",
15
+ "semantic search",
16
+ "opencode",
17
+ "codex",
18
+ "mcp"
19
+ ],
20
+ "skills": "./skills/",
21
+ "hooks": "./hooks/hooks.json",
22
+ "id": "codebase-index",
23
+ "mcpServers": "./.mcp.json",
24
+ "interface": {
25
+ "displayName": "Codebase Index",
26
+ "shortDescription": "Navigate large codebases with semantic search and graph tools",
27
+ "longDescription": "Install this plugin to get semantic search tools in Codex. The skill layer gives usage guidance, and MCP tools provide searchable context for large repos.",
28
+ "developerName": "Kenneth",
29
+ "category": "Productivity",
30
+ "capabilities": [
31
+ "Instructions",
32
+ "MCP Tools",
33
+ "Search"
34
+ ],
35
+ "websiteURL": "https://github.com/Helweg/opencode-codebase-index",
36
+ "privacyPolicyURL": "https://github.com/Helweg/opencode-codebase-index/blob/main/SECURITY.md",
37
+ "termsOfServiceURL": "https://github.com/Helweg/opencode-codebase-index/blob/main/LICENSE",
38
+ "brandColor": "#3B82F6",
39
+ "defaultPrompt": [
40
+ "For repository questions, use index_status when readiness is unknown, then call codebase_context before shell search or broad file reads."
41
+ ]
42
+ }
43
+ }
package/.mcp.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "mcpServers": {
3
+ "codebase-index": {
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "--package",
8
+ "open-codebase-index",
9
+ "open-codebase-index-mcp",
10
+ "--host",
11
+ "codex"
12
+ ]
13
+ }
14
+ }
15
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kenneth Helweg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # open-codebase-index
2
+
3
+ [![npm version](https://img.shields.io/npm/v/open-codebase-index.svg)](https://www.npmjs.com/package/open-codebase-index)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Downloads](https://img.shields.io/npm/dm/open-codebase-index.svg)](https://www.npmjs.com/package/open-codebase-index)
6
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/Helweg/opencode-codebase-index/ci.yml?branch=main)](https://github.com/Helweg/opencode-codebase-index/actions)
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
8
+
9
+ > Search a codebase by meaning, then follow the result into definitions, callers, and dependency paths.
10
+
11
+ `open-codebase-index` is a local semantic code index for OpenCode, Jcode, Pi, Codex, Claude Code, and other MCP clients. It combines embeddings, BM25 keyword search, branch-aware filtering, symbol lookup, and a call graph behind agent-friendly tools.
12
+
13
+ New installs should use `open-codebase-index` and `open-codebase-index-mcp`. The legacy package `opencode-codebase-index` and `opencode-codebase-index-mcp` remain supported aliases.
14
+
15
+ ## Highlights
16
+
17
+ - **Semantic and hybrid retrieval** for questions where you do not know the identifier.
18
+ - **Low-token discovery** through `codebase_context` and `codebase_peek`.
19
+ - **Definition and graph navigation** through `implementation_lookup`, `call_graph`, and `call_graph_path`.
20
+ - **Incremental, branch-aware indexing** with file watching and content-hash reuse.
21
+ - **Local storage** backed by SQLite, usearch vectors, and a BM25 inverted index.
22
+ - **Multiple embedding providers**: Ollama, GitHub Copilot, OpenAI, Google, or a custom OpenAI-compatible endpoint.
23
+ - **Native parsing** for TypeScript/TSX, JavaScript/JSX, Python, Rust, Swift, Go, Java, C#, Ruby, C/C++, Metal, PHP, Apex, Bash, Zig, GDScript, MATLAB, JSON, TOML, YAML, Markdown, and HTML, with text fallback.
24
+
25
+ ## Quick start with OpenCode
26
+
27
+ Requires Node.js 20 or newer.
28
+
29
+ 1. Install the package:
30
+
31
+ ```bash
32
+ npm install open-codebase-index
33
+ ```
34
+
35
+ Legacy installs continue to work with:
36
+
37
+ ```bash
38
+ npm install opencode-codebase-index
39
+ ```
40
+
41
+ 2. Add it to `opencode.json`:
42
+
43
+ ```json
44
+ {
45
+ "plugin": ["open-codebase-index"]
46
+ }
47
+ ```
48
+
49
+ Legacy alias:
50
+
51
+ ```json
52
+ {
53
+ "plugin": ["opencode-codebase-index"]
54
+ }
55
+ ```
56
+
57
+ 3. Run `/status`, then `/index`.
58
+ 4. Ask a repository question, for example:
59
+
60
+ > Where is authentication state validated before an API request?
61
+
62
+ The first index creates embeddings. Later runs reuse unchanged content and process only relevant changes.
63
+
64
+ ## Choose your host
65
+
66
+ | Host | Recommended integration | Storage |
67
+ |---|---|---|
68
+ | OpenCode | Native plugin | `.opencode/` |
69
+ | Jcode | Per-session MCP server | `.codebase-index/` |
70
+ | Pi | Pi package | `.codebase-index/` |
71
+ | Codex | Marketplace plugin with MCP and skill guidance | `.codebase-index/` |
72
+ | Claude Code | Marketplace plugin with MCP and skill guidance | `.claude/` |
73
+ | Cursor, Windsurf, other MCP clients | `open-codebase-index-mcp` (legacy alias: `opencode-codebase-index-mcp`) | Selected by `--host`; default is OpenCode-compatible |
74
+
75
+ See [Installation and host setup](docs/installation.md) for complete instructions.
76
+
77
+ ## Recommended workflow
78
+
79
+ 1. **Check readiness** with `index_status` or `/status`.
80
+ 2. **Index when needed** with `index_codebase` or `/index`.
81
+ 3. **Start repository discovery** with `codebase_context`.
82
+ 4. **Use `codebase_peek`** when you only need likely locations.
83
+ 5. **Use `implementation_lookup`** for a known symbol or definition question.
84
+ 6. **Use `codebase_search`** when you need full matching source content.
85
+ 7. **Use `grep`** for exact identifiers or exhaustive text matches.
86
+ 8. **Use call-graph tools** for callers, callees, and dependency paths.
87
+
88
+ ### Which search tool should I use?
89
+
90
+ | Need | Tool |
91
+ |---|---|
92
+ | Route a repository question to a bounded evidence pack | `codebase_context` |
93
+ | Find likely files and symbols without source bodies | `codebase_peek` |
94
+ | Retrieve full matching code | `codebase_search` |
95
+ | Find an authoritative definition | `implementation_lookup` |
96
+ | Find analogous implementations or duplicates | `find_similar` |
97
+ | Find direct callers or callees | `call_graph` |
98
+ | Find a path between two symbols | `call_graph_path` |
99
+ | Analyze a branch or pull request blast radius | `pr_impact` |
100
+
101
+ See [Tools and commands](docs/tools.md) for host availability, tool details, MCP prompts, and slash commands.
102
+
103
+ ## How it works
104
+
105
+ ```text
106
+ source files
107
+
108
+ ├─ file discovery and git-aware change detection
109
+ ├─ tree-sitter parsing and semantic chunking
110
+ ├─ embedding generation and content-hash reuse
111
+
112
+ SQLite metadata + usearch vectors + BM25 index
113
+
114
+ ├─ semantic candidates
115
+ ├─ keyword candidates
116
+ ├─ branch and request filters
117
+ ├─ deterministic fusion and ranking
118
+
119
+ locations, source results, definitions, and call-graph evidence
120
+ ```
121
+
122
+ The TypeScript layer handles host integration, configuration, indexing orchestration, providers, ranking, and tools. The Rust NAPI module handles parsing, vector storage, SQLite operations, BM25 indexing, hashing, and call extraction.
123
+
124
+ Read [Architecture](ARCHITECTURE.md) for the detailed data flow and design decisions.
125
+
126
+ ## Embedding providers
127
+
128
+ With `embeddingProvider: "auto"`, providers are tried in this order:
129
+
130
+ 1. Ollama
131
+ 2. GitHub Copilot
132
+ 3. OpenAI
133
+ 4. Google
134
+
135
+ Ollama is the simplest local option:
136
+
137
+ ```bash
138
+ ollama pull nomic-embed-text
139
+ ```
140
+
141
+ ```json
142
+ {
143
+ "embeddingProvider": "ollama"
144
+ }
145
+ ```
146
+
147
+ A custom OpenAI-compatible embeddings endpoint is also supported. Provider, indexing, search, reranking, include/exclude, knowledge-base, storage, and debug settings are documented in [Configuration](docs/configuration.md).
148
+
149
+ ## Configuration example
150
+
151
+ OpenCode project config lives at `.opencode/codebase-index.json`. Codex, Pi, and Jcode use `.codebase-index/config.json`; Claude uses `.claude/codebase-index.json`.
152
+
153
+ ```json
154
+ {
155
+ "embeddingProvider": "auto",
156
+ "scope": "project",
157
+ "indexing": {
158
+ "autoIndex": false,
159
+ "watchFiles": true,
160
+ "requireProjectMarker": true,
161
+ "semanticOnly": false
162
+ },
163
+ "search": {
164
+ "maxResults": 20,
165
+ "minScore": 0.1,
166
+ "fusionStrategy": "rrf",
167
+ "rerankTopN": 20
168
+ }
169
+ }
170
+ ```
171
+
172
+ Only specify values you want to override. See [Configuration](docs/configuration.md) for defaults and host-specific paths.
173
+
174
+ ## Branch-aware indexing
175
+
176
+ The index stores reusable content by hash and maintains branch catalogs for chunks and symbols. On a branch switch, unchanged content can be reused while results remain scoped to the active branch. Linked worktrees without a local project config share the main checkout's portable project index; adding a worktree-local config creates an isolated index boundary.
177
+
178
+ ## Knowledge bases and reranking
179
+
180
+ OpenCode and Pi can index additional directories as knowledge bases. Configure them with `knowledgeBases` or use the host-native knowledge-base tools where available.
181
+
182
+ Optional external reranking supports Cohere, Jina, and custom compatible endpoints. Local filtering and evidence classes are applied before external candidates are submitted.
183
+
184
+ See [Configuration](docs/configuration.md) for examples and privacy considerations.
185
+
186
+ ## Troubleshooting
187
+
188
+ Start with:
189
+
190
+ 1. `/status` or `index_status`
191
+ 2. `index_health_check`
192
+ 3. a normal `/index` retry
193
+ 4. a forced rebuild only when status reports incompatibility or corruption
194
+
195
+ Common provider, native module, stale index, branch, and performance issues are covered in [Troubleshooting](TROUBLESHOOTING.md).
196
+
197
+ ## Evaluation and performance
198
+
199
+ The repository includes reproducible retrieval datasets, latency and quality budgets, baseline comparison, and cross-repository benchmarking tools.
200
+
201
+ - [Evaluation harness](docs/evaluation.md)
202
+ - [Cross-repository benchmarking](docs/benchmarking-cross-repo.md)
203
+
204
+ Performance depends on repository size, parser coverage, provider latency, embedding cache reuse, and the selected indexing limits. Prefer measured evaluation over fixed marketing claims.
205
+
206
+ ## Development
207
+
208
+ ```bash
209
+ npm ci
210
+ npm run build
211
+ npm run typecheck
212
+ npm run lint
213
+ npm run test:run
214
+ ```
215
+
216
+ Native changes require Rust and `npm run build:native`. See [Contributing](CONTRIBUTING.md), [Architecture](ARCHITECTURE.md), and [Adding language support](docs/adding-language-support.md).
217
+
218
+ ## Documentation
219
+
220
+ - [Installation and host setup](docs/installation.md)
221
+ - [Tools and commands](docs/tools.md)
222
+ - [Configuration](docs/configuration.md)
223
+ - [Troubleshooting](TROUBLESHOOTING.md)
224
+ - [Architecture](ARCHITECTURE.md)
225
+ - [Evaluation](docs/evaluation.md)
226
+ - [Cross-repository benchmarking](docs/benchmarking-cross-repo.md)
227
+ - [Adding language support](docs/adding-language-support.md)
228
+ - [Future `open-codebase-index` rename plan](docs/rename-to-open-codebase-index.md)
229
+ - [Contributing](CONTRIBUTING.md)
230
+ - [Security](SECURITY.md)
231
+ - [Changelog](CHANGELOG.md)
232
+
233
+ ## License
234
+
235
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,92 @@
1
+ # Third-party licenses
2
+
3
+ This file records third-party license notices added with their respective components. It does not claim to retroactively inventory every project dependency.
4
+
5
+ ## tree-sitter-php 0.24.2
6
+
7
+ - Project: [tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php)
8
+ - Source: [crate 0.24.2](https://crates.io/crates/tree-sitter-php/0.24.2)
9
+ - License: MIT
10
+
11
+ ```text
12
+ The MIT License (MIT)
13
+
14
+ Copyright (c) 2017 Josh Vera, GitHub
15
+ Copyright (c) 2019 Max Brunsfeld, Amaan Qureshi, Christian Frøystad, Caleb White
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+ ```
35
+
36
+ ## tree-sitter-swift 0.7.3
37
+
38
+ - Project: [alex-pinkus/tree-sitter-swift](https://github.com/alex-pinkus/tree-sitter-swift)
39
+ - Source: [tag 0.7.3](https://github.com/alex-pinkus/tree-sitter-swift/tree/0.7.3)
40
+ - License: MIT
41
+
42
+ ```text
43
+ MIT License
44
+
45
+ Copyright (c) 2021 alex-pinkus
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining a copy
48
+ of this software and associated documentation files (the "Software"), to deal
49
+ in the Software without restriction, including without limitation the rights
50
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51
+ copies of the Software, and to permit persons to whom the Software is
52
+ furnished to do so, subject to the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be included in all
55
+ copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63
+ SOFTWARE.
64
+ ```
65
+
66
+ ## unicode-case-folding 1.1.1
67
+
68
+ - Project: [avivkeller/unicode-case-folding](https://github.com/avivkeller/unicode-case-folding)
69
+ - Source: [npm package 1.1.1](https://www.npmjs.com/package/unicode-case-folding/v/1.1.1)
70
+ - License: MIT
71
+
72
+ ```text
73
+ Copyright 2025-Present Aviv Keller
74
+
75
+ Permission is hereby granted, free of charge, to any person obtaining a copy
76
+ of this software and associated documentation files (the “Software”), to deal
77
+ in the Software without restriction, including without limitation the rights
78
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
79
+ copies of the Software, and to permit persons to whom the Software is
80
+ furnished to do so, subject to the following conditions:
81
+
82
+ The above copyright notice and this permission notice shall be included in all
83
+ copies or substantial portions of the Software.
84
+
85
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
90
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
91
+ SOFTWARE.
92
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: Trace callers, callees, or paths using the call graph
3
+ ---
4
+
5
+ Trace function dependencies using the `call_graph` and `call_graph_path` tools.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Interpret input as follows:
10
+ - If input asks for a path, connection, route, chain, or "from X to Y", use `call_graph_path`.
11
+ - Default to `direction="callers"` unless input asks for callees/calls/makes calls.
12
+ - `name=<function>` or plain text function name sets `name`.
13
+ - Unique names resolve automatically for both directions. Use optional `filePath=<path>` only when duplicate names are reported.
14
+ - `symbolId=<id>` remains an optional backward-compatible escape hatch.
15
+ - For path queries, parse `from=<function>`, `to=<function>`, and optional `maxDepth=<number>`.
16
+
17
+ Execution flow:
18
+ 1. If input asks for a path and has source/target names, call `call_graph_path` with `{ from, to, maxDepth? }`.
19
+ 2. If direction is `callers`, call `call_graph` with `{ name, direction: "callers" }`.
20
+ 3. If direction is `callees`, call `call_graph` with `{ name, direction: "callees" }`.
21
+ 4. If the tool reports duplicate names, retry with the suggested `filePath`; for paths use `fromFilePath` or `toFilePath`.
22
+
23
+ Examples:
24
+ - `/call-graph Database` → callers for `Database`
25
+ - `/call-graph callers name=Indexer` → callers for `Indexer`
26
+ - `/call-graph callees name=Database filePath=src/database.ts` → callees for a duplicate name at that location
27
+ - `/call-graph path from=createOrder to=chargeCard` → shortest known path between the two symbols
28
+
29
+ If output says no callers found, suggest running `/index force` first.
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Find where a symbol is defined in the codebase
3
+ ---
4
+
5
+ Find the authoritative definition of a symbol in the codebase.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ The input is a symbol name or description of what to find the definition of.
10
+
11
+ Look for optional parameters:
12
+ - `limit=N` or "top N" → set limit
13
+ - `dir=X` or "in folder X" → set directory filter
14
+ - File extensions like ".ts", ".py" → set fileType
15
+
16
+ Call `implementation_lookup` with the parsed arguments.
17
+
18
+ Examples:
19
+ - `/definition validateToken` → query="validateToken"
20
+ - `/definition payment handler` → query="payment handler"
21
+ - `/definition createSystem dir=packages/react` → query="createSystem", directory="packages/react"
22
+
23
+ This prioritizes real implementation files over tests, docs, and examples.
24
+ If no definition is found, suggest using `codebase_search` for broader discovery.
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Find code using hybrid approach (semantic + grep)
3
+ ---
4
+
5
+ Find code using both semantic search and grep.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Strategy:
10
+ 1. Use `codebase_search` to find semantically related code
11
+ 2. Identify specific function/class/variable names from results
12
+ 3. Use grep to find all occurrences of those identifiers
13
+ 4. Combine into a comprehensive answer
14
+
15
+ Parse optional parameters from input:
16
+ - `limit=N` → limit semantic results
17
+ - `type=X` or "functions"/"classes" → filter chunk type
18
+ - `dir=X` → filter directory
19
+
20
+ Examples:
21
+ - `/find error handling middleware`
22
+ - `/find payment validation type=function`
23
+ - `/find user auth in src/services`
24
+
25
+ If no index exists, run `index_codebase` first.
@@ -0,0 +1,27 @@
1
+ ---
2
+ description: Index the codebase for semantic search
3
+ ---
4
+
5
+ Run the `index_codebase` tool with these settings:
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Parse the input and set tool arguments:
10
+ - force=true if input contains "force"
11
+ - estimateOnly=true if input contains "estimate"
12
+ - verbose=false (default, for token efficiency)
13
+ - verbose=true if input contains "verbose" (for detailed output)
14
+
15
+ Examples:
16
+ - `/index` → force=false, estimateOnly=false, verbose=false
17
+ - `/index force` → force=true, estimateOnly=false, verbose=false
18
+ - `/index estimate` → force=false, estimateOnly=true, verbose=false
19
+ - `/index verbose` → force=false, estimateOnly=false, verbose=true
20
+
21
+ IMPORTANT: You MUST pass the parsed arguments to `index_codebase`. Do not ignore them.
22
+
23
+ Show final statistics including files processed, chunks indexed, tokens used, and duration.
24
+
25
+ If indexing completes but the codebase still is not ready, tell the user to run `/status` next.
26
+ - If `/status` reports failed embedding batches, fix the provider/auth issue and rerun `/index` normally.
27
+ - Use `/index force` only for a full rebuild or when `/status` reports provider/model incompatibility.
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Quickly find likely code locations without returning full code
3
+ ---
4
+
5
+ Search the codebase using `codebase_peek`.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ The first part is the search query. Look for optional parameters:
10
+ - `limit=N` or "top N" or "first N" → set limit
11
+ - `type=X` or mentions "functions"/"classes"/"methods" → set chunkType
12
+ - `dir=X` or "in folder X" → set directory filter
13
+ - File extensions like ".ts", "typescript", ".py" → set fileType
14
+ - `author=X` or `blameAuthor=X` → set blameAuthor filter
15
+ - `sha=X` or `blameSha=X` → set blameSha filter
16
+ - `since=YYYY-MM-DD` or `blameSince=YYYY-MM-DD` → set blameSince filter
17
+
18
+ Call `codebase_peek` with the parsed arguments.
19
+
20
+ Examples:
21
+ - `/peek authentication logic` → query="authentication logic"
22
+ - `/peek error handling limit=5` → query="error handling", limit=5
23
+ - `/peek validation functions` → query="validation", chunkType="function"
24
+ - `/peek auth logic author=jane@example.com since=2025-01-01` → query="auth logic", blameAuthor="jane@example.com", blameSince="2025-01-01"
25
+
26
+ If the index doesn't exist, run `index_codebase` first.
27
+
28
+ Return results as concise locations with file paths and line numbers. Suggest reading the returned files or using `codebase_search` when the user needs full code context.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Analyze PR or branch impact using the call graph
3
+ ---
4
+
5
+ Analyze the impact of a pull request or branch before merging.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Interpret input as follows:
10
+ - `pr=N` or plain number at the start → set `pr`
11
+ - `branch=<name>` or plain branch name → set `branch`
12
+ - `maxDepth=N` → set max traversal depth
13
+ - `hubThreshold=N` → set hub node threshold
14
+ - `checkConflicts` or `conflicts` → set `checkConflicts=true`
15
+
16
+ Call `pr_impact` with the parsed arguments.
17
+
18
+ Examples:
19
+ - `/pr-impact 42` → pr=42
20
+ - `/pr-impact branch=feature/auth` → branch="feature/auth"
21
+ - `/pr-impact branch=feature/x maxDepth=3 checkConflicts` → branch="feature/x", maxDepth=3, checkConflicts=true
22
+
23
+ If the index doesn't exist, run `index_codebase` first.
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Fully rebuild the codebase index from scratch
3
+ ---
4
+
5
+ Run the `index_codebase` tool with `force=true` to rebuild the index from scratch.
6
+
7
+ User input: $ARGUMENTS
8
+
9
+ Parse the input and set tool arguments:
10
+ - force=true always
11
+ - estimateOnly=false always
12
+ - verbose=false (default, for token efficiency)
13
+ - verbose=true if input contains "verbose" (for detailed output)
14
+
15
+ Examples:
16
+ - `/reindex` → force=true, estimateOnly=false, verbose=false
17
+ - `/reindex verbose` → force=true, estimateOnly=false, verbose=true
18
+
19
+ IMPORTANT: You MUST call `index_codebase` with `force=true`.
20
+
21
+ Show final statistics including files processed, chunks indexed, tokens used, and duration.
22
+
23
+ If indexing completes but the codebase still is not ready, tell the user to run `/status` next.
24
+ - If `/status` reports failed embedding batches, fix the provider/auth issue and rerun `/index` normally.
25
+ - If `/status` reports provider/model incompatibility again after a rebuild, surface that clearly as an unexpected issue.