CodeGraph indexes a codebase into a knowledge graph with embeddings and exposes it to coding agents over MCP (Model Context Protocol), so an assistant can query relationships instead of reading files one at a time. Parsing uses tree-sitter with FastML pattern matching, optional language-server resolution links types and definitions, and enrichment adds module nodes and import edges, Rust-local dataflow edges (defines, uses, flows_to, returns, mutates), document nodes linked to backticked symbols in Markdown and schema files, and architecture signals such as package cycles. It is written in Rust and stores the graph in SurrealDB with an HNSW vector index.
Rather than returning a list of matches, it ships four agentic tools — agenticcontext for search and context building, agenticimpact for dependency chains and call flows, agenticarchitecture for structure and API surface, and agenticquality for complexity, coupling, and hotspots. Each runs a reasoning agent that plans, queries the graph, and synthesises an answer with file paths, line numbers, and bounded snippets. Agents are implemented with Rig by default; ReAct and LATS backends remain selectable, and under Rig each tool maps to a sub-strategy — tree search for open-ended questions, linear reasoning for direct lookups, and a self-correcting fallback that retries with a refined plan.
Indexing is tiered so you can trade richness against speed and storage:
| Tier | What it enables | Typical use |
|---|---|---|
| fast | AST nodes and core edges only, no language server or enrichment | quick indexing, low storage |
| balanced | language-server symbols, enrichment, module linking, docs and contracts | agentic results without full cost |
| full | all analyzers, language-server definitions, dataflow, and architecture | maximum richness |
Behaviour also adapts to the context window configured for the agent's model, from terse prompts capped at 3 steps under 50K tokens up to 8 steps beyond 500K, with a hard cap of 8 steps (10 with an environment override). Layered guards keep results within that budget: each tool result is truncated relative to the context window and flagged with _truncated, and an accumulation guard fails fast when multi-step results pass a safe threshold. Search is hybrid — 70% vector similarity, 30% lexical, plus graph traversal and optional cross-encoder reranking.
Indexing respects .gitignore and filters common secret patterns. Languages covered include Rust, Python, TypeScript, JavaScript, Go, Java, C++, C, Swift, Kotlin, C#, Ruby, PHP, and Dart, and a tier that enables a language server fails fast when that language's server binary is missing.
Features
- Graph plus embeddings: matches come back with callers, dependencies, and their place in the architecture attached
- Four agentic tools: context, impact, architecture, and quality, each with an optional focus parameter for precision
- Reasoning backends: Rig by default, with ReAct, LATS, and an automatic Reflexion recovery path
- Indexing tiers: fast, balanced, and full trade graph richness against indexing speed and storage
- Context-window awareness: prompt style and step budget adapt to the configured window, capped at 8 steps
- Overflow protection: per-tool truncation with a _truncated marker plus an accumulated-context guard
- Hybrid search: 70% vector similarity, 30% lexical, graph traversal, and optional reranking
- Dataflow and architecture edges: impact analysis over flows_to, mutates, and boundary rules declared in codegraph.boundaries.toml
- Agent bootstrap: an optional lightweight project primer so an agent's first tool calls are not blind
- Daemon mode: --watch re-indexes in the background as files change, debounced
- Provider flexibility: local or cloud embedding and reasoning models, with SurrealDB as the graph and vector store
