{"slug": "make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph", "title": "🧠 Make Your AI Coding Assistant 500x Smarter — Complete Guide to graphify + code-review-graph + MCP (Knowledge Graphs for Claude Code, Cursor, Windsurf)", "summary": "To dramatically improve AI coding assistants by using the Model Context Protocol (MCP) to create knowledge graphs of codebases. Instead of having the AI read every file from scratch for each query—which is slow and expensive—the guide shows how to install and configure tools like `graphify` and `code-review-graph` to build a map of code relationships. Using this approach reduces token consumption by up to 500x, allowing the AI to answer questions in seconds by querying the graph rather than scanning the entire project.", "body_md": "<div align=\"center\">\n\n# 🧠 Make Your AI Coding Assistant 500x Smarter\n\n### Stop Burning Tokens — Use Knowledge Graphs + MCP to Give AI a Map of Your Code\n\n<img src=\"https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=20&pause=1000&color=00D4AA&center=true&vCenter=true&width=700&lines=500x+fewer+tokens+per+query;AI+reads+a+graph+instead+of+your+entire+codebase;Auto-updates+on+every+git+commit;Works+with+Claude+Code%2C+Cursor%2C+Windsurf;Zero+config+after+setup+%E2%80%94+fully+automatic\" alt=\"Typing SVG\" />\n\n<br/>\n\n[![graphify](https://img.shields.io/badge/graphify-Knowledge_Graph-00D4AA?style=for-the-badge)](https://pypi.org/project/graphifyy/)\n[![code-review-graph](https://img.shields.io/badge/code--review--graph-AST_MCP_Server-FF6F00?style=for-the-badge)](https://pypi.org/project/code-review-graph/)\n[![MCP](https://img.shields.io/badge/MCP-Model_Context_Protocol-7F52FF?style=for-the-badge)](https://modelcontextprotocol.io)\n[![Claude Code](https://img.shields.io/badge/Claude_Code-Compatible-E8590C?style=for-the-badge)](https://claude.ai/code)\n[![Cursor](https://img.shields.io/badge/Cursor-Compatible-000000?style=for-the-badge)](https://cursor.sh)\n\n</div>\n\n---\n\n## 📖 What This Guide Covers\n\n```\nYour AI assistant reads your ENTIRE codebase every time you ask a question.\nThat's slow, expensive, and dumb.\n\nThis guide gives your AI a MAP of your code — so it looks up answers\ninstead of reading everything from scratch.\n\n         ┌──────────────────────────────────┐\n         │  1. What is MCP?                 │  ← The \"USB port\" for AI\n         │  2. Install graphify             │  ← Builds the knowledge graph\n         │  3. Install code-review-graph    │  ← Fast code-only MCP server\n         │  4. Connect via MCP              │  ← Wire it to Claude Code\n         │  5. Automate updates             │  ← Graph stays fresh forever\n         │  6. Use it                       │  ← 500x less tokens\n         └──────────────────────────────────┘\n```\n\n---\n\n## 🤔 Wait, What is MCP?\n\n**MCP = Model Context Protocol**\n\nThink of it like a **USB port for AI**.\n\n```\nUSB lets ANY device talk to ANY computer:\n\n  🖨️ Printer ──┐\n  📷 Camera  ──┤── USB ──── 💻 Computer\n  🎮 Gamepad ──┘\n\nMCP lets ANY tool talk to ANY AI assistant:\n\n  📊 Graph DB    ──┐\n  💬 Slack       ──┤── MCP ──── 🤖 AI Assistant\n  📁 Code Graph  ──┘\n```\n\n**Without MCP:**\n```\nYou: \"How does LlmRouter work?\"\n\nAI: \"Let me read... *reads 143 files* ... *burns 362,000 tokens* ... here's what I found\"\n    ⏱️ 30 seconds\n    💰 $$$ tokens burned\n```\n\n**With MCP:**\n```\nYou: \"How does LlmRouter work?\"\n\nAI: \"Let me check the graph...\"\n    → query_graph(\"callers_of\", \"LlmRouter\")\n    → gets back 10 precise connections in 0.2 seconds\n    \"LlmRouter has 47 connections. It's called by WebChatServer, ZeroClawService...\"\n    ⏱️ 2 seconds\n    💰 ~700 tokens (that's 500x less!)\n```\n\n### The Restaurant Analogy 🍕\n\n```\nWITHOUT MCP (reading files):\n┌──────────────────────────────────────────┐\n│                                          │\n│  You walk into a restaurant.             │\n│  There's no menu.                        │\n│  You go to the kitchen.                  │\n│  You open EVERY fridge.                  │\n│  You read EVERY ingredient label.        │\n│  Then you decide what to order.          │\n│                                          │\n│  That's your AI reading your codebase.   │\n│                                          │\n└──────────────────────────────────────────┘\n\nWITH MCP (using graph):\n┌──────────────────────────────────────────┐\n│                                          │\n│  You walk into a restaurant.             │\n│  There's a MENU on the table.            │\n│  You pick what you want.                 │\n│  Done.                                   │\n│                                          │\n│  The graph IS the menu.                  │\n│  MCP IS the waiter.                      │\n│                                          │\n└──────────────────────────────────────────┘\n```\n\n---\n\n## 🧩 The Two Tools (And Why You Need Both)\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                                                                 │\n│   graphify                        code-review-graph             │\n│   ════════                        ═════════════════             │\n│                                                                 │\n│   📚 The FULL picture             ⚡ The FAST picture           │\n│                                                                 │\n│   ✅ Code (functions, classes)    ✅ Code (functions, classes)  │\n│   ✅ Docs (README, guides)        ❌ No docs                   │\n│   ✅ Images (screenshots)         ❌ No images                  │\n│   ✅ Bugs & plans                 ❌ No docs                    │\n│   ✅ Semantic connections         ❌ Only structural            │\n│   ✅ Community clusters           ❌ Basic clusters             │\n│   ✅ Interactive HTML viz         ✅ HTML viz                   │\n│                                                                 │\n│   🐌 Needs LLM for docs/images   ⚡ Pure AST, no LLM needed   │\n│   📊 1,479 nodes example          📊 1,411 nodes example       │\n│                                                                 │\n│   Best for:                       Best for:                     │\n│   \"How does feature X relate      \"Who calls this function?\"    │\n│    to the bug in BUGS.md?\"        \"What imports this class?\"    │\n│                                   \"Impact of changing this?\"    │\n│                                                                 │\n└─────────────────────────────────────────────────────────────────┘\n\nUSE BOTH. They complement each other.\ncode-review-graph = your quick dictionary\ngraphify = your full encyclopedia\n```\n\n---\n\n## 📦 Step 1 — Install Everything\n\n### 1a. Install graphify\n\n```bash\npip install graphifyy\n```\n\n> Yes, it's `graphifyy` with two y's on PyPI.\n\n### 1b. Install code-review-graph\n\n```bash\npip install code-review-graph\n```\n\n### 1c. Verify both installed\n\n```bash\ngraphify --version\ncode-review-graph --help\n```\n\nYou should see version info and help text. If not, make sure Python is in your PATH.\n\n---\n\n## 🔨 Step 2 — Build Your First Graph\n\n### 2a. Build the graphify knowledge graph\n\nNavigate to your project root and run:\n\n```bash\ncd /path/to/your/project\n```\n\nThen in Claude Code (or any AI assistant with graphify skill):\n\n```\n/graphify .\n```\n\nThis will:\n1. Detect all files (code, docs, images)\n2. Parse code via AST (free, no LLM)\n3. Extract concepts from docs/images (uses LLM)\n4. Build a graph with nodes + edges\n5. Cluster into communities\n6. Generate `graphify-out/graph.html` (interactive viz!)\n\n```\nWhat happens:\n\n  Your Project                          graphify-out/\n  ├── src/                              ├── graph.json      ← The graph data\n  │   ├── auth.kt        ──────►       ├── graph.html      ← Open in browser!\n  │   ├── router.kt      ──────►       ├── GRAPH_REPORT.md ← Audit report\n  │   └── database.kt    ──────►       └── cost.json       ← Token usage\n  ├── README.md           ──────►\n  ├── BUGS.md             ──────►\n  └── screenshots/        ──────►\n        All files become graph nodes\n        with edges showing relationships\n```\n\n### 2b. Build the code-review-graph\n\n```bash\ncode-review-graph build\n```\n\nThis is instant — it only parses code via AST (no LLM needed):\n\n```\n$ code-review-graph build\nINFO: Progress: 50/140 files parsed\nINFO: Progress: 100/140 files parsed\nINFO: Progress: 140/140 files parsed\nFull build: 140 files, 1411 nodes, 2801 edges\n```\n\n### 2c. Open the graph in your browser\n\n```bash\n# graphify interactive visualization\nopen graphify-out/graph.html    # macOS\nstart graphify-out/graph.html   # Windows\nxdg-open graphify-out/graph.html # Linux\n```\n\nYou'll see something like this:\n```\n    ┌─────────────────────────────────────────────┐\n    │                                             │\n    │    ○ LlmRouter                              │\n    │   /|\\                                       │\n    │  / | \\                                      │\n    │ ○  ○  ○  WebChat  KeyManager  ToolSystem    │\n    │ |  |  |                                     │\n    │ ○  ○  ○  Service  Agents  OfflineModel      │\n    │                                             │\n    │   Nodes colored by community                │\n    │   Click any node to see connections          │\n    │   Zoom, pan, drag                           │\n    │                                             │\n    └─────────────────────────────────────────────┘\n```\n\n---\n\n## 🔌 Step 3 — Connect to Your AI via MCP\n\n### What are we doing here?\n\n```\nRight now:\n\n  Claude Code ──── ??? ──── Your graph\n  (can't see the graph)\n\nAfter this step:\n\n  Claude Code ──── MCP ──── code-review-graph server ──── Fast code lookups\n       │\n       └────────── MCP ──── graphify server ──────────── Full knowledge graph\n```\n\n### 3a. Create `.mcp.json` in your project root\n\nCreate a file called `.mcp.json` (note the dot!) in your project's root directory:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-review-graph\": {\n      \"command\": \"code-review-graph\",\n      \"args\": [\"serve\"],\n      \"type\": \"stdio\"\n    },\n    \"graphify\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"graphify-out/graph.json\"],\n      \"type\": \"stdio\"\n    }\n  }\n}\n```\n\n> **That's it.** Claude Code reads `.mcp.json` on startup and connects to both servers automatically.\n\n### 3b. What each server provides\n\n**code-review-graph MCP tools:**\n\n| Tool | What it does | Example |\n|------|-------------|---------|\n| `semantic_search_nodes` | Find code by keyword | \"Find all auth-related classes\" |\n| `query_graph` | Trace relationships | \"Who calls LlmRouter?\" |\n| `get_impact_radius` | Blast radius of a change | \"What breaks if I change this?\" |\n| `detect_changes` | Risk-scored code review | \"Review my last commit\" |\n| `get_review_context` | Token-efficient snippets | \"Show me relevant code for review\" |\n| `get_affected_flows` | Execution path analysis | \"Which flows does this change affect?\" |\n\n**graphify MCP tools:**\n\n| Tool | What it does | Example |\n|------|-------------|---------|\n| `query_graph` | Search the full graph | \"How does auth relate to the API?\" |\n| `get_node` | Get node details | \"Tell me about OfflineModelManager\" |\n| `get_neighbors` | Find connected nodes | \"What's connected to LlmRouter?\" |\n| `get_community` | See a cluster | \"Show me the memory subsystem\" |\n| `god_nodes` | Most connected nodes | \"What are the core abstractions?\" |\n| `graph_stats` | Graph overview | \"How big is the graph?\" |\n| `shortest_path` | Find path between concepts | \"How does auth connect to database?\" |\n\n### 3c. Restart Claude Code\n\n```bash\n# Close and reopen Claude Code, or start a new session\n# The MCP servers will connect automatically\n```\n\n### 3d. Verify it works\n\nIn your new Claude Code session, ask:\n\n```\n\"What are the most connected nodes in this codebase?\"\n```\n\nIf it uses MCP tools (you'll see tool calls like `god_nodes` or `semantic_search_nodes`) instead of running Grep/Read on your files — **it's working!**\n\n```\nBEFORE MCP (what you DON'T want to see):\n┌────────────────────────────────────────┐\n│  🔍 Grep(\"class.*Router\", **/*.kt)    │  ← Reading files\n│  📖 Read(src/LlmRouter.kt)            │  ← Reading files\n│  📖 Read(src/ProviderRouter.kt)        │  ← Reading files\n│  📖 Read(src/WebChatServer.kt)         │  ← More files...\n│                                        │\n│  💰 Used: ~50,000 tokens              │\n└────────────────────────────────────────┘\n\nAFTER MCP (what you WANT to see):\n┌────────────────────────────────────────┐\n│  🔌 query_graph(\"callers_of\",          │  ← Graph lookup!\n│       \"LlmRouter\")                     │\n│                                        │\n│  💰 Used: ~700 tokens                 │\n└────────────────────────────────────────┘\n```\n\n---\n\n## 🤖 Step 4 — Automate Everything (Set and Forget)\n\nThis is the magic part. After this, your graphs **update themselves** every time you commit code.\n\n### 4a. Install the graphify git hook\n\n```bash\ngraphify hook install\n```\n\nOutput:\n```\npost-commit: appended to .git/hooks/post-commit\npost-checkout: appended to .git/hooks/post-checkout\n```\n\n### 4b. Add code-review-graph to the same hook\n\nOpen `.git/hooks/post-commit` and add at the bottom:\n\n```bash\n# code-review-graph: incremental update for MCP server\nif command -v code-review-graph >/dev/null 2>&1; then\n    code-review-graph update 2>/dev/null || true\nfi\n```\n\n### 4c. What happens now on every commit\n\n```\nYou type: git commit -m \"add new feature\"\n\n                    ┌──────────────┐\n                    │  git commit  │\n                    └──────┬───────┘\n                           │\n                    ┌──────▼───────┐\n                    │ post-commit  │\n                    │    hook      │\n                    └──────┬───────┘\n                           │\n              ┌────────────┼────────────┐\n              ▼                         ▼\n    ┌─────────────────┐     ┌──────────────────────┐\n    │    graphify      │     │  code-review-graph   │\n    │                  │     │                      │\n    │ Re-extracts only │     │ Re-parses only       │\n    │ CHANGED files    │     │ CHANGED files        │\n    │ (AST, no LLM)   │     │ (AST, no LLM)        │\n    │                  │     │                      │\n    │ Updates:         │     │ Updates:             │\n    │ graph.json       │     │ internal graph       │\n    │ GRAPH_REPORT.md  │     │ MCP serves new data  │\n    └─────────────────┘     └──────────────────────┘\n\n    ⚡ Both take < 5 seconds for code-only changes\n    ⚡ No LLM tokens consumed\n    ⚡ No internet needed\n    ⚡ Completely automatic\n```\n\n### 4d. What about docs and images?\n\nCode changes auto-update (AST parsing, free).\nDocs/images need LLM — run manually when you update docs:\n\n```bash\n/graphify . --update\n```\n\nThis only re-extracts **new/changed** files (cached results are reused):\n\n```\n$ /graphify . --update\nCache: 165 files hit, 2 files need extraction\nSemantic extraction: ~2 files → 1 agent, estimated ~45s\n...done!\n```\n\n### 4e. Manual update (no commit needed)\n\nDon't want to commit just to update the graph? Run these anytime:\n\n```bash\n# Update code-review-graph (instant, no LLM)\ncode-review-graph update\n\n# Or full rebuild from scratch\ncode-review-graph build\n```\n\nFor graphify, in Claude Code:\n```\n/graphify . --update\n```\n\n```\n┌──────────────────────────────────────────────────────────────┐\n│                                                              │\n│   HOW THE GRAPH STAYS FRESH                                  │\n│                                                              │\n│   Option 1: Automatic (git commit)                           │\n│   ════════════════════════════════                            │\n│   git commit → hook runs → both graphs update                │\n│   You do nothing. It just works.                             │\n│                                                              │\n│   Option 2: Manual (anytime)                                 │\n│   ═════════════════════════                                   │\n│   code-review-graph update    ← run in terminal              │\n│   /graphify . --update        ← run in Claude Code           │\n│   No commit needed. Run after any edit.                      │\n│                                                              │\n│   Option 3: Full rebuild (switch branch, big changes)        │\n│   ═════════════════════════════════════════════════           │\n│   code-review-graph build     ← rebuild from scratch         │\n│   /graphify .                 ← full rebuild in Claude Code  │\n│                                                              │\n└──────────────────────────────────────────────────────────────┘\n```\n\n### Summary: What's automatic vs manual\n\n| Change Type | Auto-updates? | Cost |\n|-------------|:------------:|------|\n| New `.kt` / `.java` / `.py` file | ✅ On commit | Free (AST) |\n| Modified code file | ✅ On commit | Free (AST) |\n| New/changed `.md` / `.txt` doc | ❌ Manual: `/graphify . --update` | LLM tokens |\n| New screenshot / image | ❌ Manual: `/graphify . --update` | LLM tokens |\n\n---\n\n## 📊 Step 5 — See the Token Savings\n\nAfter graphify builds, it prints a benchmark:\n\n```\ngraphify token reduction benchmark\n──────────────────────────────────────────────────\n  Corpus:          271,756 words → ~362,341 tokens (naive)\n  Graph:           1,479 nodes, 1,326 edges\n  Avg query cost:  ~706 tokens\n  Reduction:       513.2x fewer tokens per query\n\n  Per question:\n    [787.7x] how does authentication work\n    [469.4x] what is the main entry point\n    [332.1x] how are errors handled\n    [827.3x] what connects the data layer to the api\n    [469.4x] what are the core abstractions\n```\n\n### What does 500x mean in practice?\n\n```\nWithout graph:\n  10 questions × 362,341 tokens = 3,623,410 tokens\n  💰 ~$10-15 in API costs\n\nWith graph:\n  10 questions × 706 tokens = 7,060 tokens\n  💰 ~$0.02 in API costs\n\n  That's like paying $0.02 instead of $10.\n  For the SAME answers.\n  Actually BETTER answers (structural context).\n```\n\n---\n\n## 🎯 Real Usage Examples\n\n### Example 1: \"What does LlmRouter do?\"\n\n```\nWITHOUT graph:\n  AI reads LlmRouter.kt (500 lines)\n  AI reads every file that imports it (20+ files)\n  AI reads docs mentioning it\n  Total: ~50,000 tokens, 30 seconds\n\nWITH graph:\n  AI calls: get_node(\"LlmRouter\")\n  AI calls: get_neighbors(\"LlmRouter\")\n  Gets back: 47 connections, callers, callees, related docs\n  Total: ~700 tokens, 2 seconds\n```\n\n### Example 2: \"What breaks if I change OfflineModelManager?\"\n\n```\nWITHOUT graph:\n  AI greps for \"OfflineModelManager\" in all files\n  AI reads each file to understand the dependency\n  AI guesses at impact\n  Total: ~30,000 tokens, maybe misses indirect deps\n\nWITH graph:\n  AI calls: get_impact_radius(\"OfflineModelManager\")\n  Gets back: direct deps, transitive deps, affected flows, test coverage\n  Total: ~500 tokens, complete picture\n```\n\n### Example 3: \"Review my last commit\"\n\n```\nWITHOUT graph:\n  AI reads the diff\n  AI reads surrounding code for context\n  AI reads test files\n  Total: ~40,000 tokens\n\nWITH graph:\n  AI calls: detect_changes()\n  Gets back: risk score, affected communities, missing test coverage\n  AI calls: get_review_context() for only the risky parts\n  Total: ~2,000 tokens, better review\n```\n\n---\n\n## 🗂️ Project Structure After Setup\n\n```\nyour-project/\n├── .mcp.json                    ← MCP server config (commit this!)\n├── .gitignore                   ← Add: graphify-out/\n├── .git/hooks/post-commit       ← Auto-update hook\n├── graphify-out/                ← ⚠️ GITIGNORED\n│   ├── graph.json               ← The knowledge graph\n│   ├── graph.html               ← Interactive visualization\n│   ├── GRAPH_REPORT.md          ← Audit report (god nodes, surprises)\n│   └── cost.json                ← Token usage tracker\n├── src/\n│   └── ... your code ...\n└── README.md\n```\n\n### What to commit, what to gitignore\n\n| File | Commit? | Why |\n|------|:-------:|-----|\n| `.mcp.json` | ✅ Yes | Team members get MCP servers too |\n| `graphify-out/` | ❌ No | Generated, can be rebuilt |\n| `.git/hooks/` | ❌ No | Local only (each dev runs `graphify hook install`) |\n\nAdd to your `.gitignore`:\n```\n# Knowledge graph outputs (rebuild with: /graphify . )\ngraphify-out/\n```\n\n---\n\n## 🚀 Quick Start — Set Up ANY Project in 2 Minutes\n\nCopy-paste these commands in your project root:\n\n```bash\n# 1. Install (one-time, works for all projects)\npip install graphifyy code-review-graph\n\n# 2. Build the code-review-graph (instant, no LLM)\ncode-review-graph build\n\n# 3. Create MCP config for your AI editor\ncat > .mcp.json << 'EOF'\n{\n  \"mcpServers\": {\n    \"code-review-graph\": {\n      \"command\": \"code-review-graph\",\n      \"args\": [\"serve\"],\n      \"type\": \"stdio\"\n    },\n    \"graphify\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"graphify-out/graph.json\"],\n      \"type\": \"stdio\"\n    }\n  }\n}\nEOF\n\n# 4. Install auto-update git hooks\ngraphify hook install\n\n# 5. Add code-review-graph to the same hook\ncat >> .git/hooks/post-commit << 'HOOK'\n\n# code-review-graph: incremental update for MCP server\nif command -v code-review-graph >/dev/null 2>&1; then\n    code-review-graph update 2>/dev/null || true\nfi\nHOOK\n\n# 6. Gitignore the output\necho -e \"\\n# Knowledge graph outputs\\ngraphify-out/\" >> .gitignore\n\n# 7. Auto-configure your AI editor (pick ONE):\ngraphify claude install       # Claude Code\ngraphify cursor install       # Cursor\ngraphify gemini install       # Gemini CLI / Android Studio Gemini\ngraphify antigravity install  # Google Antigravity\ngraphify codex install        # OpenAI Codex\ngraphify copilot install      # GitHub Copilot CLI\ngraphify opencode install     # OpenCode\ngraphify aider install        # Aider\ngraphify droid install        # Factory Droid\ngraphify claw install         # OpenClaw\ngraphify trae install         # Trae\ngraphify trae-cn install      # Trae CN\n```\n\n### 8. Build the graphify knowledge graph\n\n**In Claude Code**, just type:\n```\n/graphify .\n```\n\nThis is a Claude Code **skill** (slash command). It reads all your code, docs, and images, then builds the full knowledge graph.\n\n**Not using Claude Code?** You can still build the code graph (no LLM needed):\n```bash\ncode-review-graph build\n```\nThis gives you the AST-based graph with MCP. The full graphify graph (with docs/images/semantic connections) requires `/graphify .` in Claude Code or another AI editor with the graphify skill installed.\n\n### 9. Start a new session\n\nClose and reopen your AI editor. The MCP servers load on startup. **Done!**\n\n```\n┌────────────────────────────────────────────────────┐\n│                                                    │\n│  ✅ code-review-graph MCP    → code lookups        │\n│  ✅ graphify MCP             → full knowledge graph│\n│  ✅ git hook                 → auto-updates        │\n│  ✅ CLAUDE.md / .cursorrules → AI knows to use it  │\n│                                                    │\n│  Your AI is now 500x smarter. For every project.   │\n│                                                    │\n└────────────────────────────────────────────────────┘\n```\n\n---\n\n## 🔄 Setting Up Your NEXT Project\n\nAlready did the Quick Start once? For each new project, it's even faster:\n\n```bash\ncd /path/to/new/project\n\n# Build + configure (30 seconds)\ncode-review-graph build\ngraphify hook install\ngraphify claude install    # or: cursor, gemini, antigravity, codex, copilot, etc.\n\n# Create MCP config\ncat > .mcp.json << 'EOF'\n{\n  \"mcpServers\": {\n    \"code-review-graph\": {\n      \"command\": \"code-review-graph\",\n      \"args\": [\"serve\"],\n      \"type\": \"stdio\"\n    },\n    \"graphify\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"graphify-out/graph.json\"],\n      \"type\": \"stdio\"\n    }\n  }\n}\nEOF\n\necho -e \"\\ngraphify-out/\" >> .gitignore\n\n# Add code-review-graph to hook\ncat >> .git/hooks/post-commit << 'HOOK'\n\nif command -v code-review-graph >/dev/null 2>&1; then\n    code-review-graph update 2>/dev/null || true\nfi\nHOOK\n\n# Then in Claude Code: /graphify .\n```\n\nThat's it — 30 seconds per project after the first time.\n\n---\n\n## 🌐 Multi-Project Setup — Query ALL Your Projects From ONE Session\n\n<div align=\"center\">\n\n[![Multi-Project](https://img.shields.io/badge/Multi--Project-Query_All_From_Anywhere-FF6F00?style=for-the-badge)](.)\n[![Global MCP](https://img.shields.io/badge/Global_MCP-Works_In_Every_Session-00D4AA?style=for-the-badge)](.)\n\n</div>\n\n> 💡 **The Problem:** You graphified Project A and Project B separately. But when you open Claude Code in Project A, it only sees Project A's graph. How do you query both?\n\n> ✅ **The Solution:** Set MCP servers **globally** so they're available in EVERY session, from ANY folder.\n\n### 🤔 Local vs Global — What's the Difference?\n\n```\nLOCAL (.mcp.json in project folder)          GLOBAL (~/.claude.json in home folder)\n═══════════════════════════════════          ════════════════════════════════════\n\n  📁 Project-A/                                🏠 ~/.claude.json\n  │  └── .mcp.json                             │\n  │       └── graphify-A  ✅                    ├── graphify-A  ✅\n  │                                             ├── graphify-B  ✅\n  📁 Project-B/                                 └── graphify-C  ✅\n  │  └── .mcp.json\n  │       └── graphify-B  ✅                   Open Claude Code ANYWHERE:\n  │                                             → ALL graphs available ✅\n  Open Claude Code in Project-A:\n  → Only sees graphify-A ❌\n  → Can't query Project-B ❌\n```\n\n### 🚀 Step 1 — Graphify Each Project First\n\n```bash\n# Project A\ncd /path/to/project-A\ncode-review-graph build\n# In Claude Code: /graphify .\n\n# Project B\ncd /path/to/project-B\ncode-review-graph build\n# In Claude Code: /graphify .\n\n# Project C ... repeat for each project\n```\n\n### 🔗 Step 2 — Register All Projects in code-review-graph\n\n```bash\n# code-review-graph has BUILT-IN multi-repo support 🎉\ncode-review-graph register \"/path/to/project-A\" --alias projectA\ncode-review-graph register \"/path/to/project-B\" --alias projectB\ncode-review-graph register \"/path/to/project-C\" --alias projectC\n\n# Check what's registered\ncode-review-graph repos\n```\n\n```\n┌──────────────────────────────────────────────────────────┐\n│                                                          │\n│  $ code-review-graph repos                               │\n│                                                          │\n│  ✅ projectA  → /path/to/project-A  (1,411 nodes)       │\n│  ✅ projectB  → /path/to/project-B  (892 nodes)         │\n│  ✅ projectC  → /path/to/project-C  (2,100 nodes)       │\n│                                                          │\n│  ONE MCP server. ALL projects. 🔥                        │\n│                                                          │\n└──────────────────────────────────────────────────────────┘\n```\n\n> 🎯 **That's it for code-review-graph!** The single `code-review-graph serve` MCP server now queries ALL registered repos automatically.\n\n### 🧠 Step 3 — Set graphify MCP Globally\n\nFor graphify, add each project's graph server to your **global** `~/.claude.json`:\n\n**Tell your AI assistant:**\n> \"Set up global MCP servers for all my graphified projects\"\n\nOr manually add to `~/.claude.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-review-graph\": {\n      \"command\": \"code-review-graph\",\n      \"args\": [\"serve\"],\n      \"type\": \"stdio\"\n    },\n    \"graphify-projectA\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"/path/to/project-A/graphify-out/graph.json\"]\n    },\n    \"graphify-projectB\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"/path/to/project-B/graphify-out/graph.json\"]\n    },\n    \"graphify-projectC\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"graphify.serve\", \"/path/to/project-C/graphify-out/graph.json\"]\n    }\n  }\n}\n```\n\n> ⚠️ **Important:** Each graphify server needs a **unique name** (`graphify-projectA`, `graphify-projectB`, etc.)\n\n### ✅ Result — Everything Connected\n\n```\n┌──────────────────────────────────────────────────────────────────┐\n│                                                                  │\n│         🌐 OPEN CLAUDE CODE FROM ANY FOLDER                      │\n│                                                                  │\n│                    ┌─────────────────┐                           │\n│                    │   Claude Code   │                           │\n│                    │   (any folder)  │                           │\n│                    └────────┬────────┘                           │\n│                             │                                    │\n│              Global MCP Servers Load Automatically               │\n│                             │                                    │\n│         ┌───────────────────┼───────────────────┐               │\n│         │                   │                   │               │\n│         ▼                   ▼                   ▼               │\n│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐          │\n│  │ 📱 Project A │  │ 🌐 Project B │  │ 🎮 Project C │          │\n│  │              │  │              │  │              │          │\n│  │ graphify-A   │  │ graphify-B   │  │ graphify-C   │          │\n│  │ code-review  │  │ code-review  │  │ code-review  │          │\n│  │              │  │              │  │              │          │\n│  │ 1,411 nodes  │  │ 892 nodes    │  │ 2,100 nodes  │          │\n│  └──────────────┘  └──────────────┘  └──────────────┘          │\n│                                                                  │\n│  🔍 \"How does auth work in Project A?\"  → queries graphify-A    │\n│  🔍 \"Compare Project B's DB to C's\"    → queries both B and C   │\n│  🔍 \"Impact of changing this class?\"    → queries code-review    │\n│                                                                  │\n│         ALL PROJECTS. ANY SESSION. ZERO SETUP PER SESSION.       │\n│                                                                  │\n└──────────────────────────────────────────────────────────────────┘\n```\n\n### 📊 Quick Reference\n\n```\n┌─────────────────────┬──────────────────────┬────────────────────────┐\n│       Tool          │  Multi-Project How?  │  Where to Configure    │\n├─────────────────────┼──────────────────────┼────────────────────────┤\n│                     │                      │                        │\n│  code-review-graph  │  Built-in!           │  code-review-graph     │\n│                     │  register command    │  register <path>       │\n│                     │  1 server = N repos  │                        │\n│                     │                      │                        │\n│  graphify           │  1 server per        │  ~/.claude.json        │\n│                     │  project             │  (global mcpServers)   │\n│                     │  unique name each    │                        │\n│                     │                      │                        │\n└─────────────────────┴──────────────────────┴────────────────────────┘\n```\n\n> 💡 **Pro tip:** After graphifying a new project, just add one more `graphify-newproject` entry to `~/.claude.json` and restart Claude Code. That's it — the new project is connected to all your sessions.\n\n---\n\n## ❓ FAQ\n\n### Q: Does this work with Cursor / Windsurf / other AI editors?\n\n**Yes!** graphify supports **12 AI editors/agents** out of the box:\n\n```\n┌──────────────────────────────────────────────────────────────────────┐\n│                                                                      │\n│  EDITOR / AGENT             INSTALL COMMAND          WHAT IT WRITES  │\n│  ═══════════════            ═══════════════          ══════════════  │\n│                                                                      │\n│  Claude Code                graphify claude install     CLAUDE.md    │\n│  Cursor                     graphify cursor install     .cursorrules │\n│  Gemini CLI / Android Studio graphify gemini install    GEMINI.md    │\n│  Google Antigravity         graphify antigravity install .agent/     │\n│  OpenAI Codex               graphify codex install      AGENTS.md   │\n│  GitHub Copilot CLI         graphify copilot install    ~/.copilot/  │\n│  OpenCode                   graphify opencode install   AGENTS.md   │\n│  Aider                      graphify aider install      AGENTS.md   │\n│  Factory Droid              graphify droid install       AGENTS.md   │\n│  OpenClaw                   graphify claw install        AGENTS.md   │\n│  Trae                       graphify trae install        AGENTS.md   │\n│  Trae CN                    graphify trae-cn install     AGENTS.md   │\n│                                                                      │\n└──────────────────────────────────────────────────────────────────────┘\n```\n\nMCP is a standard protocol. The `.mcp.json` config works with any editor that supports MCP.\n\n> **Android Studio users:** If you use Gemini in Android Studio, run `graphify gemini install`. The MCP config (`.mcp.json`) is project-level so the `code-review-graph` server is available too.\n\n### Q: What languages are supported?\n\n**code-review-graph:** Kotlin, Java, Python, TypeScript, JavaScript, Go, Rust, C/C++, Ruby, Swift, Scala, PHP, Lua — anything with AST parsing.\n\n**graphify:** ALL files. Code via AST, docs/images via LLM semantic extraction.\n\n### Q: Does this cost money?\n\n- **code-review-graph:** 100% free. Pure AST parsing, no LLM.\n- **graphify AST extraction:** Free. No LLM needed for code files.\n- **graphify semantic extraction:** Uses your AI tokens for docs/images only. One-time cost, then cached.\n- **Auto-updates on commit:** Free (AST only for code changes).\n\n### Q: My graph is out of date after switching branches\n\n```bash\ncode-review-graph build          # rebuild from scratch (instant)\n# Then in Claude Code:\n# /graphify . --update           # incremental update (only changed files)\n```\n\n### Q: Can I query the graph without Claude Code?\n\nYes! graphify has a built-in CLI:\n\n```bash\ngraphify query \"how does authentication work?\"\ngraphify query \"how does authentication work?\" --dfs    # depth-first trace\ngraphify query \"how does authentication work?\" --budget 1500  # limit tokens\n```\n\nAnd in Claude Code, you can use slash commands:\n```\n/graphify query \"how does authentication work?\"\n/graphify path \"AuthModule\" \"Database\"\n/graphify explain \"LlmRouter\"\n```\n\n### Q: How big can the graph get?\n\nTested with 1,500+ nodes and 2,800+ edges without issues. The HTML visualization handles up to 5,000 nodes. Beyond that, use Obsidian vault (`/graphify . --obsidian`).\n\n---\n\n## 🔧 Troubleshooting\n\n| Problem | Fix |\n|---------|-----|\n| `graphify: command not found` | `pip install graphifyy` (two y's!) |\n| `code-review-graph: command not found` | `pip install code-review-graph` |\n| MCP tools not showing in Claude Code | Restart session (MCP loads at startup) |\n| Graph out of date | Run `code-review-graph build` + in Claude Code: `/graphify . --update` |\n| `UnicodeEncodeError` on Windows | Set `PYTHONUTF8=1` environment variable |\n| HTML viz won't open | Try: `python -m http.server 8080` in `graphify-out/`, open `localhost:8080/graph.html` |\n| Hook not running on commit | Check: `ls -la .git/hooks/post-commit` (must be executable) |\n| `Graph was built on different branch` | Run `code-review-graph build` to rebuild |\n\n---\n\n## 🎁 Bonus: The Full Picture\n\n```\n┌──────────────────────────────────────────────────────────────────┐\n│                                                                  │\n│                    YOUR DEVELOPMENT WORKFLOW                      │\n│                                                                  │\n│  ┌──────────┐     ┌──────────┐     ┌──────────┐                │\n│  │  Write    │────►│  Commit  │────►│  Hook    │                │\n│  │  Code     │     │  (git)   │     │  Runs    │                │\n│  └──────────┘     └──────────┘     └─────┬────┘                │\n│                                          │                       │\n│                            ┌─────────────┼─────────────┐        │\n│                            ▼                           ▼        │\n│                   ┌────────────────┐        ┌─────────────────┐ │\n│                   │   graphify     │        │ code-review-    │ │\n│                   │   updates      │        │ graph updates   │ │\n│                   │   graph.json   │        │ internal graph  │ │\n│                   └───────┬────────┘        └────────┬────────┘ │\n│                           │                          │          │\n│                           ▼                          ▼          │\n│                   ┌────────────────┐        ┌─────────────────┐ │\n│                   │   graphify     │        │ code-review-    │ │\n│                   │   MCP server   │        │ graph MCP       │ │\n│                   │   (full graph) │        │ server (fast)   │ │\n│                   └───────┬────────┘        └────────┬────────┘ │\n│                           │                          │          │\n│                           └──────────┬───────────────┘          │\n│                                      │                          │\n│                                      ▼                          │\n│                             ┌────────────────┐                  │\n│                             │  Claude Code   │                  │\n│                             │  / Cursor /    │                  │\n│                             │  Any AI Editor │                  │\n│                             └────────────────┘                  │\n│                                      │                          │\n│                                      ▼                          │\n│                             ┌────────────────┐                  │\n│                             │  500x FASTER   │                  │\n│                             │  500x CHEAPER  │                  │\n│                             │  BETTER ANSWERS│                  │\n│                             └────────────────┘                  │\n│                                                                  │\n└──────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n<div align=\"center\">\n\n### Made with 🧠 by [Ashok Varma Matta](https://github.com/ashokvarmamatta)\n\n*If this saved you time, star the gist and share it with your team!*\n\n[![graphify](https://img.shields.io/badge/graphify-GitHub-00D4AA?style=flat-square)](https://github.com/graphify-ai/graphify)\n[![code-review-graph](https://img.shields.io/badge/code--review--graph-PyPI-FF6F00?style=flat-square)](https://pypi.org/project/code-review-graph/)\n\n</div>\n", "url": "https://wpnews.pro/news/make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph", "canonical_source": "https://gist.github.com/ashokvarmamatta/344a642e8b5bd286be605a8f439c3848", "published_at": "2026-04-13 05:36:47+00:00", "updated_at": "2026-05-22 03:07:33.199837+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models", "open-source", "products"], "entities": ["Claude Code", "Cursor", "Windsurf", "MCP", "graphify", "code-review-graph", "LlmRouter", "Model Context Protocol"], "alternates": {"html": "https://wpnews.pro/news/make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph", "markdown": "https://wpnews.pro/news/make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph.md", "text": "https://wpnews.pro/news/make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph.txt", "jsonld": "https://wpnews.pro/news/make-your-ai-coding-assistant-500x-smarter-complete-guide-to-graphify-code-graph.jsonld"}}