惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
宝玉的分享
宝玉的分享
量子位
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
J
Java Code Geeks
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
S
SegmentFault 最新的问题
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
小众软件
小众软件
The Cloudflare Blog
Y
Y Combinator Blog
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
IT之家
IT之家

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
CodeGraph: Stop Your AI Agent From Grepping the Same File...
ArshTechPro · 2026-05-18 · via DEV Community

When Claude Code explores a codebase it does not know, it spawns Explore agents that scan files with grep, glob, and Read. Every one of those calls costs tokens and time. And most of that work is not even useful analysis. It is discovery: figuring out where things live before the agent can start reading the code that actually matters.

CodeGraph removes that discovery step. Instead of letting the agent explore blind, it hands the agent a map.

What it is

CodeGraph is an open-source tool that builds a pre-indexed knowledge graph of your codebase: symbols, call graphs, imports, inheritance, and code structure. The agent queries that graph in one shot instead of scanning files one by one.

It runs as an MCP server for Claude Code, is MIT licensed, supports 19+ languages, and is 100 percent local. No API keys. No data leaving your machine. Just a SQLite database.

How it works

The pipeline is straightforward:

  1. Extraction. tree-sitter parses your source into ASTs. Language-specific queries pull out nodes (functions, classes, methods) and edges (calls, imports, extends, implements).
  2. Storage. Everything goes into a local SQLite database with FTS5 full-text search.
  3. Resolution. References get linked up: function calls map to their definitions, imports map to source files, class inheritance is traced.
  4. Auto-sync. A file watcher uses native OS events to keep the graph fresh as you code. Changes are debounced with a short quiet window. No configuration needed.

When the agent needs to understand the code, it asks the graph a question and gets entry points, related symbols, and code snippets back in a single call.

The numbers

This is the part that gets attention. The maintainer benchmarked Claude Code's Explore agent with and without CodeGraph across six real codebases, including VS Code, Excalidraw, and the Swift compiler.

The reported average: 92 percent fewer tool calls and 71 percent faster exploration.

A concrete example: on the VS Code codebase, answering "how does the extension host communicate with the main process" took 52 tool calls without CodeGraph and 3 with it. On a Java codebase, the agent answered the full question in a single CodeGraph call and zero file reads.

A fair note: these are self-reported, single-query benchmarks, so treat them as best-case. But the underlying idea does not depend on the exact percentage. Giving an agent a structured index instead of forcing it to explore blind is sound regardless.

Getting started

The interactive installer wires everything up:

npx @colbymchenry/codegraph

Enter fullscreen mode Exit fullscreen mode

It installs CodeGraph globally, configures the MCP server in your Claude config, sets up auto-allow permissions, and adds global instructions. Then restart Claude Code and initialize a project:

cd your-project
codegraph init -i

Enter fullscreen mode Exit fullscreen mode

Once a .codegraph/ directory exists, Claude Code uses the tools automatically.

A bonus that stands on its own

Even if you ignore the AI angle, one command is worth knowing: codegraph affected. It traces import dependencies transitively to find which test files are impacted by a set of changed files.

git diff --name-only HEAD | codegraph affected --stdin --quiet

Enter fullscreen mode Exit fullscreen mode

Drop that in a CI script or git hook and you only run the tests that a change can actually break. That is a genuine speedup with no AI involved at all.

Is it useful?

Very, if you work in a large or unfamiliar codebase with Claude Code. The bigger and less familiar the repo, the more discovery the agent has to do, and the more CodeGraph saves you in tokens and wall-clock time.

The honest limit: on a small project, an agent can grep a 20-file repo cheaply enough that the index buys you little. The payoff scales with codebase size.

The takeaway

AI coding agents are not slow because the model is slow. They are slow because they spend most of their time figuring out where things are. CodeGraph solves that once, locally, and keeps the map current as you work. For anyone using Claude Code on a serious codebase, it is a low-effort, high-return addition.