@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.
- package/README.md +252 -116
- package/dist/bin/codegraph.js +52 -82
- package/dist/bin/codegraph.js.map +1 -1
- package/dist/context/formatter.d.ts.map +1 -1
- package/dist/context/formatter.js +25 -6
- package/dist/context/formatter.js.map +1 -1
- package/dist/context/index.d.ts +22 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +257 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/queries.d.ts +88 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +251 -7
- package/dist/db/queries.js.map +1 -1
- package/dist/db/sqlite-adapter.d.ts +7 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +3 -0
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +6 -20
- package/dist/directory.js.map +1 -1
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +80 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +17 -1
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +65 -1
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +15 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +206 -98
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +45 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/dist/extraction/languages/csharp.js +2 -1
- package/dist/extraction/languages/csharp.js.map +1 -1
- package/dist/extraction/languages/go.d.ts.map +1 -1
- package/dist/extraction/languages/go.js +18 -2
- package/dist/extraction/languages/go.js.map +1 -1
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +2 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/java.d.ts.map +1 -1
- package/dist/extraction/languages/java.js +6 -0
- package/dist/extraction/languages/java.js.map +1 -1
- package/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/dist/extraction/languages/kotlin.js +6 -0
- package/dist/extraction/languages/kotlin.js.map +1 -1
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +14 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +84 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +681 -20
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/vue-extractor.d.ts +15 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/dist/extraction/vue-extractor.js +88 -0
- package/dist/extraction/vue-extractor.js.map +1 -1
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +1 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +5 -2
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +66 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/config-writer.d.ts +7 -8
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +7 -27
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/index.d.ts +3 -20
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +8 -39
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +11 -21
- package/dist/installer/instructions-template.d.ts.map +1 -1
- package/dist/installer/instructions-template.js +12 -56
- package/dist/installer/instructions-template.js.map +1 -1
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +10 -1
- package/dist/installer/targets/claude.d.ts.map +1 -1
- package/dist/installer/targets/claude.js +25 -40
- package/dist/installer/targets/claude.js.map +1 -1
- package/dist/installer/targets/codex.d.ts.map +1 -1
- package/dist/installer/targets/codex.js +15 -13
- package/dist/installer/targets/codex.js.map +1 -1
- package/dist/installer/targets/cursor.d.ts.map +1 -1
- package/dist/installer/targets/cursor.js +9 -38
- package/dist/installer/targets/cursor.js.map +1 -1
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +167 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -1
- package/dist/installer/targets/hermes.js +57 -3
- package/dist/installer/targets/hermes.js.map +1 -1
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -1
- package/dist/installer/targets/opencode.js +15 -13
- package/dist/installer/targets/opencode.js.map +1 -1
- package/dist/installer/targets/registry.d.ts.map +1 -1
- package/dist/installer/targets/registry.js +6 -0
- package/dist/installer/targets/registry.js.map +1 -1
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +3 -2
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/installer/targets/types.d.ts +1 -16
- package/dist/installer/targets/types.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +403 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +270 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +67 -53
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +315 -388
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +510 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +21 -21
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +294 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +160 -14
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1622 -322
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts +111 -29
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +181 -71
- package/dist/mcp/transport.js.map +1 -1
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +1300 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/dist/resolution/frameworks/csharp.js +36 -8
- package/dist/resolution/frameworks/csharp.js.map +1 -1
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -1
- package/dist/resolution/frameworks/drupal.js +44 -12
- package/dist/resolution/frameworks/drupal.js.map +1 -1
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +143 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/dist/resolution/frameworks/express.js +102 -19
- package/dist/resolution/frameworks/express.js.map +1 -1
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +6 -3
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/frameworks/index.d.ts +5 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +25 -1
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/dist/resolution/frameworks/java.js +339 -12
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/dist/resolution/frameworks/laravel.js +17 -8
- package/dist/resolution/frameworks/laravel.js.map +1 -1
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/dist/resolution/frameworks/nestjs.js +324 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/dist/resolution/frameworks/python.js +134 -16
- package/dist/resolution/frameworks/python.js.map +1 -1
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +360 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/dist/resolution/frameworks/react.js +96 -3
- package/dist/resolution/frameworks/react.js.map +1 -1
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/dist/resolution/frameworks/ruby.js +106 -2
- package/dist/resolution/frameworks/ruby.js.map +1 -1
- package/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/dist/resolution/frameworks/rust.js +102 -5
- package/dist/resolution/frameworks/rust.js.map +1 -1
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/dist/resolution/frameworks/swift.js +30 -6
- package/dist/resolution/frameworks/swift.js.map +1 -1
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +28 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +617 -5
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +11 -0
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +156 -3
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +212 -0
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +44 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +208 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/query-utils.d.ts +18 -0
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +30 -0
- package/dist/search/query-utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts.map +1 -1
- package/dist/sync/git-hooks.js +2 -0
- package/dist/sync/git-hooks.js.map +1 -1
- package/dist/sync/index.d.ts +3 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/watcher.d.ts +212 -8
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +465 -51
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +137 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +24 -11
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/pack-npm.sh +25 -1
- 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,
|
|
5
|
+
### Supercharge Claude Code, Cursor, Codex, OpenCode, Hermes Agent, Gemini, Antigravity, and Kiro with Semantic Code Intelligence
|
|
6
6
|
|
|
7
|
-
**~
|
|
7
|
+
**~16% cheaper · ~58% fewer tool calls · 100% local**
|
|
8
|
+
|
|
9
|
+
### [Documentation & Website →](https://colbymchenry.github.io/codegraph/)
|
|
8
10
|
|
|
9
11
|
[](https://www.npmjs.com/package/@stupidloud/codegraph)
|
|
10
12
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -16,9 +18,20 @@
|
|
|
16
18
|
|
|
17
19
|
[](#supported-agents)
|
|
18
20
|
[](#supported-agents)
|
|
19
|
-
[](#supported-agents)
|
|
20
22
|
[](#supported-agents)
|
|
21
23
|
[](#supported-agents)
|
|
24
|
+
[](#supported-agents)
|
|
25
|
+
[](#supported-agents)
|
|
26
|
+
[](#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
|
|
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
|
|
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
|

|
|
@@ -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:
|
|
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 |
|
|
84
|
-
| **Excalidraw** | TypeScript · ~
|
|
85
|
-
| **Django** | Python · ~
|
|
86
|
-
| **Tokio** | Rust · ~
|
|
87
|
-
| **OkHttp** | Java · ~
|
|
88
|
-
| **Gin** | Go · ~
|
|
89
|
-
| **Alamofire** | Swift · ~
|
|
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
|
-
|
|
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.
|
|
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
|
-
**
|
|
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
|
-
| **
|
|
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
|
|
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.
|
|
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
|
-
"
|
|
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>
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
│
|
|
313
|
-
│
|
|
314
|
-
│
|
|
315
|
-
│
|
|
316
|
-
│
|
|
317
|
-
|
|
318
|
-
│
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
│
|
|
322
|
-
│
|
|
323
|
-
│
|
|
324
|
-
│
|
|
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
|
|
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
|
|
435
|
-
|
|
436
|
-
|
|
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
|
|
567
|
+
What it skips out of the box:
|
|
440
568
|
|
|
441
|
-
-
|
|
442
|
-
|
|
443
|
-
-
|
|
444
|
-
|
|
445
|
-
-
|
|
446
|
-
|
|
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
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
|
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
|
|
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,
|
|
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
|
|