{"versions":{"0.7.11":{"name":"@myersguo/codegraph","version":"0.7.11","description":"Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.","main":"dist/index.js","types":"dist/index.d.ts","bin":{"codegraph":"dist/bin/codegraph.js"},"scripts":{"build":"tsc && npm run copy-assets && node -e \"require('fs').chmodSync('dist/bin/codegraph.js', 0o755)\"","preuninstall":"node dist/bin/uninstall.js","copy-assets":"node -e \"const fs=require('fs');fs.mkdirSync('dist/db',{recursive:true});fs.copyFileSync('src/db/schema.sql','dist/db/schema.sql');fs.mkdirSync('dist/extraction/wasm',{recursive:true});fs.readdirSync('src/extraction/wasm').filter(f=>f.endsWith('.wasm')).forEach(f=>fs.copyFileSync('src/extraction/wasm/'+f,'dist/extraction/wasm/'+f))\"","dev":"tsc --watch","cli":"npm run build && node dist/bin/codegraph.js","test":"vitest run","test:watch":"vitest","test:eval":"vitest run __tests__/evaluation/","eval":"npm run build && npx tsx __tests__/evaluation/runner.ts","clean":"node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""},"keywords":["code-intelligence","knowledge-graph","static-analysis"],"author":"","license":"MIT","dependencies":{"@clack/prompts":"^1.3.0","commander":"^14.0.2","fast-string-width":"^3.0.2","fast-wrap-ansi":"^0.2.0","jsonc-parser":"^3.3.1","node-sqlite3-wasm":"^0.8.30","picomatch":"^4.0.3","sisteransi":"^1.0.5","tree-sitter-wasms":"^0.1.11","web-tree-sitter":"^0.25.3"},"devDependencies":{"@types/better-sqlite3":"^7.6.0","@types/node":"^20.19.30","@types/picomatch":"^4.0.2","typescript":"^5.0.0","vitest":"^2.1.9"},"optionalDependencies":{"better-sqlite3":"^11.0.0"},"engines":{"node":">=18.0.0 <25.0.0"},"_id":"@myersguo/codegraph@0.7.11","gitHead":"2c1a314b84fd3633624f10f752163f9629c105e2","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-a6wBfyS4PZha5ulMy3iO/WghyAaYkHIL/5pcbchRxD2QNj1GKusZM4+3ckm8u1EhMzPPr+lcPma/pHKaorC/Ew==","shasum":"751a23df365430825f0519b34d70a790f1cb747d","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@myersguo/codegraph/-/codegraph-0.7.11.tgz","fileCount":368,"unpackedSize":7776046,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD0/Ng3bVlRPkoqYBYBTIgkP/2QEUJuviRnVetmDRyp8wIgaRg4i11SXXgU+lxZPyOFNxAvp8oN01oWJG1Xq/B//SQ="}],"size":1110234},"_npmUser":{"name":"anonymous","email":"myersguo@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"myersguo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codegraph_0.7.11_1779265852539_0.3812019262323665"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-20T08:30:52.815Z","publish_time":1779265852815,"_source_registry_name":"default","contributors":[]},"0.7.12":{"name":"@myersguo/codegraph","version":"0.7.12","description":"Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.","main":"dist/index.js","types":"dist/index.d.ts","bin":{"codegraph":"dist/bin/codegraph.js"},"scripts":{"build":"tsc && npm run copy-assets && node -e \"require('fs').chmodSync('dist/bin/codegraph.js', 0o755)\"","preuninstall":"node dist/bin/uninstall.js","copy-assets":"node -e \"const fs=require('fs');fs.mkdirSync('dist/db',{recursive:true});fs.copyFileSync('src/db/schema.sql','dist/db/schema.sql');fs.mkdirSync('dist/extraction/wasm',{recursive:true});fs.readdirSync('src/extraction/wasm').filter(f=>f.endsWith('.wasm')).forEach(f=>fs.copyFileSync('src/extraction/wasm/'+f,'dist/extraction/wasm/'+f))\"","dev":"tsc --watch","cli":"npm run build && node dist/bin/codegraph.js","test":"vitest run","test:watch":"vitest","test:eval":"vitest run __tests__/evaluation/","eval":"npm run build && npx tsx __tests__/evaluation/runner.ts","clean":"node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""},"keywords":["code-intelligence","knowledge-graph","static-analysis"],"author":"","license":"MIT","dependencies":{"@clack/prompts":"^1.3.0","commander":"^14.0.2","fast-string-width":"^3.0.2","fast-wrap-ansi":"^0.2.0","jsonc-parser":"^3.3.1","node-sqlite3-wasm":"^0.8.30","picomatch":"^4.0.3","sisteransi":"^1.0.5","tree-sitter-wasms":"^0.1.11","web-tree-sitter":"^0.25.3"},"devDependencies":{"@types/better-sqlite3":"^7.6.0","@types/node":"^20.19.30","@types/picomatch":"^4.0.2","typescript":"^5.0.0","vitest":"^2.1.9"},"optionalDependencies":{"better-sqlite3":"^11.0.0"},"engines":{"node":">=18.0.0 <25.0.0"},"_id":"@myersguo/codegraph@0.7.12","gitHead":"2c1a314b84fd3633624f10f752163f9629c105e2","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-38FKhjFTmq+Rxopz9GUuJQ9PXyomn2ZlqfWdPLEBYaLUZGhWc88njdUW4KB0yfVdHqZtzOlogaFEA1Rtc5Xnkg==","shasum":"ac9aa6bf4cf6a10bee9830ca1570de259017e23a","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@myersguo/codegraph/-/codegraph-0.7.12.tgz","fileCount":368,"unpackedSize":7776126,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCjkOqjtujRHXBik7PIGIn8sOQ+4inl/DAbnJWbWlleGQIhALQpeVfeI6+D6DvZj/0xLyXysACxqqzpRHt5OgEfT92y"}],"size":1110285},"_npmUser":{"name":"anonymous","email":"myersguo@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"myersguo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codegraph_0.7.12_1779269005759_0.9442837382964622"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-20T09:23:26.153Z","publish_time":1779269006153,"_source_registry_name":"default","contributors":[]},"0.7.13":{"name":"@myersguo/codegraph","version":"0.7.13","description":"Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.","main":"dist/index.js","types":"dist/index.d.ts","bin":{"codegraph":"dist/bin/codegraph.js"},"scripts":{"build":"tsc && npm run copy-assets && node -e \"require('fs').chmodSync('dist/bin/codegraph.js', 0o755)\"","preuninstall":"node dist/bin/uninstall.js","copy-assets":"node -e \"const fs=require('fs');fs.mkdirSync('dist/db',{recursive:true});fs.copyFileSync('src/db/schema.sql','dist/db/schema.sql');fs.mkdirSync('dist/extraction/wasm',{recursive:true});fs.readdirSync('src/extraction/wasm').filter(f=>f.endsWith('.wasm')).forEach(f=>fs.copyFileSync('src/extraction/wasm/'+f,'dist/extraction/wasm/'+f))\"","dev":"tsc --watch","cli":"npm run build && node dist/bin/codegraph.js","test":"vitest run","test:watch":"vitest","test:eval":"vitest run __tests__/evaluation/","eval":"npm run build && npx tsx __tests__/evaluation/runner.ts","clean":"node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""},"keywords":["code-intelligence","knowledge-graph","static-analysis"],"author":"","license":"MIT","dependencies":{"@clack/prompts":"^1.3.0","commander":"^14.0.2","fast-string-width":"^3.0.2","fast-wrap-ansi":"^0.2.0","jsonc-parser":"^3.3.1","node-sqlite3-wasm":"^0.8.30","picomatch":"^4.0.3","sisteransi":"^1.0.5","tree-sitter-wasms":"^0.1.11","web-tree-sitter":"^0.25.3"},"devDependencies":{"@types/better-sqlite3":"^7.6.0","@types/node":"^20.19.30","@types/picomatch":"^4.0.2","typescript":"^5.0.0","vitest":"^2.1.9"},"optionalDependencies":{"better-sqlite3":"^11.0.0"},"engines":{"node":">=18.0.0 <25.0.0"},"_id":"@myersguo/codegraph@0.7.13","gitHead":"296e595fa9e2b84fda8d88de02fbb5f08048d39f","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-bLJT62YWhmBvybr3msWKX2u2/YB6JG+AcZ5jiVGBq4Z6jmAcQwyDJ0Nd27h1cpag36qxhb1LOz04EB3WUhPFxg==","shasum":"7d8af163f1ce0ba8a193c43824b7e79ca6860356","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@myersguo/codegraph/-/codegraph-0.7.13.tgz","fileCount":368,"unpackedSize":7780479,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCg3fwjnfoBgTH+rdNN1jwBasBZ7/F9PaiDR2XqFOK5wQIhAIGpuqSKHTeUHjpC8AtfxtKAI8YVVMoFb4BtqSI36ilc"}],"size":1111845},"_npmUser":{"name":"anonymous","email":"myersguo@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"myersguo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codegraph_0.7.13_1779276518181_0.316846728502689"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-20T11:28:38.604Z","publish_time":1779276518604,"_source_registry_name":"default","contributors":[]},"0.7.14":{"name":"@myersguo/codegraph","version":"0.7.14","description":"Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.","main":"dist/index.js","types":"dist/index.d.ts","bin":{"codegraph":"dist/bin/codegraph.js"},"scripts":{"build":"tsc && npm run copy-assets && node -e \"require('fs').chmodSync('dist/bin/codegraph.js', 0o755)\"","preuninstall":"node dist/bin/uninstall.js","copy-assets":"node -e \"const fs=require('fs');fs.mkdirSync('dist/db',{recursive:true});fs.copyFileSync('src/db/schema.sql','dist/db/schema.sql');fs.mkdirSync('dist/extraction/wasm',{recursive:true});fs.readdirSync('src/extraction/wasm').filter(f=>f.endsWith('.wasm')).forEach(f=>fs.copyFileSync('src/extraction/wasm/'+f,'dist/extraction/wasm/'+f))\"","dev":"tsc --watch","cli":"npm run build && node dist/bin/codegraph.js","test":"vitest run","test:watch":"vitest","test:eval":"vitest run __tests__/evaluation/","eval":"npm run build && npx tsx __tests__/evaluation/runner.ts","clean":"node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""},"keywords":["code-intelligence","knowledge-graph","static-analysis"],"author":"","license":"MIT","dependencies":{"@clack/prompts":"^1.3.0","@myersguo/codegraph":"^0.7.13","commander":"^14.0.2","fast-string-width":"^3.0.2","fast-wrap-ansi":"^0.2.0","jsonc-parser":"^3.3.1","node-sqlite3-wasm":"^0.8.30","picomatch":"^4.0.3","sisteransi":"^1.0.5","tree-sitter-wasms":"^0.1.11","web-tree-sitter":"^0.25.3"},"devDependencies":{"@types/better-sqlite3":"^7.6.0","@types/node":"^20.19.30","@types/picomatch":"^4.0.2","typescript":"^5.0.0","vitest":"^2.1.9"},"optionalDependencies":{"better-sqlite3":"^11.0.0"},"engines":{"node":">=18.0.0 <25.0.0"},"_id":"@myersguo/codegraph@0.7.14","gitHead":"5dd1912579ced08acf0455a977c0700922b403ce","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-8Doe7uDgsyuRgOiQAsK4rBPW9vVTaVcEnDuI8ojYRB2Q3mc+mV5EhPBZtFBxzKtxIDTwCJc0b9rxtEpEg9Gl8g==","shasum":"e11cd1f448a023763fdc2ecc6efa411f837cc0d6","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@myersguo/codegraph/-/codegraph-0.7.14.tgz","fileCount":368,"unpackedSize":7782799,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHkzMH5ER/wqoDCAVpUgTbm0g7nJZfDZJqiNrsxihnqzAiEAnTtsor1HAx9mdJG0cohjJRAwa+FNNHn5NCNgasl3C20="}],"size":1112774},"_npmUser":{"name":"anonymous","email":"myersguo@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"myersguo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codegraph_0.7.14_1779279993759_0.756700619207316"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-05-20T12:26:33.953Z","publish_time":1779279993953,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"0.7.14"},"name":"@myersguo/codegraph","time":{"created":"2026-05-20T08:31:13.688Z","modified":"2026-05-20T12:26:51.063Z","0.7.11":"2026-05-20T08:30:52.815Z","0.7.12":"2026-05-20T09:23:26.153Z","0.7.13":"2026-05-20T11:28:38.604Z","0.7.14":"2026-05-20T12:26:33.953Z"},"readme":"<div align=\"center\">\n\n# CodeGraph\n\n### Supercharge Claude Code, Cursor, Codex, and OpenCode with Semantic Code Intelligence\n\n**94% fewer tool calls · 77% faster exploration · 100% local**\n\n[![npm version](https://img.shields.io/npm/v/@myersguo/codegraph.svg)](https://www.npmjs.com/package/@myersguo/codegraph)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)\n\n[![Windows](https://img.shields.io/badge/Windows-supported-blue.svg)](#)\n[![macOS](https://img.shields.io/badge/macOS-supported-blue.svg)](#)\n[![Linux](https://img.shields.io/badge/Linux-supported-blue.svg)](#)\n\n[![Claude Code](https://img.shields.io/badge/Claude_Code-supported-blueviolet.svg)](#)\n[![Cursor](https://img.shields.io/badge/Cursor-supported-blueviolet.svg)](#)\n[![Codex CLI](https://img.shields.io/badge/Codex_CLI-supported-blueviolet.svg)](#)\n[![opencode](https://img.shields.io/badge/opencode-supported-blueviolet.svg)](#)\n\n<br />\n\n### Get Started\n\n```bash\nnpx @myersguo/codegraph\n```\n\n<sub>Interactive installer auto-configures your agent(s) — Claude Code, Cursor, Codex CLI, opencode</sub>\n\n#### Initialize Projects\n\n```bash\ncd your-project\ncodegraph init -i\n```\n\n![1_C_VYnhpys0UHrOuOgpgoyw](https://github.com/user-attachments/assets/f168182f-4d9a-44e0-94d7-08d018cc8a3a)\n\n</div>\n\n---\n\n## Why CodeGraph?\n\nWhen Claude Code explores a codebase, it spawns **Explore agents** that scan files with grep, glob, and Read — consuming tokens on every tool call.\n\n**CodeGraph gives those agents a pre-indexed knowledge graph** — symbol relationships, call graphs, and code structure. Agents query the graph instantly instead of scanning files.\n\n### Benchmark Results\n\nTested across 6 real-world codebases comparing Claude Code's Explore agent **with** and **without** CodeGraph:\n\n> **Average: 92% fewer tool calls · 71% faster**\n\n| Codebase | With CG | Without CG | Improvement |\n|----------|---------|------------|-------------|\n| **VS Code** · TypeScript | 3 calls, 17s | 52 calls, 1m 37s | **94% fewer · 82% faster** |\n| **Excalidraw** · TypeScript | 3 calls, 29s | 47 calls, 1m 45s | **94% fewer · 72% faster** |\n| **Claude Code** · Python + Rust | 3 calls, 39s | 40 calls, 1m 8s | **93% fewer · 43% faster** |\n| **Claude Code** · Java | 1 call, 19s | 26 calls, 1m 22s | **96% fewer · 77% faster** |\n| **Alamofire** · Swift | 3 calls, 22s | 32 calls, 1m 39s | **91% fewer · 78% faster** |\n| **Swift Compiler** · Swift/C++ | 6 calls, 35s | 37 calls, 2m 8s | **84% fewer · 73% faster** |\n\n<details>\n<summary><strong>Full benchmark details</strong></summary>\n\nAll tests used Claude Opus 4.6 (1M context) with Claude Code v2.1.91. Each test spawned a single Explore agent with the same question.\n\n**Queries used:**\n| Codebase | Query |\n|----------|-------|\n| VS Code | \"How does the extension host communicate with the main process?\" |\n| Excalidraw | \"How does collaborative editing and real-time sync work?\" |\n| Claude Code (Python+Rust) | \"How does tool execution work end to end?\" |\n| Claude Code (Java) | \"How does tool execution work end to end?\" |\n| Alamofire | \"Trace how a request flows from Session.request() through to the URLSession layer\" |\n| Swift Compiler | \"How does the Swift compiler handle error diagnostics?\" |\n\n**With CodeGraph — the agent uses `codegraph_explore` and stops:**\n| Codebase | Files Indexed | Nodes | Tool Uses | Tokens | Time | File Reads |\n|----------|--------------|-------|-----------|--------|------|------------|\n| VS Code (TypeScript) | 4,002 | 59,377 | 3 | 56.6k | 17s | 0 |\n| Excalidraw (TypeScript) | 626 | 9,859 | 3 | 57.1k | 29s | 0 |\n| Claude Code (Python+Rust) | 115 | 3,080 | 3 | 67.1k | 39s | 0 |\n| Claude Code (Java) | — | — | 1 | 40.8k | 19s | 0 |\n| Alamofire (Swift) | 102 | 2,624 | 3 | 57.3k | 22s | 0 |\n| Swift Compiler (Swift/C++) | 25,874 | 272,898 | 6 | 77.4k | 35s | 0 |\n\n**Without CodeGraph — the agent uses grep, find, ls, and Read extensively:**\n| Codebase | Tool Uses | Tokens | Time | File Reads |\n|----------|-----------|--------|------|------------|\n| VS Code (TypeScript) | 52 | 89.4k | 1m 37s | ~15 |\n| Excalidraw (TypeScript) | 47 | 77.9k | 1m 45s | ~20 |\n| Claude Code (Python+Rust) | 40 | 69.3k | 1m 8s | ~15 |\n| Claude Code (Java) | 26 | 73.3k | 1m 22s | ~15 |\n| Alamofire (Swift) | 32 | 52.4k | 1m 39s | ~10 |\n| Swift Compiler (Swift/C++) | 37 | 99.1k | 2m 8s | ~20 |\n\n**Key observations:**\n- With CodeGraph, the agent **never fell back to reading files** — it trusted the codegraph_explore results completely\n- Without CodeGraph, agents spent most of their time on discovery (find, ls, grep) before they could even start reading relevant code\n- The Java codebase needed only **1 codegraph_explore call** to answer the entire question\n- Cross-language queries (Python+Rust) worked seamlessly — CodeGraph's graph traversal found connections across language boundaries\n- The Swift benchmark (Alamofire) traced a **9-step call chain** from `Session.request()` to `URLSession.dataTask()` — CodeGraph's graph traversal at depth 3 captured the full chain in one explore call\n- The **Swift Compiler** benchmark is the largest codebase tested (**25,874 files, 272,898 nodes**) — CodeGraph indexed it in under 4 minutes and the agent answered a complex cross-cutting question with **6 explore calls and zero file reads** in 35 seconds\n\n</details>\n\n---\n\n## Key Features\n\n| | |\n|---|---|\n| **Smart Context Building** | One tool call returns entry points, related symbols, and code snippets — no expensive exploration agents |\n| **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |\n| **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |\n| **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config |\n| **19+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Swift, Kotlin, Dart, Svelte, Liquid, Pascal/Delphi |\n| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 13 frameworks |\n| **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |\n\n---\n\n## Framework-aware Routes\n\nCodeGraph detects web-framework routing files and emits `route` nodes linked by `references` edges to their handler classes or functions. Querying callers of a view/controller now surfaces the URL pattern that binds it.\n\n| Framework | Shapes recognized |\n|---|---|\n| **Django** | `path()`, `re_path()`, `url()`, `include()` in `urls.py` (CBV `.as_view()`, dotted paths) |\n| **Flask** | `@app.route('/path', methods=[...])`, blueprint routes |\n| **FastAPI** | `@app.get(...)`, `@router.post(...)`, all standard methods |\n| **Express** | `app.get(...)`, `router.post(...)` with middleware chains |\n| **Laravel** | `Route::get()`, `Route::resource()`, `Controller@action`, tuple syntax |\n| **Rails** | `get '/x', to: 'users#index'`, hash-rocket `=>` syntax |\n| **Spring** | `@GetMapping`, `@PostMapping`, `@RequestMapping` on methods |\n| **Gin / chi / gorilla / mux** | `r.GET(...)`, `router.HandleFunc(...)` |\n| **Axum / actix / Rocket** | `.route(\"/x\", get(handler))` |\n| **ASP.NET** | `[HttpGet(\"/x\")]` attributes on action methods |\n| **Vapor** | `app.get(\"x\", use: handler)` |\n| **React Router** / **SvelteKit** | Route component nodes |\n\n---\n\n## Quick Start\n\n### 1. Run the Installer\n\n```bash\nnpx @myersguo/codegraph\n```\n\nThe installer will:\n- Ask which agent(s) to configure — auto-detects installed ones from: **Claude Code**, **Cursor**, **Codex CLI**, **opencode**\n- Prompt to install `codegraph` on your PATH (so agents can launch the MCP server)\n- Ask whether configs apply to all your projects or just this one\n- Write each chosen agent's MCP server config + an instructions file (e.g. `CLAUDE.md`, `.cursor/rules/codegraph.mdc`, `~/.codex/AGENTS.md`)\n- Set up auto-allow permissions when Claude Code is one of the targets\n- Initialize your current project (local installs only)\n\n**Non-interactive (scripting / CI):**\n\n```bash\ncodegraph install --yes                              # auto-detect agents, install global\ncodegraph install --target=cursor,claude --yes       # explicit target list\ncodegraph install --target=auto --location=local     # detected agents, project-local\ncodegraph install --print-config codex               # print snippet, no file writes\n```\n\n| Flag | Values | Default |\n|---|---|---|\n| `--target` | `auto`, `all`, `none`, or csv (`claude,cursor,...`) | prompt |\n| `--location` | `global`, `local` | prompt |\n| `--yes` | (boolean) | prompt every step |\n| `--no-permissions` | (boolean) skip Claude auto-allow list | permissions on |\n| `--print-config <id>` | dump snippet for one agent and exit | — |\n\n### 2. Restart Your Agent\n\nRestart your agent (Claude Code / Cursor / Codex CLI / opencode) for the MCP server to load.\n\n### 3. Initialize Projects\n\n```bash\ncd your-project\ncodegraph init -i\n```\n\nBuilds 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.\n\nThat's it — your agent will use CodeGraph tools automatically when a `.codegraph/` directory exists.\n\n<details>\n<summary><strong>Manual Setup (Alternative)</strong></summary>\n\n**Install globally:**\n```bash\nnpm install -g @myersguo/codegraph\n```\n\n**Add to `~/.claude.json`:**\n```json\n{\n  \"mcpServers\": {\n    \"codegraph\": {\n      \"type\": \"stdio\",\n      \"command\": \"codegraph\",\n      \"args\": [\"serve\", \"--mcp\"]\n    }\n  }\n}\n```\n\n**Add to `~/.claude/settings.json` (optional, for auto-allow):**\n```json\n{\n  \"permissions\": {\n    \"allow\": [\n      \"mcp__codegraph__codegraph_search\",\n      \"mcp__codegraph__codegraph_context\",\n      \"mcp__codegraph__codegraph_callers\",\n      \"mcp__codegraph__codegraph_callees\",\n      \"mcp__codegraph__codegraph_impact\",\n      \"mcp__codegraph__codegraph_node\",\n      \"mcp__codegraph__codegraph_status\",\n      \"mcp__codegraph__codegraph_files\"\n    ]\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Global Instructions Reference</strong></summary>\n\nThe installer automatically adds these instructions to `~/.claude/CLAUDE.md`:\n\n```markdown\n## CodeGraph\n\nCodeGraph builds a semantic knowledge graph of codebases for faster, smarter code exploration.\n\n### If `.codegraph/` exists in the project\n\n**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?\").\n\n**When spawning Explore agents**, include this instruction in the prompt:\n\n> 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.\n>\n> **Rules:**\n> 1. Follow the explore call budget in the `codegraph_explore` tool description — it scales automatically based on project size.\n> 2. Do NOT re-read files that codegraph_explore already returned source code for. The source sections are complete and authoritative.\n> 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.\n\n**The main session may only use these lightweight tools directly** (for targeted lookups before making edits, not for exploration):\n\n| Tool | Use For |\n|------|---------|\n| `codegraph_search` | Find symbols by name |\n| `codegraph_callers` / `codegraph_callees` | Trace call flow |\n| `codegraph_impact` | Check what's affected before editing |\n| `codegraph_node` | Get a single symbol's details |\n\n### If `.codegraph/` does NOT exist\n\nAt the start of a session, ask the user if they'd like to initialize CodeGraph:\n\n\"I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph?\"\n```\n\n</details>\n\n---\n\n## How It Works\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                        Claude Code                               │\n│                                                                  │\n│  \"Implement user authentication\"                                 │\n│           │                                                      │\n│           ▼                                                      │\n│  ┌─────────────────┐      ┌─────────────────┐                   │\n│  │  Explore Agent  │ ──── │  Explore Agent  │                   │\n│  └────────┬────────┘      └────────┬────────┘                   │\n│           │                        │                             │\n└───────────┼────────────────────────┼─────────────────────────────┘\n            │                        │\n            ▼                        ▼\n┌───────────────────────────────────────────────────────────────────┐\n│                     CodeGraph MCP Server                          │\n│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐               │\n│  │   Search    │  │   Callers   │  │   Context   │               │\n│  │  \"auth\"     │  │  \"login()\"  │  │  for task   │               │\n│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘               │\n│         │                │                │                       │\n│         └────────────────┼────────────────┘                       │\n│                          ▼                                        │\n│              ┌───────────────────────┐                            │\n│              │   SQLite Graph DB     │                            │\n│              │   • 387 symbols       │                            │\n│              │   • 1,204 edges       │                            │\n│              │   • Instant lookups   │                            │\n│              └───────────────────────┘                            │\n└───────────────────────────────────────────────────────────────────┘\n```\n\n1. **Extraction** — [tree-sitter](https://tree-sitter.github.io/) parses source code into ASTs. Language-specific queries extract nodes (functions, classes, methods) and edges (calls, imports, extends, implements).\n\n2. **Storage** — Everything goes into a local SQLite database (`.codegraph/codegraph.db`) with FTS5 full-text search.\n\n3. **Resolution** — After extraction, references are resolved: function calls → definitions, imports → source files, class inheritance, and framework-specific patterns.\n\n4. **Auto-Sync** — The MCP server watches your project using native OS file events. Changes are debounced (2-second quiet window), filtered to source files only, and incrementally synced. The graph stays fresh as you code — no configuration needed.\n\n---\n\n## CLI Reference\n\n```bash\ncodegraph                         # Run interactive installer\ncodegraph install                 # Run installer (explicit)\ncodegraph init [path]             # Initialize in a project (--index to also index)\ncodegraph uninit [path]           # Remove CodeGraph from a project (--force to skip prompt)\ncodegraph index [path]            # Full index (--force to re-index, --quiet for less output)\ncodegraph sync [path]             # Incremental update\ncodegraph status [path]           # Show statistics\ncodegraph query <search>          # Search symbols (--kind, --limit, --json)\ncodegraph files [path]            # Show file structure (--format, --filter, --max-depth, --json)\ncodegraph context <task>          # Build context for AI (--format, --max-nodes)\ncodegraph affected [files...]     # Find test files affected by changes (see below)\ncodegraph serve --mcp             # Start MCP server\n```\n\n### `codegraph affected`\n\nTraces import dependencies transitively to find which test files are affected by changed source files.\n\n```bash\ncodegraph affected src/utils.ts src/api.ts         # Pass files as arguments\ngit diff --name-only | codegraph affected --stdin   # Pipe from git diff\ncodegraph affected src/auth.ts --filter \"e2e/*\"     # Custom test file pattern\n```\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `--stdin` | Read file list from stdin | `false` |\n| `-d, --depth <n>` | Max dependency traversal depth | `5` |\n| `-f, --filter <glob>` | Custom glob to identify test files | auto-detect |\n| `-j, --json` | Output as JSON | `false` |\n| `-q, --quiet` | Output file paths only | `false` |\n\n**CI/hook example:**\n\n```bash\n#!/usr/bin/env bash\nAFFECTED=$(git diff --name-only HEAD | codegraph affected --stdin --quiet)\nif [ -n \"$AFFECTED\" ]; then\n  npx vitest run $AFFECTED\nfi\n```\n\n---\n\n## MCP Tools\n\nWhen running as an MCP server, CodeGraph exposes these tools to Claude Code:\n\n| Tool | Purpose |\n|------|---------|\n| `codegraph_search` | Find symbols by name across the codebase |\n| `codegraph_context` | Build relevant code context for a task |\n| `codegraph_callers` | Find what calls a function |\n| `codegraph_callees` | Find what a function calls |\n| `codegraph_impact` | Analyze what code is affected by changing a symbol |\n| `codegraph_node` | Get details about a specific symbol (optionally with source code) |\n| `codegraph_files` | Get indexed file structure (faster than filesystem scanning) |\n| `codegraph_status` | Check index health and statistics |\n\n---\n\n## Library Usage\n\n```typescript\nimport CodeGraph from '@myersguo/codegraph';\n\nconst cg = await CodeGraph.init('/path/to/project');\n// Or: const cg = await CodeGraph.open('/path/to/project');\n\nawait cg.indexAll({\n  onProgress: (p) => console.log(`${p.phase}: ${p.current}/${p.total}`)\n});\n\nconst results = cg.searchNodes('UserService');\nconst callers = cg.getCallers(results[0].node.id);\nconst context = await cg.buildContext('fix login bug', { maxNodes: 20, includeCode: true, format: 'markdown' });\nconst impact = cg.getImpactRadius(results[0].node.id, 2);\n\ncg.watch();   // auto-sync on file changes\ncg.unwatch(); // stop watching\ncg.close();\n```\n\n---\n\n## Configuration\n\nThe `.codegraph/config.json` file controls indexing:\n\n```json\n{\n  \"version\": 1,\n  \"languages\": [\"typescript\", \"javascript\"],\n  \"exclude\": [\"node_modules/**\", \"dist/**\", \"build/**\", \"*.min.js\"],\n  \"frameworks\": [],\n  \"maxFileSize\": 1048576,\n  \"extractDocstrings\": true,\n  \"trackCallSites\": true\n}\n```\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `languages` | Languages to index (auto-detected if empty) | `[]` |\n| `exclude` | Glob patterns to ignore | `[\"node_modules/**\", ...]` |\n| `frameworks` | Framework hints for better resolution | `[]` |\n| `maxFileSize` | Skip files larger than this (bytes) | `1048576` (1MB) |\n| `extractDocstrings` | Extract docstrings from code | `true` |\n| `trackCallSites` | Track call site locations | `true` |\n\n## Supported Languages\n\n| Language | Extension | Status |\n|----------|-----------|--------|\n| TypeScript | `.ts`, `.tsx` | Full support |\n| JavaScript | `.js`, `.jsx`, `.mjs` | Full support |\n| Python | `.py` | Full support |\n| Go | `.go` | Full support |\n| Rust | `.rs` | Full support |\n| Java | `.java` | Full support |\n| C# | `.cs` | Full support |\n| PHP | `.php` | Full support |\n| Ruby | `.rb` | Full support |\n| C | `.c`, `.h` | Full support |\n| C++ | `.cpp`, `.hpp`, `.cc` | Full support |\n| Swift | `.swift` | Full support |\n| Kotlin | `.kt`, `.kts` | Full support |\n| Scala | `.scala`, `.sc` | Full support (classes, traits, methods, type aliases, Scala 3 enums) |\n| Dart | `.dart` | Full support |\n| Svelte | `.svelte` | Full support (script extraction, Svelte 5 runes, SvelteKit routes) |\n| Vue | `.vue` | Full support (script + script-setup extraction, Nuxt page/API/middleware routes) |\n| Liquid | `.liquid` | Full support |\n| Pascal / Delphi | `.pas`, `.dpr`, `.dpk`, `.lpr` | Full support (classes, records, interfaces, enums, DFM/FMX form files) |\n\n## Troubleshooting\n\n**\"CodeGraph not initialized\"** — Run `codegraph init` in your project directory first.\n\n**Indexing is slow** — Check that `node_modules` and other large directories are excluded. Use `--quiet` to reduce output overhead.\n\n**Indexing is slow / MCP `database is locked` / WASM fallback active** — `codegraph` ships with a WASM SQLite fallback for environments where `better-sqlite3` (a native module, declared as `optionalDependencies`) can't install. The fallback is 5-10x slower than the native backend and uses a journal mode that lets writers block readers, so MCP queries can also hit `database is locked` while indexing runs. Run `codegraph status` and look at the `Backend:` line:\n\n- `Backend: native` — you're on the fast path, nothing to do.\n- `Backend: wasm` — you're on the slow fallback. Common causes: missing C build tools, prebuilt binary unavailable for your Node version, or your Node version changed after install. Fix:\n\n  ```bash\n  # macOS\n  xcode-select --install                                  # installs the C compiler\n\n  # Linux (Debian / Ubuntu)\n  sudo apt install build-essential python3 make\n\n  # Linux (RHEL / Fedora)\n  sudo yum groupinstall \"Development Tools\"\n\n  # Then rebuild on any platform:\n  npm rebuild better-sqlite3\n\n  # Or force-include as a hard dep:\n  npm install better-sqlite3 --save\n  ```\n\n  After the fix, `codegraph status` should show `Backend: native`.\n\n**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.\n\n**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.\n\n## License\n\nMIT\n\n---\n\n<div align=\"center\">\n\n**Made for the Claude Code community**\n\n[Report Bug](https://github.com/myersguo/codegraph/issues) · [Request Feature](https://github.com/myersguo/codegraph/issues)\n\n</div>","users":{}}