> ## 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.

# Build a fully local code knowledge graph with Ollama

> Build a code knowledge graph that never leaves your machine: parse code offline, then run Graphify's semantic extraction on a local Ollama model.

You can build a Graphify knowledge graph without sending a byte to a hosted model. Code is parsed locally with tree-sitter and needs no model at all. For docs, papers and community names, point Graphify at a model running in [Ollama](https://ollama.com) on your own machine.

## What you'll build

* A code graph built offline.
* Semantic extraction for docs and community labels on a local model.
* Settings tuned for a laptop GPU or CPU.

## Setup

Install Ollama from [ollama.com](https://ollama.com), then pull a model. Graphify's default Ollama model is `qwen2.5-coder:7b`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
ollama pull qwen2.5-coder:7b
uv tool install "graphifyy[ollama]"
```

The `ollama` extra installs the OpenAI-compatible client Graphify uses to talk to Ollama.

## Step 1: Build the code graph offline

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
cd your-repo
graphify extract . --code-only
```

`--code-only` uses only the local parser. On the open-source [Graphify-Labs/graphify](https://github.com/Graphify-Labs/graphify) repository it wrote 19,602 nodes and 44,439 edges in about 26 seconds. For many codebases this is all you need. Stop here if you have no docs to add.

## Step 2: Add docs with a local model

Drop `--code-only` and choose the Ollama backend:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify extract . --backend ollama
```

Graphify sends doc and paper chunks to `http://localhost:11434/v1` and uses `qwen2.5-coder:7b` unless you set `OLLAMA_MODEL` or pass `--model`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify extract . --backend ollama --model llama3.1:8b
```

## Step 3: Name the communities locally

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify label . --backend ollama
```

`label` reruns clustering and asks the model for a short name for each community, so `GRAPH_REPORT.md` and the wiki read as "Billing retries" instead of "Community 12".

## Step 4: Tune for your machine

Local models are slower and have smaller context windows than hosted ones. These settings help:

| Setting | What it does |
| - | - |
| `--max-concurrency 1` | Sends one request at a time. Use it on a single GPU. |
| `--token-budget N` | Caps the size of each extraction chunk. |
| `--api-timeout S` | Gives slow models longer to answer. |
| `GRAPHIFY_OLLAMA_NUM_CTX` | Sets the context window Ollama allocates. Graphify warns if it's too small for a chunk. |
| `GRAPHIFY_OLLAMA_KEEP_ALIVE` | Keeps the model loaded between requests. Default `30m`. |
| `GRAPHIFY_OLLAMA_SEED` | Fixes the seed for more repeatable output. |
| `GRAPHIFY_OLLAMA_VISION=1` | Sends images to the model. Use only with a vision model. |

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export GRAPHIFY_OLLAMA_NUM_CTX=16384
graphify extract . --backend ollama --max-concurrency 1 --api-timeout 600
```

## Step 5: Point at another machine

If Ollama runs on a different host, such as a GPU box on your network:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export OLLAMA_HOST=gpu-box:11434
graphify extract . --backend ollama
```

`OLLAMA_BASE_URL` takes priority over `OLLAMA_HOST` when both are set. For other OpenAI-compatible servers, such as LM Studio or llama.cpp, set `OPENAI_BASE_URL` and `OPENAI_MODEL` and use `--backend openai`.

## When it goes wrong

**Requests time out.** Raise `--api-timeout`, lower `--max-concurrency` to 1, or pick a smaller model.

**Output is cut off or empty.** The chunk didn't fit the context window. Raise `GRAPHIFY_OLLAMA_NUM_CTX` or lower `--token-budget`.

**Connection refused.** Check `ollama serve` is running and `curl http://localhost:11434` answers. Check `OLLAMA_BASE_URL` isn't overriding `OLLAMA_HOST`.

## Production patterns

* Keep the code graph on git hooks with `graphify hook install`. It's code-only, so it never calls the model.
* Run semantic extraction and `label` overnight or on a schedule, not on each commit.
* Review `INFERRED` edges in `GRAPH_REPORT.md`. Smaller models infer less reliably than large hosted ones.

## Complete example

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
ollama pull qwen2.5-coder:7b
uv tool install "graphifyy[ollama]"
cd your-repo
graphify extract . --code-only
export GRAPHIFY_OLLAMA_NUM_CTX=16384
graphify extract . --backend ollama --max-concurrency 1 --api-timeout 600
graphify label . --backend ollama
graphify hook install
```

## What you built

A knowledge graph of code and docs built entirely on your hardware, tuned for a local model, and kept current by code-only hooks.

## Next steps

> **[Build your first graph](https://docs.graphify.com/guides/first-graph.md)**
>
> What extract does with code, docs and images.

> **[Self-host a shared MCP](https://docs.graphify.com/cookbooks/self-host-shared-mcp.md)**
>
> Serve the local graph to your team.

> **[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.