Back to Blog
tutorialsclaude-code

Graphify for Claude Code: turning a codebase into a knowledge graph with /graphify, and which steps cost tokens

Graphify is an open-source code knowledge graph tool. Type /graphify in Claude Code, Codex, Cursor or another coding agent and it maps the whole project into a graph the agent can query instead of searching file by file. How to install it (the package is graphifyy), the everyday commands, how to make Claude Code check the graph first, whether a third-party API needs extra setup, and which steps spend tokens.

November 14, 202611 min readCyberFisher

Graphify is an open-source code knowledge graph tool. Type /graphify . in your coding agent and it maps the whole project (code, docs, PDFs, images) into a knowledge graph; from then on the agent answers code questions by querying the graph instead of searching file by file. The project is Graphify-Labs/graphify on GitHub, under the Apache-2.0 licence, with about 147k stars when checked on 2026-11-14. The latest release was 0.9.108, published on 2026-11-12. Besides Claude Code it supports Codex, Cursor, Gemini CLI, OpenCode and about twenty other tools. The same company sells a hosted version, Graphify Cloud; this article covers the free open-source tool.

Three things to know before you start:

  1. The package is graphifyy, with two y's. There is no official graphify package on PyPI, so uv tool install graphify fails to resolve, and similarly named packages are not from Graphify Labs. Once installed, the command is graphify.
  2. Mapping code costs no tokens; docs, PDFs and images do. Code is parsed on your machine without a model. Document-type files need a model to read them.
  3. /graphify inside Claude Code needs no API key. The model work is done by Claude Code's own subagents, through the endpoint Claude Code is already configured with. So on a third-party API there is nothing extra to set up, unlike claude-mem. Only a few commands run on their own in a terminal need separate setup; see below.

What it does

  • Code: parses about 40 languages locally with tree-sitter, finds calls, imports and inheritance between functions, classes and files, and links them across files. No model is called and your code doesn't leave your machine.
  • Docs, PDFs, images: a model reads them and extracts the concepts in them and how they relate to the code, so a module mentioned in a design doc links to the code that implements it.
  • Groups: the graph is split into groups (communities) that roughly match subsystems, and the most-connected hub nodes are picked out.
  • Every edge says where it came from: EXTRACTED means it is stated in the source, INFERRED means graphify worked it out, so you can tell what was read from what was deduced.
  • Not vector search: no embeddings and no vector store; it is a graph you can walk.

After a build the project has a graphify-out/ folder:

graphify-out/
├── graph.html       open in a browser: click nodes, filter, search
├── GRAPH_REPORT.md  the highlights: key concepts, surprising links, suggested questions
└── graph.json       the full graph; queries read this instead of your source files

Install

Requirements: Python 3.10 to 3.14. Installing with uv is recommended, and uv provides Python itself. To get uv: brew install uv on macOS, winget install astral-sh.uv on Windows, curl -LsSf https://astral.sh/uv/install.sh | sh on Linux.

Step 1: install the CLI

uv tool install graphifyy

pipx install graphifyy also works. If the shell can't find graphify afterwards, run uv tool update-shell (with pipx, pipx ensurepath) and open a new terminal.

Step 2: register it with Claude Code

graphify install

With no flags it targets Claude Code: it copies the skill to ~/.claude/skills/graphify/SKILL.md and registers it in ~/.claude/CLAUDE.md. Windows is detected automatically. To install into the current project only, so you can commit it for your team, add --project.

Step 3: restart Claude Code and, in your project, send

/graphify .

It detects files, extracts relationships, groups them and writes the report, then summarises the result. On a project with more than 500 files (or a very large amount of text) it first lists the subfolders with the most files and asks which one to build. To confirm the graph exists, run graphify god-nodes --top 5 in a terminal; it should list the five most-connected symbols in your code.

Upgrade: run uv tool upgrade graphifyy, then graphify install again so the skill file matches the new version. Uninstall: graphify uninstall; --purge also deletes graphify-out/.

Other tools: register each one separately.

ToolRegister withNotes
Codexgraphify install --platform codexCodex uses $graphify instead of /graphify; for parallel extraction add multi_agent = true under [features] in ~/.codex/config.toml
Cursorgraphify cursor install
Gemini CLIgraphify install --platform gemini
OpenCodegraphify install --platform opencode
Kimi Codegraphify install --platform kimi

Everyday use

Asking questions: once the graph exists, use these three commands:

/graphify query "how does login reach the database"
/graphify path "UserService" "DatabasePool"
/graphify explain "RateLimiter"
  • query returns the small part of the graph that answers the question, about 2,000 tokens by default (change it with --budget).
  • path gives the shortest path between two things, showing how they connect.
  • explain describes one node: which file and line it is on, and what it connects to.

Inside Claude Code you can ask in plain language, even in another language: it first picks matching words from the graph's own vocabulary (for example auth and login), then queries. The same commands also run in a terminal (graphify query "...") with no AI involved and no tokens spent, but the terminal version matches words literally, so use the names that appear in your code.

Keeping the graph current:

graphify hook install

With the git hooks in place, every commit, branch switch, merge and rebase rebuilds the code part of the graph in the background, without calling a model. When docs or images change, run /graphify . --update in Claude Code. To share one graph with your team, commit graph.json and GRAPH_REPORT.md and add graphify-out/cache/ to .gitignore.

Making Claude Code check the graph first: in your project, run

graphify claude install

It adds a ## graphify section to the project's CLAUDE.md and two hooks to .claude/settings.json, so before Claude Code searches or reads a file it is reminded to run graphify query. If a hook fails it does nothing and the tool call goes ahead. For a firmer rule, graphify install --project --strict blocks the first direct read of a source file in each session until the agent has queried the graph. Both commands change files in your project, so look at the changes before committing them.

What a third-party API needs

/graphify inside Claude Code: nothing. When it reads docs, PDFs and images, it has Claude Code start subagents to do it, and those subagents use Claude Code's current endpoint and key. Naming the groups is also done by Claude Code itself. The skill's instructions say outright that it doesn't read ANTHROPIC_API_KEY and never asks you for a key.

One exception: if GEMINI_API_KEY or GOOGLE_API_KEY is set in your environment, the document step uses Gemini instead and spends that key's quota.

Commands run on their own in a terminal need care in three places:

  1. graphify extract . on a project that has docs needs a model to use (for code only, add --code-only and no model is needed). The simplest option borrows Claude Code:

    GRAPHIFY_CLAUDE_CLI_MODEL=model-id graphify extract . --backend claude-cli
    

    It calls claude -p in the background, which uses the URL and key you configured for Claude Code. Without GRAPHIFY_CLAUDE_CLI_MODEL it uses Claude Code's default model; extraction doesn't need the strongest model, so a low-priced one is enough. graphify's own cost estimate treats this route as free, but a per-token API still bills it, so go by your provider's bill.

  2. To call an Anthropic-compatible endpoint directly, first run uv tool install --reinstall "graphifyy[anthropic]", then:

    ANTHROPIC_BASE_URL=https://www.ccsub.net \
    ANTHROPIC_API_KEY=your-api-key \
    ANTHROPIC_MODEL=model-id \
    graphify extract . --backend claude
    

    Set these three on the command itself, as above, rather than in ~/.zshrc or similar: Claude Code also reads ANTHROPIC_MODEL and ANTHROPIC_API_KEY, so exporting them would change Claude Code's default model and sign-in too. graphify reads only ANTHROPIC_API_KEY, not ANTHROPIC_AUTH_TOKEN; CCSub accepts the key either way. The default model is claude-sonnet-4-6, and if your provider doesn't recognise that name the request fails, so set ANTHROPIC_MODEL to a full ID from your provider's list (CCSub's is on the models page). Prompt caching is on by default; some services reject it, and if you get a caching error, prefix the command with GRAPHIFY_CLAUDE_PROMPT_CACHE=0. The cost estimate it prints uses Anthropic's list prices, which may not match what you pay; CCSub bills cache reads and writes at the input rate, so caching doesn't make it cheaper.

  3. graphify cluster-only . and graphify label name the groups. With no API key set but Claude Code installed, they switch to claude -p for this and print a line saying so. Only node names are sent, so usage is small, but it still goes through your endpoint and is billed. To keep model calls off entirely, prefix the command with GRAPHIFY_BACKEND=none; each group is then named after its most-connected node.

How many tokens it uses

Building the graph:

  • On a code-only project, extraction itself calls no model.
  • Docs, PDFs and images are each read by a model. The skill's own instructions say this can take minutes and tens of thousands of tokens, and a README plus a folder of screenshots is enough to trigger it.
  • --mode deep extracts more and costs more.
  • /graphify . inside Claude Code also has a fixed overhead: the skill's instruction file is about 50 KB of text, read into the conversation each time it runs, and Claude Code then works through the steps and names the groups. So even on a code-only project, building with /graphify uses some tokens.

The cheapest way to build: build in a terminal, then query from Claude Code:

graphify extract . --code-only
GRAPHIFY_BACKEND=none graphify cluster-only .

The first parses the code; the second writes the report and graph.html. Neither calls a model. Then ask questions in Claude Code with /graphify query, or set up graphify claude install from the previous section so it checks the graph on its own.

Updates: graphify update ., the git hooks and graphify watch re-read code only and never call a model. Unchanged docs come from the cache, so you don't pay for them twice.

How much does it save? The "80% fewer tokens" on the GitHub page refers to the paid hosted version. The open-source docs also say headline numbers aren't your numbers. graphify includes a measuring command:

graphify benchmark

It takes five typical questions and compares the tokens in your whole corpus with the tokens in the answers it pulls from the graph. That compares against sending the entire codebase, which Claude Code doesn't normally do, so the real answer is your bill. With CCSub, the Usage page in the dashboard shows tokens and charge for every request: do a few similar tasks before and after installing it and compare.

Privacy

  • Code is parsed locally and isn't sent anywhere.
  • Docs, PDFs and images are sent to a model. With /graphify they go to the endpoint Claude Code is using; with terminal commands, to the backend you chose. Files it considers sensitive are skipped, and it lists them.
  • To keep files out of the graph, add a .graphifyignore at the project root, written like .gitignore.
  • No telemetry. Each query is logged locally to ~/.cache/graphify-queries.log; set GRAPHIFY_QUERY_LOG_DISABLE=1 to turn that off.

Troubleshooting

uv tool install graphify can't find the package? It's missing a y: the package is graphifyy.

Claude Code doesn't recognise /graphify? Run graphify install --platform claude, check that ~/.claude/skills/graphify/SKILL.md exists, and restart Claude Code. If you installed with --project, open Claude Code at that project's root.

It can't find graph.json? The graph hasn't been built, or you're not at the project root. Build it first, or add --graph /full/path/to/graph.json.

Answers reflect old code? Run graphify update . and ask again. With git hooks installed, the background rebuild can lag a few seconds right after a commit.

Does it depend on your API provider?

graphify doesn't change Claude Code's API settings. With /graphify inside Claude Code, every step that needs a model uses Claude Code's current endpoint, so it works the same with an official account or a third-party service, with nothing extra to configure. Only extracting docs or naming groups from a terminal needs the setup in "What a third-party API needs". The costs to watch are the tokens spent reading docs while building, and the fixed overhead of loading the skill each time you run /graphify.

If you haven't set up Claude Code yet, see the Claude Code setup guide; for Codex, see the Codex CLI guide. For other Claude Code add-ons, see the Superpowers skills library and the claude-mem memory plugin.

Ready to use AI APIs?

Sign up for CCSub and get an extra $5 on your first top-up

Get Started

Related Posts