This Repo Gives Claude Code a Brain — 30k Stars on GitHub
The Problem 0:00
LLMs like Claude Code are powerful — but they're effectively stateless. Every time you start a new session, the model has zero memory of your codebase's architecture, relationships, or conventions.
- Claude Code reads files one at a time, losing the big picture
- Context windows fill up fast with large repos, leading to expensive and slow sessions
- The model re-discovers the same structures over and over — burning tokens and your patience
Enter CodeGraph 0:50
CodeGraph is an open-source tool (30k+ stars) that gives Claude Code persistent memory by building a knowledge graph of your entire codebase. Instead of reading files linearly, Claude can now query the structure of your code.
- Parses your repo into a graph of functions, classes, modules, and their relationships
- Stores everything in SQLite for lightning-fast lookups
- Exposes the graph to Claude via MCP (Model Context Protocol) tools
Tree-sitter Parsing 1:12
CodeGraph uses Tree-sitter — the same incremental parser used by editors like Neovim, Zed, and VS Code — to parse source code into concrete syntax trees.
- Supports dozens of languages out of the box (Python, TypeScript, Rust, Go, etc.)
- Extracts function signatures, class hierarchies, imports, and call sites
- Incremental parsing means re-indexing after a change is nearly instant
The Graph 1:45
Once parsed, your codebase becomes a directed graph where:
- Nodes are functions, classes, methods, modules, and files
- Edges represent calls, imports, inheritance, and containment
- Each node stores metadata: signature, docstring, file path, line numbers
This structure lets Claude answer questions like "what calls this function?" or "show me all subclasses of BaseHandler" — without reading a single file.
SQLite + MCP 2:15
The graph is stored in a local SQLite database, keeping everything fast and portable. Claude accesses it through MCP tools:
search_symbols— fuzzy-find functions, classes by nameget_callers / get_callees— traverse the call graphget_definition— retrieve full source of a specific symbolget_file_summary— high-level overview of a file's exports
Because it's MCP, it works with any compatible client — not just Claude Code.
The Orchestrator 2:50
CodeGraph includes an orchestrator layer that intercepts Claude's planning phase. Before Claude starts reading files, the orchestrator:
- Analyzes the user's prompt to identify relevant symbols and concepts
- Pre-fetches relevant graph context and injects it into Claude's context
- Suggests which files are most likely relevant — saving Claude from blind exploration
This "guided exploration" pattern dramatically reduces the number of tool calls needed.
Graph vs RAG 3:20
Why not just use embedding-based RAG (Retrieval-Augmented Generation)? The video makes a compelling case for graphs:
- RAG finds textually similar chunks — but code relationships are structural, not textual
- Graphs capture call chains, inheritance, and data flow — things embeddings miss entirely
- Graph queries are deterministic and explainable; embedding similarity is fuzzy
- Graphs handle refactoring gracefully — rename a function and the edges still hold
Benchmarks 3:55
The results speak for themselves — CodeGraph dramatically improves Claude Code's efficiency:
- Claude spends less time exploring and more time implementing
- Fewer file reads means smaller context windows, which means faster and cheaper completions
- Accuracy improves because Claude has the right context from the start
The Fine Print 4:30
A few caveats to keep in mind before jumping in:
- Initial indexing takes time on very large repos (100k+ lines) — but only needs to run once
- Dynamic languages (Python, JS) have less precise call graphs than statically typed ones (Rust, Go)
- The graph captures static relationships — runtime dispatch and metaprogramming can be missed
- You still need Claude Code (or another MCP client) — CodeGraph is a plugin, not a standalone tool