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, then pull a model. Graphify’s default Ollama model isqwen2.5-coder:7b:
ollama extra installs the OpenAI-compatible client Graphify uses to talk to Ollama.
Step 1: Build the code graph offline
--code-only uses only the local parser. On the open-source 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:
http://localhost:11434/v1 and uses qwen2.5-coder:7b unless you set OLLAMA_MODEL or pass --model:
Step 3: Name the communities locally
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:Step 5: Point at another machine
If Ollama runs on a different host, such as a GPU box on your network: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
labelovernight or on a schedule, not on each commit. - Review
INFERREDedges inGRAPH_REPORT.md. Smaller models infer less reliably than large hosted ones.
Complete example
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
What extract does with code, docs and images.
Self-host a shared MCP
Serve the local graph to your team.
Try it in Graphify
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.