How to Install Codegraph for AI Coding Assistants
An open-source tool that builds a pre-indexed knowledge graph of your code, so AI coding assistants use fewer tokens and fewer tool calls, with everything running 100 percent locally.
What is Codegraph?
Codegraph is an open-source tool that builds a pre-indexed knowledge graph of your code and keeps it in sync as the code changes. It works with Claude Code, Codex, Gemini, Cursor, OpenCode, AntiGravity, Kiro, Copilot and Hermes Agent. Because the agent queries the graph instead of searching files with grep, it uses fewer tokens and fewer tool calls, and everything runs 100 percent on your own machine.
The idea is that an agent should understand the shape of a codebase before it starts editing. A knowledge graph gives it that picture: which files depend on which, where a function is defined, and how a change ripples through the project.
What can you do with it?
- Let AI assistants explore a codebase through a fast, pre-built index
- Keep the index in sync automatically as files change
- Cut token use and tool calls compared with searching files by hand
- Use it with most popular coding agents, not just one
- Run everything locally, with no code leaving your machine
How to install Codegraph
Installation is one command. Open a terminal and run:
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | shThis command needs bash. On Windows, run it in Git Bash or WSL. Do not use PowerShell or CMD, which do not have bash, or the install will fail. On macOS or Linux, run it in a normal terminal.
The installer asks whether to add Codegraph to your PATH so agents can start its MCP server, and whether the setup should apply to every project or just the current one. For scripting or CI, you can install non-interactively instead:
codegraph install --yesThat auto-detects your agents and installs globally. One requirement: the API runs on your own runtime, so you need Node.js 22.5 or newer for the built-in node:sqlite support.
First steps after installing
Open a project and ask your coding agent a question about the code, for example where a feature is implemented or what depends on a particular module. The agent should answer from the graph rather than grepping through files. If you edit code, check the staleness banner the tool shows after a change; it tells you when the index is catching up.
Trust the graph results. The tool is designed so the agent does not need to double-check every answer with grep, which is where the token savings come from.
Frequently asked questions
Is Codegraph free? Yes. It is an open-source project on GitHub, and you can download and use it free of charge.
Is it hard to install? No. One command installs it, and the installer walks you through the setup.
Does my code leave my machine? No. The index and the API run locally, so your code stays on your own computer.
Comments (0)