# CodeGraph

> A local code knowledge graph that answers an agent's question in one tool call

- Category: Retrieval & Knowledge (RAG) / Code Indexing & Search
- Licence: MIT
- Repository: https://github.com/colbymchenry/codegraph
- Website: https://colbymchenry.github.io/codegraph/
- Canonical page: https://ai-tldr.dev/tools/codegraph/
- Updated: 2026-05-19

## In short

CodeGraph pre-indexes a codebase into a knowledge graph so a coding agent can ask one question instead of running a dozen greps. It sits in the Code Indexing & Search category of the Retrieval & Knowledge (RAG) tools and is open-source, licensed MIT. To get started: install without Node.

## Overview

CodeGraph pre-indexes a codebase into a knowledge graph so a coding agent can ask one question instead of running a dozen greps. A single MCP tool call returns the verbatim source of the symbols involved, the call paths through them, and the blast radius of a change — the context an agent would otherwise assemble by reading files one at a time.

The indexer is a native Rust kernel that parses source with tree-sitter, extracting nodes (functions, classes) and edges (calls, imports), then resolves references: calls to definitions, imports to their sources, inheritance chains. Everything lands in a local SQLite database with FTS5 full-text search, and a file watcher on native OS events keeps the graph in sync as you edit. Nothing leaves the machine — there is no external service in the path.

It understands more than plain call graphs: it recognises routing patterns across 17 web frameworks, and bridges cross-language boundaries such as Swift↔Objective-C, the React Native bridge and Expo Modules. A browser viewer renders the graph interactively — callers, source, callees and entry points — which is also the quickest way to sanity-check what the agent is being told.

## What it does

- Rust tree-sitter kernel indexing 30+ languages, from TypeScript, Python, Go and Rust to Swift, Kotlin, Solidity and Terraform
- One MCP call returns verbatim source, call flow and blast-radius impact instead of a grep-and-read loop
- Local SQLite storage with FTS5 full-text symbol search — no external service, fully offline
- File watcher on native OS events auto-syncs the graph after a debounce as you code
- Reference resolution: calls to definitions, imports to sources, inheritance chains
- Framework-aware route detection across 17 web frameworks, plus Swift↔Objective-C and React Native bridging
- Installer auto-detects agents — Claude Code, Cursor, Codex CLI, opencode, Gemini CLI, Antigravity, Kiro, GitHub Copilot and Hermes Agent
- Browser viewer showing callers, source, callees and entry points

## Getting started

Install the binary, let the installer configure your agents, then build the index once per repository.

1. Install without Node

   A shell installer for macOS and Linux, or PowerShell on Windows.

```bash
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. Or install with npm

   If you already have Node on the machine.

```bash
npm i -g @colbymchenry/codegraph
```

3. Wire it into your agents and index the repo

   `codegraph install` detects and configures supported agents; `codegraph init` builds the index once per repository; `codegraph ui` opens the browser viewer.

```bash
codegraph install
codegraph init
codegraph ui
```

4. Let the watcher keep it fresh

   After `init`, the file watcher tracks the project with native OS events and syncs changes after a short debounce, so you do not re-index by hand as you work.

## When to use it

- Cut the exploration tool calls a coding agent makes on a large repository by giving it symbols and call paths directly
- Ask what a change would break before making it, using blast-radius impact analysis
- Keep code context fully local — the index is SQLite on disk, with no external service in the path
- Trace a request across a language boundary in a mobile codebase, such as Swift to Objective-C or a React Native bridge

## Version history

- 2026-05-19 0.7.10: CodeGraph trended on GitHub with a local SQLite plus tree-sitter knowledge graph exposed over MCP, reported to cut Claude Code, Codex and Cursor codebase-exploration tool calls by 94%.
