AI Guides › Step-by-step guides

Giving Claude Code a Codebase Map With Graphify

By Nigel Guy · 6 min read

Most people fix "Claude Code keeps re-reading my whole repo" by writing a longer CLAUDE.md or by pasting file lists into the prompt. It feels productive, and it goes stale the first time you move a folder. The better fix is a map that is rebuilt from the code itself, so the assistant can ask "what connects to this?" instead of opening files one by one.

Graphify is an open-source tool that builds that map. This guide covers the setup, what the install changes on your machine, how to keep the map current, and the traps. One honest note first: the original social post this topic came from made claims about long-term use, and I could not verify those. Everything below comes from the tool's own PyPI page and GitHub README, checked on 2026-10-04.

The rule: a graph is only useful while it matches the code, and the install is only safe once you know exactly what it writes to your project.

Before you start

Step 1 — Install the tool

In a terminal, run:

uv tool install graphifyy

If you do not use uv, pipx install graphifyy or pip install graphifyy are the listed alternatives. Run graphify --help afterwards. If the command is not found, your tool directory is not on your PATH; fix that before going further.

Step 2 — Register it with Claude Code

Run:

graphify claude install

According to the project's README, this does three things:

  1. Writes a CLAUDE.md instruction telling Claude Code to consult the graph for codebase questions and prefer graphify query over reading raw files.
  2. Installs PreToolUse hooks, which fire before search-style tool calls and file reads and nudge Claude towards the graph.
  3. Sets up a git merge driver so graph.json merges without conflict markers when several people commit it.

Read that list twice. It edits instruction and hook files in your project, and you should know which. After running it, open the project's CLAUDE.md and look at what was added. Then start Claude Code and type /hooks to open the hooks browser and see what is registered. Hook config lives in your .claude/settings.json or .claude/settings.local.json, as described in the Claude Code hooks guide.

Step 3 — Build the graph

Open Claude Code in the project folder and type:

/graphify .

The README describes three files landing in a graphify-out/ folder:

File What it is Who it is for
graph.html Interactive graph you open in a browser You
GRAPH_REPORT.md Highlights, communities, suggested questions You and Claude
graph.json The full queryable graph Claude and the CLI

Start with GRAPH_REPORT.md. The suggested questions are a quick way to see whether the structure matches how you think about your own code.

Step 4 — Ask questions through the graph

The README lists three query commands you can also run yourself in a terminal:

Once the hook and CLAUDE.md are in place, Claude Code should reach for these before reading files. You can also steer it directly. Fill in the square brackets:

You are helping me understand an unfamiliar part of my codebase.
This project has a Graphify graph in graphify-out/.

My question: [YOUR_QUESTION_ABOUT_THE_CODE]
Area I care about: [FOLDER_OR_FEATURE_NAME]

Steps:
1. Check GRAPH_REPORT.md and use `graphify query` or `graphify path`
   to find the relevant nodes before opening any source file.
2. Open only the files the graph points to.
3. Answer in this format: a two-sentence summary, then a list of the
   files involved with one line each on their role.
4. Say which statements came from the graph and which from reading code.

Rules: if the graph looks out of date (a file it mentions does not
exist, or a file I mention is missing), stop and tell me to rebuild
rather than guessing. Ask me if the question or area is unclear.
Before you answer, check that every file you name actually exists.

Step 5 — Keep it current

This is the step people skip, and it is the whole difference between a map and a stale drawing. The README lists these options:

Pick one routine and stick to it. The simplest is graphify hook install plus graphify update . after every pull.

Step 6 — Exclude what should not be mapped

Create a .graphifyignore file in the project root using .gitignore-style patterns. Graphify already respects your .gitignore. When both exist the patterns are merged and .graphifyignore is evaluated last. Files your .gitignore excludes are never re-included by it. Put generated code, vendored folders and anything confidential here before the first build, not after.

Check it worked

What to skip

Guardrails

Sources

All 751 AI guides · JulieMango plans from £17/mo