@mars167/git-ai 2.3.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 (122) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +364 -0
  3. package/README.zh-CN.md +361 -0
  4. package/assets/hooks/post-checkout +28 -0
  5. package/assets/hooks/post-merge +28 -0
  6. package/assets/hooks/pre-commit +17 -0
  7. package/assets/hooks/pre-push +29 -0
  8. package/dist/bin/git-ai.js +62 -0
  9. package/dist/src/commands/ai.js +30 -0
  10. package/dist/src/commands/checkIndex.js +19 -0
  11. package/dist/src/commands/dsr.js +156 -0
  12. package/dist/src/commands/graph.js +203 -0
  13. package/dist/src/commands/hooks.js +125 -0
  14. package/dist/src/commands/index.js +92 -0
  15. package/dist/src/commands/pack.js +31 -0
  16. package/dist/src/commands/query.js +139 -0
  17. package/dist/src/commands/semantic.js +134 -0
  18. package/dist/src/commands/serve.js +14 -0
  19. package/dist/src/commands/status.js +78 -0
  20. package/dist/src/commands/trae.js +75 -0
  21. package/dist/src/commands/unpack.js +28 -0
  22. package/dist/src/core/archive.js +91 -0
  23. package/dist/src/core/astGraph.js +127 -0
  24. package/dist/src/core/astGraphQuery.js +142 -0
  25. package/dist/src/core/cozo.js +266 -0
  26. package/dist/src/core/cpg/astLayer.js +56 -0
  27. package/dist/src/core/cpg/callGraph.js +483 -0
  28. package/dist/src/core/cpg/cfgLayer.js +490 -0
  29. package/dist/src/core/cpg/dfgLayer.js +237 -0
  30. package/dist/src/core/cpg/index.js +80 -0
  31. package/dist/src/core/cpg/types.js +108 -0
  32. package/dist/src/core/crypto.js +10 -0
  33. package/dist/src/core/dsr/generate.js +308 -0
  34. package/dist/src/core/dsr/gitContext.js +74 -0
  35. package/dist/src/core/dsr/indexMaterialize.js +106 -0
  36. package/dist/src/core/dsr/paths.js +26 -0
  37. package/dist/src/core/dsr/query.js +73 -0
  38. package/dist/src/core/dsr/snapshotParser.js +73 -0
  39. package/dist/src/core/dsr/state.js +27 -0
  40. package/dist/src/core/dsr/types.js +2 -0
  41. package/dist/src/core/embedding/fusion.js +52 -0
  42. package/dist/src/core/embedding/index.js +43 -0
  43. package/dist/src/core/embedding/parser.js +14 -0
  44. package/dist/src/core/embedding/semantic.js +254 -0
  45. package/dist/src/core/embedding/structural.js +97 -0
  46. package/dist/src/core/embedding/symbolic.js +117 -0
  47. package/dist/src/core/embedding/tokenizer.js +91 -0
  48. package/dist/src/core/embedding/types.js +2 -0
  49. package/dist/src/core/embedding.js +36 -0
  50. package/dist/src/core/git.js +49 -0
  51. package/dist/src/core/gitDiff.js +73 -0
  52. package/dist/src/core/indexCheck.js +131 -0
  53. package/dist/src/core/indexer.js +185 -0
  54. package/dist/src/core/indexerIncremental.js +303 -0
  55. package/dist/src/core/indexing/config.js +51 -0
  56. package/dist/src/core/indexing/hnsw.js +568 -0
  57. package/dist/src/core/indexing/index.js +17 -0
  58. package/dist/src/core/indexing/monitor.js +82 -0
  59. package/dist/src/core/indexing/parallel.js +252 -0
  60. package/dist/src/core/lancedb.js +111 -0
  61. package/dist/src/core/lfs.js +27 -0
  62. package/dist/src/core/log.js +62 -0
  63. package/dist/src/core/manifest.js +88 -0
  64. package/dist/src/core/parser/adapter.js +2 -0
  65. package/dist/src/core/parser/c.js +93 -0
  66. package/dist/src/core/parser/chunkRelations.js +178 -0
  67. package/dist/src/core/parser/chunker.js +274 -0
  68. package/dist/src/core/parser/go.js +98 -0
  69. package/dist/src/core/parser/java.js +80 -0
  70. package/dist/src/core/parser/markdown.js +76 -0
  71. package/dist/src/core/parser/python.js +81 -0
  72. package/dist/src/core/parser/rust.js +103 -0
  73. package/dist/src/core/parser/typescript.js +98 -0
  74. package/dist/src/core/parser/utils.js +62 -0
  75. package/dist/src/core/parser/yaml.js +53 -0
  76. package/dist/src/core/parser.js +75 -0
  77. package/dist/src/core/paths.js +10 -0
  78. package/dist/src/core/repoMap.js +164 -0
  79. package/dist/src/core/retrieval/cache.js +31 -0
  80. package/dist/src/core/retrieval/classifier.js +74 -0
  81. package/dist/src/core/retrieval/expander.js +80 -0
  82. package/dist/src/core/retrieval/fuser.js +40 -0
  83. package/dist/src/core/retrieval/index.js +32 -0
  84. package/dist/src/core/retrieval/reranker.js +304 -0
  85. package/dist/src/core/retrieval/types.js +2 -0
  86. package/dist/src/core/retrieval/weights.js +42 -0
  87. package/dist/src/core/search.js +41 -0
  88. package/dist/src/core/sq8.js +65 -0
  89. package/dist/src/core/symbolSearch.js +143 -0
  90. package/dist/src/core/types.js +2 -0
  91. package/dist/src/core/workspace.js +116 -0
  92. package/dist/src/mcp/server.js +794 -0
  93. package/docs/README.md +44 -0
  94. package/docs/cross-encoder.md +157 -0
  95. package/docs/embedding.md +158 -0
  96. package/docs/logo.png +0 -0
  97. package/docs/windows-setup.md +67 -0
  98. package/docs/zh-CN/DESIGN.md +102 -0
  99. package/docs/zh-CN/README.md +46 -0
  100. package/docs/zh-CN/advanced.md +26 -0
  101. package/docs/zh-CN/architecture_explained.md +116 -0
  102. package/docs/zh-CN/cli.md +109 -0
  103. package/docs/zh-CN/dsr.md +91 -0
  104. package/docs/zh-CN/graph_scenarios.md +173 -0
  105. package/docs/zh-CN/hooks.md +14 -0
  106. package/docs/zh-CN/manifests.md +136 -0
  107. package/docs/zh-CN/mcp.md +205 -0
  108. package/docs/zh-CN/quickstart.md +35 -0
  109. package/docs/zh-CN/rules.md +7 -0
  110. package/docs/zh-CN/technical-details.md +454 -0
  111. package/docs/zh-CN/troubleshooting.md +19 -0
  112. package/docs/zh-CN/windows-setup.md +67 -0
  113. package/install.sh +183 -0
  114. package/package.json +97 -0
  115. package/skills/git-ai-mcp/SKILL.md +86 -0
  116. package/skills/git-ai-mcp/references/constraints.md +143 -0
  117. package/skills/git-ai-mcp/references/tools.md +263 -0
  118. package/templates/agents/common/documents/Fix EISDIR error and enable multi-language indexing.md +14 -0
  119. package/templates/agents/common/documents/Fix git-ai index error in CodaGraph directory.md +13 -0
  120. package/templates/agents/common/skills/git-ai-mcp/SKILL.md +86 -0
  121. package/templates/agents/common/skills/git-ai-mcp/references/constraints.md +143 -0
  122. package/templates/agents/common/skills/git-ai-mcp/references/tools.md +263 -0
@@ -0,0 +1,263 @@
1
+ # git-ai MCP Tools Reference
2
+
3
+ Complete documentation for all git-ai MCP tools.
4
+
5
+ ## Index Management
6
+
7
+ ### check_index
8
+
9
+ Check if repository index is ready and compatible.
10
+
11
+ ```js
12
+ check_index({ path: "/abs/path/to/repo" })
13
+ ```
14
+
15
+ **Returns:** Index status, compatibility info, and recommendations.
16
+
17
+ **When to use:** Before any search or graph operation.
18
+
19
+ ### rebuild_index
20
+
21
+ Rebuild the repository index from scratch.
22
+
23
+ ```js
24
+ rebuild_index({ path: "/abs/path/to/repo" })
25
+ ```
26
+
27
+ **Parameters:**
28
+ - `path` (required): Absolute path to repository root
29
+ - `overwrite` (optional): Whether to overwrite existing index (default: true)
30
+ - `dim` (optional): Vector dimension (default: 256)
31
+
32
+ **Note:** Can be slow for large repositories. Use when index is missing or incompatible.
33
+
34
+ ### pack_index / unpack_index
35
+
36
+ Package index for storage or distribution.
37
+
38
+ ```js
39
+ pack_index({ path: "/repo", lfs: true }) // Pack with LFS tracking
40
+ unpack_index({ path: "/repo" }) // Restore from archive
41
+ ```
42
+
43
+ ## Search Tools
44
+
45
+ ### repo_map
46
+
47
+ Get a high-level overview of repository structure.
48
+
49
+ ```js
50
+ repo_map({
51
+ path: "/abs/path/to/repo",
52
+ max_files: 20, // Top files by importance
53
+ max_symbols: 5 // Top symbols per file
54
+ })
55
+ ```
56
+
57
+ **When to use:** First contact with a repository, before large changes.
58
+
59
+ ### search_symbols
60
+
61
+ Search for symbols by name pattern.
62
+
63
+ ```js
64
+ search_symbols({
65
+ path: "/repo",
66
+ query: "handleRequest",
67
+ mode: "substring", // substring | prefix | wildcard | regex | fuzzy
68
+ limit: 50,
69
+ case_insensitive: false
70
+ })
71
+ ```
72
+
73
+ **Modes:**
74
+ - `substring`: Match anywhere in name (default)
75
+ - `prefix`: Match start of name
76
+ - `wildcard`: Use `*` and `?` wildcards
77
+ - `regex`: Full regex support
78
+ - `fuzzy`: Typo-tolerant matching
79
+
80
+ ### semantic_search
81
+
82
+ Search code by meaning using vector similarity.
83
+
84
+ ```js
85
+ semantic_search({
86
+ path: "/repo",
87
+ query: "user authentication and session management",
88
+ topk: 10,
89
+ lang: "auto" // auto | all | java | ts
90
+ })
91
+ ```
92
+
93
+ **When to use:** Understanding functional intent, finding conceptually related code.
94
+
95
+ ## AST Graph Tools
96
+
97
+ ### ast_graph_find
98
+
99
+ Find symbols by name prefix in the AST graph.
100
+
101
+ ```js
102
+ ast_graph_find({
103
+ path: "/repo",
104
+ prefix: "handle",
105
+ limit: 50
106
+ })
107
+ ```
108
+
109
+ ### ast_graph_callers
110
+
111
+ Find all functions that call a given function.
112
+
113
+ ```js
114
+ ast_graph_callers({
115
+ path: "/repo",
116
+ name: "authenticateUser",
117
+ limit: 200
118
+ })
119
+ ```
120
+
121
+ **When to use:** Impact analysis before refactoring, understanding usage patterns.
122
+
123
+ ### ast_graph_callees
124
+
125
+ Find all functions called by a given function.
126
+
127
+ ```js
128
+ ast_graph_callees({
129
+ path: "/repo",
130
+ name: "processOrder",
131
+ limit: 200
132
+ })
133
+ ```
134
+
135
+ **When to use:** Understanding implementation details, dependency analysis.
136
+
137
+ ### ast_graph_chain
138
+
139
+ Trace complete call chain in either direction.
140
+
141
+ ```js
142
+ ast_graph_chain({
143
+ path: "/repo",
144
+ name: "handlePayment",
145
+ direction: "downstream", // downstream | upstream
146
+ max_depth: 3,
147
+ limit: 500
148
+ })
149
+ ```
150
+
151
+ **Directions:**
152
+ - `downstream`: What does this function call? (implementation details)
153
+ - `upstream`: Who calls this function? (usage/impact)
154
+
155
+ **When to use:** Complex flow analysis, understanding system architecture.
156
+
157
+ ### ast_graph_children
158
+
159
+ List direct children in AST containment (file → symbols, class → methods).
160
+
161
+ ```js
162
+ ast_graph_children({
163
+ path: "/repo",
164
+ id: "src/auth/service.ts",
165
+ as_file: true // Treat id as file path
166
+ })
167
+ ```
168
+
169
+ ### ast_graph_refs
170
+
171
+ Find all references to a name (calls, new expressions, type references).
172
+
173
+ ```js
174
+ ast_graph_refs({
175
+ path: "/repo",
176
+ name: "UserService",
177
+ limit: 200
178
+ })
179
+ ```
180
+
181
+ ## DSR Tools (Deterministic Semantic Records)
182
+
183
+ ### dsr_context
184
+
185
+ Get repository Git context and DSR directory state.
186
+
187
+ ```js
188
+ dsr_context({ path: "/repo" })
189
+ ```
190
+
191
+ **Returns:** Branch info, commit status, DSR availability.
192
+
193
+ ### dsr_generate
194
+
195
+ Generate DSR for a specific commit.
196
+
197
+ ```js
198
+ dsr_generate({
199
+ path: "/repo",
200
+ commit: "HEAD" // or specific commit hash
201
+ })
202
+ ```
203
+
204
+ **When to use:** Before querying history for commits without DSR.
205
+
206
+ ### dsr_symbol_evolution
207
+
208
+ Track how a symbol changed over time.
209
+
210
+ ```js
211
+ dsr_symbol_evolution({
212
+ path: "/repo",
213
+ symbol: "authenticateUser",
214
+ limit: 50,
215
+ contains: false, // true for substring match
216
+ all: false // true to traverse all refs, not just HEAD
217
+ })
218
+ ```
219
+
220
+ **Returns:** List of changes with:
221
+ - `commit`: Commit hash
222
+ - `operation`: add | modify | delete | rename
223
+ - `risk_level`: low | medium | high
224
+ - `details`: Change description
225
+
226
+ **When to use:** Understanding design evolution, finding when/why something changed.
227
+
228
+ ### dsr_rebuild_index
229
+
230
+ Rebuild DSR index from DSR files.
231
+
232
+ ```js
233
+ dsr_rebuild_index({ path: "/repo" })
234
+ ```
235
+
236
+ ## File Operations
237
+
238
+ ### read_file
239
+
240
+ Read file content with optional line range.
241
+
242
+ ```js
243
+ read_file({
244
+ path: "/repo",
245
+ file: "src/auth/service.ts", // Relative to repo root
246
+ start_line: 1,
247
+ end_line: 200
248
+ })
249
+ ```
250
+
251
+ **Best practice:** Use with `start_line`/`end_line` for large files.
252
+
253
+ ### list_files
254
+
255
+ List repository files by glob pattern.
256
+
257
+ ```js
258
+ list_files({
259
+ path: "/repo",
260
+ pattern: "src/**/*.ts",
261
+ limit: 500
262
+ })
263
+ ```
@@ -0,0 +1,14 @@
1
+ The user encountered an `EISDIR: illegal operation on a directory, read` error when running `git-ai ai index`. This is caused by the file globbing logic inadvertently matching directories (likely due to a directory name matching the file extension pattern or default glob behavior), and then trying to read them as files.
2
+
3
+ Additionally, the current indexer implementation (`src/core/indexer.ts` and `src/core/lancedb.ts`) only supports `java` and `ts`, missing the newly added languages (C, Go, Python, PHP, Rust).
4
+
5
+ I will fix the error and enable full multi-language support by:
6
+
7
+ 1. **Updating `src/core/lancedb.ts`**: Expand the `IndexLang` type and `ALL_INDEX_LANGS` array to include `c`, `go`, `python`, `php`, and `rust`.
8
+ 2. **Updating `src/core/indexer.ts`**:
9
+ * Modify the `glob` pattern to include extensions for all supported languages (`.c`, `.h`, `.go`, `.py`, `.php`, `.rs`).
10
+ * **Crucial Fix**: Add `nodir: true` to the `glob` options to ensure only files are returned, preventing the `EISDIR` error.
11
+ * Update `inferIndexLang` to correctly map file extensions to the new `IndexLang` types.
12
+ * Add an extra `fs.stat` check before parsing as a safety net.
13
+
14
+ This will resolve the crash and enable indexing for the full polyglot stack.
@@ -0,0 +1,13 @@
1
+ The error is caused by `ts-node` (running in development mode) failing to find type definitions for `tree-sitter-php` when executed from the `CodaGraph` directory. This happens because `tree-sitter-php` (v0.20.0) does not include built-in TypeScript definitions, unlike the other language parsers (C, Go, Python, Rust) which are newer versions (v0.21+) or include types.
2
+
3
+ Although `src/modules.d.ts` exists, `ts-node` is not picking it up correctly in this execution context.
4
+
5
+ I will fix this by:
6
+ 1. Explicitly referencing the type declaration file in `src/core/parser/php.ts` using a triple-slash directive. This ensures TypeScript always loads the definitions regardless of the working directory.
7
+ 2. Updating `src/modules.d.ts` to remove unnecessary declarations for other languages (C, Go, Python, Rust) since they already provide official types, keeping only the necessary one for PHP.
8
+ 3. Verifying the fix by running the index command again.
9
+
10
+ Implementation Steps:
11
+ 1. **Edit `src/core/parser/php.ts`**: Add `/// <reference path="../../modules.d.ts" />` to the top of the file.
12
+ 2. **Edit `src/modules.d.ts`**: Remove declarations for C, Go, Python, and Rust; keep only `tree-sitter-php`.
13
+ 3. **Verify**: Run the index command in the `CodaGraph` directory to confirm success.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: git-ai-mcp
3
+ description: |
4
+ Efficient codebase understanding and navigation using git-ai MCP tools. Use when working with code repositories that have git-ai indexed, including: (1) Understanding project structure and architecture, (2) Searching for symbols, functions, or semantic concepts, (3) Analyzing code relationships and call graphs, (4) Tracking symbol evolution and change history via DSR, (5) Reading and navigating code files. Triggers: "understand this project", "find function X", "who calls X", "what does X call", "history of X", "where is X implemented".
5
+ ---
6
+
7
+ # git-ai MCP Skill
8
+
9
+ Guide for using git-ai MCP tools to understand and navigate codebases efficiently.
10
+
11
+ ## Overview
12
+
13
+ git-ai provides semantic code understanding through:
14
+
15
+ - **Hyper RAG**: Vector + Graph + DSR retrieval
16
+ - **AST Analysis**: Symbol relationships and call graphs
17
+ - **DSR**: Deterministic Semantic Records for change tracking
18
+
19
+ ## Workflow
20
+
21
+ Understanding a codebase involves these steps:
22
+
23
+ 1. Get global view (run `repo_map`)
24
+ 2. Check index status (run `check_index`, rebuild if needed)
25
+ 3. Locate code (run `search_symbols` or `semantic_search`)
26
+ 4. Analyze relationships (run `ast_graph_callers/callees/chain`)
27
+ 5. Trace history (run `dsr_symbol_evolution`)
28
+ 6. Read code (run `read_file`)
29
+
30
+ ## Tool Selection
31
+
32
+ | Task | Tool | Key Parameters |
33
+ |------|------|----------------|
34
+ | Project overview | `repo_map` | `path`, `max_files: 20` |
35
+ | Find by name | `search_symbols` | `path`, `query`, `mode: substring` |
36
+ | Find by meaning | `semantic_search` | `path`, `query`, `topk: 10` |
37
+ | Who calls X | `ast_graph_callers` | `path`, `name` |
38
+ | What X calls | `ast_graph_callees` | `path`, `name` |
39
+ | Call chain | `ast_graph_chain` | `path`, `name`, `direction`, `max_depth` |
40
+ | Symbol history | `dsr_symbol_evolution` | `path`, `symbol`, `limit` |
41
+ | Read code | `read_file` | `path`, `file`, `start_line`, `end_line` |
42
+ | Index health | `check_index` | `path` |
43
+ | Rebuild index | `rebuild_index` | `path` |
44
+
45
+ ## Critical Rules
46
+
47
+ **MUST follow:**
48
+
49
+ 1. **Always pass `path` explicitly** - Never rely on implicit working directory
50
+ 2. **Check index before search** - Run `check_index` before using search/graph tools
51
+ 3. **Read before modify** - Use `read_file` to understand code before making changes
52
+ 4. **Use DSR for history** - Never manually parse git log; use `dsr_symbol_evolution`
53
+
54
+ **NEVER do:**
55
+
56
+ - Assume symbol locations without searching
57
+ - Modify files without reading them first
58
+ - Search when index is missing or incompatible
59
+ - Ignore DSR risk levels (high risk = extra review needed)
60
+
61
+ ## Examples
62
+
63
+ **Find authentication code:**
64
+ ```js
65
+ semantic_search({ path: "/repo", query: "user authentication logic", topk: 10 })
66
+ ```
67
+
68
+ **Find who calls a function:**
69
+ ```js
70
+ ast_graph_callers({ path: "/repo", name: "handleRequest", limit: 50 })
71
+ ```
72
+
73
+ **Trace call chain upstream:**
74
+ ```js
75
+ ast_graph_chain({ path: "/repo", name: "processOrder", direction: "upstream", max_depth: 3 })
76
+ ```
77
+
78
+ **View symbol history:**
79
+ ```js
80
+ dsr_symbol_evolution({ path: "/repo", symbol: "authenticateUser", limit: 50 })
81
+ ```
82
+
83
+ ## References
84
+
85
+ - **Tool details**: See [references/tools.md](references/tools.md) for complete tool documentation
86
+ - **Constraints**: See [references/constraints.md](references/constraints.md) for behavioral rules
@@ -0,0 +1,143 @@
1
+ # git-ai MCP Behavioral Constraints
2
+
3
+ Rules and constraints for using git-ai MCP tools effectively and safely.
4
+
5
+ ## Must-Follow Rules (Error Level)
6
+
7
+ ### 1. explicit_path
8
+
9
+ **Rule:** Every MCP tool call MUST include an explicit `path` parameter.
10
+
11
+ **Why:** Ensures atomic, reproducible calls. Never rely on process state or working directory.
12
+
13
+ **Good:**
14
+ ```js
15
+ search_symbols({ path: "/abs/path/to/repo", query: "handleRequest" })
16
+ ```
17
+
18
+ **Bad:**
19
+ ```js
20
+ search_symbols({ query: "handleRequest" }) // Missing path!
21
+ ```
22
+
23
+ ### 2. check_index_first
24
+
25
+ **Rule:** Before using `search_symbols`, `semantic_search`, or any `ast_graph_*` tool, MUST call `check_index` to verify index is ready.
26
+
27
+ **Why:** These tools depend on the index. Searching with a missing/incompatible index gives unreliable results.
28
+
29
+ **Workflow:**
30
+ ```js
31
+ // Step 1: Check index
32
+ const status = check_index({ path: "/repo" })
33
+
34
+ // Step 2: Rebuild if needed
35
+ if (!status.compatible) {
36
+ rebuild_index({ path: "/repo" })
37
+ }
38
+
39
+ // Step 3: Now safe to search
40
+ search_symbols({ path: "/repo", query: "..." })
41
+ ```
42
+
43
+ ### 3. understand_before_modify
44
+
45
+ **Rule:** Before modifying any file, MUST:
46
+ 1. Use `search_symbols` to locate the code
47
+ 2. Use `read_file` to understand the implementation
48
+ 3. Use `ast_graph_callers` to assess impact
49
+ 4. Only then make changes
50
+
51
+ **Why:** Prevents breaking changes and ensures informed modifications.
52
+
53
+ ### 4. use_dsr_for_history
54
+
55
+ **Rule:** When tracing symbol history, MUST use `dsr_symbol_evolution`. NEVER manually parse git log or diff.
56
+
57
+ **Why:** DSR provides structured, semantic change information that raw git commands don't.
58
+
59
+ ## Warning-Level Rules
60
+
61
+ ### 5. repo_map_before_large_change
62
+
63
+ **Rule:** Before large refactoring or architectural changes, use `repo_map` to understand project structure.
64
+
65
+ **Why:** Provides context for planning changes and identifying affected areas.
66
+
67
+ ### 6. respect_dsr_risk
68
+
69
+ **Rule:** When DSR reports `risk_level: high`, exercise extra caution. Operations like `delete` and `rename` require additional review.
70
+
71
+ **Risk levels:**
72
+ - `low`: Safe, routine changes
73
+ - `medium`: Review recommended
74
+ - `high`: Extra scrutiny required
75
+
76
+ ## Recommended Practices
77
+
78
+ ### prefer_semantic_search
79
+
80
+ For understanding functional intent, prefer `semantic_search` over `search_symbols`.
81
+
82
+ **Use `semantic_search` when:**
83
+ - Looking for conceptual functionality
84
+ - Query is in natural language
85
+ - Exact name is unknown
86
+
87
+ **Use `search_symbols` when:**
88
+ - Exact or partial name is known
89
+ - Looking for specific identifiers
90
+
91
+ ### use_call_chain_for_complex_flow
92
+
93
+ For complex flows spanning multiple functions, use `ast_graph_chain` instead of manually chaining `callers`/`callees` calls.
94
+
95
+ ```js
96
+ // Good: Single call for complete chain
97
+ ast_graph_chain({ path: "/repo", name: "processPayment", direction: "upstream", max_depth: 5 })
98
+
99
+ // Avoid: Manual recursive calls
100
+ ast_graph_callers({ path: "/repo", name: "processPayment" })
101
+ // then for each result...
102
+ ast_graph_callers({ path: "/repo", name: result.name })
103
+ // etc.
104
+ ```
105
+
106
+ ### incremental_dsr_generation
107
+
108
+ Generate DSR on-demand for specific commits rather than batch-generating for entire history.
109
+
110
+ ```js
111
+ // Good: Generate for specific commit when needed
112
+ dsr_generate({ path: "/repo", commit: "abc123" })
113
+
114
+ // Avoid: Generating for all historical commits upfront
115
+ ```
116
+
117
+ ## Prohibited Actions
118
+
119
+ | Action | Reason |
120
+ |--------|--------|
121
+ | Assume symbol location without searching | Always confirm via search |
122
+ | Modify unread files | Must read and understand first |
123
+ | Manual git log parsing for history | Use DSR tools instead |
124
+ | Search with missing index | Rebuild index first |
125
+ | Ignore high risk DSR warnings | Requires extra review |
126
+ | Omit `path` parameter | Every call must be explicit |
127
+
128
+ ## Tool-Specific Constraints
129
+
130
+ | Tool | Precondition | Required Params |
131
+ |------|--------------|-----------------|
132
+ | `repo_map` | None | `path` |
133
+ | `check_index` | None | `path` |
134
+ | `rebuild_index` | None | `path` |
135
+ | `search_symbols` | `check_index` passed | `path`, `query` |
136
+ | `semantic_search` | `check_index` passed | `path`, `query` |
137
+ | `ast_graph_callers` | `check_index` passed | `path`, `name` |
138
+ | `ast_graph_callees` | `check_index` passed | `path`, `name` |
139
+ | `ast_graph_chain` | `check_index` passed | `path`, `name` |
140
+ | `dsr_context` | None | `path` |
141
+ | `dsr_generate` | None | `path`, `commit` |
142
+ | `dsr_symbol_evolution` | DSR exists for commits | `path`, `symbol` |
143
+ | `read_file` | None | `path`, `file` |