CodeGraph Hub is a Fork of CodeGraph built for running many AI coding agents at once. Every session on your machine shares one server, agents can each query their own checkout, and the index keeps up as parallel work moves.
- One shared server. A single machine-wide server replaces the daemon per project, and idle project indexes close on their own.
- The right code on every call. Each MCP call names its repository or worktree, so parallel agents can stay on their own checkouts.
- Worktrees that start ready. A new worktree can copy the nearest sibling's index, and removed worktrees are cleaned up.
- Orderly index builds. A separate builder queues index writes, so agents don't compete to update the same index.
- Answers you can verify. Agents can wait for an up-to-date index or get a checkpoint of the indexed state.
- Sessions that keep working. If the shared server can't be reached, a session answers from existing indexes in read-only mode.
- Focused searches. A session focus narrows finding tools to the part of the repository you're working in.
- Change review tools.
grepfinds text and groups each hit under the symbol that contains it,blastshows what depends on the lines a change touched,orphanslists what a branch added that nothing uses, andsuspectslists the call edges that need a second look. - Runs on Node 25 and later. Upstream refuses to start on Node 25 (
engines>=20.0.0 <25.0.0). - Fixes ahead of upstream. The hub carries fixes for Swift and Rust resolution, index recovery, writer ownership, and syncs that re-read unchanged files.
For everything else CodeGraph does, see upstream's README.
The hub tracks colbymchenry/codegraph and keeps its own feature set. It is brought up to date on the 4th of each month, or the next working day when the 4th falls on a weekend. It takes issues through GitHub Issues in this repository; an issue that needs a fix sooner gets one out of cycle.
The examples use codegraph for the built CLI; see the setup section to run it from a clone.
- Server controls. Use
codegraph daemonto see the server andcodegraph daemon --stopto stop it. SetCODEGRAPH_PROJECT_IDLE_TIMEOUT_MSto change the ten-minute idle timeout, orCODEGRAPH_STATE_DIRto an absolute path to choose another state directory.CODEGRAPH_HOUSEKEEPING_INTERVAL_MSsets the periodic cleanup interval in milliseconds (default 60 seconds;0turns the periodic pass off). - Project controls. Use
codegraph project list --json,codegraph project pin /path/to/project,codegraph project unpin /path/to/projectandcodegraph project remove /path/to/project. Pinning keeps a project open; removing its registry entry deletes no files. - Fallback. While serving in process, the session normally retries the server. It does not build or sync an index, even for
fresh: true. - Query workers. Spare workers retire on their own idle clocks after 60 seconds by default, while the last worker retains the upstream five-minute idle trim. Set
CODEGRAPH_QUERY_WORKER_IDLE_TIMEOUT_MSin milliseconds to change spare-worker retirement;0turns it off. - Project path. Pass
projectPath: "/path/to/project"on an MCP call. - Builder. A queued sync goes ahead of a queued full build. Set
CODEGRAPH_BUILDER_ENSURE_WAIT_MSto change the bounded wait for an index to open; while a new index builds, calls can receive a building note. - Worktree locks. A lock left by a dead process can be taken over. Use
codegraph unlockto remove a stale lock when no live process holds it. - Session focus. Start with
codegraph serve --mcp --focus src, and passscope: "repo"to search the whole repository when needed. Out-of-focus impact results appear underOutside focus (N). - Worktree hook. Add
dist/extensions/host/worktree-hook/main.jsto Claude Code settings by hand, using the example insrc/extensions/host/README.md; it setsprojectPathto the git root of the agent's working directory. - Fresh answers and checkpoints. Use
fresh: trueon an MCP call or--freshon a supported CLI query; usecheckpoint: trueor--checkpointfor a checkpoint without waiting.codegraph checkpoint /path/to/projectprints one and exits 3 when the index is not fresh.CODEGRAPH_FRESH_TIMEOUT_MSsets the freshness wait in milliseconds (default 30 seconds);CODEGRAPH_FRESH_SETTLE_TIMEOUT_MSbounds how long a CLI waits after printing for a still-running sync to settle before exit (default 10 minutes). - Extension hooks. Add CLI commands and MCP tools in
src/extensions/<name>/extension.ts. SetCODEGRAPH_EXTENSION_MODULESto comma-separated absolute module paths to load additional extensions; seesrc/extensions/host/README.mdfor the contract. - Grep. Use
codegraph grep 'pattern' -p /path/to/project(upstream PR #3208). Grep needs ripgrep: it runsrgfromPATHunlessCODEGRAPH_RGnames another binary. - Blast. Use
codegraph blast -b main -p /path/to/project(upstream PR #3209). - Orphans. Use
codegraph orphans -b main -p /path/to/project(upstream PR #3210). - Suspects. Use
codegraph suspects -p /path/to/project(upstream PR #3207).
The four commands also have MCP tools. They are listed only when the session's CODEGRAPH_MCP_TOOLS names them, for example explore,grep,blast,orphans,suspects.
Grep counts incoming calls bound by name only separately, and blast marks dependents reached only through such calls. Use --strict on either command, or strict: true on its MCP tool, to leave those calls out of grep's counts and those dependents out of blast.
Library callers can pass pathPrefixes: ["src/app"] in search and context options to limit candidate lookups to whole, case-sensitive path segments relative to the index. Context graph traversal is not filtered by this option.
- Node version check: #3197.
- A file with unchanged content and a new modification time is read once, not on every sync. #3198
- Swift calls on standard-library values no longer link by name to a project method. #3199
- Swift comma-separated enum case lists index every case. #3200
- Swift qualified inheritance entries resolve to the types they name. #3201
- Rust
impl Trait for Typeinside a function body records the implementation. #3202 - Rust calls through a type named by a path reach that type's own function. #3203
- Copied indexes recover without disturbing live writers of the source index. #3204
- Writer and daemon ownership changes are serialized to prevent competing owners. #3205
- Swift static
Type.member()calls resolve to the member declared by the type. #3206 - Swift calls to enum cases such as
E.bad(1)resolve to the named enum's case, not a case from a supertype or an unrelated enum (not yet offered upstream).
Install Git and Node.js 22.12 or later, then build from a clone.
git clone https://github.com/codedaptive/codegraph-hub.git
cd codegraph-hub
npm ci
npm run build
node dist/bin/codegraph.js --helpTo use codegraph in the shell examples, set an alias in your shell, replacing the path with the absolute path to your clone:
alias codegraph="node /absolute/path/to/codegraph-hub/dist/bin/codegraph.js"Point your agent at the built file. For Claude Code, put an absolute path in a project .mcp.json, for example:
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/codegraph-hub/dist/bin/codegraph.js", "serve", "--mcp", "--focus", "src"],
"env": { "CODEGRAPH_MCP_TOOLS": "explore,search,callers,impact,grep,blast,orphans,suspects" }
}
}
}codegraph install writes an entry using codegraph serve --mcp, which can run a different executable from your PATH; point the entry at the built file yourself. The installer does not add the focus or worktree hook.
To update a clone, run git pull && npm ci && npm run build. For an npm installation, codegraph upgrade installs the hub release GitHub marks as Latest (a release published as a pre-release is skipped) or a named hub version, using the release's packed build with --ignore-scripts, not upstream's registry package or install scripts. Other installation types may receive manual instructions instead; a source checkout installs nothing and may be advised to pull and rebuild. Prerelease numbers compare numerically. The update notice checks the hub's releases and uses its own cache, update-check-hub.json.
- No default project. A call without
projectPathgetsmissing argument: root path to the code you wish to query. - Indexing without opt-in. A call can start indexing an unindexed project in the background. Set
CODEGRAPH_NO_AUTO_SEED=1to turn this off. The builder refuses a filesystem root, a home directory, a parent of home and sensitive paths. If a session continues to query a project aftercodegraph uninit, a later call can build its index again. - A repository anchor. A path outside the session's repository and its worktrees gets guidance rather than being queried. The session ignores the MCP client's
rootUri,workspaceFoldersandroots/list.codegraph serve --mcp --path /path/to/projectsets the launch directory and anchor, not a default project. - Daemon command.
codegraph daemonreports or stops the shared server rather than offering a per-project picker. - Agent instructions. The block written by
codegraph installtells agents with the MCP tool to callcodegraph_exploreeven when the project has no index, rather than skip CodeGraph. - Tool options. Every MCP tool accepts optional
freshandcheckpoint; search, explore and grep also acceptscope. The default MCP tool list iscodegraph_explorealone.
The hub has only been run on macOS so far. Linux and Windows are untested; worktree index copies on those platforms can use a plain copy.
Focus separates results for callers, impact and blast. It does not apply to node, callees, orphans, suspects or CLI commands. There is no access control beyond the repository anchor.
The hub carries upstream's MIT license unchanged in LICENSE. Copyright (c) 2026 Colby Mchenry.