Code
Knowledge Graph
for Claude Code
Reduce token usage by 5-10x with intelligent, graph-aware code retrieval. Fully local. Zero config. No API keys.
$ rg "authentication" --files-with-matches
src/auth/middleware.py
src/auth/tokens.py
src/api/views.py
src/api/permissions.py
... 8 more files
$ cat src/auth/middleware.py # 200 lines
$ cat src/auth/tokens.py # 150 lines
$ cat src/api/views.py # 300 lines
~8,000 tokens consumed $ search_code("authentication middleware")
auth/middleware.py:15 — AuthMiddleware
class AuthMiddleware(BaseHTTPMiddleware)
lines: 15-45
calls: verify_token, get_user
auth/tokens.py:8 — verify_token
def verify_token(token: str) -> User
lines: 8-22
~800 tokens consumed Why CodeLattice?
A smarter way for Claude to understand your codebase — semantic search, dependency graphs, and architectural advice in one MCP extension.
Semantic Code Search
Natural language queries instead of regex. Ask for 'authentication middleware' and get precise results with file paths and line numbers.
Dependency Analysis
Trace what any file or symbol depends on, and what depends on it. Impact analysis before refactoring — in a single tool call.
Advisor Skills
Built-in guidance for Django, React, SOLID principles, and design patterns. Extensible with custom SKILL.md files.
Fully Local & Free
No API keys, no Ollama, no external services. FastEmbed runs on CPU. LanceDB and SQLite are file-based. Everything stays on your machine.
Per-Repo Isolation
Each repository gets its own isolated knowledge graph. Index multiple repos in parallel with no cross-contamination.
Token Savings
5-10x reduction in exploration tokens. Returns signatures and line numbers instead of full source files. Built-in metrics tracking.
Use Cases
Real workflows where CodeLattice saves time and tokens.
Semantic Code Search
Search for "authentication middleware" across a Python project and instantly find the relevant functions by meaning, without knowing exact file names or function names.
Pre-Refactoring Impact Analysis
Before refactoring a utility function, run find_symbol and get_dependents to see every file and function that depends on it.
Onboarding to Unfamiliar Codebases
Index a new TypeScript monorepo and use get_file_summary to quickly understand the structure of unfamiliar files without reading their full contents.
Keeping Search Fresh After Edits
After making edits to several files, call refresh_index to update the knowledge graph, then use search_code to verify your changes are reflected.
Understanding Code Dependencies
Use get_dependencies to trace what a module imports and calls, helping you understand unfamiliar code before making changes.
12 MCP Tools
Everything Claude needs to navigate your codebase — nothing it doesn't.
Code Exploration
search_code Semantic search across indexed code by meaning
find_symbol Find function/class/variable with dependency graph
get_dependencies What a file or symbol imports, calls, or extends
get_dependents Reverse dependencies — what depends on a target
get_file_summary Structural summary without reading full contents
index_repository Parse and index a codebase (incremental support)
refresh_index Re-index only files changed since last run
Architecture Advice
advise Best-practice advice matched by semantic similarity
list_skills List all loaded advisor skills with metadata
Analytics
index_status Indexing stats: file count, entities, languages
usage_stats Token savings report with daily breakdown
cancel_indexing Cancel a currently running indexing operation
Advisor Skills
Built-in knowledge about frameworks, principles, and patterns — extensible with your own SKILL.md files.
django framework Django architecture, views, models, ORM optimization, DRF, testing, and security best practices.
react framework React patterns, hooks, component design, state management, performance optimization, and TypeScript integration.
solid-principles principle SRP, OCP, LSP, ISP, and DIP explained with real Python and TypeScript code examples.
strategy-pattern pattern Strategy pattern: when to use, Python and TypeScript implementations, comparison with other behavioral patterns.
Skill Discovery Locations
{repo}/.codelattice/skills/
Team-specific overrides
priority +20~/.codelattice/skills/
User-installed skills
priority +10Built-in
Ships with CodeLattice
priority +0SKILL.md Format
---
name: my-framework
description: Best practices for...
category: framework
domains: [django, python, orm]
triggers: ["django views", "manage.py"]
priority: 50
depends-on: [solid-principles]
---
# My Framework Guide
Markdown body with best practices... Get Started in 60 Seconds
Zero config. No API keys. Same three steps as graphify.
Install the CLI
$ uv tool install codelattice Or pipx install codelattice. uv fetches Python 3.12 for you if needed.
Register with Claude Code
$ codelattice install Adds the /codelattice skill and the MCP server for every project. Use --project to write them into the current repo instead.
Index your project
> /codelattice . Type this inside Claude Code (restart it once after step 2). Then ask questions as usual; Claude uses search_code and find_symbol instead of grep.
Supported languages
How It Works
From source code to intelligent responses — no cloud services required.
Embeddings generated locally by FastEmbed on CPU
LanceDB (vectors) + SQLite (graph + state)
Each repo gets ~/.codelattice/repos/{hash}/
SHA-256 content hashes detect only changed files
Project Structure
src/codelattice/
config/ Pydantic settings from .env
models/ 6 DataPoint subclasses
parser/ tree-sitter engine + language queries
indexer/ File discovery, hashing, incremental state
graph/ SQLite + LanceDB engines, search, ingestion
advisor/ Skill registry, matching, formatting
server/ FastMCP server + tool implementations
stats/ Token savings tracker Token Savings
Real metrics from actual usage — not theoretical estimates.
Token savings measured over 7 days of real use
=== CodeLattice Token Savings Report ===
Period: Last 7 day(s)
Total tool calls: 47
CodeLattice tokens: 3,842
Traditional est.: 28,650
Tokens saved: 24,808
Savings: 86.6% Task-by-Task Comparison
Finding a function
3-5 grep calls + 2-3 file reads
~4,000 tokens
1 find_symbol call
~400 tokens
Understanding dependencies
grep imports + read 4 files
~6,000 tokens
1 get_dependencies call
~600 tokens
Exploring a module
ls + read 5 files
~10,000 tokens
1 get_file_summary call
~500 tokens
CodeLattice vs graphify
Same setup, different jobs. graphify maps a whole corpus; CodeLattice finds the exact code Claude needs, cheaply.
| CodeLattice | graphify | |
|---|---|---|
| Goal | Cut the tokens Claude spends finding code during everyday tasks | Turn any folder — code, docs, papers, images, video — into an explorable knowledge graph |
| Inputs | Python, TypeScript, JavaScript | ~37 tree-sitter languages plus docs, PDFs, images, video |
| Extraction | tree-sitter, fully local | tree-sitter for code (local); LLM pass for non-code files |
| Retrieval | Semantic vector search (local embeddings) + graph lookups: callers, callees, imports, base classes | Graph traversal: BFS/DFS query, shortest path, explain. No vector store |
| Claude talks to it via | MCP tools — search_code, find_symbol, get_dependents, … | Skill + CLI — graphify query / path / explain (MCP optional) |
| Output | Compact signatures + line numbers; Claude reads only the lines it needs | graphify-out/: graph.html, graph.json, GRAPH_REPORT.md |
| Data location | ~/.codelattice — nothing written into your repo | graphify-out/ inside the repo |
| Freshness | Incremental re-index, stale-file warnings in every response, file watcher | graphify update, git hooks, --watch |
| Extras | Advisor guides, token-savings tracking | Communities, god nodes, visualization, Neo4j/GraphML/Obsidian export, PR impact |
| Assistants | Claude Code | Claude Code, Codex, Cursor, Gemini CLI, Copilot and ~15 more |
| Setup | uv tool install codelattice → codelattice install → /codelattice . | uv tool install graphifyy → graphify install → /graphify . |
Pick CodeLattice when…
you want Claude to find a function by meaning ("where do we retry failed payments?") and answer impact questions before a refactor, at low token cost, with no generated files in your repo.
Pick graphify when…
you want to understand a large or mixed corpus as a whole: architecture overviews, cross-document links, visual exploration, or many languages and assistants.
They don't conflict — install both side by side.