Graphify and Claude Code: save tokens and get better answers

Hi everyone,

in today’s article I want to tell you about Graphify, an open source tool I’m using on an enterprise Angular project. It lets you build a queryable knowledge graph, and the main goal is to cut down on token usage. Normally, when Claude (or other AI agents) go looking for a file or a word, they reach for the grep command. The bigger the project, the more tokens that burns through. With this approach the AI can query the graph directly and get straight to the answer.

On top of that, I noticed the answers got a lot better too, and that’s really what sold me on keeping it in the project.

Here I’ll walk you through my experience, from setup to actual use.

What Graphify is

Graphify is an external Python tool that maps your whole project into a graph. It pulls out the code locally through tree-sitter, with no API calls, and for documents and media it leans on your favourite AI model (Claude, in my case). The output lands in the graphify-out/ folder:

Plaintext
graphify-out/
├── graph.html       # graph you can browse: nodes, filters, search
├── GRAPH_REPORT.md  # the summary: key concepts, connections, suggested questions
└── graph.json       # the full graph, queryable without re-reading the files

The report points out the god nodes (the most connected concepts of the project), the unexpected links between modules. It also tags every inferred relationship as EXTRACTED, INFERRED or AMBIGUOUS, so that you always know what was actually found and what was deduced.

Installation

Like I said, Graphify runs on Python, so you’ll need Python 3.10+ and an isolated package manager. I went with uv (but pipx works too). If you don’t have uv, here’s how to install it:

ShellScript
# macOS (Homebrew)
brew install python@3.12 uv

# Windows
winget install astral-sh.uv

# Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

Check with python --version and uv --version and you’re good to go.

Installing Graphify

ℹ️ The PyPI package is called graphifyy, with the double y (the other graphify* packages on PyPI are not tied to the project). The CLI command is still graphify.

ShellScript
# Recommended: uv puts graphify in the PATH automatically
uv tool install graphifyy

# Alternative
pipx install graphifyy

The authors themselves tell you to steer clear of a plain pip install. If the skill picks a different Python interpreter from the one pip used to install the package, you’ll hit a ModuleNotFoundError. With uv tool or pipx the package gets its own isolated environment, so that never happens.

Usage with Claude Code

⚠️ Note, you don’t need an account with an AI provider (Claude, ChatGPT, etc.): this tool can build the graph even without AI.

After the previous step, close and reopen the terminal, then run these commands to install graphify globally and then add the skill to your project.

ShellScript
graphify install
graphify install --project

Creating the graph

The first time around, you have to build the graph from scratch. This is the longest part, and how long it takes come down to how complex your project is. The command below creates the first mapping via AST (structural parsing, so symbols, functions, classes, imports, etc.) and semantically (Claude handles this part, as long as you have a subscription or an API key).

In my project I keep a /docs directory where I write the documentation. Thanks to the skill and to Claude, those files get mapped too and join the graph.

⚠️ Note: before you dive in, take a moment to figure out whether you really need all your directories. In my case I had to leave out a directory holding a documentation project pulled in as a git submodule, since it would have only added useless “noise” for development. To skip directories, just create a .graphifyignore file in the project root and list them there.

Let’s open the Claude Code CLI (in the project we want to map) and run graphify through the skill:

ShellScript
/graphify .

If you don’t have a subscription to Claude or other providers, you can run this command from the terminal instead, which builds the graph using AST only:

ShellScript
graphify update .

This is the graph I got on the project (an nx monorepo, while building an enterprise application) using the skill:

And this is the same graph, but built from the terminal command, without Claude:

On the right you can see the node names. In the mapping Claude handles, the names are far more meaningful (and semantically correct), while in the second example they come out much more generic.

Now let’s run a prompt and see whether usage really dropped.

Usage test

First prompt with graphify:

Outcome:

A more complete, better structured answer, with fewer tokens used.

Prompt WITHOUT graphify (in a fresh session, of course)

Outcome:

A complete answer, but with far less information than the previous prompt.

Graphify as the default

Now that the graph exists, we need to tell Claude to use it as the primary method over the Grep command. To do that, just open the CLAUDE.md file and add this section:

Plaintext
## graphify  
  
This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.  
  
Rules:  
- For codebase questions, first run `graphify query "<question>"` when graphify-out/graph.json exists. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.  
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.  
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.  
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).

On top of that, it’s worth installing it as a hook that runs after every commit. Just type:

ShellScript
graphify hook install

Two limitations worth keeping in mind:

  • It only updates the code files changed in the commit, so changes to docs/ or images still need a manual /graphify --update .
  • It runs post-commit, so it won’t block the commit if it fails

Conclusions

In these uncertain times, where hardware is getting harder for most people to access, saving tokens and squeezing the most out of our subscriptions really matters. This tool won’t solve every optimization problem on its own, but I use graphify alongside other tools, and my sense is that it doesn’t just save tokens, but it bumps up the quality of the answers too, which is what won me over the most. Seeing is believing!😊

Thanks for reading, see you next time!

Share this article
Shareable URL
Prev Post

Translations in Angular enterprise application with i18next

Next Post

Documenting a legacy project with Claude skills

Read next

ChatGPT-5 is coming!

Back in February, Sam Altman hinted that the new model might drop this summer… and here we are!…