R076 · Knowledge for agents › Code knowledge graphs for agents

Graphify: a tree-sitter code graph that agents query instead of grep

Read the original

code-graphgraph-databaseagent-memorycontext-engineeringagent-harnessharness-config

TL;DR

Graphify turns a folder (code, docs, PDFs, images, audio) into a persistent local knowledge graph that a coding agent queries before it greps. Code is parsed with tree-sitter (about 40 languages) and never sent to an LLM; prose and images still go through LLM subagents. Every edge is labelled EXTRACTED, INFERRED (with a score) or AMBIGUOUS, and a Claude Code hook steers the agent from Grep/Read to the graph. The repo claims 147K stars and a 71.5x token cut per query on a 52-file corpus, but its own numbers show the win shrinks to about 1x on small repos and its QA accuracy trails a rival on LOCOMO. Treat it as a strong navigation layer for large, unfamiliar codebases, not as proof that graphs beat grep in general.

What it is and how it works

Graphify-Labs/graphify is a Python CLI plus a /graphify skill (Apache-2.0, created 2026-04-03; the company is in YC S26). The free CLI is open source; Graphify Cloud is the paid layer with cross-repo graphs, Sentry and Jira connectors, and what it calls formal verification. Install is pip install graphifyy (the PyPI name is temporary).

  1. Extract, in three passes. Code goes through tree-sitter locally: functions, classes, imports, calls, inheritance and cross-file references. Audio and video are transcribed locally with faster-whisper. Docs, PDFs and images go to LLM subagents that each emit a JSON fragment, which are merged.

  2. Label every edge. EXTRACTED edges come straight from the parse (confidence 1.0). INFERRED edges are scored from 0.95 down to 0.55. AMBIGUOUS edges are kept but flagged.

  3. Cluster. Leiden community detection groups nodes into subsystems, with no embeddings.

  4. Capture rationale. Comments marked NOTE or WHY, and ADR or RFC citations, become rationale nodes linked to the code they explain.

  5. Persist and update. Output is graph.json (NetworkX format), an interactive graph.html, an Obsidian vault and GRAPH_REPORT.md (central nodes, surprising links, suggested questions). A SHA256 cache re-extracts only changed files; git hooks keep it fresh.

  6. Query. query (default budget 2,000 tokens, depth 2), path between two nodes (rated by its weakest hop) and explain. Also exposed as an MCP server, with export to Neo4j or FalkorDB.

  7. Steer the agent. On Claude Code a PreToolUse hook redirects Grep/Read to the graph. A strict mode blocks reads of indexed files unless the graph was queried recently. graphify prs reports each PR's graph impact and merge-order risk.

The post says it works with Claude Code, Codex, Cursor, Gemini CLI and 20+ other tools, with no embeddings, vector DB or paid API.

Claims and evidence

All numbers below are the project's own and have not been reproduced. Read together, they say the graph is very good at finding the right evidence and only average at answering from it.

BenchmarkGraphifyComparisonWhat it shows
LOCOMO recall@100.497mem0 0.048, supermemory 0.149Strong at finding the right evidence
LOCOMO QA accuracy45.3%supermemory 49.7%Finding is not answering; it loses here
LongMemEval-S76%dense RAG 76%A tie with plain retrieval
ERPNext key-fact coverage82.0%grep 70.8%Beats grep, but on only 6 questions
Tokens per query71.5x fewerreading files directly, 52-file corpusSavings grow with corpus size
Tokens per queryabout 1xreading files directly, 6-file corpusNo savings on small repos

Two framing issues. "No LLM calls" holds only for code; docs, PDFs and images still need an LLM. LOCOMO and LongMemEval are conversational-memory benchmarks, so they say little about code navigation, which is the post's main pitch.

Tradeoffs and failure modes

Review checklist

Before adopting a code graph like this for agents:

Sources

Connections

See R076 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.