codesift-mcp 0.1.0 → 0.2.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 (299) hide show
  1. package/LICENSE +66 -21
  2. package/README.md +346 -56
  3. package/dist/cli/args.d.ts +2 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +11 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/commands.d.ts.map +1 -1
  8. package/dist/cli/commands.js +177 -67
  9. package/dist/cli/commands.js.map +1 -1
  10. package/dist/cli/help.d.ts +1 -1
  11. package/dist/cli/help.d.ts.map +1 -1
  12. package/dist/cli/help.js +157 -0
  13. package/dist/cli/help.js.map +1 -1
  14. package/dist/cli/hooks.d.ts +3 -0
  15. package/dist/cli/hooks.d.ts.map +1 -0
  16. package/dist/cli/hooks.js +163 -0
  17. package/dist/cli/hooks.js.map +1 -0
  18. package/dist/cli/setup.d.ts +25 -0
  19. package/dist/cli/setup.d.ts.map +1 -0
  20. package/dist/cli/setup.js +400 -0
  21. package/dist/cli/setup.js.map +1 -0
  22. package/dist/config.d.ts +2 -0
  23. package/dist/config.d.ts.map +1 -1
  24. package/dist/config.js +2 -0
  25. package/dist/config.js.map +1 -1
  26. package/dist/formatters-shortening.d.ts +7 -0
  27. package/dist/formatters-shortening.d.ts.map +1 -0
  28. package/dist/formatters-shortening.js +68 -0
  29. package/dist/formatters-shortening.js.map +1 -0
  30. package/dist/formatters.d.ts +314 -0
  31. package/dist/formatters.d.ts.map +1 -0
  32. package/dist/formatters.js +396 -0
  33. package/dist/formatters.js.map +1 -0
  34. package/dist/instructions.d.ts +6 -0
  35. package/dist/instructions.d.ts.map +1 -0
  36. package/dist/instructions.js +72 -0
  37. package/dist/instructions.js.map +1 -0
  38. package/dist/lsp/lsp-client.d.ts +21 -0
  39. package/dist/lsp/lsp-client.d.ts.map +1 -0
  40. package/dist/lsp/lsp-client.js +122 -0
  41. package/dist/lsp/lsp-client.js.map +1 -0
  42. package/dist/lsp/lsp-manager.d.ts +12 -0
  43. package/dist/lsp/lsp-manager.d.ts.map +1 -0
  44. package/dist/lsp/lsp-manager.js +82 -0
  45. package/dist/lsp/lsp-manager.js.map +1 -0
  46. package/dist/lsp/lsp-servers.d.ts +13 -0
  47. package/dist/lsp/lsp-servers.d.ts.map +1 -0
  48. package/dist/lsp/lsp-servers.js +57 -0
  49. package/dist/lsp/lsp-servers.js.map +1 -0
  50. package/dist/lsp/lsp-tools.d.ts +67 -0
  51. package/dist/lsp/lsp-tools.d.ts.map +1 -0
  52. package/dist/lsp/lsp-tools.js +359 -0
  53. package/dist/lsp/lsp-tools.js.map +1 -0
  54. package/dist/parser/extractors/_shared.d.ts +11 -0
  55. package/dist/parser/extractors/_shared.d.ts.map +1 -0
  56. package/dist/parser/extractors/_shared.js +38 -0
  57. package/dist/parser/extractors/_shared.js.map +1 -0
  58. package/dist/parser/extractors/astro.d.ts +15 -0
  59. package/dist/parser/extractors/astro.d.ts.map +1 -0
  60. package/dist/parser/extractors/astro.js +104 -0
  61. package/dist/parser/extractors/astro.js.map +1 -0
  62. package/dist/parser/extractors/conversation.d.ts +16 -0
  63. package/dist/parser/extractors/conversation.d.ts.map +1 -0
  64. package/dist/parser/extractors/conversation.js +196 -0
  65. package/dist/parser/extractors/conversation.js.map +1 -0
  66. package/dist/parser/extractors/go.d.ts.map +1 -1
  67. package/dist/parser/extractors/go.js +22 -45
  68. package/dist/parser/extractors/go.js.map +1 -1
  69. package/dist/parser/extractors/python.d.ts +1 -1
  70. package/dist/parser/extractors/python.d.ts.map +1 -1
  71. package/dist/parser/extractors/python.js +19 -50
  72. package/dist/parser/extractors/python.js.map +1 -1
  73. package/dist/parser/extractors/rust.d.ts +1 -1
  74. package/dist/parser/extractors/rust.d.ts.map +1 -1
  75. package/dist/parser/extractors/rust.js +7 -34
  76. package/dist/parser/extractors/rust.js.map +1 -1
  77. package/dist/parser/extractors/typescript.d.ts +1 -1
  78. package/dist/parser/extractors/typescript.d.ts.map +1 -1
  79. package/dist/parser/extractors/typescript.js +99 -68
  80. package/dist/parser/extractors/typescript.js.map +1 -1
  81. package/dist/parser/parser-manager.d.ts.map +1 -1
  82. package/dist/parser/parser-manager.js +12 -2
  83. package/dist/parser/parser-manager.js.map +1 -1
  84. package/dist/parser/symbol-extractor.d.ts +2 -0
  85. package/dist/parser/symbol-extractor.d.ts.map +1 -1
  86. package/dist/parser/symbol-extractor.js +2 -0
  87. package/dist/parser/symbol-extractor.js.map +1 -1
  88. package/dist/register-tools.d.ts +127 -0
  89. package/dist/register-tools.d.ts.map +1 -0
  90. package/dist/register-tools.js +1453 -0
  91. package/dist/register-tools.js.map +1 -0
  92. package/dist/retrieval/codebase-retrieval.d.ts +4 -26
  93. package/dist/retrieval/codebase-retrieval.d.ts.map +1 -1
  94. package/dist/retrieval/codebase-retrieval.js +105 -403
  95. package/dist/retrieval/codebase-retrieval.js.map +1 -1
  96. package/dist/retrieval/retrieval-constants.d.ts +27 -0
  97. package/dist/retrieval/retrieval-constants.d.ts.map +1 -0
  98. package/dist/retrieval/retrieval-constants.js +27 -0
  99. package/dist/retrieval/retrieval-constants.js.map +1 -0
  100. package/dist/retrieval/retrieval-schemas.d.ts +107 -0
  101. package/dist/retrieval/retrieval-schemas.d.ts.map +1 -0
  102. package/dist/retrieval/retrieval-schemas.js +102 -0
  103. package/dist/retrieval/retrieval-schemas.js.map +1 -0
  104. package/dist/retrieval/retrieval-utils.d.ts +40 -0
  105. package/dist/retrieval/retrieval-utils.d.ts.map +1 -0
  106. package/dist/retrieval/retrieval-utils.js +139 -0
  107. package/dist/retrieval/retrieval-utils.js.map +1 -0
  108. package/dist/retrieval/semantic-handlers.d.ts +8 -0
  109. package/dist/retrieval/semantic-handlers.d.ts.map +1 -0
  110. package/dist/retrieval/semantic-handlers.js +152 -0
  111. package/dist/retrieval/semantic-handlers.js.map +1 -0
  112. package/dist/search/bm25.d.ts +6 -1
  113. package/dist/search/bm25.d.ts.map +1 -1
  114. package/dist/search/bm25.js +95 -32
  115. package/dist/search/bm25.js.map +1 -1
  116. package/dist/search/chunker.d.ts +10 -0
  117. package/dist/search/chunker.d.ts.map +1 -1
  118. package/dist/search/chunker.js +63 -11
  119. package/dist/search/chunker.js.map +1 -1
  120. package/dist/search/reranker.d.ts +15 -0
  121. package/dist/search/reranker.d.ts.map +1 -0
  122. package/dist/search/reranker.js +126 -0
  123. package/dist/search/reranker.js.map +1 -0
  124. package/dist/search/semantic.d.ts +1 -1
  125. package/dist/search/semantic.d.ts.map +1 -1
  126. package/dist/search/semantic.js +40 -45
  127. package/dist/search/semantic.js.map +1 -1
  128. package/dist/server-helpers.d.ts +29 -0
  129. package/dist/server-helpers.d.ts.map +1 -0
  130. package/dist/server-helpers.js +312 -0
  131. package/dist/server-helpers.js.map +1 -0
  132. package/dist/server.d.ts +1 -1
  133. package/dist/server.d.ts.map +1 -1
  134. package/dist/server.js +11 -271
  135. package/dist/server.js.map +1 -1
  136. package/dist/storage/_shared.d.ts +9 -0
  137. package/dist/storage/_shared.d.ts.map +1 -0
  138. package/dist/storage/_shared.js +26 -0
  139. package/dist/storage/_shared.js.map +1 -0
  140. package/dist/storage/chunk-store.d.ts.map +1 -1
  141. package/dist/storage/chunk-store.js +23 -63
  142. package/dist/storage/chunk-store.js.map +1 -1
  143. package/dist/storage/embedding-store.d.ts +6 -3
  144. package/dist/storage/embedding-store.d.ts.map +1 -1
  145. package/dist/storage/embedding-store.js +54 -30
  146. package/dist/storage/embedding-store.js.map +1 -1
  147. package/dist/storage/graph-store.d.ts +48 -0
  148. package/dist/storage/graph-store.d.ts.map +1 -0
  149. package/dist/storage/graph-store.js +52 -0
  150. package/dist/storage/graph-store.js.map +1 -0
  151. package/dist/storage/index-store.d.ts +5 -0
  152. package/dist/storage/index-store.d.ts.map +1 -1
  153. package/dist/storage/index-store.js +28 -16
  154. package/dist/storage/index-store.js.map +1 -1
  155. package/dist/storage/registry.d.ts +4 -0
  156. package/dist/storage/registry.d.ts.map +1 -1
  157. package/dist/storage/registry.js +16 -16
  158. package/dist/storage/registry.js.map +1 -1
  159. package/dist/storage/usage-stats.d.ts +6 -0
  160. package/dist/storage/usage-stats.d.ts.map +1 -1
  161. package/dist/storage/usage-stats.js +59 -11
  162. package/dist/storage/usage-stats.js.map +1 -1
  163. package/dist/storage/usage-tracker.d.ts +3 -0
  164. package/dist/storage/usage-tracker.d.ts.map +1 -1
  165. package/dist/storage/usage-tracker.js +50 -132
  166. package/dist/storage/usage-tracker.js.map +1 -1
  167. package/dist/storage/watcher.d.ts +2 -1
  168. package/dist/storage/watcher.d.ts.map +1 -1
  169. package/dist/storage/watcher.js +16 -16
  170. package/dist/storage/watcher.js.map +1 -1
  171. package/dist/tools/ast-query-tools.d.ts +29 -0
  172. package/dist/tools/ast-query-tools.d.ts.map +1 -0
  173. package/dist/tools/ast-query-tools.js +110 -0
  174. package/dist/tools/ast-query-tools.js.map +1 -0
  175. package/dist/tools/boundary-tools.d.ts +31 -0
  176. package/dist/tools/boundary-tools.d.ts.map +1 -0
  177. package/dist/tools/boundary-tools.js +62 -0
  178. package/dist/tools/boundary-tools.js.map +1 -0
  179. package/dist/tools/clone-tools.d.ts +35 -0
  180. package/dist/tools/clone-tools.d.ts.map +1 -0
  181. package/dist/tools/clone-tools.js +181 -0
  182. package/dist/tools/clone-tools.js.map +1 -0
  183. package/dist/tools/community-tools.d.ts +23 -0
  184. package/dist/tools/community-tools.d.ts.map +1 -0
  185. package/dist/tools/community-tools.js +297 -0
  186. package/dist/tools/community-tools.js.map +1 -0
  187. package/dist/tools/complexity-tools.d.ts +34 -0
  188. package/dist/tools/complexity-tools.d.ts.map +1 -0
  189. package/dist/tools/complexity-tools.js +135 -0
  190. package/dist/tools/complexity-tools.js.map +1 -0
  191. package/dist/tools/context-tools.d.ts +44 -3
  192. package/dist/tools/context-tools.d.ts.map +1 -1
  193. package/dist/tools/context-tools.js +329 -99
  194. package/dist/tools/context-tools.js.map +1 -1
  195. package/dist/tools/conversation-tools.d.ts +107 -0
  196. package/dist/tools/conversation-tools.d.ts.map +1 -0
  197. package/dist/tools/conversation-tools.js +419 -0
  198. package/dist/tools/conversation-tools.js.map +1 -0
  199. package/dist/tools/coordinator-tools.d.ts +73 -0
  200. package/dist/tools/coordinator-tools.d.ts.map +1 -0
  201. package/dist/tools/coordinator-tools.js +153 -0
  202. package/dist/tools/coordinator-tools.js.map +1 -0
  203. package/dist/tools/cross-repo-tools.d.ts +43 -0
  204. package/dist/tools/cross-repo-tools.d.ts.map +1 -0
  205. package/dist/tools/cross-repo-tools.js +55 -0
  206. package/dist/tools/cross-repo-tools.js.map +1 -0
  207. package/dist/tools/diff-tools.d.ts +4 -1
  208. package/dist/tools/diff-tools.d.ts.map +1 -1
  209. package/dist/tools/diff-tools.js +23 -5
  210. package/dist/tools/diff-tools.js.map +1 -1
  211. package/dist/tools/frequency-tools.d.ts +46 -0
  212. package/dist/tools/frequency-tools.d.ts.map +1 -0
  213. package/dist/tools/frequency-tools.js +184 -0
  214. package/dist/tools/frequency-tools.js.map +1 -0
  215. package/dist/tools/generate-tools.d.ts.map +1 -1
  216. package/dist/tools/generate-tools.js +13 -2
  217. package/dist/tools/generate-tools.js.map +1 -1
  218. package/dist/tools/graph-tools.d.ts +44 -11
  219. package/dist/tools/graph-tools.d.ts.map +1 -1
  220. package/dist/tools/graph-tools.js +147 -104
  221. package/dist/tools/graph-tools.js.map +1 -1
  222. package/dist/tools/hotspot-tools.d.ts +24 -0
  223. package/dist/tools/hotspot-tools.d.ts.map +1 -0
  224. package/dist/tools/hotspot-tools.js +122 -0
  225. package/dist/tools/hotspot-tools.js.map +1 -0
  226. package/dist/tools/impact-tools.d.ts +13 -0
  227. package/dist/tools/impact-tools.d.ts.map +1 -0
  228. package/dist/tools/impact-tools.js +238 -0
  229. package/dist/tools/impact-tools.js.map +1 -0
  230. package/dist/tools/index-tools.d.ts +44 -3
  231. package/dist/tools/index-tools.d.ts.map +1 -1
  232. package/dist/tools/index-tools.js +530 -222
  233. package/dist/tools/index-tools.js.map +1 -1
  234. package/dist/tools/memory-tools.d.ts +35 -0
  235. package/dist/tools/memory-tools.d.ts.map +1 -0
  236. package/dist/tools/memory-tools.js +229 -0
  237. package/dist/tools/memory-tools.js.map +1 -0
  238. package/dist/tools/outline-tools.d.ts +24 -13
  239. package/dist/tools/outline-tools.d.ts.map +1 -1
  240. package/dist/tools/outline-tools.js +113 -87
  241. package/dist/tools/outline-tools.js.map +1 -1
  242. package/dist/tools/pattern-tools.d.ts +32 -0
  243. package/dist/tools/pattern-tools.d.ts.map +1 -0
  244. package/dist/tools/pattern-tools.js +116 -0
  245. package/dist/tools/pattern-tools.js.map +1 -0
  246. package/dist/tools/report-tools.d.ts +5 -0
  247. package/dist/tools/report-tools.d.ts.map +1 -0
  248. package/dist/tools/report-tools.js +167 -0
  249. package/dist/tools/report-tools.js.map +1 -0
  250. package/dist/tools/review-diff-tools.d.ts +148 -0
  251. package/dist/tools/review-diff-tools.d.ts.map +1 -0
  252. package/dist/tools/review-diff-tools.js +852 -0
  253. package/dist/tools/review-diff-tools.js.map +1 -0
  254. package/dist/tools/route-tools.d.ts +32 -0
  255. package/dist/tools/route-tools.d.ts.map +1 -0
  256. package/dist/tools/route-tools.js +276 -0
  257. package/dist/tools/route-tools.js.map +1 -0
  258. package/dist/tools/search-ranker.d.ts +5 -0
  259. package/dist/tools/search-ranker.d.ts.map +1 -0
  260. package/dist/tools/search-ranker.js +142 -0
  261. package/dist/tools/search-ranker.js.map +1 -0
  262. package/dist/tools/search-tools.d.ts +24 -1
  263. package/dist/tools/search-tools.d.ts.map +1 -1
  264. package/dist/tools/search-tools.js +459 -225
  265. package/dist/tools/search-tools.js.map +1 -1
  266. package/dist/tools/secret-tools.d.ts +104 -0
  267. package/dist/tools/secret-tools.d.ts.map +1 -0
  268. package/dist/tools/secret-tools.js +410 -0
  269. package/dist/tools/secret-tools.js.map +1 -0
  270. package/dist/tools/symbol-tools.d.ts +90 -2
  271. package/dist/tools/symbol-tools.d.ts.map +1 -1
  272. package/dist/tools/symbol-tools.js +576 -42
  273. package/dist/tools/symbol-tools.js.map +1 -1
  274. package/dist/types.d.ts +34 -1
  275. package/dist/types.d.ts.map +1 -1
  276. package/dist/utils/framework-detect.d.ts +5 -0
  277. package/dist/utils/framework-detect.d.ts.map +1 -0
  278. package/dist/utils/framework-detect.js +36 -0
  279. package/dist/utils/framework-detect.js.map +1 -0
  280. package/dist/utils/glob.d.ts +19 -0
  281. package/dist/utils/glob.d.ts.map +1 -0
  282. package/dist/utils/glob.js +74 -0
  283. package/dist/utils/glob.js.map +1 -0
  284. package/dist/utils/import-graph.d.ts +29 -0
  285. package/dist/utils/import-graph.d.ts.map +1 -0
  286. package/dist/utils/import-graph.js +125 -0
  287. package/dist/utils/import-graph.js.map +1 -0
  288. package/dist/utils/test-file.d.ts.map +1 -1
  289. package/dist/utils/test-file.js +1 -0
  290. package/dist/utils/test-file.js.map +1 -1
  291. package/dist/utils/walk.d.ts +45 -0
  292. package/dist/utils/walk.d.ts.map +1 -0
  293. package/dist/utils/walk.js +87 -0
  294. package/dist/utils/walk.js.map +1 -0
  295. package/package.json +10 -4
  296. package/rules/codesift.md +187 -0
  297. package/rules/codesift.mdc +192 -0
  298. package/rules/codex.md +187 -0
  299. package/rules/gemini.md +187 -0
@@ -0,0 +1,87 @@
1
+ import { readdir, stat } from "node:fs/promises";
2
+ import { join, relative, extname } from "node:path";
3
+ /**
4
+ * Directories to skip during filesystem walks.
5
+ * Shared by index-tools, search-tools, and (via toIgnorePatterns) watcher.
6
+ */
7
+ export const IGNORE_DIRS = new Set([
8
+ "node_modules", ".git", "dist", "build", "coverage",
9
+ ".codesift", ".next", "__pycache__", ".pytest_cache",
10
+ ".venv", "venv", ".tox", ".mypy_cache", ".turbo",
11
+ "generated", "audit-results", ".backup", "jscpd-report",
12
+ "helpscout_export", ".output",
13
+ ]);
14
+ /**
15
+ * Convert IGNORE_DIRS to chokidar-compatible glob patterns.
16
+ * e.g., "node_modules" -> "**\/node_modules/**"
17
+ */
18
+ export function toIgnorePatterns() {
19
+ return [...IGNORE_DIRS].map((dir) => `**/${dir}/**`);
20
+ }
21
+ const DEFAULT_MAX_FILE_SIZE = 1_000_000; // 1MB
22
+ /**
23
+ * Walk a directory tree collecting files.
24
+ * Skips directories listed in IGNORE_DIRS and hidden directories (dot-prefixed).
25
+ */
26
+ export async function walkDirectory(rootPath, options) {
27
+ const files = [];
28
+ const maxFileSize = options?.maxFileSize ?? DEFAULT_MAX_FILE_SIZE;
29
+ const maxFiles = options?.maxFiles ?? Infinity;
30
+ const fileFilter = options?.fileFilter;
31
+ const includePaths = options?.includePaths;
32
+ const useRelative = options?.relative ?? false;
33
+ let limitReached = false;
34
+ async function walk(dirPath) {
35
+ if (limitReached)
36
+ return;
37
+ let entries;
38
+ try {
39
+ entries = await readdir(dirPath, { withFileTypes: true });
40
+ }
41
+ catch {
42
+ return; // permission denied, etc.
43
+ }
44
+ for (const entry of entries) {
45
+ if (limitReached)
46
+ return;
47
+ const fullPath = join(dirPath, entry.name);
48
+ if (entry.isDirectory()) {
49
+ if (IGNORE_DIRS.has(entry.name) || entry.name.startsWith(".")) {
50
+ continue;
51
+ }
52
+ await walk(fullPath);
53
+ }
54
+ else if (entry.isFile()) {
55
+ const ext = extname(entry.name);
56
+ // Apply caller's file filter (e.g. language check, binary exclusion)
57
+ if (fileFilter && !fileFilter(ext, entry.name))
58
+ continue;
59
+ // Filter by include paths if specified
60
+ if (includePaths && includePaths.length > 0) {
61
+ const relPath = relative(rootPath, fullPath);
62
+ const matches = includePaths.some((p) => relPath.startsWith(p));
63
+ if (!matches)
64
+ continue;
65
+ }
66
+ // Skip files that are too large
67
+ try {
68
+ const fileStat = await stat(fullPath);
69
+ if (fileStat.size > maxFileSize)
70
+ continue;
71
+ }
72
+ catch {
73
+ continue;
74
+ }
75
+ files.push(useRelative ? relative(rootPath, fullPath) : fullPath);
76
+ if (files.length >= maxFiles) {
77
+ console.warn(`[codesift] walkDirectory: reached ${maxFiles} file limit, returning partial results`);
78
+ limitReached = true;
79
+ return;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ await walk(rootPath);
85
+ return files;
86
+ }
87
+ //# sourceMappingURL=walk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "codesift-mcp",
3
- "version": "0.1.0",
4
- "description": "MCP server for code intelligence — 21 tools for symbol search, call graph analysis, and semantic code retrieval",
5
- "license": "MIT",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for code intelligence — 39 tools for symbol search, call graph, semantic search, route tracing, community detection, LSP bridge, and HTML reporting",
5
+ "license": "BSL-1.1",
6
6
  "author": "Greg Laskowski",
7
7
  "type": "module",
8
8
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "main": "./dist/server.js",
13
13
  "files": [
14
14
  "dist",
15
+ "rules",
15
16
  "src/parser/languages",
16
17
  "README.md",
17
18
  "LICENSE"
@@ -29,16 +30,21 @@
29
30
  },
30
31
  "dependencies": {
31
32
  "@modelcontextprotocol/sdk": "^1.0.0",
33
+ "@sanity-labs/secret-scan": "^1.1.0",
32
34
  "chokidar": "^4.0.0",
33
35
  "ignore": "^6.0.0",
34
- "web-tree-sitter": "^0.24.0"
36
+ "picomatch": "^4.0.3",
37
+ "web-tree-sitter": "^0.24.0",
38
+ "zod": "^4.3.6"
35
39
  },
36
40
  "optionalDependencies": {
41
+ "@huggingface/transformers": "^3.0.0",
37
42
  "openai": "^4.0.0",
38
43
  "voyageai": "^0.1.0"
39
44
  },
40
45
  "devDependencies": {
41
46
  "@types/node": "^22.0.0",
47
+ "@types/picomatch": "^4.0.2",
42
48
  "@vitest/coverage-v8": "^3.0.0",
43
49
  "tsx": "^4.0.0",
44
50
  "typescript": "^5.7.0",
@@ -0,0 +1,187 @@
1
+ <!-- codesift-rules v0.1.0 hash:PLACEHOLDER -->
2
+
3
+ # CodeSift MCP — Agent Rules
4
+
5
+ ## Setup
6
+
7
+ Run once per session:
8
+
9
+ 1. `list_repos()` — get the repo identifier (e.g. `local/codesift-mcp`). **Never call again** — cache the result.
10
+ 2. If the repo is missing: `index_folder(path=<root>)` once to index it.
11
+ 3. Use `"local/<folder-name>"` as the `repo` parameter for all tool calls.
12
+
13
+ ## Tool Discovery
14
+
15
+ **63 MCP tools total** (13 core visible + 50 deferred/hidden).
16
+
17
+ Only ~13 core tools appear in ListTools. Hidden tools are discovered on demand:
18
+
19
+ - `discover_tools(query="dead code")` — keyword search across all 63 tools
20
+ - `describe_tools(names=["find_dead_code"])` — get full parameter schema
21
+ - `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
22
+
23
+ Core tools always visible: `search_text`, `search_symbols`, `get_file_outline`, `get_file_tree`, `get_symbol`, `get_symbols`, `find_references`, `find_and_show`, `codebase_retrieval`, `semantic_search`, `list_repos`, `index_file`, `discover_tools`, `describe_tools`.
24
+
25
+ ## Tool Mapping
26
+
27
+ Use this table to pick the right tool for each task:
28
+
29
+ | Task | Tool |
30
+ |------|------|
31
+ | text pattern search | `search_text(file_pattern=)` |
32
+ | find function/class/type | `search_symbols(include_source=true)` |
33
+ | file structure/outline | `get_file_outline` |
34
+ | find files | `get_file_tree(compact=true)` |
35
+ | read 1 symbol | `get_symbol` |
36
+ | read 2+ symbols | `get_symbols` (batch) |
37
+ | find usages | `find_references` |
38
+ | symbol + refs in 1 call | `find_and_show(include_refs=true)` |
39
+ | call chain | `trace_call_chain` |
40
+ | blast radius | `impact_analysis(since="HEAD~3")` |
41
+ | concept question | `semantic_search` or `codebase_retrieval(queries=[{type:"semantic",...}])` |
42
+ | multi-search 3+ | `codebase_retrieval(queries=[...])` |
43
+ | symbol in context | `get_context_bundle` |
44
+ | dead code | `find_dead_code` |
45
+ | complexity | `analyze_complexity` |
46
+ | copy-paste | `find_clones` |
47
+ | anti-patterns | `search_patterns` |
48
+ | git churn | `analyze_hotspots` |
49
+ | cross-repo | `cross_repo_search` |
50
+ | circular deps | `find_circular_deps` or `get_knowledge_map(focus=)` |
51
+ | mermaid diagram | `trace_call_chain(output_format="mermaid")` |
52
+ | affected tests | `impact_analysis` → `.affected_tests` |
53
+ | explore new repo | `suggest_queries` |
54
+ | re-index 1 file | `index_file(path=)` |
55
+ | route trace | `trace_route` |
56
+ | code modules | `detect_communities(focus=)` |
57
+ | go to definition | `go_to_definition` |
58
+ | return type | `get_type_info` |
59
+ | cross-file rename | `rename_symbol` |
60
+ | scan secrets | `scan_secrets` |
61
+ | search past sessions | `search_conversations` |
62
+ | symbol ↔ conversation | `find_conversations_for_symbol` |
63
+ | index conversations | `index_conversations` |
64
+ | structural diff | `diff_outline(since=)` |
65
+ | what changed | `changed_symbols(since=)` |
66
+
67
+ ## When to Use (Situational Triggers)
68
+
69
+ | Situation | Tool |
70
+ |-----------|------|
71
+ | refactor/clean up | `analyze_complexity(top_n=10)` |
72
+ | dead code/unused | `find_dead_code` |
73
+ | unused imports | `find_unused_imports` |
74
+ | DRY/duplication | `find_clones(min_similarity=0.7)` |
75
+ | architecture/deps | `detect_communities(focus="src")` |
76
+ | module boundaries | `check_boundaries` |
77
+ | symbol roles (hub/leaf/bridge) | `classify_roles` |
78
+ | structural code patterns | `ast_query` |
79
+ | diagram/visualize | `trace_call_chain(output_format="mermaid")` |
80
+ | hotspots/tech debt | `analyze_hotspots(since_days=90)` |
81
+ | unfamiliar symbol | `get_context_bundle` |
82
+ | new repo | `suggest_queries` |
83
+ | trace endpoint | `trace_route` |
84
+ | dense context (5+ symbols) | `assemble_context(level="L1")` |
85
+ | overview only | `assemble_context(level="L3")` |
86
+ | review git diff | `review_diff` |
87
+ | code review / PR | `changed_symbols(since="HEAD~N")` + `diff_outline` |
88
+ | quick symbol + refs | `find_and_show(include_refs=true)` |
89
+ | error seen before | `search_conversations` |
90
+ | before refactoring complex fn | `find_conversations_for_symbol` |
91
+ | "we discussed this" | `search_conversations` |
92
+ | secrets/leaked keys | `scan_secrets` |
93
+ | security audit | `scan_secrets(min_confidence="high")` |
94
+ | code audit | `search_patterns("empty-catch")` |
95
+ | past decisions | `find_conversations_for_symbol` |
96
+
97
+ ## Key Parameters
98
+
99
+ ### search_symbols
100
+ - `detail_level="compact"` — locations only (~15 tok/result vs ~150 default)
101
+ - `token_budget=N` — cap output instead of guessing `top_k`
102
+ - `file_pattern=` — always pass when scope is known (e.g. `"*.ts"`, `"src/tools/"`)
103
+ - `kind=` — filter by type: `function`, `class`, `type`, `interface`
104
+ - `include_source=true` — include source code in results
105
+
106
+ ### search_text
107
+ - `group_by_file=true` — ~80% output reduction on many matches
108
+ - `auto_group=true` — auto-switch to grouped above 50 matches
109
+ - `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
110
+ - `file_pattern=` — always pass when scope is known
111
+
112
+ ### assemble_context levels
113
+ - `L0` — full source (use when editing)
114
+ - `L1` — signatures only (3× more symbols fit, use when reading)
115
+ - `L2` — file summaries
116
+ - `L3` — directory overview (91% less tokens, use for orientation)
117
+
118
+ ### codebase_retrieval
119
+ - Always pass `token_budget` to cap output
120
+ - Batch 3+ searches: `queries=[{type:"semantic",...},{type:"text",...}]`
121
+
122
+ ### get_knowledge_map
123
+ - **ALWAYS pass `focus=`** — without it returns 129K+ tokens
124
+
125
+ ## Hint Codes
126
+
127
+ The server appends hint codes to responses to guide tool usage. Act on them immediately.
128
+
129
+ | Code | Meaning | Action |
130
+ |------|---------|--------|
131
+ | `H1(n)` | n matches returned | Add `group_by_file=true` |
132
+ | `H2(n,tool)` | n consecutive identical calls | Batch into one `tool` call |
133
+ | `H3(n)` | `list_repos` called n times | Reuse cached value |
134
+ | `H4` | `include_source` without `file_pattern` | Add `file_pattern` |
135
+ | `H5(path)` | Duplicate `get_file_tree` | Use cached result |
136
+ | `H6(n)` | n results without `detail_level` | Add `detail_level='compact'` |
137
+ | `H7` | `get_symbol` after `search_symbols` | Use `get_context_bundle` |
138
+ | `H8(n)` | n× `get_symbol` calls | Use `assemble_context(level='L1')` |
139
+ | `H9` | Question-word text query | Use semantic search |
140
+
141
+ ## ALWAYS
142
+
143
+ - Use `semantic_search` or `codebase_retrieval(type:"semantic")` for conceptual questions
144
+ - Use `trace_route` FIRST for any API endpoint — NEVER multiple `search_text` + `trace_call_chain`
145
+ - Use `detect_communities` BEFORE `get_knowledge_map` — NEVER `knowledge_map` without communities first
146
+ - Use `index_file(path)` after editing — NEVER `index_folder` (9ms vs 3-8s)
147
+ - Pass `include_source=true` on `search_symbols`
148
+ - Use `get_symbols` (batch) for 2+ symbols — NEVER sequential `get_symbol`
149
+ - Batch 3+ searches into `codebase_retrieval`
150
+ - Use `search_conversations` when encountering error/bug that may have been solved before
151
+ - Use `Read` tool when file path is already known — CodeSift excels at discovery
152
+
153
+ ## NEVER
154
+
155
+ - Call `index_folder` if repo already in `list_repos` — file watcher auto-updates
156
+ - Call `list_repos` more than once per session
157
+ - Use manual Edit on multiple files for rename — use `rename_symbol`
158
+ - Read entire file just to get a return type — use `get_type_info`
159
+ - Index worktrees — use the main repo index
160
+ - Call `get_knowledge_map` without `focus=` parameter
161
+
162
+ ## Response Cascade
163
+
164
+ Large responses auto-shorten to stay within token limits:
165
+
166
+ | Threshold | Format | Annotation |
167
+ |-----------|--------|------------|
168
+ | > 52,500 chars | compact format | `[compact]` prepended |
169
+ | > 87,500 chars | counts only | `[counts]` prepended |
170
+ | > 105,000 chars | hard truncate | `[truncated]` prepended |
171
+
172
+ Cascade is **skipped** when `detail_level` or `token_budget` is explicitly set.
173
+
174
+ ## Hooks
175
+
176
+ Setup auto-indexing and read-redirect hooks for Claude Code:
177
+
178
+ ```
179
+ codesift setup claude --hooks
180
+ ```
181
+
182
+ Installs two hooks in `.claude/settings.local.json`:
183
+
184
+ - **PreToolUse** (`precheck-read`) — redirects `Read` on large code files to CodeSift tools
185
+ - **PostToolUse** (`postindex-file`) — auto-runs `index_file` after `Edit` or `Write`
186
+
187
+ This ensures the index stays current without manual `index_file` calls after every edit.
@@ -0,0 +1,192 @@
1
+ ---
2
+ description: CodeSift MCP tool usage rules
3
+ globs: **/*
4
+ alwaysApply: true
5
+ ---
6
+ <!-- codesift-rules v0.1.0 hash:PLACEHOLDER -->
7
+
8
+ # CodeSift MCP — Agent Rules
9
+
10
+ ## Setup
11
+
12
+ Run once per session:
13
+
14
+ 1. `list_repos()` — get the repo identifier (e.g. `local/codesift-mcp`). **Never call again** — cache the result.
15
+ 2. If the repo is missing: `index_folder(path=<root>)` once to index it.
16
+ 3. Use `"local/<folder-name>"` as the `repo` parameter for all tool calls.
17
+
18
+ ## Tool Discovery
19
+
20
+ **63 MCP tools total** (13 core visible + 50 deferred/hidden).
21
+
22
+ Only ~13 core tools appear in ListTools. Hidden tools are discovered on demand:
23
+
24
+ - `discover_tools(query="dead code")` — keyword search across all 63 tools
25
+ - `describe_tools(names=["find_dead_code"])` — get full parameter schema
26
+ - `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
27
+
28
+ Core tools always visible: `search_text`, `search_symbols`, `get_file_outline`, `get_file_tree`, `get_symbol`, `get_symbols`, `find_references`, `find_and_show`, `codebase_retrieval`, `semantic_search`, `list_repos`, `index_file`, `discover_tools`, `describe_tools`.
29
+
30
+ ## Tool Mapping
31
+
32
+ Use this table to pick the right tool for each task:
33
+
34
+ | Task | Tool |
35
+ |------|------|
36
+ | text pattern search | `search_text(file_pattern=)` |
37
+ | find function/class/type | `search_symbols(include_source=true)` |
38
+ | file structure/outline | `get_file_outline` |
39
+ | find files | `get_file_tree(compact=true)` |
40
+ | read 1 symbol | `get_symbol` |
41
+ | read 2+ symbols | `get_symbols` (batch) |
42
+ | find usages | `find_references` |
43
+ | symbol + refs in 1 call | `find_and_show(include_refs=true)` |
44
+ | call chain | `trace_call_chain` |
45
+ | blast radius | `impact_analysis(since="HEAD~3")` |
46
+ | concept question | `semantic_search` or `codebase_retrieval(queries=[{type:"semantic",...}])` |
47
+ | multi-search 3+ | `codebase_retrieval(queries=[...])` |
48
+ | symbol in context | `get_context_bundle` |
49
+ | dead code | `find_dead_code` |
50
+ | complexity | `analyze_complexity` |
51
+ | copy-paste | `find_clones` |
52
+ | anti-patterns | `search_patterns` |
53
+ | git churn | `analyze_hotspots` |
54
+ | cross-repo | `cross_repo_search` |
55
+ | circular deps | `find_circular_deps` or `get_knowledge_map(focus=)` |
56
+ | mermaid diagram | `trace_call_chain(output_format="mermaid")` |
57
+ | affected tests | `impact_analysis` → `.affected_tests` |
58
+ | explore new repo | `suggest_queries` |
59
+ | re-index 1 file | `index_file(path=)` |
60
+ | route trace | `trace_route` |
61
+ | code modules | `detect_communities(focus=)` |
62
+ | go to definition | `go_to_definition` |
63
+ | return type | `get_type_info` |
64
+ | cross-file rename | `rename_symbol` |
65
+ | scan secrets | `scan_secrets` |
66
+ | search past sessions | `search_conversations` |
67
+ | symbol ↔ conversation | `find_conversations_for_symbol` |
68
+ | index conversations | `index_conversations` |
69
+ | structural diff | `diff_outline(since=)` |
70
+ | what changed | `changed_symbols(since=)` |
71
+
72
+ ## When to Use (Situational Triggers)
73
+
74
+ | Situation | Tool |
75
+ |-----------|------|
76
+ | refactor/clean up | `analyze_complexity(top_n=10)` |
77
+ | dead code/unused | `find_dead_code` |
78
+ | unused imports | `find_unused_imports` |
79
+ | DRY/duplication | `find_clones(min_similarity=0.7)` |
80
+ | architecture/deps | `detect_communities(focus="src")` |
81
+ | module boundaries | `check_boundaries` |
82
+ | symbol roles (hub/leaf/bridge) | `classify_roles` |
83
+ | structural code patterns | `ast_query` |
84
+ | diagram/visualize | `trace_call_chain(output_format="mermaid")` |
85
+ | hotspots/tech debt | `analyze_hotspots(since_days=90)` |
86
+ | unfamiliar symbol | `get_context_bundle` |
87
+ | new repo | `suggest_queries` |
88
+ | trace endpoint | `trace_route` |
89
+ | dense context (5+ symbols) | `assemble_context(level="L1")` |
90
+ | overview only | `assemble_context(level="L3")` |
91
+ | review git diff | `review_diff` |
92
+ | code review / PR | `changed_symbols(since="HEAD~N")` + `diff_outline` |
93
+ | quick symbol + refs | `find_and_show(include_refs=true)` |
94
+ | error seen before | `search_conversations` |
95
+ | before refactoring complex fn | `find_conversations_for_symbol` |
96
+ | "we discussed this" | `search_conversations` |
97
+ | secrets/leaked keys | `scan_secrets` |
98
+ | security audit | `scan_secrets(min_confidence="high")` |
99
+ | code audit | `search_patterns("empty-catch")` |
100
+ | past decisions | `find_conversations_for_symbol` |
101
+
102
+ ## Key Parameters
103
+
104
+ ### search_symbols
105
+ - `detail_level="compact"` — locations only (~15 tok/result vs ~150 default)
106
+ - `token_budget=N` — cap output instead of guessing `top_k`
107
+ - `file_pattern=` — always pass when scope is known (e.g. `"*.ts"`, `"src/tools/"`)
108
+ - `kind=` — filter by type: `function`, `class`, `type`, `interface`
109
+ - `include_source=true` — include source code in results
110
+
111
+ ### search_text
112
+ - `group_by_file=true` — ~80% output reduction on many matches
113
+ - `auto_group=true` — auto-switch to grouped above 50 matches
114
+ - `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
115
+ - `file_pattern=` — always pass when scope is known
116
+
117
+ ### assemble_context levels
118
+ - `L0` — full source (use when editing)
119
+ - `L1` — signatures only (3× more symbols fit, use when reading)
120
+ - `L2` — file summaries
121
+ - `L3` — directory overview (91% less tokens, use for orientation)
122
+
123
+ ### codebase_retrieval
124
+ - Always pass `token_budget` to cap output
125
+ - Batch 3+ searches: `queries=[{type:"semantic",...},{type:"text",...}]`
126
+
127
+ ### get_knowledge_map
128
+ - **ALWAYS pass `focus=`** — without it returns 129K+ tokens
129
+
130
+ ## Hint Codes
131
+
132
+ The server appends hint codes to responses to guide tool usage. Act on them immediately.
133
+
134
+ | Code | Meaning | Action |
135
+ |------|---------|--------|
136
+ | `H1(n)` | n matches returned | Add `group_by_file=true` |
137
+ | `H2(n,tool)` | n consecutive identical calls | Batch into one `tool` call |
138
+ | `H3(n)` | `list_repos` called n times | Reuse cached value |
139
+ | `H4` | `include_source` without `file_pattern` | Add `file_pattern` |
140
+ | `H5(path)` | Duplicate `get_file_tree` | Use cached result |
141
+ | `H6(n)` | n results without `detail_level` | Add `detail_level='compact'` |
142
+ | `H7` | `get_symbol` after `search_symbols` | Use `get_context_bundle` |
143
+ | `H8(n)` | n× `get_symbol` calls | Use `assemble_context(level='L1')` |
144
+ | `H9` | Question-word text query | Use semantic search |
145
+
146
+ ## ALWAYS
147
+
148
+ - Use `semantic_search` or `codebase_retrieval(type:"semantic")` for conceptual questions
149
+ - Use `trace_route` FIRST for any API endpoint — NEVER multiple `search_text` + `trace_call_chain`
150
+ - Use `detect_communities` BEFORE `get_knowledge_map` — NEVER `knowledge_map` without communities first
151
+ - Use `index_file(path)` after editing — NEVER `index_folder` (9ms vs 3-8s)
152
+ - Pass `include_source=true` on `search_symbols`
153
+ - Use `get_symbols` (batch) for 2+ symbols — NEVER sequential `get_symbol`
154
+ - Batch 3+ searches into `codebase_retrieval`
155
+ - Use `search_conversations` when encountering error/bug that may have been solved before
156
+ - Use `Read` tool when file path is already known — CodeSift excels at discovery
157
+
158
+ ## NEVER
159
+
160
+ - Call `index_folder` if repo already in `list_repos` — file watcher auto-updates
161
+ - Call `list_repos` more than once per session
162
+ - Use manual Edit on multiple files for rename — use `rename_symbol`
163
+ - Read entire file just to get a return type — use `get_type_info`
164
+ - Index worktrees — use the main repo index
165
+ - Call `get_knowledge_map` without `focus=` parameter
166
+
167
+ ## Response Cascade
168
+
169
+ Large responses auto-shorten to stay within token limits:
170
+
171
+ | Threshold | Format | Annotation |
172
+ |-----------|--------|------------|
173
+ | > 52,500 chars | compact format | `[compact]` prepended |
174
+ | > 87,500 chars | counts only | `[counts]` prepended |
175
+ | > 105,000 chars | hard truncate | `[truncated]` prepended |
176
+
177
+ Cascade is **skipped** when `detail_level` or `token_budget` is explicitly set.
178
+
179
+ ## Hooks
180
+
181
+ Setup auto-indexing and read-redirect hooks for Claude Code:
182
+
183
+ ```
184
+ codesift setup claude --hooks
185
+ ```
186
+
187
+ Installs two hooks in `.claude/settings.local.json`:
188
+
189
+ - **PreToolUse** (`precheck-read`) — redirects `Read` on large code files to CodeSift tools
190
+ - **PostToolUse** (`postindex-file`) — auto-runs `index_file` after `Edit` or `Write`
191
+
192
+ This ensures the index stays current without manual `index_file` calls after every edit.