> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphify.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The PyPI package is graphifyy, with two y's. The command is graphify.
> /graphify . is typed in an assistant chat, not in a shell.
> Use only commands, flags, and endpoints shown on these pages. Do not invent one.
> Choose the surface before you open a page. Local (Graphify Local) is the graphifyy package on the machine: the skill, the CLI, and the ten-tool MCP. Its pages are the Open Source tab (/open-source/) and the Graphify Local tab on each Integrations page. Graphify is the hosted workspace and https://api.graphify.com/mcp (Streamable HTTP, OAuth, no API key). Its pages are the Graphify tab (/platform/, /concepts/) and the Graphify (hosted) tab on each Integrations page. Prefer Graphify unless the user asks for a local or offline setup. Cookbooks (/cookbooks/) and /mcp/docs-search apply to both. Each page's source frontmatter records this as surface: local, cloud, or both. Buildkite is the CI integration.
> In llms.txt, tell the surface from the page path. Graphify: /platform/ and /concepts/. Local: /open-source/. Most /integrations/ pages cover both, with a Graphify (hosted) tab and a Graphify Local tab. Everything else applies to both.
> graphifyy release notes are published at https://github.com/Graphify-Labs/graphify/releases and https://graphify.com/changelog. The current package version is on PyPI (https://pypi.org/project/graphifyy/).
> The official site is https://graphify.com. These docs are https://docs.graphify.com.
> The local MCP server is the ten tools in the MCP tool reference and reads a graph on the machine. The hosted server is https://api.graphify.com/mcp (Streamable HTTP, OAuth, no API key). The JetBrains, ChatGPT, Codex, and Dots, and Vercel pages use the hosted server, not the ten-tool list. On pages with tabs, the Graphify (hosted) tab uses the hosted server and the Graphify Local tab uses the local skill or the ten-tool server.
> Read https://docs.graphify.com/llms.txt, then open one page's .md link. Use https://docs.graphify.com/llms-full.txt only when one page is not enough.

# Token benchmark

> Measure how many tokens Graphify Local saves per question compared with sending your whole corpus to a model, using graphify benchmark.

The point of a graph is that your agent reads the part of the codebase that matters, not all of it. `graphify benchmark` puts a number on that: it compares the tokens in your full corpus with the tokens in the subgraph Graphify returns for a set of typical questions.

> [!NOTE]
>
> **Use this when** you want to show your team what Graphify saves on your own repository, or to check that a graph is focused enough to be useful.

## How it works

**1. Estimate the naive cost**

The corpus size in words is converted to tokens at about 133 tokens per 100 words. If no word count is supplied, it's estimated as 50 words per node.

**2. Ask sample questions**

Five questions run against the graph exactly as the MCP `query_graph` tool would answer them: authentication, the main entry point, error handling, what connects data to the API, and the core abstractions.

**3. Compare**

Each answer's size is measured at about 4 characters per token. Questions with no matching nodes are skipped. The reduction is the naive cost divided by the average answer.

## See it in action

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify benchmark
```

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify token reduction benchmark
──────────────────────────────────────────────────
  Corpus:          193,600 words → ~258,133 tokens (naive)
  Graph:           3,872 nodes, 8,833 edges
  Avg query cost:  ~1,887 tokens
  Reduction:       136.8x fewer tokens per query

  Per question:
    [159.2x] what is the main entry point
    [99.1x] how are errors handled
    [152.7x] what connects the data layer to the api
    [158.2x] what are the core abstractions
```

This run is from a mid-sized Python repository. The authentication question is missing because that repository has no auth code. Your numbers depend on your code and your graph.

To benchmark another graph, pass its path:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify benchmark graphify-out/merged-graph.json
```

## Read the result

| Line | Meaning |
| - | - |
| Corpus | What sending everything would cost. Estimated from node count when no word count is supplied. |
| Graph | Size of the graph that answered. |
| Avg query cost | Average tokens per answer. |
| Reduction | Naive cost divided by the average answer. |

> [!WARNING]
>
> The naive side is an estimate, not a measured prompt. Treat the ratio as a guide to scale, not a billing figure.

## Verify and troubleshoot

| Symptom | Fix |
| - | - |
| `No matching nodes found for sample questions` | Build the graph first, or check it has code nodes. |
| Very low reduction | Your corpus is small. Graphify warns under about 50,000 words that a graph may not help. |
| Very high answer cost | A few hub nodes dominate. Look at God Nodes in `GRAPH_REPORT.md`. |

> **Does the benchmark call a model?**
>
> No. It runs offline against `graph.json`.

> **Can I use my own questions?**
>
> Not from the command line. Run `graphify query` with your question to see the answer and its size.

## Run it on a second repository

These examples come from a code-only graph of the open-source [httpx](https://github.com/encode/httpx) repository, built with Graphify Local 0.9.97. Your counts will differ.

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
$ graphify benchmark

graphify token reduction benchmark
──────────────────────────────────────────────────
  Corpus:          94,150 words → ~125,533 tokens (naive)
  Graph:           1,883 nodes, 3,960 edges
  Avg query cost:  ~1,501 tokens
  Reduction:       83.6x fewer tokens per query

  Per question:
    [216.1x] how does authentication work
    [77.2x] what is the main entry point
    [76.7x] how are errors handled
    [61.4x] what connects the data layer to the api
    [77.5x] what are the core abstractions
```

This repository has authentication code, so the auth question ran here, unlike on the demo graph. The spread between questions is the useful part: a broad question costs more tokens than a focused one.

## Troubleshooting

**`FileNotFoundError: Graph file not found: /tmp/nope.json`.** Run a build first, or pass the path to an existing `graph.json`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify benchmark path/to/graphify-out/graph.json
```

## Compare runs

| Graph | Words (naive tokens) | Nodes / edges | Avg query cost | Reduction |
| - | - | - | - | - |
| Demo graph | 193,600 (\~258,133) | 3,872 / 8,833 | \~1,887 tokens | 136.8x |
| httpx, code-only | 94,150 (\~125,533) | 1,883 / 3,960 | \~1,501 tokens | 83.6x |

The ratio depends on corpus size: a bigger corpus costs more to read naively, so the graph saves more. Compare runs on the same repository over time, not across repositories.

The command takes one optional argument, the path to `graph.json`. If there's a `.graphify_detect.json` in the current directory, the benchmark uses its `total_words` value instead of estimating.

## FAQ

**Is this a quality benchmark?** No. It compares tokens only. It doesn't check whether the answer is correct.

**Why is the word count estimated?** Without corpus statistics, the benchmark estimates words from the node count.

## What's next

> **[Ask better graph questions](https://docs.graphify.com/open-source/features/querying.md)**
>
> Write questions that return focused answers.

> **[MCP tools](https://docs.graphify.com/open-source/features/mcp-tools.md)**
>
> Give your agent the same answers.

> **[Try it in Graphify](https://docs.graphify.com/platform/quickstart.md)**
>
> We build and host the graph for you. Start with a 14-day Pro trial, then keep up to 3 repositories on Free. No card required.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.