Code Retrieval Is Converging on Graphs, Not Embeddings
A trending open-source tool turns your monorepo into a queryable knowledge graph your coding agent can call over MCP.
Ask a coding agent "what does this function do" and it'll nail it. Ask "who calls this function across our twelve services, and which of those paths touch user input" and you'll watch it grep, read, grep again, and eventually hand you a confident half-answer. That gap — structural questions across a large codebase — is exactly what code-graph-rag targets, and it's why the project has been climbing GitHub's trending charts: it parses your repo with Tree-sitter, builds a knowledge graph of functions, classes, and call edges in Memgraph, and lets an LLM answer questions by generating Cypher queries against real structure instead of guessing from similar-looking text.
The interesting part isn't the tool itself. It's what it says about where code retrieval is heading.
The retrieval pendulum swings again
Code RAG has been through two regimes already. The 2023 playbook was embeddings: chunk the repo, vectorize it, cosine-similarity your way to context. It mostly disappointed — chunking splits functions mid-body, and vector search retrieves code that looks like your query, not code that's connected to it. Then came the agentic-search backlash: Claude Code shipped with no index at all, just grep and file reads, and the results were good enough to make embedding pipelines look like over-engineering. Fresh by construction, zero infrastructure, surprisingly effective.
But agentic grep has a ceiling, and it's structural. "Find dead code" means computing reachability over a call graph. "Does this value flow into a SQL query" means taint tracking. "Which client requests hit this Go route handler" means linking across languages. You can't grep your way to any of those; you can only burn tokens approximating them.
Graph-based retrieval is the third regime, and it isn't new — it's the open-source arrival of ideas that have been proven elsewhere. Sourcegraph's precise code intelligence has done compiler-accurate cross-repo navigation via SCIP indexes for years. Joern's code property graphs are standard kit in security analysis. Aider's repo map has quietly used Tree-sitter plus graph ranking to pick context since 2023. Microsoft's GraphRAG made the general document-side argument in 2024. What code-graph-rag adds is packaging: one unified graph schema across thirteen languages — Python, TypeScript/TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart — served to any agent over MCP.
That MCP detail matters more than the RAG branding. This isn't another chat-with-your-code app competing with your editor. It's a structure oracle your existing agent can call. Claude Code keeps doing what it's good at (reading, editing, running tests) and delegates the questions grep can't answer to the graph. Sidecar, not replacement — that's the architecture that has a chance of sticking.
What you actually get
Setup is a package install plus a local daemon (Memgraph runs via Docker; Qdrant joins it if you enable the semantic extras):
uv tool install "code-graph-rag[treesitter-full,semantic]"
cgr daemon up
cgr start --repo-path /path/to/repo --update-graph
From there you can query structure in plain English (the LLM — OpenAI, Gemini, or local Ollama — compiles it to Cypher), pull any function's source by name or intent, and make AST-based edits with a diff preview. The more distinctive features lean hard on the graph: dead-code detection by tracing call edges, structural search-and-replace via ast-grep patterns, and FLOWS_TO edges that follow values through assignments and calls into I/O sinks for C#, Java, C, and Go — lightweight taint tracking, the kind of thing that previously meant standing up CodeQL or Joern. Recent releases even resolve client request URLs to server route handlers across projects, which is the polyglot-monorepo question grep is worst at.
The honest trade-offs
Now the cold water. The project is at version 0.0.x with a fast-moving release cadence, and despite 2.9k stars its Show HN post drew essentially zero discussion — this codebase has not been community-vetted at the level its feature list implies. One already-patched path-traversal bug in the MCP file-reading tool is a reminder that you're wiring a young tool into an agent with edit permissions.
The structural criticisms apply to the whole category, not just this tool. A graph index reintroduces everything agentic search escaped: a daemon to run, an index that goes stale the moment you git pull, re-parse latency on large repos. Tree-sitter is also a syntactic parser — it sees names, not resolved types, so dynamic dispatch and metaprogramming will produce edges a compiler-grade indexer like SCIP wouldn't. The project knows this; the C# frontend already hybridizes with Roslyn for real semantic analysis. Expect that hybrid pattern to spread, because it's the only way syntactic graphs grow up.
And the null hypothesis still looms: frontier models keep getting better at brute-force agentic search. Every model generation shrinks the set of questions where the graph pays for its upkeep.
Where this lands
Here's my read: the graph approach is right, and this specific tool is a credible early implementation of it — but the payoff is sharply bimodal. On a single-language repo under a few hundred thousand lines, skip it; agentic grep plus Aider-style repo maps cover you, and the daemon is pure overhead. On a polyglot monorepo — TypeScript frontends calling Go services calling Java backends — structural questions are where agents currently waste the most tokens and produce the most confident nonsense, and a queryable call graph is a genuine unlock. That's the environment to trial this in: wire it into Claude Code as an MCP server, point it at your gnarliest cross-service question, and compare the answer against what your agent produces unaided.
The longer arc seems clear regardless of whether this particular repo wins. Retrieval for code is converging on deterministic structure — ASTs, call graphs, data flow — with embeddings demoted to a fallback for fuzzy intent. Sourcegraph proved the value commercially, security tooling proved it for analysis, and MCP finally makes it pluggable into whatever agent you already use. Code-graph-rag is early and rough. The bet it's making isn't.
Sources & further reading
- vitali87/code-graph-rag — github.com
- code-graph-rag releases — github.com
- Show HN: Code-Graph-RAG - Knowledge graph RAG for any codebase — news.ycombinator.com
Mariana covers the fast-moving world of machine learning and generative AI, with a particular focus on how these technologies are reshaping development workflows. When she isn't stress-testing the latest foundation models, she's usually at a local hackathon.
Discussion 0
No comments yet
Be the first to weigh in.