Skip to content

LearnTutorials

Index your codebase for Claude Code with GitNexus

Turn your repo into a knowledge graph with GitNexus, so Claude Code checks callers, flows and blast radius before it edits, in about 20 minutes.

By Recaply EditorsIntermediate19 min5 stepsUpdated

Two hands place a paper card at the centre of a web of blank cards joined by thin lines

What you need

GitNexus is free under the PolyForm Noncommercial licence. Using it for commercial work needs a licence from its makers at Akon Labs.

  1. Step 1: Install GitNexus

    3 min

    A global install gives you the gitnexus command and avoids an npx crash on newer npm.

    1. Run node --version and check it meets the version above.
    2. Run the install command below.
    3. Run gitnexus doctor to check that it installed.
    Run this
    npm install -g gitnexus

    You should see the install finishing, and gitnexus doctor printing a report on your system.

    npx crashes with Cannot destructure property 'package'?

    That's a known npm 11 bug. Use the global install above and run gitnexus directly, not through npx.

  2. Step 2: Index your repository

    5 min

    The index maps every function, call and dependency, so Claude can look them up instead of guessing.

    1. Open a terminal at the root of your repo.
    2. Run the command below and wait for it to finish. Big repos take longer.
    3. Run gitnexus status to check the index.
    Run this
    gitnexus analyze

    You should see a new .gitnexus/ folder, a GitNexus section in AGENTS.md and CLAUDE.md, and skills under .claude/skills/.

    You don't want GitNexus to touch your AGENTS.md or CLAUDE.md?

    Run gitnexus analyze --index-only to build just the index. Or use --skip-agents-md to keep your own edits to the GitNexus section.

    Indexing runs on your machine with no AI model, so your code isn't sent anywhere.

  3. Step 3: Connect GitNexus to Claude Code

    3 min

    The MCP server gives Claude the graph tools in every session.

    1. Run gitnexus setup once. It finds Claude Code and adds the GitNexus server for all your projects.
    2. Or add the server yourself with the command below. On Windows, put cmd /c before npx.
    3. Run claude mcp list to check the connection.
    Or add it yourself
    claude mcp add gitnexus -- npx -y gitnexus@latest mcp

    You should see gitnexus in the list, marked Connected.

    It says Failed to connect?

    Run claude mcp get gitnexus to see the error. If npx crashes, run claude mcp remove gitnexus, then add it again with claude mcp add gitnexus -- gitnexus mcp.

  4. Step 4: Ask Claude how your code connects

    4 min

    A question about callers or flows shows the graph working before you trust it with an edit.

    1. Start claude in your repo.
    2. Paste the prompt below, with a real function or class name.
    3. Watch for GitNexus tool calls, such as query and context, in the transcript.
    Your prompt
    Use GitNexus to answer this: what calls [FUNCTION OR CLASS], and which execution flows run through it? List the files involved.

    You should see an answer that names the callers, files and flows, backed by GitNexus tool calls.

    Claude searches with grep instead of GitNexus?

    Name the tool in your prompt, such as "use the GitNexus context tool". Then run /mcp to check the server is connected in this session.

    query finds code and flows, context shows a symbol's callers and dependencies, and impact shows what a change could affect.

  5. Step 5: Check the impact before an edit

    4 min

    Seeing what depends on the code first keeps a small change from breaking something far away.

    1. Paste the prompt below before any refactor.
    2. Read the list of affected callers and flows before you approve any edits.
    3. After the edit, check the change report against your tests.
    Your prompt
    Before you edit anything, use the GitNexus impact tool on [FUNCTION OR CLASS] and list what could break. Then refactor [FEATURE]. When you're done, run detect_changes on the diff and tell me which flows changed.

    You should see a list of what could break before the edit, and a short report of the changed flows after it.

    Answers miss code you just wrote?

    The index is out of date. Run gitnexus analyze again, or keep gitnexus analyze --watch running in a second terminal.

You get

A knowledge graph of your repo that Claude Code checks for callers, flows and blast radius before it edits

Did this guide work for you?

Sources