Embedded code-graph engine for AI code assistants. One Rust daemon per repo extracts dependencies via Tree-sitter, serves blast radius with source inline. Your agent acts in turn 1, not turn 15.
View on GitHubRust · Single binary · CozoDB + in-memory adjacency · Docs
The problem
AI code assistants spend most of their turns reading files to understand architecture. Each file read is a tool call, each tool call is latency, each wrong file is a wasted turn.
The agent reads dozens of files to map dependencies before making a single edit. Most of those reads discover things the graph already knows.
Exploration dominates execution. The agent's first edit often comes after 5+ tool calls of pure discovery. Every session re-discovers the same codebase.
Understanding dies with the session. No queryable graph, no dependency index, no blast radius. Every new conversation starts blind.
Measured
Effectiveness benchmark on a production multi-language repo (Python, TypeScript, Rust; 50K+ lines). Same model, same tasks, multiple repeats. Interception hooks deliver graph context transparently.
Pilot C2 vs A2 on issue-form tasks (hard/medium difficulty, cross-module). Hook latency median 27ms. Full methodology in benchmarks.
How it works
One daemon per repo keeps the graph always hot. Every agent session queries the same indexed graph through a local socket.
Tree-sitter parses source code into symbols, calls, imports, inheritance. Python today; Rust and TypeScript next. Deterministic IDs, edge confidence tags.
CozoDB (embedded Datalog) holds facts and derives confidence by rule. In-memory adjacency serves traversals in microseconds. Atomic per-file updates; reads never wait for writes.
CLI, MCP shim, and interception hooks deliver blast radius, source inline, covering tests. The agent gets the answer and the code in one call.
In practice
Interception hooks rewrite the agent's grep into an enriched graph-aware answer. The agent gets structural context without changing its habits.
$ graphite blast rebase_onto_base # Blast radius: 4 symbols in 3 files (depth 3, trusted edges only) # Confidence: 3 EXTRACTED, 1 INFERRED (resolved) EXTRACTED rover/git_ops.py:142 rebase_onto_base() def rebase_onto_base(repo_path, base_branch, ...): """Rebase current worktree onto the given base branch.""" EXTRACTED rover/git_ops.py:198 rebase_main_onto_current() calls rebase_onto_base (depth 1) EXTRACTED runner/engine.py:87 pre_hook() calls rebase_main_onto_current (depth 2) INFERRED runner/engine.py:245 execute_task() calls pre_hook (depth 3, resolved via call chain) # Covering tests: tests/test_rover.py, tests/test_engine.py # graph_rev: 1847 stale: false latency: 0.4ms
Honesty built in
Every edge carries a confidence tier and provenance. Responses disclose when a result is a lower bound and why. Assertiveness from transparency, not from hiding uncertainty.
Parsed directly from source. Static call, explicit import, type annotation. The graph saw it in the AST.
Derived by rule. Duck-typed call resolved to a likely target. Marked with provenance so the agent can verify if needed.
Multiple possible targets. Dynamic dispatch, reflection, generated code. The graph says "I don't know which one" instead of guessing.
Under the hood
File watcher indexes eagerly. Queries hit an already-indexed graph. At most a short freshness barrier, never a rebuild.
In-memory adjacency serves blast radius in plain Rust BFS. CozoDB handles facts, rules, and search.
Responses return verbatim source with line numbers alongside graph context. One call = dependency context + actual code.
Tree-sitter grammars, CozoDB, daemon, clients, file watcher. One Rust executable. No runtime, no npm, no venv.
Landscape
Competing tools optimize for ease of adoption. Graphite optimizes for agent execution speed. Background watcher, source inline, consolidated queries, runner integration.
| Tool | Language | Storage | Speed focus | Stars |
|---|---|---|---|---|
| Graphify | Python | NetworkX | Token reduction | 120K+ |
| CodeGraph | TS + Rust | SQLite + FTS5 | Tool call reduction | 71K+ |
| GitNexus | TypeScript | KuzuDB | Community clustering | 47K+ |
| codebase-memory | C | Knowledge graph | Sub-ms queries | 44K+ |
| Graft | TypeScript | JSON + markdown | Pre-query freshness | 9K+ |
| Graphite | Rust | CozoDB (Datalog) | Always-hot, source inline, zero exploration | - |
Get started
# Build from source $ cargo build --release # Start the daemon (indexes your repo immediately) $ ./target/release/graphite-cli daemon # See what your current diff will break $ ./target/release/graphite-cli diff-impact