100% Rust implementation of code graphRAG with blazing fast AST+FastML parsing, surrealDB backend and advanced agentic code analysis tools through MCP for efficient code agent context management
$git clone https://github.com/jakedismo/codegraph-rustInstalls into the current project.
Install codegraph-rust by running `git clone https://github.com/jakedismo/codegraph-rust`, then use it for the current task and follow its documentation at https://github.com/jakedismo/codegraph-rust.
| 1 |  |
| 2 | |
| 3 | # CodeGraph |
| 4 | |
| 5 | **Your codebase, understood.** |
| 6 | |
| 7 | CodeGraph transforms your entire codebase into a semantically searchable knowledge graph that AI agents can actually *reason* about—not just grep through. |
| 8 | |
| 9 | > **Ready to get started?** Jump to the [Installation Guide](docs/INSTALLATION_GUIDE.md) for step-by-step setup instructions. |
| 10 | > |
| 11 | > **Already set up?** See the [Usage Guide](docs/USAGE_GUIDE.md) for tips on getting the most out of CodeGraph with your AI assistant. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## The Problem |
| 16 | |
| 17 | AI coding assistants are powerful, but they're flying blind. They see files one at a time, grep for patterns, and burn tokens trying to understand your architecture. Every conversation starts from zero. |
| 18 | |
| 19 | **What if your AI assistant already knew your codebase?** |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## What CodeGraph Does Differently |
| 24 | |
| 25 | ### 1. Graph + Embeddings = True Understanding |
| 26 | |
| 27 | Most semantic search tools create embeddings and call it a day. CodeGraph builds a **real knowledge graph**: |
| 28 | |
| 29 | ``` |
| 30 | Your Code → Build Context → AST + FastML → LSP Resolution → Enrichment → Graph + Embeddings |
| 31 | ↓ ↓ ↓ ↓ ↓ ↓ |
| 32 | Packages Nodes/edges Type-aware API surface Graph Semantic |
| 33 | Features Fast patterns linking Module graph traversal search |
| 34 | Targets Spans Definitions Dataflow/Docs (hybrid) |
| 35 | ``` |
| 36 | |
| 37 | When you search, you don't just get "similar code"—you get code with its **relationships intact**. The function that matches your query, plus what calls it, what it depends on, and where it fits in the architecture. |
| 38 | |
| 39 | Indexing enrichment adds: |
| 40 | - Module nodes and module-level import/containment edges for cross-file navigation |
| 41 | - Rust-local dataflow edges (`defines`, `uses`, `flows_to`, `returns`, `mutates`) for impact analysis |
| 42 | - Document/spec nodes linked to backticked symbols in `README.md`, `docs/**/*.md`, and `schema/**/*.surql` |
| 43 | - Architecture signals (package cycles + optional boundary violations) |
| 44 | |
| 45 | #### Indexing tiers (speed vs richness) |
| 46 | |
| 47 | Indexing is tiered so you can choose between speed/storage and graph richness. The default is **fast**. |
| 48 | |
| 49 | | Tier | What it enables | Typical use | |
| 50 | |------|-----------------|-------------| |
| 51 | | `fast` | AST nodes + core edges only (no LSP or enrichment) | Quick indexing, low storage | |
| 52 | | `balanced` | LSP symbols + docs/enrichment + module linking | Good agentic results without full cost | |
| 53 | | `full` | All analyzers + LSP definitions + dataflow + architecture | Maximum accuracy/richness | |
| 54 | |
| 55 | Tier behavior details: |
| 56 | - `fast`: disables build context, LSP, enrichment, module linking, dataflow, docs/contracts, and architecture; filters out `Uses`/`References` edges. |
| 57 | - `balanced`: enables build context, LSP symbols, enrichment, module linking, and docs/contracts; filters out `References` edges. |
| 58 | - `full`: enables all analyzers and LSP definitions; no edge filtering. |
| 59 | |
| 60 | Configure the tier: |
| 61 | - CLI: `codegraph index --index-tier balanced` |
| 62 | - Env: `CODEGRAPH_INDEX_TIER=balanced` |
| 63 | - Config: `[indexing] tier = "balanced"` |
| 64 | |
| 65 | #### Indexing prerequisites (LSP-enabled tiers) |
| 66 | |
| 67 | When the tier enables LSP (`balanced`/`full`), indexing **fails fast** if required external tools are missing. |
| 68 | |
| 69 | Required tools by language: |
| 70 | - Rust: `rust-analyzer` |
| 71 | - TypeScript/JavaScript: `node` and `typescript-language-server` |
| 72 | - Python: `node` and `pyright-langserver` |
| 73 | - Go: `gopls` |
| 74 | - Java: `jdtls` |
| 75 | - C/C++: `clangd` |
| 76 | |
| 77 | If indexing appears to stall during LSP resolution, you can adjust the per-request timeout: |
| 78 | |
| 79 | - `CODEGRAPH_LSP_REQUEST_TIMEOUT_SECS` (default `600`, minimum `5`) |
| 80 | |
| 81 | If LSP resolution fails immediately and the error includes something like `Unknown binary 'rust-analyzer' in official toolchain ...`, your `rust-analyzer` is a rustup shim without an installed binary. Install a runnable `rust-analyzer` (e.g. via `brew install rust-analyzer` or by switching to a toolchain that provides it). |
| 82 | |
| 83 | #### Optional architecture boundary rul |