@stupidloud/codegraph 0.9.5 → 0.9.9

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 (302) hide show
  1. package/README.md +252 -116
  2. package/dist/bin/codegraph.js +52 -82
  3. package/dist/bin/codegraph.js.map +1 -1
  4. package/dist/context/formatter.d.ts.map +1 -1
  5. package/dist/context/formatter.js +25 -6
  6. package/dist/context/formatter.js.map +1 -1
  7. package/dist/context/index.d.ts +22 -0
  8. package/dist/context/index.d.ts.map +1 -1
  9. package/dist/context/index.js +257 -6
  10. package/dist/context/index.js.map +1 -1
  11. package/dist/context/markers.d.ts +19 -0
  12. package/dist/context/markers.d.ts.map +1 -0
  13. package/dist/context/markers.js +22 -0
  14. package/dist/context/markers.js.map +1 -0
  15. package/dist/db/queries.d.ts +88 -0
  16. package/dist/db/queries.d.ts.map +1 -1
  17. package/dist/db/queries.js +251 -7
  18. package/dist/db/queries.js.map +1 -1
  19. package/dist/db/sqlite-adapter.d.ts +7 -0
  20. package/dist/db/sqlite-adapter.d.ts.map +1 -1
  21. package/dist/db/sqlite-adapter.js +3 -0
  22. package/dist/db/sqlite-adapter.js.map +1 -1
  23. package/dist/directory.d.ts.map +1 -1
  24. package/dist/directory.js +6 -20
  25. package/dist/directory.js.map +1 -1
  26. package/dist/extraction/generated-detection.d.ts +30 -0
  27. package/dist/extraction/generated-detection.d.ts.map +1 -0
  28. package/dist/extraction/generated-detection.js +80 -0
  29. package/dist/extraction/generated-detection.js.map +1 -0
  30. package/dist/extraction/grammars.d.ts +17 -1
  31. package/dist/extraction/grammars.d.ts.map +1 -1
  32. package/dist/extraction/grammars.js +65 -1
  33. package/dist/extraction/grammars.js.map +1 -1
  34. package/dist/extraction/index.d.ts +15 -2
  35. package/dist/extraction/index.d.ts.map +1 -1
  36. package/dist/extraction/index.js +206 -98
  37. package/dist/extraction/index.js.map +1 -1
  38. package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  39. package/dist/extraction/languages/c-cpp.js +45 -0
  40. package/dist/extraction/languages/c-cpp.js.map +1 -1
  41. package/dist/extraction/languages/csharp.d.ts.map +1 -1
  42. package/dist/extraction/languages/csharp.js +2 -1
  43. package/dist/extraction/languages/csharp.js.map +1 -1
  44. package/dist/extraction/languages/go.d.ts.map +1 -1
  45. package/dist/extraction/languages/go.js +18 -2
  46. package/dist/extraction/languages/go.js.map +1 -1
  47. package/dist/extraction/languages/index.d.ts.map +1 -1
  48. package/dist/extraction/languages/index.js +2 -0
  49. package/dist/extraction/languages/index.js.map +1 -1
  50. package/dist/extraction/languages/java.d.ts.map +1 -1
  51. package/dist/extraction/languages/java.js +6 -0
  52. package/dist/extraction/languages/java.js.map +1 -1
  53. package/dist/extraction/languages/kotlin.d.ts.map +1 -1
  54. package/dist/extraction/languages/kotlin.js +6 -0
  55. package/dist/extraction/languages/kotlin.js.map +1 -1
  56. package/dist/extraction/languages/objc.d.ts +3 -0
  57. package/dist/extraction/languages/objc.d.ts.map +1 -0
  58. package/dist/extraction/languages/objc.js +133 -0
  59. package/dist/extraction/languages/objc.js.map +1 -0
  60. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  61. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  62. package/dist/extraction/mybatis-extractor.js +198 -0
  63. package/dist/extraction/mybatis-extractor.js.map +1 -0
  64. package/dist/extraction/tree-sitter-types.d.ts +14 -0
  65. package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  66. package/dist/extraction/tree-sitter.d.ts +84 -0
  67. package/dist/extraction/tree-sitter.d.ts.map +1 -1
  68. package/dist/extraction/tree-sitter.js +681 -20
  69. package/dist/extraction/tree-sitter.js.map +1 -1
  70. package/dist/extraction/vue-extractor.d.ts +15 -0
  71. package/dist/extraction/vue-extractor.d.ts.map +1 -1
  72. package/dist/extraction/vue-extractor.js +88 -0
  73. package/dist/extraction/vue-extractor.js.map +1 -1
  74. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  75. package/dist/extraction/wasm-runtime-flags.js +1 -0
  76. package/dist/extraction/wasm-runtime-flags.js.map +1 -1
  77. package/dist/graph/traversal.d.ts.map +1 -1
  78. package/dist/graph/traversal.js +5 -2
  79. package/dist/graph/traversal.js.map +1 -1
  80. package/dist/index.d.ts +66 -3
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +105 -1
  83. package/dist/index.js.map +1 -1
  84. package/dist/installer/config-writer.d.ts +7 -8
  85. package/dist/installer/config-writer.d.ts.map +1 -1
  86. package/dist/installer/config-writer.js +7 -27
  87. package/dist/installer/config-writer.js.map +1 -1
  88. package/dist/installer/index.d.ts +3 -20
  89. package/dist/installer/index.d.ts.map +1 -1
  90. package/dist/installer/index.js +8 -39
  91. package/dist/installer/index.js.map +1 -1
  92. package/dist/installer/instructions-template.d.ts +11 -21
  93. package/dist/installer/instructions-template.d.ts.map +1 -1
  94. package/dist/installer/instructions-template.js +12 -56
  95. package/dist/installer/instructions-template.js.map +1 -1
  96. package/dist/installer/targets/antigravity.d.ts +57 -0
  97. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  98. package/dist/installer/targets/antigravity.js +308 -0
  99. package/dist/installer/targets/antigravity.js.map +1 -0
  100. package/dist/installer/targets/claude.d.ts +10 -1
  101. package/dist/installer/targets/claude.d.ts.map +1 -1
  102. package/dist/installer/targets/claude.js +25 -40
  103. package/dist/installer/targets/claude.js.map +1 -1
  104. package/dist/installer/targets/codex.d.ts.map +1 -1
  105. package/dist/installer/targets/codex.js +15 -13
  106. package/dist/installer/targets/codex.js.map +1 -1
  107. package/dist/installer/targets/cursor.d.ts.map +1 -1
  108. package/dist/installer/targets/cursor.js +9 -38
  109. package/dist/installer/targets/cursor.js.map +1 -1
  110. package/dist/installer/targets/gemini.d.ts +26 -0
  111. package/dist/installer/targets/gemini.d.ts.map +1 -0
  112. package/dist/installer/targets/gemini.js +167 -0
  113. package/dist/installer/targets/gemini.js.map +1 -0
  114. package/dist/installer/targets/hermes.d.ts.map +1 -1
  115. package/dist/installer/targets/hermes.js +57 -3
  116. package/dist/installer/targets/hermes.js.map +1 -1
  117. package/dist/installer/targets/kiro.d.ts +27 -0
  118. package/dist/installer/targets/kiro.d.ts.map +1 -0
  119. package/dist/installer/targets/kiro.js +178 -0
  120. package/dist/installer/targets/kiro.js.map +1 -0
  121. package/dist/installer/targets/opencode.d.ts.map +1 -1
  122. package/dist/installer/targets/opencode.js +15 -13
  123. package/dist/installer/targets/opencode.js.map +1 -1
  124. package/dist/installer/targets/registry.d.ts.map +1 -1
  125. package/dist/installer/targets/registry.js +6 -0
  126. package/dist/installer/targets/registry.js.map +1 -1
  127. package/dist/installer/targets/shared.d.ts.map +1 -1
  128. package/dist/installer/targets/shared.js +3 -2
  129. package/dist/installer/targets/shared.js.map +1 -1
  130. package/dist/installer/targets/types.d.ts +1 -16
  131. package/dist/installer/targets/types.d.ts.map +1 -1
  132. package/dist/mcp/daemon-paths.d.ts +46 -0
  133. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  134. package/dist/mcp/daemon-paths.js +125 -0
  135. package/dist/mcp/daemon-paths.js.map +1 -0
  136. package/dist/mcp/daemon.d.ts +161 -0
  137. package/dist/mcp/daemon.d.ts.map +1 -0
  138. package/dist/mcp/daemon.js +403 -0
  139. package/dist/mcp/daemon.js.map +1 -0
  140. package/dist/mcp/engine.d.ts +105 -0
  141. package/dist/mcp/engine.d.ts.map +1 -0
  142. package/dist/mcp/engine.js +270 -0
  143. package/dist/mcp/engine.js.map +1 -0
  144. package/dist/mcp/index.d.ts +67 -53
  145. package/dist/mcp/index.d.ts.map +1 -1
  146. package/dist/mcp/index.js +315 -388
  147. package/dist/mcp/index.js.map +1 -1
  148. package/dist/mcp/proxy.d.ts +81 -0
  149. package/dist/mcp/proxy.d.ts.map +1 -0
  150. package/dist/mcp/proxy.js +510 -0
  151. package/dist/mcp/proxy.js.map +1 -0
  152. package/dist/mcp/server-instructions.d.ts +1 -1
  153. package/dist/mcp/server-instructions.d.ts.map +1 -1
  154. package/dist/mcp/server-instructions.js +21 -21
  155. package/dist/mcp/session.d.ts +77 -0
  156. package/dist/mcp/session.d.ts.map +1 -0
  157. package/dist/mcp/session.js +294 -0
  158. package/dist/mcp/session.js.map +1 -0
  159. package/dist/mcp/tools.d.ts +160 -14
  160. package/dist/mcp/tools.d.ts.map +1 -1
  161. package/dist/mcp/tools.js +1622 -322
  162. package/dist/mcp/tools.js.map +1 -1
  163. package/dist/mcp/transport.d.ts +111 -29
  164. package/dist/mcp/transport.d.ts.map +1 -1
  165. package/dist/mcp/transport.js +181 -71
  166. package/dist/mcp/transport.js.map +1 -1
  167. package/dist/mcp/version.d.ts +19 -0
  168. package/dist/mcp/version.d.ts.map +1 -0
  169. package/dist/mcp/version.js +71 -0
  170. package/dist/mcp/version.js.map +1 -0
  171. package/dist/resolution/callback-synthesizer.d.ts +10 -0
  172. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  173. package/dist/resolution/callback-synthesizer.js +1300 -0
  174. package/dist/resolution/callback-synthesizer.js.map +1 -0
  175. package/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  176. package/dist/resolution/frameworks/csharp.js +36 -8
  177. package/dist/resolution/frameworks/csharp.js.map +1 -1
  178. package/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  179. package/dist/resolution/frameworks/drupal.js +44 -12
  180. package/dist/resolution/frameworks/drupal.js.map +1 -1
  181. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  182. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  183. package/dist/resolution/frameworks/expo-modules.js +143 -0
  184. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  185. package/dist/resolution/frameworks/express.d.ts.map +1 -1
  186. package/dist/resolution/frameworks/express.js +102 -19
  187. package/dist/resolution/frameworks/express.js.map +1 -1
  188. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  189. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  190. package/dist/resolution/frameworks/fabric.js +354 -0
  191. package/dist/resolution/frameworks/fabric.js.map +1 -0
  192. package/dist/resolution/frameworks/go.d.ts.map +1 -1
  193. package/dist/resolution/frameworks/go.js +6 -3
  194. package/dist/resolution/frameworks/go.js.map +1 -1
  195. package/dist/resolution/frameworks/index.d.ts +5 -0
  196. package/dist/resolution/frameworks/index.d.ts.map +1 -1
  197. package/dist/resolution/frameworks/index.js +25 -1
  198. package/dist/resolution/frameworks/index.js.map +1 -1
  199. package/dist/resolution/frameworks/java.d.ts.map +1 -1
  200. package/dist/resolution/frameworks/java.js +339 -12
  201. package/dist/resolution/frameworks/java.js.map +1 -1
  202. package/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  203. package/dist/resolution/frameworks/laravel.js +17 -8
  204. package/dist/resolution/frameworks/laravel.js.map +1 -1
  205. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  206. package/dist/resolution/frameworks/nestjs.js +324 -0
  207. package/dist/resolution/frameworks/nestjs.js.map +1 -1
  208. package/dist/resolution/frameworks/play.d.ts +19 -0
  209. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  210. package/dist/resolution/frameworks/play.js +111 -0
  211. package/dist/resolution/frameworks/play.js.map +1 -0
  212. package/dist/resolution/frameworks/python.d.ts.map +1 -1
  213. package/dist/resolution/frameworks/python.js +134 -16
  214. package/dist/resolution/frameworks/python.js.map +1 -1
  215. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  216. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  217. package/dist/resolution/frameworks/react-native.js +360 -0
  218. package/dist/resolution/frameworks/react-native.js.map +1 -0
  219. package/dist/resolution/frameworks/react.d.ts.map +1 -1
  220. package/dist/resolution/frameworks/react.js +96 -3
  221. package/dist/resolution/frameworks/react.js.map +1 -1
  222. package/dist/resolution/frameworks/ruby.d.ts.map +1 -1
  223. package/dist/resolution/frameworks/ruby.js +106 -2
  224. package/dist/resolution/frameworks/ruby.js.map +1 -1
  225. package/dist/resolution/frameworks/rust.d.ts.map +1 -1
  226. package/dist/resolution/frameworks/rust.js +102 -5
  227. package/dist/resolution/frameworks/rust.js.map +1 -1
  228. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  229. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  230. package/dist/resolution/frameworks/swift-objc.js +252 -0
  231. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  232. package/dist/resolution/frameworks/swift.d.ts.map +1 -1
  233. package/dist/resolution/frameworks/swift.js +30 -6
  234. package/dist/resolution/frameworks/swift.js.map +1 -1
  235. package/dist/resolution/go-module.d.ts +26 -0
  236. package/dist/resolution/go-module.d.ts.map +1 -0
  237. package/dist/resolution/go-module.js +78 -0
  238. package/dist/resolution/go-module.js.map +1 -0
  239. package/dist/resolution/import-resolver.d.ts +28 -0
  240. package/dist/resolution/import-resolver.d.ts.map +1 -1
  241. package/dist/resolution/import-resolver.js +617 -5
  242. package/dist/resolution/import-resolver.js.map +1 -1
  243. package/dist/resolution/index.d.ts +11 -0
  244. package/dist/resolution/index.d.ts.map +1 -1
  245. package/dist/resolution/index.js +156 -3
  246. package/dist/resolution/index.js.map +1 -1
  247. package/dist/resolution/name-matcher.d.ts.map +1 -1
  248. package/dist/resolution/name-matcher.js +212 -0
  249. package/dist/resolution/name-matcher.js.map +1 -1
  250. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  251. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  252. package/dist/resolution/swift-objc-bridge.js +256 -0
  253. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  254. package/dist/resolution/types.d.ts +44 -0
  255. package/dist/resolution/types.d.ts.map +1 -1
  256. package/dist/resolution/workspace-packages.d.ts +48 -0
  257. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  258. package/dist/resolution/workspace-packages.js +208 -0
  259. package/dist/resolution/workspace-packages.js.map +1 -0
  260. package/dist/search/query-utils.d.ts +18 -0
  261. package/dist/search/query-utils.d.ts.map +1 -1
  262. package/dist/search/query-utils.js +30 -0
  263. package/dist/search/query-utils.js.map +1 -1
  264. package/dist/sync/git-hooks.d.ts.map +1 -1
  265. package/dist/sync/git-hooks.js +2 -0
  266. package/dist/sync/git-hooks.js.map +1 -1
  267. package/dist/sync/index.d.ts +3 -1
  268. package/dist/sync/index.d.ts.map +1 -1
  269. package/dist/sync/index.js +8 -1
  270. package/dist/sync/index.js.map +1 -1
  271. package/dist/sync/watcher.d.ts +212 -8
  272. package/dist/sync/watcher.d.ts.map +1 -1
  273. package/dist/sync/watcher.js +465 -51
  274. package/dist/sync/watcher.js.map +1 -1
  275. package/dist/sync/worktree.d.ts +54 -0
  276. package/dist/sync/worktree.d.ts.map +1 -0
  277. package/dist/sync/worktree.js +137 -0
  278. package/dist/sync/worktree.js.map +1 -0
  279. package/dist/types.d.ts +9 -1
  280. package/dist/types.d.ts.map +1 -1
  281. package/dist/types.js +3 -0
  282. package/dist/types.js.map +1 -1
  283. package/package.json +1 -1
  284. package/scripts/agent-eval/arms-F.sh +21 -0
  285. package/scripts/agent-eval/arms-matrix.sh +37 -0
  286. package/scripts/agent-eval/bench-readme.sh +28 -0
  287. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  288. package/scripts/agent-eval/block-read-hook.sh +19 -0
  289. package/scripts/agent-eval/hook-settings.json +15 -0
  290. package/scripts/agent-eval/itrun.sh +24 -11
  291. package/scripts/agent-eval/parse-arms.mjs +116 -0
  292. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  293. package/scripts/agent-eval/probe-context.mjs +21 -0
  294. package/scripts/agent-eval/probe-explore.mjs +40 -0
  295. package/scripts/agent-eval/probe-node.mjs +20 -0
  296. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  297. package/scripts/agent-eval/probe-trace.mjs +20 -0
  298. package/scripts/agent-eval/run-arms.sh +56 -0
  299. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  300. package/scripts/npm-sdk.js +75 -0
  301. package/scripts/pack-npm.sh +25 -1
  302. package/scripts/prepare-release.mjs +270 -0
package/README.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  # CodeGraph
4
4
 
5
- ### Supercharge Claude Code, Cursor, Codex, OpenCode, and Hermes Agent with Semantic Code Intelligence
5
+ ### Supercharge Claude Code, Cursor, Codex, OpenCode, Hermes Agent, Gemini, Antigravity, and Kiro with Semantic Code Intelligence
6
6
 
7
- **~35% cheaper · ~70% fewer tool calls · 100% local**
7
+ **~16% cheaper · ~58% fewer tool calls · 100% local**
8
+
9
+ ### [Documentation & Website →](https://colbymchenry.github.io/codegraph/)
8
10
 
9
11
  [![npm version](https://img.shields.io/npm/v/@stupidloud/codegraph.svg)](https://www.npmjs.com/package/@stupidloud/codegraph)
10
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -16,9 +18,20 @@
16
18
 
17
19
  [![Claude Code](https://img.shields.io/badge/Claude_Code-supported-blueviolet.svg)](#supported-agents)
18
20
  [![Cursor](https://img.shields.io/badge/Cursor-supported-blueviolet.svg)](#supported-agents)
19
- [![Codex CLI](https://img.shields.io/badge/Codex_CLI-supported-blueviolet.svg)](#supported-agents)
21
+ [![Codex](https://img.shields.io/badge/Codex-supported-blueviolet.svg)](#supported-agents)
20
22
  [![opencode](https://img.shields.io/badge/opencode-supported-blueviolet.svg)](#supported-agents)
21
23
  [![Hermes Agent](https://img.shields.io/badge/Hermes_Agent-supported-blueviolet.svg)](#supported-agents)
24
+ [![Gemini](https://img.shields.io/badge/Gemini-supported-blueviolet.svg)](#supported-agents)
25
+ [![Antigravity](https://img.shields.io/badge/Antigravity-supported-blueviolet.svg)](#supported-agents)
26
+ [![Kiro](https://img.shields.io/badge/Kiro-supported-blueviolet.svg)](#supported-agents)
27
+
28
+ <br>
29
+
30
+ **The CodeGraph platform is coming** — for every PR, know exactly what to test, what could break, which flows are affected, and whether business logic is compromised.
31
+
32
+ <a href="https://getcodegraph.com"><img alt="Join the waitlist for early beta access" src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/waitlist.svg" height="44"></a>
33
+
34
+ <sub>Get <b>early beta access</b> to the hosted product · <a href="https://getcodegraph.com">getcodegraph.com</a></sub>
22
35
 
23
36
  [English](./README.md) · [简体中文](./README.zh-CN.md)
24
37
 
@@ -26,6 +39,8 @@
26
39
 
27
40
  ## Get Started
28
41
 
42
+ ### 1. Install the CLI
43
+
29
44
  **No Node.js required** — one command grabs the right build for your OS:
30
45
 
31
46
  ```bash
@@ -39,15 +54,27 @@ npx @stupidloud/codegraph # zero-install, or:
39
54
  npm i -g @stupidloud/codegraph
40
55
  ```
41
56
 
42
- <sub>CodeGraph bundles its own runtime — nothing to compile, no native build, works the same everywhere. The interactive installer auto-configures your agent(s)Claude Code, Cursor, Codex CLI, opencode, Hermes Agent.</sub>
57
+ <sub>CodeGraph bundles its own runtime — nothing to compile, no native build, works the same everywhere. The installer puts `codegraph` on your PATH but **doesn't change your current shell** open a new terminal before the next step so the command resolves.</sub>
58
+
59
+ ### 2. Wire up your agent(s)
60
+
61
+ In a **new terminal**, run the installer to connect CodeGraph to the agents you use:
62
+
63
+ ```bash
64
+ codegraph install
65
+ ```
66
+
67
+ <sub>Detects and auto-configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro — wiring the CodeGraph MCP server into each. **This is the step that connects CodeGraph to your agent;** installing the CLI in step 1 does not do it on its own. (Shortcut: `npx @colbymchenry/codegraph` downloads and runs this in one go.)</sub>
43
68
 
44
- ### Initialize Projects
69
+ ### 3. Initialize each project
45
70
 
46
71
  ```bash
47
72
  cd your-project
48
73
  codegraph init -i
49
74
  ```
50
75
 
76
+ <sub>`codegraph init` just creates the local `.codegraph/` index directory; adding `-i` (`--index`) also builds the initial graph in the same step. Without `-i`, run `codegraph index` afterwards to populate it.</sub>
77
+
51
78
  <div align="center">
52
79
 
53
80
  ![1_C_VYnhpys0UHrOuOgpgoyw](https://github.com/user-attachments/assets/f168182f-4d9a-44e0-94d7-08d018cc8a3a)
@@ -74,26 +101,101 @@ When Claude Code explores a codebase, it spawns **Explore agents** that scan fil
74
101
 
75
102
  ### Benchmark Results
76
103
 
77
- Tested across **7 real-world open-source codebases** spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question **with** and **without** CodeGraph. Each cell is the savings at the **median of 4 runs per arm**.
104
+ Tested across **7 real-world open-source codebases** spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question **with** and **without** CodeGraph. Each cell is the savings at the **median of 4 runs per arm**. _Re-validated on Opus 4.8 (2026-06-02), on the current build (`codegraph_explore` as the primary tool)._
78
105
 
79
- > **Average: 35% cheaper · 59% fewer tokens · 49% faster · 70% fewer tool calls**
106
+ > **Average: 16% cheaper · 47% fewer tokens · 22% faster · 58% fewer tool calls**
80
107
 
81
108
  | Codebase | Language | Cost | Tokens | Time | Tool calls |
82
109
  |----------|----------|------|--------|------|------------|
83
- | **VS Code** | TypeScript · ~10k files | 35% cheaper | 73% fewer | 41% faster | 72% fewer |
84
- | **Excalidraw** | TypeScript · ~600 | 47% cheaper | 73% fewer | 60% faster | 86% fewer |
85
- | **Django** | Python · ~2.7k | 34% cheaper | 64% fewer | 59% faster | 81% fewer |
86
- | **Tokio** | Rust · ~700 | 52% cheaper | 81% fewer | 63% faster | 89% fewer |
87
- | **OkHttp** | Java · ~640 | 17% cheaper | 41% fewer | 36% faster | 64% fewer |
88
- | **Gin** | Go · ~150 | 22% cheaper | 23% fewer | 34% faster | 19% fewer |
89
- | **Alamofire** | Swift · ~100 | 38% cheaper | 59% fewer | 51% faster | 77% fewer |
110
+ | **VS Code** | TypeScript · ~10k files | 18% cheaper | 64% fewer | 11% faster | 81% fewer |
111
+ | **Excalidraw** | TypeScript · ~640 | even | 25% fewer | 27% faster | 40% fewer |
112
+ | **Django** | Python · ~3k | 8% cheaper | 60% fewer | 13% faster | 77% fewer |
113
+ | **Tokio** | Rust · ~790 | even | 38% fewer | 18% faster | 57% fewer |
114
+ | **OkHttp** | Java · ~645 | 25% cheaper | 54% fewer | 31% faster | 50% fewer |
115
+ | **Gin** | Go · ~110 | 19% cheaper | 23% fewer | 24% faster | 44% fewer |
116
+ | **Alamofire** | Swift · ~110 | 40% cheaper | 64% fewer | 33% faster | 58% fewer |
117
+
118
+ CodeGraph cuts **tokens, tool calls, and wall-clock time on every repo** — across small, medium, and large codebases — and answers them with **near-zero file reads**, while the no-CodeGraph agent spends its budget on grep/find/Read discovery. `codegraph_explore` shows the answer in full — the mechanism plus the exact methods you asked about, even when they're buried in a multi-thousand-line file — while collapsing redundant interchangeable implementations to signatures, so the response is sized to the *answer* rather than the file count. **Cost stays flat-to-cheaper everywhere** — largest on the small repos (Alamofire, OkHttp), roughly break-even on the most response-heavy ones (Excalidraw, Tokio), where CodeGraph trades the no-CodeGraph agent's many small grep/read round-trips for a few large, cache-heavy tool responses.
90
119
 
91
- The gains scale with codebase size: on large repos the agent answers from the index in a handful of calls with **zero file reads**, while the no-CodeGraph agent fans out across grep/find/Read (and the sub-agents it spawns). On a small repo like Gin (~150 files) native search is already cheap, so the margin narrows.
120
+ <details>
121
+ <summary><strong>Per-repo breakdown — WITH vs WITHOUT (median of 4)</strong></summary>
122
+
123
+ **VS Code** · ~10k files
124
+ | Metric | WITH cg | WITHOUT cg | Δ |
125
+ |---|---|---|---|
126
+ | Time | 1m 59s | 2m 13s | 11% faster |
127
+ | File Reads | 0 | 9 | −9 |
128
+ | Grep/Bash | 0 | 11 | −11 |
129
+ | Tool calls | 4 | 21 | 81% fewer |
130
+ | Total tokens | 640k | 1.79M | 64% fewer |
131
+ | Cost | $0.68 | $0.83 | 18% cheaper |
132
+
133
+ **Excalidraw** · ~640 files
134
+ | Metric | WITH cg | WITHOUT cg | Δ |
135
+ |---|---|---|---|
136
+ | Time | 1m 32s | 2m 6s | 27% faster |
137
+ | File Reads | 0 | 7 | −7 |
138
+ | Grep/Bash | 1 | 8 | −7 |
139
+ | Tool calls | 9 | 15 | 40% fewer |
140
+ | Total tokens | 1.27M | 1.69M | 25% fewer |
141
+ | Cost | $0.78 | $0.78 | even |
142
+
143
+ **Django** · ~3k files
144
+ | Metric | WITH cg | WITHOUT cg | Δ |
145
+ |---|---|---|---|
146
+ | Time | 1m 43s | 1m 58s | 13% faster |
147
+ | File Reads | 0 | 9 | −9 |
148
+ | Grep/Bash | 0 | 5 | −5 |
149
+ | Tool calls | 3 | 13 | 77% fewer |
150
+ | Total tokens | 559k | 1.41M | 60% fewer |
151
+ | Cost | $0.57 | $0.62 | 8% cheaper |
152
+
153
+ **Tokio** · ~790 files
154
+ | Metric | WITH cg | WITHOUT cg | Δ |
155
+ |---|---|---|---|
156
+ | Time | 1m 55s | 2m 20s | 18% faster |
157
+ | File Reads | 0 | 8 | −8 |
158
+ | Grep/Bash | 0 | 6 | −6 |
159
+ | Tool calls | 6 | 14 | 57% fewer |
160
+ | Total tokens | 1.08M | 1.73M | 38% fewer |
161
+ | Cost | $0.82 | $0.82 | even |
162
+
163
+ **OkHttp** · ~645 files
164
+ | Metric | WITH cg | WITHOUT cg | Δ |
165
+ |---|---|---|---|
166
+ | Time | 1m 1s | 1m 29s | 31% faster |
167
+ | File Reads | 0 | 4 | −4 |
168
+ | Grep/Bash | 2 | 6 | −4 |
169
+ | Tool calls | 5 | 10 | 50% fewer |
170
+ | Total tokens | 502k | 1.10M | 54% fewer |
171
+ | Cost | $0.41 | $0.55 | 25% cheaper |
172
+
173
+ **Gin** · ~110 files
174
+ | Metric | WITH cg | WITHOUT cg | Δ |
175
+ |---|---|---|---|
176
+ | Time | 1m 14s | 1m 37s | 24% faster |
177
+ | File Reads | 1 | 6 | −5 |
178
+ | Grep/Bash | 1 | 2 | −1 |
179
+ | Tool calls | 5 | 9 | 44% fewer |
180
+ | Total tokens | 651k | 847k | 23% fewer |
181
+ | Cost | $0.46 | $0.57 | 19% cheaper |
182
+
183
+ **Alamofire** · ~110 files
184
+ | Metric | WITH cg | WITHOUT cg | Δ |
185
+ |---|---|---|---|
186
+ | Time | 1m 35s | 2m 21s | 33% faster |
187
+ | File Reads | 0 | 9 | −9 |
188
+ | Grep/Bash | 0 | 4 | −4 |
189
+ | Tool calls | 5 | 12 | 58% fewer |
190
+ | Total tokens | 766k | 2.10M | 64% fewer |
191
+ | Cost | $0.57 | $0.95 | 40% cheaper |
192
+
193
+ </details>
92
194
 
93
195
  <details>
94
196
  <summary><strong>Full benchmark details</strong></summary>
95
197
 
96
- **Methodology.** Each arm is `claude -p` (Claude Opus 4.7, Claude Code v2.1.145) run headlessly against the repo with `--strict-mcp-config`: **WITH** = CodeGraph's MCP server enabled, **WITHOUT** = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, **4 runs per arm, median reported**. Cost = the run's `total_cost_usd`; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at `--depth 1` and indexed by the same CodeGraph build that served them.
198
+ **Methodology.** Each arm is `claude -p` (Claude Opus 4.8) run headlessly against the repo with `--strict-mcp-config`: **WITH** = CodeGraph's MCP server enabled, **WITHOUT** = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, **4 runs per arm, median reported**. Cost = the run's `total_cost_usd`; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at `--depth 1` and indexed by the same CodeGraph build that served them. Re-validated 2026-06-02 on the current build. These numbers are lower than the prior Opus 4.7 validation — not a CodeGraph regression but a stronger native baseline: Opus 4.8 greps/reads efficiently on the main thread instead of fanning out into large Explore-subagent sweeps, so the no-CodeGraph arm is leaner than it used to be. Per-repo numbers move run-to-run with how hard the without-arm thrashes (the median-of-4 smooths it, but tails remain — e.g. Django's without-arm hit $2.71/14m one batch).
97
199
 
98
200
  **Queries:**
99
201
  | Codebase | Query |
@@ -106,18 +208,7 @@ The gains scale with codebase size: on large repos the agent answers from the in
106
208
  | Gin | "How does gin route requests through its middleware chain?" |
107
209
  | Alamofire | "How does Alamofire build, send, and validate a request?" |
108
210
 
109
- **Raw mediansWITH WITHOUT:**
110
- | Codebase | Cost | Tokens | Time | Tool calls |
111
- |----------|------|--------|------|------------|
112
- | VS Code | $0.42 → $0.64 | 393k → 1.4M | 1m 0s → 1m 43s | 7 → 23 |
113
- | Excalidraw | $0.54 → $1.02 | 851k → 3.2M | 1m 17s → 3m 14s | 12 → 83 |
114
- | Django | $0.41 → $0.62 | 499k → 1.4M | 1m 0s → 2m 25s | 9 → 48 |
115
- | Tokio | $0.50 → $1.04 | 657k → 3.4M | 1m 5s → 2m 56s | 9 → 75 |
116
- | OkHttp | $0.36 → $0.44 | 352k → 596k | 45s → 1m 11s | 5 → 14 |
117
- | Gin | $0.36 → $0.46 | 431k → 562k | 47s → 1m 11s | 7 → 8 |
118
- | Alamofire | $0.61 → $0.99 | 1.1M → 2.6M | 1m 19s → 2m 41s | 15 → 64 |
119
-
120
- **Why CodeGraph wins:** with the index available, the agent answers directly — `codegraph_context` to map the area, then one `codegraph_explore` for the relevant source — and stops, usually with zero file reads. Without it, the agent (and the Explore sub-agents it spawns) spends most of its budget on discovery (find/ls/grep) before reading the right code. CodeGraph only helps when queried *directly*, so its instructions steer agents to answer directly rather than delegate exploration to file-reading sub-agents — otherwise a sub-agent reads files regardless and CodeGraph becomes overhead.
211
+ **Why CodeGraph wins:** with the index available, the agent answers directly usually one `codegraph_explore` returns the relevant source — and stops, usually with zero file reads. Without it, the agent spends most of its budget on discovery (find/ls/grep) before reading the right code. CodeGraph only helps when queried *directly*, so its instructions steer agents to answer directly rather than delegate exploration to file-reading sub-agents — otherwise a sub-agent reads files regardless and CodeGraph becomes overhead.
121
212
 
122
213
  </details>
123
214
 
@@ -131,10 +222,38 @@ The gains scale with codebase size: on large repos the agent answers from the in
131
222
  | **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |
132
223
  | **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
133
224
  | **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config |
134
- | **19+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Swift, Kotlin, Dart, Lua, Luau, Svelte, Liquid, Pascal/Delphi |
225
+ | **20+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Objective-C, Swift, Kotlin, Dart, Lua, Luau, Svelte, Liquid, Pascal/Delphi |
135
226
  | **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 14 frameworks |
227
+ | **Mixed iOS / React Native / Expo** | Closes cross-language flows that static parsing misses: Swift ↔ ObjC bridging, React Native legacy bridge + TurboModules + Fabric view components, native → JS event emitters, Expo Modules |
136
228
  | **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
137
229
 
230
+ <details>
231
+ <summary><strong>How auto-syncing works — and why you don't need to run <code>codegraph sync</code> manually</strong></summary>
232
+
233
+ When your agent (Claude Code, Cursor, Codex, opencode) launches `codegraph serve --mcp`, three layers keep the index in step with your code — and make sure the agent never gets a silent wrong answer in the brief window between an edit and the next sync:
234
+
235
+ 1. **File watcher with debounced auto-sync.** A native FSEvents / inotify / ReadDirectoryChangesW watcher captures every source-file create / modify / delete and triggers a re-index after a debounce window (default `2000ms`, tunable via `CODEGRAPH_WATCH_DEBOUNCE_MS`, clamped to `[100ms, 60s]`). Bursts of edits collapse into a single sync.
236
+
237
+ 2. **Per-file staleness banner.** During the brief debounce window, MCP tool responses that would reference a still-pending file prepend a `⚠️` banner naming it and telling the agent to `Read` it directly. Pending files NOT referenced by the response surface as a small footer instead. Either way, the agent gets an explicit signal — validated with Claude Code, where the agent literally says "Reading the file directly for the live content" before opening it.
238
+
239
+ 3. **Connect-time catch-up.** When the MCP server (re)connects, codegraph runs a fast `(size, mtime)` + content-hash reconciliation against the working tree before answering the first query — so edits made while no MCP server was running (a `git pull` from the terminal, edits from another editor, a previous agent session that exited) get absorbed on the next session's first tool call.
240
+
241
+ ```
242
+ agent writes src/Widget.ts
243
+ → watcher fires (<100ms)
244
+ → debounce (default 2s)
245
+ → sync; Widget.ts is in the index
246
+ → next agent query sees it
247
+ ```
248
+
249
+ **Verify any time** with `codegraph_status` (via MCP) or `codegraph status` (CLI). If anything is pending, you'll see a `### Pending sync:` section naming the files and their edit age.
250
+
251
+ The handful of cases where manual `codegraph sync` makes sense: the watcher is disabled (sandboxed environments, or `CODEGRAPH_NO_DAEMON=1`), or you're scripting against the index outside an agent session and want a pre-flight sync at the start of your script.
252
+
253
+ → Full deep-dive in [Guides → Indexing a Project](https://colbymchenry.github.io/codegraph/guides/indexing/#stay-fresh-automatically).
254
+
255
+ </details>
256
+
138
257
  ---
139
258
 
140
259
  ## Framework-aware Routes
@@ -160,6 +279,35 @@ CodeGraph detects web-framework routing files and emits `route` nodes linked by
160
279
 
161
280
  ---
162
281
 
282
+ ## Mixed iOS / React Native / Expo bridging
283
+
284
+ Real iOS and React Native codebases live across multiple languages — a Swift caller invokes an Objective-C selector that's been auto-bridged, a JS file calls into a native module via the React Native bridge, a JSX component delegates to a native view manager. Static tree-sitter extraction stops at each language boundary. CodeGraph bridges them so `trace`, `callers`, `callees`, and `impact` connect end-to-end across the gap.
285
+
286
+ | Boundary | JS / Swift side | Native side | How |
287
+ |---|---|---|---|
288
+ | **Swift → ObjC** | Swift `obj.foo(bar:)` | ObjC selector `-fooWithBar:` | `@objc` auto-bridging rules (including init/property/protocol forms) + Cocoa preposition prefixes (`With`/`For`/`By`/`In`/`On`/`At`/…) |
289
+ | **ObjC → Swift** | ObjC `[obj fooWithBar:]` | Swift `@objc func foo(bar:)` | Reverse-bridge name candidates; verifies `@objc` exposure from source |
290
+ | **React Native legacy bridge** | JS `NativeModules.X.fn(...)` | ObjC `RCT_EXPORT_METHOD` / `RCT_REMAP_METHOD` · Java/Kotlin `@ReactMethod` | Parses macro/annotation declarations to build a JS-name → native-method map |
291
+ | **React Native TurboModules** | JS `import M from './NativeM'; M.fn(...)` | Native impl matching the Codegen spec | Treats the `Native<X>.ts` spec interface as ground truth |
292
+ | **RN native → JS events** | JS `new NativeEventEmitter(...).addListener('e', cb)` | ObjC `[self sendEventWithName:@"e" body:...]` · Swift `sendEvent(withName: "e", ...)` · Java/Kotlin `.emit("e", ...)` | Synthesized cross-language event channel keyed by literal event name |
293
+ | **Expo Modules** | JS `requireNativeModule('X').fn(...)` | Swift / Kotlin `Module { Name("X"); AsyncFunction("fn") { ... } }` | Parses the Expo DSL literals; synthetic method nodes resolve via existing name-match |
294
+ | **Fabric view components** | JSX `<MyView prop={v}/>` | TS Codegen spec + native impl class | Spec → `component` node; convention-based name+suffix lookup (`View`/`ComponentView`/`Manager`/`ViewManager`) bridges to native |
295
+ | **Legacy Paper view managers** | JSX `<MyView prop={v}/>` | ObjC `RCT_EXPORT_VIEW_PROPERTY` · Java/Kotlin `@ReactProp` | Same as Fabric — Paper-era declarations also produce `component` + `property` nodes |
296
+
297
+ **Validated on real codebases** (small + medium + large for each bridge):
298
+
299
+ | Bridge | Small | Medium | Large |
300
+ |---|---|---|---|
301
+ | Swift ↔ ObjC | [Charts](https://github.com/danielgindi/Charts) | [realm-swift](https://github.com/realm/realm-swift) | [Wikipedia-iOS](https://github.com/wikimedia/wikipedia-ios) |
302
+ | RN legacy bridge | [AsyncStorage](https://github.com/react-native-async-storage/async-storage) | [react-native-svg](https://github.com/software-mansion/react-native-svg) | [react-native-firebase](https://github.com/invertase/react-native-firebase) |
303
+ | RN native → JS events | [RNGeolocation](https://github.com/Agontuk/react-native-geolocation-service) | — | react-native-firebase |
304
+ | Expo Modules | expo-haptics | expo-camera | expo SDK sweep (7 packages) |
305
+ | Fabric / Paper views | [react-native-segmented-control](https://github.com/react-native-segmented-control/segmented-control) | [react-native-screens](https://github.com/software-mansion/react-native-screens) | [react-native-skia](https://github.com/Shopify/react-native-skia) |
306
+
307
+ Each bridge emits edges tagged `provenance:'heuristic'` with `metadata.synthesizedBy:` set to a stable channel name (e.g. `swift-objc-bridge`, `rn-event-channel`, `fabric-native-impl`, `expo-module-extract`), so the agent can tell at a glance how a hop got into the graph.
308
+
309
+ ---
310
+
163
311
  ## Quick Start
164
312
 
165
313
  ### 1. Run the Installer
@@ -169,10 +317,10 @@ npx @stupidloud/codegraph
169
317
  ```
170
318
 
171
319
  The installer will:
172
- - Ask which agent(s) to configure — auto-detects installed ones from: **Claude Code**, **Cursor**, **Codex CLI**, **opencode**, **Hermes Agent**
320
+ - Ask which agent(s) to configure — auto-detects installed ones from: **Claude Code**, **Cursor**, **Codex CLI**, **opencode**, **Hermes Agent**, **Gemini CLI**, **Antigravity IDE**, **Kiro**
173
321
  - Prompt to install `codegraph` on your PATH (so agents can launch the MCP server)
174
322
  - Ask whether configs apply to all your projects or just this one
175
- - Write each chosen agent's MCP server config + an instructions file (e.g. `CLAUDE.md`, `.cursor/rules/codegraph.mdc`, `~/.codex/AGENTS.md`)
323
+ - Write each chosen agent's MCP server config (the codegraph usage guide is delivered by the MCP server itself, so no instructions file is added to `CLAUDE.md` / `AGENTS.md` / etc.)
176
324
  - Set up auto-allow permissions when Claude Code is one of the targets
177
325
  - Initialize your current project (local installs only)
178
326
 
@@ -195,7 +343,7 @@ codegraph install --print-config codex # print snippet, no file wr
195
343
 
196
344
  ### 2. Restart Your Agent
197
345
 
198
- Restart your agent (Claude Code / Cursor / Codex CLI / opencode / Hermes Agent) for the MCP server to load.
346
+ Restart your agent (Claude Code / Cursor / Codex CLI / opencode / Hermes Agent / Gemini CLI / Antigravity IDE / Kiro) for the MCP server to load.
199
347
 
200
348
  ### 3. Initialize Projects
201
349
 
@@ -204,7 +352,7 @@ cd your-project
204
352
  codegraph init -i
205
353
  ```
206
354
 
207
- Builds the per-project knowledge graph index. Also wires up any project-local agent surfaces (e.g. Cursor's `.cursor/rules/codegraph.mdc`) so a single global `codegraph install` works in every project you open — no need to re-run the installer per project.
355
+ Builds the per-project knowledge graph index. A single global `codegraph install` works in every project you open — no need to re-run the installer per project.
208
356
 
209
357
  That's it — your agent will use CodeGraph tools automatically when a `.codegraph/` directory exists.
210
358
 
@@ -235,7 +383,7 @@ npm install -g @stupidloud/codegraph
235
383
  "permissions": {
236
384
  "allow": [
237
385
  "mcp__codegraph__codegraph_search",
238
- "mcp__codegraph__codegraph_context",
386
+ "mcp__codegraph__codegraph_explore",
239
387
  "mcp__codegraph__codegraph_callers",
240
388
  "mcp__codegraph__codegraph_callees",
241
389
  "mcp__codegraph__codegraph_impact",
@@ -250,43 +398,16 @@ npm install -g @stupidloud/codegraph
250
398
  </details>
251
399
 
252
400
  <details>
253
- <summary><strong>Global Instructions Reference</strong></summary>
254
-
255
- The installer automatically adds these instructions to `~/.claude/CLAUDE.md`:
256
-
257
- ```markdown
258
- ## CodeGraph
401
+ <summary><strong>Agent Tool Guidance</strong></summary>
259
402
 
260
- CodeGraph builds a semantic knowledge graph of codebases for faster, smarter code exploration.
403
+ CodeGraph's MCP server delivers its usage guidance to your agent **automatically**, in the MCP `initialize` response — there's no instructions file to manage and nothing is added to your `CLAUDE.md` / `AGENTS.md` / `GEMINI.md`. In short, it tells the agent to:
261
404
 
262
- ### If `.codegraph/` exists in the project
405
+ - **Answer structural questions directly with CodeGraph** — it *is* the pre-built index, so a grep/read loop just repeats work it already did. Treat the returned source as already read.
406
+ - **Pick the tool by intent:** `codegraph_explore` for almost anything — "how does X work", a flow/"how does X reach Y", or surveying an area (one call returns the relevant symbols' source grouped by file); `codegraph_search` to just locate a symbol; `codegraph_callers`/`codegraph_callees` to walk call flow; `codegraph_impact` before editing; `codegraph_node` for one specific symbol's full source (it returns every overload for an ambiguous name).
407
+ - **Trust the results — don't re-verify with grep**, and check the staleness banner after edits.
408
+ - If `.codegraph/` doesn't exist yet, offer to run `codegraph init -i`.
263
409
 
264
- **NEVER call `codegraph_explore` or `codegraph_context` directly in the main session.** These tools return large amounts of source code that fills up main session context. Instead, ALWAYS spawn an Explore agent for any exploration question (e.g., "how does X work?", "explain the Y system", "where is Z implemented?").
265
-
266
- **When spawning Explore agents**, include this instruction in the prompt:
267
-
268
- > This project has CodeGraph initialized (.codegraph/ exists). Use `codegraph_explore` as your PRIMARY tool — it returns full source code sections from all relevant files in one call.
269
- >
270
- > **Rules:**
271
- > 1. Follow the explore call budget in the `codegraph_explore` tool description — it scales automatically based on project size.
272
- > 2. Do NOT re-read files that codegraph_explore already returned source code for. The source sections are complete and authoritative.
273
- > 3. Only fall back to grep/glob/read for files listed under "Additional relevant files" if you need more detail, or if codegraph returned no results.
274
-
275
- **The main session may only use these lightweight tools directly** (for targeted lookups before making edits, not for exploration):
276
-
277
- | Tool | Use For |
278
- |------|---------|
279
- | `codegraph_search` | Find symbols by name |
280
- | `codegraph_callers` / `codegraph_callees` | Trace call flow |
281
- | `codegraph_impact` | Check what's affected before editing |
282
- | `codegraph_node` | Get a single symbol's details |
283
-
284
- ### If `.codegraph/` does NOT exist
285
-
286
- At the start of a session, ask the user if they'd like to initialize CodeGraph:
287
-
288
- "I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph?"
289
- ```
410
+ The exact text is `src/mcp/server-instructions.ts` the single source of truth.
290
411
 
291
412
  </details>
292
413
 
@@ -295,34 +416,23 @@ At the start of a session, ask the user if they'd like to initialize CodeGraph:
295
416
  ## How It Works
296
417
 
297
418
  ```
298
- ┌─────────────────────────────────────────────────────────────────┐
299
- │ Claude Code │
300
- │ │
301
- │ "Implement user authentication" │
302
- │ │ │
303
- │ ▼ │
304
- │ ┌─────────────────┐ ┌─────────────────┐ │
305
- │ │ Explore Agent │ ──── │ Explore Agent │ │
306
- │ └────────┬────────┘ └────────┬────────┘ │
307
- │ │ │ │
308
- └───────────┼────────────────────────┼─────────────────────────────┘
309
- │ │
310
- ▼ ▼
311
419
  ┌───────────────────────────────────────────────────────────────────┐
312
- CodeGraph MCP Server
313
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
314
- Search │ Callers │ │ Context │ │
315
- │ "auth" │ │ "login()" │ │ for task
316
- └──────┬──────┘ └──────┬──────┘ └──────┬──────┘
317
- │ │ │ │ │
318
- └────────────────┼────────────────┘ │
319
-
320
- │ ┌───────────────────────┐ │
321
- │ SQLite Graph DB
322
- • 387 symbols │ │
323
- │ • 1,204 edges
324
- • Instant lookups
325
- └───────────────────────┘
420
+ Claude Code
421
+
422
+ "How does a request reach the database?"
423
+ calls CodeGraph tools directly — no Explore sub-agent
424
+
425
+ └─────────────────────────────────┬─────────────────────────────────┘
426
+
427
+
428
+ ┌───────────────────────────────────────────────────────────────────┐
429
+ CodeGraph MCP Server
430
+
431
+ explore · search · callers · callees · impact · node
432
+
433
+
434
+ │ SQLite knowledge graph │
435
+ │ symbols · edges · files · FTS5 full-text search │
326
436
  └───────────────────────────────────────────────────────────────────┘
327
437
  ```
328
438
 
@@ -349,7 +459,6 @@ codegraph sync [path] # Incremental update
349
459
  codegraph status [path] # Show statistics
350
460
  codegraph query <search> # Search symbols (--kind, --limit, --json)
351
461
  codegraph files [path] # Show file structure (--format, --filter, --max-depth, --json)
352
- codegraph context <task> # Build context for AI (--format, --max-nodes)
353
462
  codegraph callers <symbol> # Find what calls a function/method (--limit, --json)
354
463
  codegraph callees <symbol> # Find what a function/method calls (--limit, --json)
355
464
  codegraph impact <symbol> # Analyze what code is affected by changing a symbol (--depth, --json)
@@ -393,13 +502,12 @@ When running as an MCP server, CodeGraph exposes these tools to Claude Code:
393
502
 
394
503
  | Tool | Purpose |
395
504
  |------|---------|
505
+ | `codegraph_explore` | **Primary.** Answer almost any question in one call — "how does X work", a flow ("how does X reach Y"), or surveying an area — returning the relevant symbols' verbatim source grouped by file, plus a relationship map and blast radius. Surfaces dynamic-dispatch hops (callbacks, React re-render, interface→impl) grep can't follow. |
396
506
  | `codegraph_search` | Find symbols by name across the codebase |
397
- | `codegraph_context` | Build relevant code context for a task |
398
507
  | `codegraph_callers` | Find what calls a function |
399
508
  | `codegraph_callees` | Find what a function calls |
400
509
  | `codegraph_impact` | Analyze what code is affected by changing a symbol |
401
- | `codegraph_node` | Get details about a specific symbol (optionally with source code) |
402
- | `codegraph_explore` | Return source for several related symbols grouped by file, plus a relationship map, in one call |
510
+ | `codegraph_node` | Get one specific symbol's details + full source (returns every overload for an ambiguous name) |
403
511
  | `codegraph_files` | Get indexed file structure (faster than filesystem scanning) |
404
512
  | `codegraph_status` | Check index health and statistics |
405
513
 
@@ -407,8 +515,14 @@ When running as an MCP server, CodeGraph exposes these tools to Claude Code:
407
515
 
408
516
  ## Library Usage
409
517
 
518
+ CodeGraph can be embedded directly. The npm package re-exports its programmatic
519
+ API, so both `import` and `require` resolve the `CodeGraph` class in your own
520
+ process — handy for embedding it in an app (e.g. an Electron main process).
521
+
410
522
  ```typescript
411
523
  import CodeGraph from '@stupidloud/codegraph';
524
+ // CommonJS works too:
525
+ // const { CodeGraph } = require('@stupidloud/codegraph');
412
526
 
413
527
  const cg = await CodeGraph.init('/path/to/project');
414
528
  // Or: const cg = await CodeGraph.open('/path/to/project');
@@ -427,27 +541,44 @@ cg.unwatch(); // stop watching
427
541
  cg.close();
428
542
  ```
429
543
 
544
+ Lower-level building blocks are exported from the same entry point for callers
545
+ that drive the graph directly: `DatabaseConnection`, `QueryBuilder`,
546
+ `getDatabasePath`, `initGrammars` / `loadGrammarsForLanguages`, and `FileLock`.
547
+
548
+ **Embedding requirements**
549
+
550
+ - Install from npm (`npm i @colbymchenry/codegraph`) so the matching
551
+ per-platform package — which carries the compiled library and its
552
+ dependencies — is fetched alongside the shim.
553
+ - The API runs on **your** runtime, so it needs **Node 22.5+** for the built-in
554
+ `node:sqlite` (Electron qualifies when its bundled Node is 22.5+). The CLI and
555
+ MCP server are unaffected — they run on the self-contained bundled runtime.
556
+ - TypeScript types ship with the package. As with any Node-targeting library,
557
+ keep `@types/node` available and `skipLibCheck: true` (the common default).
558
+
430
559
  ---
431
560
 
432
561
  ## Configuration
433
562
 
434
- There isn't any — CodeGraph is zero-config. It indexes every file whose
435
- extension maps to a [supported language](#supported-languages) and **respects
436
- your `.gitignore`**: in git repos via git itself, and in non-git projects by
437
- reading `.gitignore` files directly (root and nested, the same way git would).
563
+ There isn't any — CodeGraph is zero-config, with **no config file** to write or
564
+ keep in sync. Language support is automatic from the file extension; there's
565
+ nothing to wire up per language.
438
566
 
439
- What that means in practice:
567
+ What it skips out of the box:
440
568
 
441
- - Anything git ignores — `node_modules`, build output, secrets in `.env` — is
442
- never indexed. **To keep something out of the graph, add it to `.gitignore`.**
443
- - There's no config file to write or keep in sync, and nothing to wire up per
444
- language: support is automatic from the file extension.
445
- - Files larger than 1 MB are skipped (generated bundles, minified JS, vendored
446
- blobs) they cost parse budget for no useful symbols.
569
+ - **Dependency, build, and cache directories** — `node_modules`, `vendor`,
570
+ `dist`, `build`, `target`, `.venv`, `Pods`, `.next`, and the like across every
571
+ [supported stack](#supported-languages) so the graph is your code, not
572
+ third-party noise. This holds even with no `.gitignore`.
573
+ - **Anything in your `.gitignore`** honored in git repos via git, and in
574
+ non-git projects by reading `.gitignore` directly (root and nested).
575
+ - **Files larger than 1 MB** — generated bundles, minified JS, vendored blobs.
447
576
 
448
- > Committed files that aren't gitignored *are* indexed, even under `vendor/` or a
449
- > committed `dist/`. If you commit a dependency or build directory you don't want
450
- > in the graph, add it to `.gitignore`.
577
+ To keep something else out, add it to `.gitignore`. To pull a default-excluded
578
+ directory back **in** (say you really do want a vendored dependency indexed),
579
+ add a negation — `!vendor/`. The defaults apply uniformly, so committing a
580
+ dependency or build directory doesn't force it into the graph; the `.gitignore`
581
+ negation is the explicit opt-in.
451
582
 
452
583
  ## Supported Platforms
453
584
 
@@ -465,13 +596,17 @@ See [Get Started](#get-started) for the one-line install commands.
465
596
  ## Supported Agents
466
597
 
467
598
  The interactive installer auto-detects and configures each of these — wiring up
468
- the MCP server and writing its instructions file:
599
+ the MCP server (which delivers its own usage guidance, so no instructions file
600
+ is written):
469
601
 
470
602
  - **Claude Code**
471
603
  - **Cursor**
472
604
  - **Codex CLI**
473
605
  - **opencode**
474
606
  - **Hermes Agent**
607
+ - **Gemini CLI**
608
+ - **Antigravity IDE**
609
+ - **Kiro**
475
610
 
476
611
  ## Supported Languages
477
612
 
@@ -488,6 +623,7 @@ the MCP server and writing its instructions file:
488
623
  | Ruby | `.rb` | Full support |
489
624
  | C | `.c`, `.h` | Full support |
490
625
  | C++ | `.cpp`, `.hpp`, `.cc` | Full support |
626
+ | Objective-C | `.m`, `.mm`, `.h` | Partial support (classes, protocols, methods, `@property`, `#import`, message sends; `.mm` ObjC++ may parse incompletely) |
491
627
  | Swift | `.swift` | Full support |
492
628
  | Kotlin | `.kt`, `.kts` | Full support |
493
629
  | Scala | `.scala`, `.sc` | Full support (classes, traits, methods, type aliases, Scala 3 enums) |
@@ -512,7 +648,7 @@ the MCP server and writing its instructions file:
512
648
 
513
649
  **MCP server not connecting** — Ensure the project is initialized/indexed, verify the path in your MCP config, and check that `codegraph serve --mcp` works from the command line.
514
650
 
515
- **Missing symbols** — The MCP server auto-syncs on save (wait a couple seconds). Run `codegraph sync` manually if needed. Check that the file's language is supported and isn't excluded by config patterns.
651
+ **Missing symbols** — The MCP server auto-syncs on save (wait a couple seconds). Run `codegraph sync` manually if needed. Check that the file's language is supported and isn't inside a `.gitignore`d or default-excluded directory (e.g. `node_modules`, `dist`).
516
652
 
517
653
  ## Star History
518
654
 
@@ -532,7 +668,7 @@ MIT
532
668
 
533
669
  <div align="center">
534
670
 
535
- **Made for AI coding agents — Claude Code, Cursor, Codex CLI, opencode, and Hermes Agent**
671
+ **Made for AI coding agents — Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro**
536
672
 
537
673
  [Report Bug](https://github.com/colbymchenry/codegraph/issues) · [Request Feature](https://github.com/colbymchenry/codegraph/issues)
538
674