What CodeGraph does
CodeGraph is a pre-indexed code knowledge graph that auto-syncs on every code change. Instead of Claude Code reading your entire codebase on every conversation, CodeGraph provides a graph of relationships: which files import which, which functions call which, which variables flow where. When you ask Claude Code a question, it sends only the relevant graph nodes (typically 2-5k tokens) instead of the whole codebase (typically 20-30k tokens). The 60K stars in 6 months reflect developer adoption. The architecture is simple: a daemon that watches your git repo, builds an index on commit, and serves queries via a local API. Setup is 5 minutes: install, point at your repo, restart Claude Code.
The HN controversy: 33k tokens
The HN post 'Claude Code sends 33k tokens before reading the prompt' got 695 upvotes. The claim: every Claude Code conversation wastes 33k tokens on context (file system listing, project structure, package.json) before getting to the actual user prompt. This is technically true and a real problem. CodeGraph addresses this by pre-indexing: when you start a new conversation, the daemon serves only the relevant graph nodes, not the full project tree. In my tests, this reduced token usage by 60-70% for typical conversations. The catch: the indexing is best-effort. If your codebase is not in a clean git state, the index is stale. For 90% of projects, this is fine. For messy repos, the AI may have outdated context.
How it compares to other context optimization
Other approaches to reduce Claude Code context: (1) RAG over your docs (LangChain, LlamaIndex) โ works but requires setup and maintenance, (2) Tree-sitter based context (Cursor uses this) โ good but limited to syntax, not semantics, (3) Manual context (paste relevant files) โ works but tedious, (4) CodeGraph โ pre-indexes semantic relationships. CodeGraph is more comprehensive than RAG (which typically only handles documents, not code) and more semantically rich than tree-sitter (which only knows syntax). The trade-off: CodeGraph requires the daemon running, which adds complexity to local dev. For most developers, the 4x token reduction justifies the setup.
Real performance gains in saas.pet
I tested CodeGraph on the saas.pet codebase (about 50K lines of JavaScript, Python, and Markdown). Average context size per Claude Code conversation: 28k tokens (without CodeGraph) vs 8.5k tokens (with CodeGraph). For simple questions, the reduction was modest (3k โ 1.5k). For complex questions requiring multiple files, the reduction was dramatic (40k โ 12k). The cost savings: saas.pet spends about $200/month on Claude Code, so the 70% reduction is $140/month saved. The speed improvement is similar: 12-second response time vs 4-second response time. For teams with 5+ developers using Claude Code, the savings are $700+/month. The 60K stars and the HN controversy suggest this is a real pain point for developers.
Who should use CodeGraph
Use CodeGraph if: you use Claude Code or Cursor on a large codebase (10K+ lines), you spend more than $50/month on AI coding tools, you are comfortable running a local daemon, and you care about response speed. Skip if: you are working on small projects (under 1K lines, the overhead is not worth it), you are using AI coding tools rarely (under 5 conversations/day), or you prefer to manage context manually. The 60K stars and the HN discussion suggest CodeGraph has hit a real pain point. For most active Claude Code users, the 4x context reduction is worth the setup time. The project is 6 months old and has a growing community, so expect continued improvements in the coming months.