> Graphify: shared context of codebase for agents and developers. Canonical: https://graphify.com/blog/local-code-context-for-ai-agents-no-proxy · Full index: https://graphify.com/llms-full.txt

# Local code context for AI agents, with no proxy

*September 22, 2026 · Syed Fahad*

Local code context for AI agents, with no proxy in the path, comes from a code knowledge graph the agent queries as a tool. Graphify builds one from your source with tree-sitter and no model, and the agent's traffic still goes straight to its provider. Lower token use can follow, but only as a side benefit.

## What does "no proxy" mean for a coding agent?

A proxy sits between your agent and its model and changes the requests on the way through. Graphify does not. It is a tool the agent chooses to call, like grep or a language server. The agent asks a question, Graphify returns a few nodes and edges, and the agent carries on. Nothing about where your prompts go, which key signs them, or which model reads them changes.

That matters if you work under a policy about where code and prompts can travel. The graph build happens on your machine. What your agent then sends to its provider is the same kind of thing it sent before: whatever it read and whatever you typed.

## How does a code graph give an agent precise context?

It answers structural questions with the exact functions involved, instead of the agent assembling the picture from search results. Tree-sitter reads each file and writes nodes (files, classes, functions) and edges (contains, calls, imports, inherits). The agent traverses those edges. Each one is tagged `EXTRACTED`, `INFERRED` or `AMBIGUOUS`, so you can see how sure Graphify is.

It is not magic. Ask about a name that exists in several files and Graphify says the match is ambiguous and lists the candidates, and you retry with a path. The graph is as good as the question.

## What does it cost to build?

For code, nothing in model tokens. For everything else, something. The [extract reference](https://docs.graphify.com/reference/extract) puts it plainly: code costs nothing to extract, and docs, PDFs and images do.

| Files | Read by | Needs a model |
| --- | --- | --- |
| Code | tree-sitter, on your machine | No |
| Docs, PDFs, images | Semantic pass | Yes |

To keep the build free, run `graphify extract . --code-only`. To keep the semantic pass local too, point the CLI at Ollama with `--backend ollama`. Refreshes after the first build, whether `graphify update .`, git hooks or `graphify watch`, only re-read code.

## How do I run it fully locally?

Install the CLI, build the graph, register the skill for your agent and serve the graph over local MCP if your agent prefers it:

```bash
uv tool install "graphifyy[mcp]"
graphify extract . --code-only
graphify install
```

For MCP, the open-source CLI ships `graphify-mcp`, which reads `graphify-out/graph.json` and exposes ten tools, including `query_graph`, `get_node` and `shortest_path`. The [MCP overview](https://docs.graphify.com/mcp/overview) has the config for each agent. The [quickstart](https://docs.graphify.com/quickstart) covers the rest. For a team, [Graphify](https://app.graphify.com) builds and serves the same graph for you, so there is nothing to keep fresh by hand.

## Will it cut my AI coding token costs?

Maybe, and we will not promise it. Any saving is a side benefit of sending the agent a small, precise answer instead of a pile of files. How much depends on your repo and your questions.

What the evidence shows today:

- `graphify benchmark` compares an estimate of the whole corpus with the size of a graph answer. No agent reads a whole repo, so the ratio is not what you will save. [What the graphify benchmark measures](/blog/what-the-graphify-benchmark-measures) says as much.
- Independent tests are mixed. Constantin Ponfick ran 11 questions on FastAPI and saw files inspected fall 14.6% while input tokens rose 49.5% ([Constantin's Blog](https://constantinsblog.eu/posts/graphify-llm-query-tool/)). [Issue #985](https://github.com/Graphify-Labs/graphify/issues/985) is still open.
- The one accuracy number we publish is coverage, not tokens: on ERPNext, key-fact coverage rose from 70.8% to 82.0% across six questions, in [BENCHMARKS.md](https://github.com/Graphify-Labs/graphify/blob/v8/BENCHMARKS.md).

Graphify also does not remember your conversations. It maps the code you have.

## What should I try before adding any tool?

The free levers first. Anthropic's [cost guide](https://code.claude.com/docs/en/costs) says token costs scale with context size, and the fixes follow from that:

1. Clear between unrelated tasks.
2. Keep the instructions file short.
3. Disconnect MCP servers you do not use.
4. Write specific prompts.
5. Match the model and effort to the job.

[Why agents grep](/blog/why-agents-grep-the-hidden-token-cost-of-file-search) explains where exploration cost comes from. Add a graph when the remaining cost is your agent working out how files connect in a repo too big to hold in its head.

## When is a code graph not worth it?

On a small repo, on a single-file edit, or when you already know which file to open. The agent still reads the file it is about to change. If your questions are about exact strings, such as an error message or a config key, grep is the right tool.

## Try it

Connect a repository at [Graphify](https://app.graphify.com) for the hosted graph. For a local one:

```bash
uv tool install graphifyy
graphify extract . --code-only
graphify install
```

Then ask your agent a question that spans files, and compare its usage with and without the graph. Open-source Graphify is licensed under Apache 2.0. Related: [what a code knowledge graph is](/blog/what-is-a-code-knowledge-graph) and [Graphify vs RAG](/vs/rag). Sources: [Graphify docs](https://docs.graphify.com), [Anthropic's Claude Code costs guide](https://code.claude.com/docs/en/costs).

## FAQ

### Is Graphify a proxy?

No. Your agent calls Graphify as a tool, over MCP or as a skill. Your prompts, keys and model traffic still go straight from the agent to its own provider. Graphify never sits in that path and does not rewrite or compress your requests.

### Does Graphify cut my AI coding token costs?

It can on cross-file questions in a large repo, but we do not promise it. Public tests show a wide spread, from fewer tokens to more. Graphify is a code context tool. Measure your own repo with your agent's usage view before and after.

### What does building the graph cost?

Nothing in model tokens for code. Tree-sitter parses source on your machine with no model and no key. Docs, PDFs and images need a model, so use `--code-only` to skip them or point the CLI at Ollama to keep that pass local too.

### Can I run all of it offline?

Yes. Install the CLI, build with `--code-only` or an Ollama backend, and serve the graph with the local `graphify-mcp` server. Your agent still needs its own model, so it is only offline if that model is too.

### What should I try before adding any tool?

The free levers: clear context between tasks, keep your instructions file short, disconnect MCP servers you do not use, write specific prompts and match the model to the job. Add a code graph only if your questions span many files.
