Repo Year in Review

colbymchenry/codegraph

Local code knowledge graph that auto-syncs and wires into AI coding agents via MCP, so agents answer from one query instead of grepping and reading files.

  • 78.6k GitHub stars
  • C
  • ⚖️ MIT

Last verified: repo last pushed

npm i -g @colbymchenry/codegraph
colbymchenry/codegraph preview image

What it is

CodeGraph is a pre-built knowledge graph of the symbols, call edges and dependencies in a codebase. It is exposed to AI coding agents through an MCP server. Instead of crawling files with grep, glob and Read, the agent asks one question and gets back relevant source, call paths and the blast radius of a change. Parsing runs in a native Rust kernel, everything is local, and a file watcher keeps the graph current.

Who it's for

  • Developers using Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro or GitHub Copilot who want fewer tool calls and tokens during code exploration
  • Teams working on large or multi-language codebases where agents spend many tool calls on discovery
  • Users who want code intelligence that stays 100% local

Requirements

Requirements

  • Windows, macOS or Linux
  • No Node.js required; the installer bundles its own runtime (an npm install path also exists)
  • Open a new terminal after installing so the codegraph command resolves
  • Run codegraph init in each project to build its graph

Setup

  1. 1. Install the CLI

    One command grabs the right build for your OS, with no Node.js needed. Open a new terminal afterward, since the installer does not change your current shell.

    bash
    # macOS / Linux
    curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
    
    # Windows (PowerShell)
    irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex
  2. Alternative: install with npm

    If you already have Node, you can install the CLI globally with npm instead.

    bash
    npm i -g @colbymchenry/codegraph
  3. 2. Wire up your agent(s)

    In a new terminal, run the installer. It detects and configures the supported agents by wiring the CodeGraph MCP server into each. It does not index any code.

    bash
    codegraph install
  4. 3. Initialize each project

    This creates the local .codegraph/ directory and builds the full graph in one step. After that, auto-sync keeps the index current.

    bash
    cd your-project
    codegraph init

Examples

Upgrade in place

bash
bash
codegraph upgrade

What it does: Detects how you installed (bundle, npm or npx) and updates in place. Add --check to see if an update is available, or pass a version to pin one.

Remove agent configs but keep the CLI

bash
bash
codegraph uninstall --keep-cli

What it does: Removes CodeGraph's configuration from every agent it set up while leaving the CLI installed. Project indexes in .codegraph/ are left untouched.

Architecture question the benchmark used (Django)

Prompt
prompt
How does Django's ORM build and execute a query from a QuerySet?

Expected output: One of the benchmark questions. With CodeGraph the agent answered in 3 tool calls with zero file reads, versus 14 tool calls and a median of 8.5 file reads without it.

Architecture question the benchmark used (Excalidraw)

Prompt
prompt
How does Excalidraw render and update canvas elements?

Expected output: In the README's benchmark, the agent answered this in 2 tool calls with CodeGraph versus 43 without.

Pros & cons

Pros

  • Pro:Benchmarked on 7 repos, the README reports 88% fewer tool calls, 62% fewer tokens, 44% lower cost and zero file reads with CodeGraph
  • Pro:Auto-sync is on by default and uses native OS file events, so the index stays fresh with nothing to re-run
  • Pro:Runs 100% locally, with a native Rust kernel for 20 languages and automatic per-file fallback
  • Pro:Offers impact analysis (callers, callees, impact radius) and full-text search alongside surgical context

Cons

  • Con:The README says CodeGraph leaves about 80% more retrieval context resident at the end of a session, which matters for long sessions in a small window
  • Con:Cost savings vary by question: only 13% cheaper on Django and roughly even on Gin
  • Con:It only helps when the agent queries it directly; if exploration is delegated to file-reading sub-agents it becomes overhead

Images