Zero tokens by default
Build, refresh and query all run locally. ask --rerank is the only thing that spends model tokens, and only when asked.
v0.7.1MITmacOS arm64 · Linux x64 · Windows x64
zerograph reads a repository's markdown and code in 24 languages and extracts the structure the authors already wrote. It answers questions about that structure in a few lines of text.
npm install -g zerograph
Build, refresh and query all run locally. ask --rerank is the only thing that spends model tokens, and only when asked.
Exact id, BM25 and local dense retrieval find it in about 200 tokens an answer.
Every reader takes --json, there is an MCP server, and a session hook keeps the graph fresh.
Five lines, from nothing to an agent that asks the graph first.
One global binary. Or pnpm add -D zerograph to pin it per project.
npm install -g zerographThe graph is built per checkout and never committed.
echo .zerograph/ >> .gitignoreThe first run downloads the embedding model; after that only changed files are re-read.
zerograph buildPlain words in, path:line out. It stays fresh with your edits.
zerograph ask cancellation policyOptional: the Claude Code plugin. Also --codex, --cursor, --copilot, --gemini, --opencode.
zerograph install-agent --claudeOutput from zerograph's own checkout. Each line reads path:line [ID] headline; └ lines are neighbours one hop away.
$ zerograph ask writer lock
src/store.rs:531 Store.lock_writer
└ src/store.rs:6 Store
src/lib.rs:2114 tests::a_poll_skips_its_cycle_while_a_refresh_holds_the_writer_lock
src/store.rs:520 Store.try_lock_writer
$ zerograph impact Store.try_lock_writer
sym:src/store.rs::Store.try_lock_writer src/store.rs:520
d=1 will break (1)
sym:src/lib.rs::Watcher.poll src/lib.rs:565 Calls → sym:src/store.rs::Store.try_lock_writer
importers (7): src/ask.rs, src/bench.rs, src/dump.rs, src/families.rs, src/index/dense.rs, src/mcp.rs, src/status.rs
risk: MEDIUM — 1 direct, 1 total, 8 files
$ zerograph trace Watcher.poll Store.try_lock_writer
sym:src/lib.rs::Watcher.poll src/lib.rs:565
→ sym:src/store.rs::Store.try_lock_writer src/store.rs:520
$ zerograph explain Store.try_lock_writer
sym:src/store.rs::Store.try_lock_writer src/store.rs:520 Symbol Store.try_lock_writer
Declares ← sym:src/store.rs::Store src/store.rs:520
Calls ← sym:src/lib.rs::Watcher.poll src/lib.rs:565
Calls → sym:src/store.rs::Store.lock_file src/store.rs:520
Calls → sym:src/store.rs::Store.lock_label src/store.rs:520
Calls → sym:src/store.rs::WriterLock src/store.rs:520
Also: zerograph changes --base main says what the diff touches and who reaches it. All commands
The hard part is not building a better graph, it is building a better door onto it.
A repository's ids, imports and calls already form a dense, human-authored graph. zerograph extracts it and finds the right entry point from a question phrased in ordinary words.
FR-PAY-22 or StaffService goes straight to its node.path:line ID headline.Requirement ids, cross-references, exports, imports, calls, decorators, and ids quoted in comments, from markdown and:
The Claude Code plugin starts zerograph's MCP server for the session, briefs each session and subagent on the index, answers a concept grep from the graph before it runs, and names the callers an edit can break.
◇ zerograph · in sync
$ zerograph install-agent --claude # also --codex --cursor --copilot --gemini --opencode # or, inside Claude Code /plugin install zerograph --marketplace devmaxxx/zerograph
keyword 40/40, paraphrase 20/30, code 12/12 at 222 p90 tokens
The recorded 82 cases on the bench fixture: 908 files, about 8.3k nodes, default embedder, 0.6.3. How it is measured
Same repository, same questions. The full results and method
Rerank (sonnet) is opt-in and the only step that spends model tokens, about 14k a question.
graphify, a cold build, reads every file with a model; zerograph and GitNexus build locally.
What an agent reads per question: about 150 tokens against 1.6k.
A fresh process per question; zerograph serve answers in 66 ms.
16 change targets: every file that reaches each one.
Shortest call chain between two symbols, including 2 correct refusals.
The whole index for one checkout.
Each checkout keeps its own graph and index in .zerograph/, so worktrees, clones and branches never share
state. The only thing shared is a cache of embeddings. Parallel agents are safe: one writer lock per checkout.
1.5 sto build a clone of zerograph itself, instead of 46 s, with the same answers.
path:line, not a dump of files.ask --rerank helps, and it is the one step that spends tokens.rg -l beside it.Build, refresh and query all run locally. ask --rerank is the only thing that spends model tokens, and only when asked.
The agent's session hook refreshes the graph per checkout, and a resident serve polls and re-reads only the files that changed.
An answer given while files are behind says so itself. Keeping fresh
No. Each checkout keeps its own graph and index in .zerograph/. The only thing shared is a cache of embeddings, text hash to vector,
which is why a new worktree builds in seconds.
By default the 4-bit ONNX export of embeddinggemma-300m, run on your machine. Another model can be pinned in zerograph.toml.
Embeddings
No. Ask the graph for a concept, a caller or an id; grep is still right for a literal string.