colbymchenry

codegraph: Give Coding Agents a Local Code Knowledge Graph

CodeGraph builds and maintains a local graph of code structure so AI coding agents can retrieve relevant source, call paths, and change impact without exploring files one by one. It connects to multiple agents through MCP and supports many languages.

Stars
73.1k
Forks
4.7k
Stars, last 16 days
+1,474

Our take

Health score

70/100

How it is scored
Activity
83
Community
45
Issues
73
Pull requests
78

+1,474 stars in the last 16 days

  • Merges more pull requests than 84% of the projects we track
  • Releases more often than 82% of the projects we track

Overview

CodeGraph indexes a project’s symbols, relationships, imports, and calls into a local SQLite knowledge graph. Coding agents can query that index for relevant source code, paths between symbols, and potential change impact instead of repeatedly searching and reading files to reconstruct how the project fits together.

It is aimed at developers using AI coding agents who want project context to stay current as files change. The index runs locally and can be queried through an MCP server or CLI. Its usefulness depends on the project having an initialized index and the agent using CodeGraph for code exploration.

Key Features

  • Builds a structural graph of code symbols and relationships, with cross-file reference resolution.
  • Provides an MCP tool that returns relevant source, call paths, and impact context in response to a query.
  • Watches project files and incrementally syncs changes to keep the index current.
  • Supports a broad set of programming languages and recognizes routes in several web frameworks.
  • Offers CLI commands for searching symbols, tracing callers and callees, checking impact, and finding affected tests.
  • Stores project data locally in SQLite, with FTS5 full-text search.
  • Installs MCP configuration for supported coding agents, including Claude Code, Cursor, Codex, Gemini, and GitHub Copilot.

Use Cases

  • A developer onboarding to an unfamiliar codebase can ask an agent how a request, feature, or subsystem flows through the code.
  • An agent-assisted coding workflow can retrieve relevant implementation context before editing, reducing repeated file discovery.
  • Teams can inspect callers and potential impact before changing a shared function or class.
  • Developers can use the affected command to identify test files related to changed source files in a local or CI workflow.

Getting Started

Install the CLI and connect your agent:

curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
codegraph install
cd your-project
codegraph init

For Windows, npm installation, supported agents, and manual configuration, see the README and documentation.

Alternatives

  • Codebase-Memory-MCP: It focuses on fast persistent code indexing across 158 languages, while CodeGraph emphasizes local source retrieval, call paths, and change impact.
  • GitNexus: It builds interactive knowledge graphs in a browser from GitHub repositories or ZIP files, rather than maintaining a local graph for agent integrations.
  • Graphify: It is an AI assistant skill that graphs code, documentation, and multimedia, rather than a local code-structure graph exposed to agents through MCP.
ProjectLanguageLicenseStarsStatus
codegraphCMIT73.1kNot checked yet
codebase-memory-mcpCMIT45.7kActive
gitnexusTypeScript–175Active
graphifyPythonApache-2.0124kActive

Considerations

  • The CLI installer configures agents, while codegraph init is still required for each project that should be indexed.
  • The README describes the CLI as self-contained, but embedding the library directly requires Node.js 22.5 or later.
  • The project reports anonymous usage telemetry by default and provides opt-out commands and environment variables; review its telemetry documentation if that matters for your environment.
  • Benchmark results and language support claims come from the project README. Validate behavior on your own repository and workflows, especially where framework-specific or cross-language relationships matter.

Found this useful?

Share it with someone who would like codegraph.

Comparisons