Graphify: A Knowledge Graph for Coding Agents That Costs Zero LLM Credits, and the One Edge It Gets Wrong — aniketkarneai.com | aniketkarneai.com
Wednesday, November 11, 2026 Field notes on autonomous systems ● Amsterdam, NL
daily

Graphify: A Knowledge Graph for Coding Agents That Costs Zero LLM Credits, and the One Edge It Gets Wrong

Graphify turns a codebase into a traversable knowledge graph using tree-sitter AST parsing instead of an LLM, so building the index costs nothing. We installed it, ran it against FastAPI, and found a false-positive edge that its own benchmark document claims does not exist.

I installed Graphify at 01:34 UTC on a Saturday, pointed it at a checkout of FastAPI, and it produced a 12,674-node graph of the framework in 21 seconds without making a single API call. Then I spent the next twenty minutes trying to find a lie in the README, because “zero LLM credits” is exactly the kind of claim that means “we did not count the part where we quietly paid someone.”

Here is the short version: the zero-credit claim is real. The AST extraction is genuinely deterministic. And I still found an edge in the graph that points at the wrong Tag, which matters more than the benchmark table it appears next to.

What this thing actually is

Graphify (Graphify-Labs/graphify) is at 133,920 stars and 12,792 forks as of this morning, Apache-2.0 with a retained MIT file for pre-relicensing contributions, and it shipped version 0.9.95 to PyPI roughly seven hours before I started writing this. It has 263 published versions on PyPI since April 4th, 28 of them in the last thirty days. The release cadence is aggressive enough that the version number is not a useful pin — 0.9.95 will be 0.9.96 by the time you read this.

The pitch is a /graphify slash command for Claude Code, Cursor, Codex, Gemini CLI, Copilot, and twenty-odd other assistants. You run it against a directory and you get three files:

graphify-out/
├── graph.html       clickable force-directed graph
├── GRAPH_REPORT.md  key concepts, surprising connections, suggested questions
└── graph.json       the full graph, queryable without re-reading files

The architectural bet is the one that makes everything else interesting. The standard way to build a code knowledge graph for an agent is to run an LLM over every file and ask it to emit entities and relationships as JSON. That is slow, expensive, non-deterministic, and produces a graph where you cannot tell which edges came from the code and which edges came from a language model being helpful. Graphify refuses the first two and mostly handles the third by never calling an LLM for code at all.

Instead of an LLM, the code path uses tree-sitter — real parser grammars — to extract classes, functions, imports, and call edges. The pipeline in ARCHITECTURE.md is a straight line:

detect() → extract() → build() → cluster() → analyze helpers → report.generate() → export.to_*()

detect.py classifies files into code, docs, papers, and images. extract.py walks the tree-sitter parse trees and emits a {nodes, edges} dict. build.py turns that into a NetworkX graph. cluster.py runs Leiden to split it into communities. Then analyze.py computes god nodes, surprising connections, import cycles, and graph diffs, and export.py writes the JSON, HTML, SVG, Obsidian, GraphML, and Cypher variants.

The code is not a thin wrapper over a model. It is a real multi-language parser pipeline with 117 dispatch entries in extract.py’s _DISPATCH table, 15 more in _SHEBANG_DISPATCH for extensionless scripts with a shebang, 35 language extractor modules under graphify/extractors/, and 53 tree-sitter grammar packages installed. That is where the zero-credit claim comes from: no token is spent because no model is in the loop for code.

Installing it and pointing it at a real repo

The install is one command, and the dependency surface is large but conventional:

uv tool install graphifyy

That pulled in 53 tree-sitter packages and left two executables behind: graphify and graphify-mcp. The MCP server is a genuine second surface — serve.py implements an MCP stdio and HTTP server over the graph with its own IDF scoring, trigram index, and Chinese token segmentation, so an assistant can query the graph as a tool rather than shelling out.

I ran it against this blog’s own src/ directory first, because that is a codebase I can check by hand. The src/ tree has 532 files, 112 MB, of which 28 are code and 503 are documentation and images. The default run refused to proceed:

error: no LLM API key found (503 doc/paper/image file(s) need semantic extraction).
Set GEMINI_API_KEY or GOOGLE_API_KEY (gemini), MOONSHOT_API_KEY (kimi),
ANTHROPIC_API_KEY (claude), OPENAI_API_KEY (openai), DEEPSEEK_API_KEY (deepseek),
or pass --backend. A code-only corpus needs no key.

This is a reasonable error message, and the fix is documented. But it is worth flagging that the “zero LLM credits” claim is scoped to code only — the moment your corpus contains markdown, PDFs, or images, you are back in the pay-per-token business for that portion. docs/how-it-works.md is explicit about it: “Code files are not sent to the LLM semantic extractor in the normal pipeline. If a corpus contains only code files, Pass 3 is skipped entirely.”

With --code-only:

[graphify extract] --code-only: skipping 503 non-code file(s) (258 docs, 2 papers, 243 images) — no LLM extraction
[graphify extract] found 28 code, 0 docs, 0 papers, 0 images
[graphify extract] AST extraction on 28 code files...
[graphify extract] wrote graphify-out/graph.json: 215 nodes, 265 edges, 17 communities

Two seconds, 215 nodes, 265 edges, 17 communities. The report header confirms the cost accounting:

- Extraction: 99% EXTRACTED · 1% INFERRED · 0% AMBIGUOUS · INFERRED: 3 edges (avg confidence: 0.85)
- Token cost: 0 input · 0 output

Zero input, zero output. That is the whole pitch, and on a code-only corpus it holds up.

FastAPI is the better test because it is large, real, and — crucially — the project publishes its own numbers against it. A fresh shallow clone gave 1,219 Python files. graphify . --code-only on it:

[graphify extract] AST extraction on 1269 code files...
[graphify] Deduplicated 15 node(s) (7 exact, 8 fuzzy).
[graphify extract] wrote graphify-out/graph.json: 12674 nodes, 25186 edges, 1123 communities
real 0m21.153s

12,674 nodes, 25,186 edges, 1,123 communities, 21 seconds, four workers, no API key. The confidence split came out 95% EXTRACTED / 5% INFERRED, with 1,286 INFERRED edges carrying an average confidence of 0.87 — and, notably, every single one of those 1,286 had a confidence_score attached, as did all 23,900 EXTRACTED edges at a flat 1.0.

That score distribution is worth pausing on. Every INFERRED edge in the graph is either 0.85 or 0.95. The documentation describes a five-rung rubric — 0.95 near-certain, 0.85 strong evidence, 0.75 reasonable, 0.65 weak, 0.55 speculative — but only two rungs ever appeared in a 12,674-node graph. The lower three are described but unused, at least here.

The god nodes tell you what the graph is actually good for

The FastAPI report’s top ten most-connected concepts read like a summary of the framework’s API surface:

1. `FastAPI` - 1559 edges
2. `APIRouter` - 478 edges
3. `HTTPException` - 432 edges
4. `Release Notes` - 341 edges
5. `post()` - 304 edges
6. `jsonable_encoder()` - 240 edges
7. `Depends()` - 206 edges
8. `UploadFile` - 204 edges
9. `Query()` - 194 edges
10. `APIRoute` - 182 edges

This is the real utility argument, and it is not about the pretty picture. An agent that can ask “which 47 things connect to APIRouter” gets a structural answer in one tool call instead of grepping, reading, and re-reading files. graphify explain gives you the node, its source file and line, its community, its degree, and the confidence tag on each connection:

$ graphify explain "getArticleSlug"
Node: getArticleSlug()
  Source:    src/scripts/analytics-events.ts L11
  Community: Community 3
  Degree:    4

Connections (4):
  <-- analytics-events.ts [contains] [EXTRACTED] src/scripts/analytics-events.ts:L11
  <-- setupScrollDepth() [calls] [EXTRACTED] src/scripts/analytics-events.ts:L61

And graphify path traces between two arbitrary nodes:

$ graphify path "getArticleSlug" "setup404Tracking"
Shortest path (2 hops):
  getArticleSlug() <--contains [EXTRACTED]-- analytics-events.ts --contains [EXTRACTED]--> setup404Tracking()

That path goes through the file rather than through a call, which is a hint about how the “contains” relation behaves in a mostly-declarative Astro codebase. It is still useful navigation, but it is not the same thing as a call path.

The token economics are real, and the numbers are enormous

Graphify ships a benchmark command that compares “read the whole corpus” against “query the graph.” On the FastAPI graph it reported:

  Corpus:          1,513,950 words → ~2,018,600 tokens (naive)
  Graph:           30,279 nodes, 44,737 edges
  Avg query cost:  ~1,468 tokens
  Reduction:       1375.1x fewer tokens per query

1,375x. On my blog repo it reported 8.8x on a 28-file code corpus. The README’s own table claims 71.5x on a 52-file corpus, 5.4x on a 4-file corpus, and roughly 1x for httpx at 6 files.

The shape of these numbers deserves scrutiny rather than celebration. The reduction factor is roughly corpus_size / query_size, and both terms are dominated by corpus size, so the ratio grows without bound as the corpus grows. A 1,375x reduction against a 2-million-token corpus means a 1,468-token query — which is excellent, and also means the comparison flatters the tool enormously at scale. Six files already fit in a context window; the README says as much. The honest framing is that Graphify converts “read everything” into “read a small neighborhood,” and that neighborhood is small because the graph is indexed, not because the answer is simple.

Where it gets interesting is the second benchmark family, which is not about code at all. BENCHMARKS.md reports Graphify as a conversational long-term memory system, benchmarked against mem0, supermemory, BM25, dense RAG, and hybrid RRF on LOCOMO (n=300) and LongMemEval-S (n=50):

SuiteMetricgraphifyField
LOCOMO (300)recall@100.497bm25 0.362, mem0 0.048
LOCOMO (300)QA accuracy45.3%supermemory 49.7% (11x ingest cost), bm25 31.3%, mem0 27.3%
LongMemEval-S (50)QA accuracy76%dense RAG 76%, hybrid 74%, mem0 70%
ERPNext cross-tool (6)key-fact coverage82.0%grep/read baseline 70.8%

This is the most interesting claim in the repo, because it is the one that competes with the entire vector-database memory category using a structure instead of embeddings. Recall@10 of 0.497 against mem0’s 0.048 is roughly 10x. And the ingest economics are stark: ~$1.40 against supermemory’s $15.67, with the graph build itself at $0 in LLM credits.

Two caveats are disclosed in the same document, and they deserve to be lifted out. First, supermemory’s recall number is marked “embedder-confounded” because its self-hosted mode locks in a 768-d English-only embedder instead of the shared BGE-m3 — so the recall column is not a like-for-like comparison. The QA-accuracy column is. Second, every number comes from Graphify’s own harness, with competing systems wired in as adapters. The judge was blind-validated against a second judge at 90.6% agreement and Cohen’s kappa 0.81, which is more methodology disclosure than most published memory benchmarks bother with, but it is still a self-run benchmark.

The ERPNext result is the one I would actually trust most, because it is the least exotic: a fixed coding agent, Claude Opus 4.8, at most 14 turns, a grep/read/list floor plus one graphify tool, on a roughly 1M-LOC production repo. Adding the graph tool moved key-fact coverage from 70.8% to 82.0%. That is a controlled A/B on real code with a real model in the loop.

The part where I found the edge that is wrong

BENCHMARKS.md has a paragraph about the INFERRED confidence tag, and it makes a precise, checkable claim. The README-scope edges are the INFERRED cross-file resolver edges whose relation is one of calls, indirect_call, imports, imports_from, or inherits, and whose source and target both live under fastapi/. Here is the claim:

This is a dated manual spot-check, not a continuously-measured metric: on a fresh AST-only extract (2026-10-05) all 12 such edges were correct.

Twelve. I ran the equivalent on FastAPI at commit 7a0a3f0b (release 0.162.0, tagged 2026-10-23), and the same scope produced 65 edges — 60 indirect_call and 5 calls. The scope has grown by more than five times in under three weeks, which is exactly what you would expect from a fast-moving framework, and it means the twelve-edge spot-check no longer describes the population it is being used to vouch for.

So I audited all 65. I checked each one by locating the target symbol’s definition and confirming it was actually reachable from the source function. Sixty-one had the callee’s name inside the caller’s own function body. Four were inconclusive — the name was elsewhere in the source file but not in the 120-line window I sampled around the call site. Zero had a callee name entirely absent from the calling file.

Then I hand-checked the five calls edges individually, because those are the ones that make a specific, falsifiable claim about a function calling a specific function:

SourceTargetVerdict
.__call__() @ applications.py L1175.enabled() @ telemetry/_asgi.py L174Correct — applications.py:1192 calls self._native_telemetry.enabled()
_add_form_union_validators() @ dependencies/utils.py L974Tag @ openapi/models.py L413Wrong
_validate_value_with_model_field() @ dependencies/utils.py L794.validate() @ _compat/v2.py L173Correct — returns field.validate(value, values, loc=loc)
.from_api_route() @ routing.py L1476.get_route_handler() @ routing.py L1278Correct — callee list confirms it
serialize_response() @ routing.py L320.validate() @ _compat/v2.py L173Correct — field.validate(response_content, {}, loc=...)

The false positive is the interesting one. _add_form_union_validators() in fastapi/dependencies/utils.py does call a class named Tag:

tag = next(
    (item for item in reversed(metadata) if isinstance(item, Tag)),
    Tag(model.__name__),
)

But that Tag is pydantic.Tag — imported at utils.py:73 from from pydantic import (...). It is not fastapi.openapi.models.Tag, which is the class the graph resolved to at openapi/models.py:413. The two are unrelated: pydantic.Tag is a frozen dataclass for labeling discriminated-union cases, and fastapi.openapi.models.Tag is an OpenAPI schema object with name, description, and externalDocs fields.

Graphify resolved the call to the wrong Tag because fastapi/dependencies/utils.py has no import from fastapi.openapi.models at all, and there is exactly one Tag node in the whole graph, at openapi/models.py:413. The resolver fell back to the single name match available in the repository and picked a different class from a different package.

This is a resolver limitation, not a bug in the confidence machinery — the edge is tagged INFERRED at 0.85, which is the “strong evidence” rung, and it should have been tagged AMBIGUOUS instead. But it directly contradicts the benchmark document’s “all 12 such edges were correct” framing, because the check was performed on a population five times smaller than the one that now exists, and a manual spot-check of twelve edges does not detect a homonym collision that requires reading the import statements.

The README does concede the general shape of this problem: “Homonymous helpers in tests/ produce noisier INFERRED calls edges.” But the failing edge is not in the test tree. It is in production code, and it is the result of a cross-package name collision rather than a duplicate helper name.

A second, sharper trap: update does not respect --code-only

This one cost me real time and would cost anyone relying on the documented “run graphify update . after code changes” workflow.

graphify . --code-only gave me 12,674 nodes and 25,186 edges on FastAPI. Then I ran the documented refresh command:

graphify update .

and got:

[graphify watch] Rebuilt: 30279 nodes, 44737 edges, 2502 communities
real 0m47.228s

The graph more than doubled in size. It was not stale-cache corruption — it was the code path. graphify update . has no --code-only flag; passing one is rejected outright:

error: unknown update option: --code-only

And watch.py:1828 explains the behavior in a comment: “Include document files that have AST extractors (e.g. .md, .mdx, .qmd).” FastAPI has a large docs/ tree of Markdown, and the markdown extractor is an AST extractor, so update pulls all of it in. Breaking down the 30,279 nodes by source extension afterward:

by ext: [('md', 17590), ('py', 8223), ('yml', 2319), ('NOEXT', 2088), ('js', 32), ('yaml', 15), ('sh', 11), ('toml', 1)]

17,590 Markdown nodes against 8,223 Python nodes. The code graph that update produced is more than half documentation.

The same thing happened to my blog repo, where update re-extracted the 258 .mdx blog posts and produced 2,123 nodes where --code-only had produced 215. That is a 10x inflation, and the update run does not need an LLM key to do it, which makes it worse rather than better: it silently changes the shape of your graph and charges nothing to do so.

So the workflow the README recommends — build with --code-only, refresh with graphify update . — produces two different graphs. For a memory-context tool where “what is in my graph” is the whole point, that is a meaningful inconsistency, and the fix on your side is to re-run the full extract rather than update, or to accept that your graph will accumulate documentation.

The direction problem is real, and it bites at the networkx boundary

One more thing worth knowing before you build on this. graph.json is written with "directed": false and "multigraph": false, but every edge is genuinely directed — the direction lives only in the arc order of the source and target fields. ARCHITECTURE.md is explicit about it, and warns that a plain json_graph.node_link_graph() load re-orders endpoints by node-list position.

In my blog-repo graph, 143 of 1,918 edges came back with their endpoints swapped when I loaded the file the naive way. 7.5% of the directed edges in the graph, silently reversed. That is enough to invert a dependency relationship and have the tool confidently tell you that A calls B when B calls A.

Two layers of defense, and you need both. First, the file also fails to load at all under networkx 3.7 without a key rename — json_graph.node_link_graph(d) raises KeyError: 'edges' because graphify writes the key as links, while networkx 3.6+ expects edges. Second, graphify’s own loader handles both: graphify.paths.load_node_link_graph() stamps _src and _tgt on every edge from the raw arc order before the networkx load can mangle it. I verified it round-trips all 1,918 edges with zero direction lost.

So the rule is: load through paths.load_node_link_graph() and read direction from data["_src"] / data["_tgt"], never from the (u, v) tuple. Graphify’s own query, path, and explain commands already do this correctly. The risk is entirely in third-party code you write against the JSON.

The honest scorecard

Graphify is doing something genuinely useful and the architecture is sound. Building a structural map of a codebase with deterministic parsing and zero API spend is a real capability, and the ~40-language AST coverage means it works on a polyglot monorepo, not just Python. The multi-format exports, the MCP server, the Leiden community detection with no embedding step, and the EXTRACTED/INFERRED/AMBIGUOUS tagging are all well-built.

The gaps I hit are all in the same family: the documentation is one version behind the code.

  • The INFERRED edge audit is stale and too small. Twelve edges on 2026-10-05 against a population that is now 65. One of the five calls edges in that scope resolves to pydantic.Tag while claiming fastapi.openapi.models.Tag. If the spot-check had been re-run after the population grew, or had included import-statement verification, it would have caught it.
  • update and extract disagree about what a graph is. --code-only excludes Markdown; update includes it, has no way to exclude it, and does so without charging you. Your refreshed graph is a different graph.
  • Three different language counts are published. docs/how-it-works.md says “25 languages supported”; the README says “across ~40 languages”; ARCHITECTURE.md says “about 40 languages”. The actual dispatch tables cover 117 suffixes plus 15 shebang routes across 35 extractor modules.
  • The benchmark’s “0.497 recall@10” is real but self-run. Same harness, same model, same grader, competing systems as adapters, judge validated at kappa 0.81 — that is better disclosure than most, and it is still a self-run harness.
  • The token-reduction numbers scale with corpus size, so quoting “1375x” without the 2M-token corpus size next to it is misleading even though both numbers are right there in the output.

And the commercial shape is worth naming plainly. The README’s headline is “Cut agent token spend by 80%” for Graphify Cloud — a 14-day trial, always-on memory across repos, formal verification, Sentry and Jira connectors. The open-source local graph is real, but the always-on, cross-repo, continuously-verified product is the thing being sold. The Apache-2.0 repository is the funnel. The worked/ folders in the repo, each shipping its raw inputs and actual outputs so you can re-run them, are unusually honest for a project at this stage, and the fact that the graph has 263 PyPI releases and 133,920 stars six months after first publication says the funnel is working.

The part I cannot resolve from here is whether the resolver’s homonym failure is a bug that will be fixed or a permanent property of name-based AST resolution. The Tag collision is not subtle — pydantic.Tag and fastapi.openapi.models.Tag share a name and nothing else — and it is the kind of thing that a per-file import-aware second pass would catch. The 0.85 confidence score on that edge is the part I would want them to revisit, because the score is what an agent reads to decide whether to trust the connection, and right now a confidently wrong edge about which Tag gets constructed is exactly the kind of thing that propagates into a wrong answer three calls later.

Aniket Karne
DevOps & AI Engineer · Amsterdam
Back to all posts
Reader correspondence

Comments

Powered by GitHub Discussions via Giscus. Sign in with GitHub to leave a comment.