AI Tools
Graphify Explained: The AI Tool That Turns Your Codebase Into a Knowledge Graph
By DevShelfHub
A complete technical research report on Graphify — the Y Combinator S26-backed open-source tool that turns any codebase into a queryable knowledge graph. Covers the full pipeline (tree-sitter AST, Leiden clustering, LLM semantic extraction), all 25+ AI assistant integrations, MCP server, PR triage, callflow-html export, comparison with grep/Sourcegraph/RAG, security model, and a final verdict.
Introduction
There is a gap at the center of every AI-assisted development workflow in 2026. AI coding assistants are remarkably capable at writing code, explaining functions, and fixing bugs — but they are architecturally blind. Ask Claude Code how authentication connects to the database in a 200K-line codebase and it starts grepping files, reading them one at a time, filling its context window, and hoping it lands on the right answer before running out of space.
Graphify ( github.com/safishamsi/graphify, MIT) is the fix. It turns your entire project — code, docs, SQL schemas, PDFs, images, and videos — into a queryable knowledge graph with a single command. Instead of making the AI read files, you give it a pre-built map it can traverse in seconds. It hit 69,000+ GitHub stars in roughly 2.5 months with zero marketing spend, was accepted into Y Combinator S26, and now integrates with 25+ AI coding assistants including Claude Code, Codex, Cursor, Gemini CLI, and GitHub Copilot CLI.
This is a complete technical deep-dive: how it works, what makes it different, when to use it, and what its real limitations are.
Key takeaways
- /graphify . builds a knowledge graph of your entire project in one command — code, docs, PDFs, images, videos, live databases.
- Code is extracted locally via tree-sitter (36 grammars, zero API cost). Your source code never leaves your machine.
- Graph-first beats file-first for AI codebase navigation: pre-computed relationships are faster, cheaper, and richer than real-time file reading.
- Persistent memory —
graph.jsonsurvives session resets; AI never rediscovers the same relationships twice. - MIT licensed, YC S26 — free forever, institutionally backed, with an enterprise tier for Fortune 500 teams.
The problem: AI coding agents are architecturally blind
Modern AI coding agents use a fundamentally file-centric approach to codebase understanding: they search files, read files, and try to infer relationships from raw text. This works for small projects and simple questions. It breaks down fast at any serious scale.
Why grep and file reading fail AI agents
- grep finds strings, not relationships. "What services depend on the payment module?" cannot be answered by text search — it requires an edge traversal.
- Context window costs compound. Sending 500K tokens of codebase per question costs $7.50 at Claude Opus rates — and the model still can't synthesize 500K tokens coherently.
- Session amnesia. Every new conversation starts from zero. The AI rediscovers the same relationships on every query, burning tokens and time.
- Multi-file reasoning breaks. LLMs struggle to maintain coherent understanding of relationships across dozens of files read sequentially in a single context window.
The beginner-friendly analogy: imagine joining a huge company where instead of receiving an org chart, you're told to "figure out who reports to whom by reading everyone's emails one at a time." That's what every AI coding agent does with your codebase today. Graphify builds the org chart first.
What Graphify does: one command, a complete map
Run /graphify . inside your AI assistant and it reads every file in your project, extracts entities
and relationships, clusters them with the Leiden algorithm, and produces three output files:
graph.html
Interactive browser visualization. Click nodes, filter by type, search relationships, zoom into communities. Open in any browser — no server needed.
GRAPH_REPORT.md
The curated highlights: god nodes, surprising cross-module connections, extracted design rationale from comments and docstrings, suggested questions.
graph.json
The full queryable graph. Your AI assistant queries this instead of re-reading raw files. Persistent across sessions — no more rediscovery.
Then query it directly:
/graphify query "what connects auth to the database?"
/graphify path "UserService" "DatabasePool"
/graphify explain "RateLimiter"
This is the shift from file-first navigation (search files, read files, infer relationships) to graph-first navigation (query pre-built relationships directly). It's the difference between a search engine that reads every web page fresh for every query vs. one that has already indexed the web.
How Graphify works: the pipeline
Input ingestion
Graphify accepts any mix of code files, documentation, PDFs, images, videos, database DSNs, and YouTube links. It merges .gitignore and .graphifyignore to determine what to process, then fans out extraction tasks to parallel workers.
AST parsing via tree-sitter (local, zero API cost)
For all 36 supported code languages, tree-sitter runs locally. Every function definition, class declaration, import statement, and function call is captured as structured data. Your source code never leaves your machine during this step.
Semantic extraction via LLM (docs, PDFs, images, video)
Non-code content routes through your configured AI backend. Graphify supports 14 backends: Gemini, Claude, OpenAI, DeepSeek, Kimi, AWS Bedrock (IAM), Azure OpenAI, and Ollama for fully offline operation. Video/audio is transcribed locally via faster-whisper before going to the LLM.
Node and edge creation with confidence tags
Every entity becomes a node; every relationship becomes a typed edge. Critically, each edge is tagged: EXTRACTED (AST-based, deterministic), INFERRED (LLM-based, probabilistic), or AMBIGUOUS (uncertain). You always know what was found vs. guessed.
Leiden clustering (community detection)
The Leiden algorithm (an improvement over Louvain) groups nodes into natural communities — the auth cluster, payment cluster, user management cluster — even when the code doesn't organize itself that way. It also surfaces god nodes: the most-connected concepts everything flows through.
Output generation
Three primary outputs (graph.html, GRAPH_REPORT.md, graph.json) plus optional exports: Obsidian vault, Markdown wiki, Mermaid call-flow HTML, Neo4j Cypher, GraphML, and SVG.
Codebase / Docs / Media / DBs
│
├─── Tree-sitter AST Parser (local · no API cost)
│ ↓
└─── LLM Semantic Extractor (docs · PDFs · images · video)
↓
Graph Builder (nodes + edges + confidence tags)
↓
Leiden Clustering Engine (community detection · god nodes)
↓
┌─────────────────────────────────────┐
│ graph.json graph.html REPORT │
│ callflow-html wiki Neo4j SVG │
└─────────────────────────────────────┘
↓ ↓
MCP Server CLI Queries
(query_graph, path, (graphify query/path/explain)
triage_prs, …)
Supported input formats
| Category | Details | Extracted via |
|---|---|---|
| Code | Python, TS, JS, Go, Rust, Java, C/C++, Ruby, C#, Kotlin, Scala, PHP, Swift, Lua, Zig, Elixir, Julia, Dart, Fortran, Pascal, SQL, Shell, Vue, Svelte, Astro, Groovy, PowerShell, + more (36 grammars) | tree-sitter (local, free) |
| Structured data | SQL schemas, Terraform/HCL, MCP configs, pyproject.toml, go.mod, pom.xml, apm.yml. Also: live PostgreSQL via --postgres DSN, Salesforce Apex (.cls, .trigger) | tree-sitter + regex (local) |
| Documentation | Markdown, MDX, QMD, HTML, TXT, RST, YAML — wikilinks and cross-file links become graph edges | LLM API |
| Office / Google | .docx, .xlsx (requires [office] extra); Google Docs/Sheets/Slides (requires gws auth + --google-workspace) | LLM API |
| PDFs | Full text extraction and semantic analysis (requires [pdf] extra) | LLM API |
| Images | PNG, JPG, WebP, GIF — described and linked to related code concepts | LLM API |
| Video / Audio | MP4, MOV, MP3, WAV — transcribed locally via faster-whisper, then semantically analyzed. YouTube URLs supported. | faster-whisper (local) → LLM |
| Papers | ArXiv URLs: /graphify add https://arxiv.org/abs/1706.03762 | LLM API |
Core components deep dive
Graph Builder
The Graph Builder merges AST parser and LLM extractor output into a unified graph. Every entity
becomes a node with a unique ID, type, file location, confidence
tag, and optional rationale text. Every relationship becomes a typed, directional
edge: calls,
imports,
references,
depends_on,
explains,
related_to.
Two graphs from different repos merge cleanly: graphify merge-graphs a.json b.json.
Semantic Extraction Layer
Handles everything tree-sitter cannot: natural language, images, audio, and inferring conceptual
relationships between code and documentation. Training the LLM with --mode deep
extracts more edges at higher API cost. Semantic relationships are always tagged INFERRED
so you know what was discovered vs. computed.
A unique "Why" extraction: inline comments (# NOTE:,
# WHY:, # HACK:),
docstrings, and design rationale from docs become separate explanation nodes linked to the code
they describe — giving the AI access to the developer intent behind each component.
Leiden Clustering Engine
The Leiden algorithm (an improvement over Louvain) produces three critical outputs:
- Community clusters — groups of tightly-coupled components. In a web app: "auth cluster", "payment cluster", "user management cluster" — even when the code doesn't organize this way by folder structure.
- God nodes — concepts with extremely high betweenness centrality that everything flows through. In most codebases: config objects, base classes, utility modules, shared data models. Knowing your god nodes tells you what to protect during refactors.
- Surprising connections — edges between nodes in different clusters you wouldn't expect: hidden coupling, violation of module boundaries, or undocumented cross-concerns.
Tuning: --resolution 1.5 (finer clusters) · --resolution 0.5 (coarser) · --exclude-hubs 99 (suppress top 1% super-hubs) · --cluster-only (re-cluster without re-extracting)
Query Engine
# Natural language graph search
graphify query "what connects auth to the database?"
graphify query "show all services that depend on UserSession"
# Shortest path between two named entities
graphify path "UserService" "DatabasePool"
graphify path "APIGateway" "PaymentProcessor"
# Full context for a node — purpose, relationships, community, rationale
graphify explain "RateLimiter"
graphify explain "AuthMiddleware"
# Direct graph file queries (headless / CI)
graphify query "auth flow" --graph graphify-out/graph.json
MCP server integration
Graphify exposes the knowledge graph as a Model Context Protocol (MCP) server — the open standard for AI assistant tool access. Any MCP-compatible client can call into the graph with structured parameters and receive structured JSON responses.
# Local server (one per developer, stdio transport)
python -m graphify.serve graphify-out/graph.json
# Team-shared HTTP server (everyone points at one URL)
python -m graphify.serve graphify-out/graph.json \
--transport http --host 0.0.0.0 --api-key "$SECRET" --port 8080
# Docker deployment
docker run -p 8080:8080 -v "$(pwd)/graphify-out:/data" graphify \
/data/graph.json --transport http --host 0.0.0.0 --api-key "$SECRET"
| MCP Tool | Description |
|---|---|
| query_graph | Natural language search across the entire graph |
| get_node | Retrieve full metadata for a specific named entity |
| get_neighbors | List all nodes directly connected to a given node |
| shortest_path | Find the shortest edge path between two named nodes |
| list_prs | Open pull requests with CI state and graph impact score |
| get_pr_impact | Which graph nodes are touched by a specific PR |
| triage_prs | AI-ranked PR review queue sorted by complexity and risk |
Supported AI platforms (25+)
| Platform | Support | Install command | Notes |
|---|---|---|---|
| Claude Code | ★★★★★ Full | graphify install | PreToolUse hooks fire before file reads |
| Codex (OpenAI) | ★★★★★ Full | graphify install --platform codex | Use $graphify not /graphify |
| Gemini CLI | ★★★★★ Full | graphify gemini install | PreToolUse hooks like Claude Code |
| Cursor | ★★★★☆ Strong | graphify cursor install | .cursor/rules/ alwaysApply |
| GitHub Copilot CLI | ★★★☆☆ Good | graphify install --platform copilot | AGENTS.md instructions |
| VS Code Copilot Chat | ★★★★☆ Strong | graphify vscode install | Via VS Code extension config |
| Kilo Code | ★★★★☆ Strong | graphify kilo install | Native /graphify command + plugin |
| Aider | ★★★☆☆ Good | graphify aider install | Sequential extraction |
| OpenClaw | ★★★☆☆ Good | graphify claw install | AGENTS.md instructions |
| Devin CLI | ★★★☆☆ Good | graphify devin install | Dedicated install |
| Trae / Trae CN | ★★★☆☆ Good | graphify trae install | No PreToolUse hooks; AGENTS.md |
Installation and quick start
Requires Python 3.10+ and uv (recommended).
Step 1 — Install the package
# ⚠️ PyPI package is graphifyy (double-y). CLI command is still "graphify".
uv tool install graphifyy
# With all extras (PDF, video, MCP server, Neo4j, etc.)
uv tool install "graphifyy[all]"
# Granular extras
uv tool install "graphifyy[pdf,video,mcp]"
Step 2 — Register the skill with your AI assistant
graphify install # auto-detects platform
graphify cursor install # Cursor specifically
graphify gemini install # Gemini CLI
graphify install --platform codex # Codex
Step 3 — Build the graph and query it
cd ~/your-project
# Build the knowledge graph
/graphify .
# Open the visualization
open graphify-out/graph.html
# Query the graph
/graphify query "how does authentication work?"
/graphify query "what are the most important components?"
/graphify explain "PaymentProcessor"
# Set up auto-rebuild on every git commit (AST only, zero API cost)
graphify hook install
# Generate living architecture documentation
graphify export callflow-html
Add external content to the graph
# Add a research paper
/graphify add https://arxiv.org/abs/1706.03762
# Add a YouTube video (architecture walkthrough, conference talk)
/graphify add https://youtube.com/watch?v=...
# Add a live PostgreSQL schema
graphify extract . --postgres "postgresql://user:pass@host/db"
# Re-extract only changed files (fast incremental update)
/graphify . --update
Real workflow: debugging a production issue
Scenario: The error says NullPointerException in EnterpriseSessionValidator:127.
Enterprise users can't pay. Standard users are fine.
Without Graphify
- Claude runs grep → 12 references across files
- Reads 4 files to understand the class
- Context window fills, stops reading
- Gives a partial answer
- 8–10 back-and-forth exchanges
- 15 minutes · $2–5 in tokens
With Graphify
/graphify explain "EnterpriseSessionValidator"→ purpose, 8 callers, 3 deps- Notice
EnterpriseLicenseCheckerin the deps /graphify path "PaymentController" "LicenseDatabase"→ full call chain- Bug identified: caching issue for enterprise accounts updated within 24h
- 3 queries · 2 minutes · <$0.10
Graphify vs. alternatives
| Tool | Approach | Strength | Weakness |
|---|---|---|---|
| grep / ripgrep | Text pattern search | Fast, universal, zero setup | No semantic understanding, returns raw text not relationships |
| Sourcegraph | Code intelligence platform | Production-grade, scales to huge orgs | SaaS pricing, no knowledge graph, no AI assistant integration |
| Cursor indexing | Embedding-based semantic search | Seamlessly integrated in IDE | Cursor-only, stateless, no relationship graph, no export |
| LLM file reading | Sending full files to LLM | Accurate for small codebases | Expensive at scale, stateless, context window limits |
| Traditional RAG | Vector similarity retrieval | Good for document Q&A | Returns text fragments not relationships, poor at "what connects X to Y?" |
| Graphify | Pre-computed knowledge graph | Local-first, 25+ integrations, multi-format, persistent, MCP server, PR analysis | Setup time, LLM cost for non-code, learning curve |
The fundamental difference: grep finds files; Sourcegraph finds code; RAG finds text fragments. Graphify finds relationships — and persists them so every subsequent question is cheaper and more accurate.
Pros and cons
Advantages
- +Graph-first navigation — pre-computed relationships, not real-time file reading
- +Persistent memory across sessions — no more rediscovery
- +Code extracted locally via tree-sitter — zero API cost, zero data egress
- +Multi-modal: code + docs + PDFs + images + video + live DBs in one graph
- +25+ AI assistant integrations — works with your existing toolchain
- +MCP server for structured programmatic access
- +Git-committable graph for team knowledge sharing
- +Confidence-tagged edges (EXTRACTED / INFERRED / AMBIGUOUS)
- +PR graph-impact analysis and AI-ranked triage
- +MIT licensed, 14 AI backends, fully offline via Ollama
Limitations
- −Initial graph generation for large doc-heavy repos takes significant time and API cost
- −PyPI naming confusion (graphifyy double-y) creates installation friction
- −Very large graph.html files become slow in the browser — use CLI queries instead
- −LLM dependency for semantic extraction of non-code content
- −Leiden extra only available for Python < 3.13 (fallback clustering for 3.13+)
- −PowerShell requires
graphify .not/graphify .— minor Windows friction - −Query learning curve — users default to file reading out of habit
- −Some platform integrations (Trae, Aider, OpenClaw) still maturing
Security and privacy
What stays local
- All source code (AST extraction via tree-sitter)
- SQL schemas, Terraform, package manifests
- Video/audio transcription (faster-whisper, local)
- No telemetry, no usage tracking
- Query logs optional (
GRAPHIFY_QUERY_LOG_DISABLE=1)
What routes through AI APIs
- Documentation (Markdown, HTML, RST)
- PDFs, Office documents
- Images (PNG, JPG, WebP)
- Video transcripts (after local transcription)
- Always uses your chosen AI backend — no Graphify cloud
For fully offline operation, combine Ollama local inference with tree-sitter AST extraction: zero network traffic during the entire graph build. For air-gapped environments, AWS Bedrock (IAM-based) requires no API key.
Frequently asked questions
What exactly does /graphify . produce?
graphify-out/: graph.html (interactive browser visualization), GRAPH_REPORT.md (god nodes, surprising connections, suggested questions), and graph.json (the full queryable graph your AI assistant uses instead of re-reading raw files). Optional: callflow-html, wiki, Obsidian vault, Neo4j Cypher export.Do I need an API key to use Graphify?
Why is the PyPI package "graphifyy" with two y's?
graphify was already taken on PyPI by an unaffiliated package. The CLI command is still just graphify — you only see the double-y when running uv tool install graphifyy. The README warns: "Other graphify* packages on PyPI are not affiliated."What is a "god node" and why does it matter?
Can I commit graphify-out/ to git?
graphify-out/ (excluding cost.json) so the entire team benefits from the graph without everyone needing to build it. A dedicated git merge driver prevents conflict markers when multiple developers commit changes simultaneously.How does --update work for incremental rebuilds?
--update compares file modification times against the manifest, re-extracts only changed or new files, and patches the graph. graphify hook install sets up a post-commit git hook that runs AST-only incremental updates automatically on every commit with zero API cost.How does graphify prs --triage work?
get_pr_impact), then uses your configured AI backend to rank them by complexity (how many god nodes touched), risk (changes to high-centrality components), and conflict likelihood (PRs sharing graph communities). The result is an ordered review queue with reasoning.Can Graphify handle multiple repositories (microservices)?
graphify merge-graphs a.json b.json to combine graphs from multiple repositories into one unified knowledge map. Cross-service dependencies become visible as edges between the two subgraphs. Particularly valuable for microservices architectures where understanding cross-service impact is hard.What is the callflow-html export?
graphify export callflow-html generates an HTML page with Mermaid-rendered call-flow diagrams showing how requests flow through your system — effectively auto-generated architecture documentation. With graphify hook install, it regenerates on every git commit, keeping architecture docs permanently synchronized with the code.Is there a graph size limit?
GRAPHIFY_MAX_GRAPH_BYTES=2GB. For very large corpora, use --token-budget to reduce semantic chunk size. For large graphs, prefer CLI queries or the MCP server over the browser visualization.Final verdict
The big picture
Graphify is building the missing infrastructure layer between AI coding assistants and the codebases they're supposed to understand. The file-centric paradigm that has dominated software development since the 1960s is hitting its ceiling in the agentic AI era. A 50,000-file repo is not meaningfully navigable as a file tree — by humans or by AI agents. Graphify is an early, production-ready demonstration of what comes next: graph-centric coding, where relationships are first-class and pre-computed rather than inferred on-the-fly.
Use Graphify if you…
- ✓Use Claude Code, Codex, Cursor, or Gemini CLI on repos > 50 files
- ✓Want to reduce AI token costs on codebase navigation questions
- ✓Onboard new engineers to complex systems
- ✓Need living architecture documentation that stays current
- ✓Work in compliance-sensitive environments (local-first pipeline)
- ✓Manage multi-repo microservices architectures
Skip it if you…
- ✗Work on tiny projects (< 20 files) — overhead exceeds benefit
- ✗Run in restricted sandbox environments (no local process execution)
- ✗Need zero-setup, immediate value in under 5 minutes
- ✗Require Python 3.9 or below
Future potential score
9.5 / 10
69,000 GitHub stars in 2.5 months without marketing. Y Combinator S26. MIT licensed. 25+ integrations.
The problem it solves (codebase blindness in AI agents) affects every serious AI coding team.
The solution is technically sound — tree-sitter, Leiden, MCP, multi-modal, confidence-tagged.
The architecture is right for the agentic AI era. The evaluation barrier is one command:
/graphify .