Codebase knowledge graph tool. Graphify turns any folder of code into a queryable knowledge graph using tree-sitter AST extraction, Leiden community detection, and graph querying.
graphify .Output:
graphify-out/
├── graph.html interactive graph in your browser
├── GRAPH_REPORT.md key concepts, connections, suggested questions
├── graph.json full graph — query without re-reading files
└── .graphify_labels.json community names
- 36+ language grammars via tree-sitter — Python, TypeScript, Rust, Go, Java, C++, Kotlin, Scala, Ruby, Swift, PHP, Lua, Zig, and more
- Leiden community detection — discover module groupings and cross-module dependencies
- 9+ LLM backends — Claude, Gemini, Kimi, OpenAI, Ollama (local), DeepSeek, Azure, Bedrock, Claude-CLI
- Query the graph —
graphify query "how does auth work?",graphify path "Parser" "AST",graphify explain "DatabasePool" - Multiple export formats — HTML, SVG, JSON, GraphML, Obsidian vault, Markdown wiki, Neo4j Cypher
- MCP server — expose the graph as tool-callable MCP server with 10 query tools and 6 resources
- 20+ AI assistant integrations — Claude Code, Gemini CLI, Codex, Cursor, Copilot, Aider, Devin, Kiro, and more
- Headless extraction —
graphify extract ./srcfor CI pipelines (no IDE needed) - Incremental updates —
graphify update ./srcre-extracts only changed files - PR impact analysis — see which communities a PR touches and its blast radius
- Git hooks — graph auto-rebuilds on commit
- Entity deduplication — MinHash/LSH blocking + Jaro-Winkler fuzzy matching + union-find merge
- Privacy — AST extraction is fully local, no telemetry
# Recommended
uv tool install graphifyy
# Alternatives
pipx install graphifyy
pip install graphifyypip install "graphifyy[pdf]" # PDF support
pip install "graphifyy[office]" # Word/Excel support
pip install "graphifyy[video]" # Video transcription
pip install "graphifyy[mcp]" # MCP server (stdio + HTTP)
pip install "graphifyy[neo4j]" # Neo4j export
pip install "graphifyy[svg]" # SVG export
pip install "graphifyy[leiden]" # Leiden community detection
pip install "graphifyy[ollama]" # Ollama local LLM
pip install "graphifyy[all]" # everything# 1. Install
uv tool install graphifyy
# 2. Set up your AI assistant
graphify install
# 3. Build the knowledge graph
graphify .
# 4. Query it
graphify query "how does the authentication system work?"
graphify path "UserService" "DatabasePool"
graphify explain "RequestHandler"| Command | Description |
|---|---|
graphify . |
Build graph for current folder (AST + LLM extraction) |
graphify extract <path> |
Full extraction pipeline |
graphify extract <path> --backend gemini |
Use specific LLM backend |
graphify update <path> |
Incremental re-extraction (AST only, no API cost) |
graphify cluster-only <path> |
Rerun clustering and generate report |
graphify query "<question>" |
Search the graph (BFS/DFS) |
graphify path "<A>" "<B>" |
Shortest path between two concepts |
graphify explain "<concept>" |
Explain a node and its neighbors |
graphify affected "<node>" |
Impact analysis for a node |
graphify serve [graph.json] |
Start MCP server (stdio or HTTP) |
graphify prs |
PR dashboard with graph impact analysis |
graphify hook install |
Auto-rebuild graph on git commit |
graphify install |
Install skill for your AI coding assistant |
graphify provider add |
Add a custom LLM provider |
| Backend | Env var | Default model | Notes |
|---|---|---|---|
| Claude | ANTHROPIC_API_KEY |
claude-sonnet-4-6 | |
| Gemini | GEMINI_API_KEY / GOOGLE_API_KEY |
gemini-3-flash-preview | |
| Kimi | MOONSHOT_API_KEY |
kimi-k2.6 | |
| OpenAI | OPENAI_API_KEY |
gpt-4.1-mini | |
| Ollama | OLLAMA_BASE_URL |
qwen2.5-coder:7b | Local, free |
| DeepSeek | DEEPSEEK_API_KEY |
deepseek-v4-flash | |
| Azure | AZURE_OPENAI_API_KEY |
gpt-4o | |
| Bedrock | AWS_PROFILE / AWS_REGION |
claude-3-5-sonnet | |
| Claude CLI | (uses claude on PATH) |
claude-code-plan | Uses your Pro/Max sub |
Graphify serves as an MCP server with these tools:
- query_graph — Search with BFS or DFS, configurable depth and token budget
- get_node — Full details for a specific node
- get_community — All nodes in a community
- god_nodes — Most connected nodes in the graph
- graph_stats — Node/edge/community counts
- shortest_path — Path between two concepts
- list_prs — Open PRs with CI status and graph impact
- get_pr_impact — Detailed graph impact for a specific PR
- triage_prs — Actionable PRs ranked by merge risk
graphify-mcp serve graph.json --transport http --port 8080 --api-key MY_SECRET# Claude Code
graphify install --platform claude
# Gemini CLI
graphify install --platform gemini
# Cursor
graphify install --platform cursor
# VS Code Copilot Chat
graphify install --platform vscode
# See all supported platforms
graphify install --helpSource Files
│
▼
[extract.py] File discovery, chunking, dispatch
│
├── [extractors/] tree-sitter AST parsing (36+ languages)
│
└── [llm.py] LLM semantic extraction (9+ backends)
│
▼
[build.py] NetworkX graph construction + deduplication
│
▼
[cluster.py] Leiden community detection (graspologic)
│
▼
[analyze.py] God nodes, surprising connections, question suggestions
│
▼
[export.py] graph.json, HTML, SVG, GraphML, Obsidian, Neo4j
[wiki.py] Wikipedia-style markdown articles
[serve.py] MCP server (stdio + HTTP)
[prs.py] PR impact analysis
- File discovery — Recursively finds code, documents, images, videos, and PDFs; respects
.gitignore - AST extraction — tree-sitter parses each file and extracts function/class definitions, imports, and call sites into nodes and edges with
EXTRACTEDconfidence - Semantic extraction — files are packed into chunks fitting an LLM's context window and sent for architectural knowledge extraction, producing
EXTRACTED,INFERRED, andAMBIGUOUSedges - Graph building — AST + semantic results are merged into a single NetworkX graph with entity deduplication (MinHash/LSH + Jaro-Winkler)
- Community detection — Leiden algorithm discovers natural module groupings; oversized communities are split
- Analysis — God nodes (most connected), surprising cross-community connections, and suggested questions
- Export — Multiple output formats including interactive HTML, queryable JSON, and Obsidian vault
git clone https://github.com/Sachitt-AV-08/graphify.git
cd graphify
uv sync
pytestMIT