graphify Documentation

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and...

105,718 stars Python Python 1 file ยท ~12,828 tokens #ai-agents#antigravity#ast#claude-code#code-analysis#code-search#codex#cursor
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy graphify on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name graphify -p 8080:8080 --restart always graphify-labs/graphify:latest

File: README.md

Type /graphify in your AI coding assistant and it maps your entire project (code, docs, PDFs, images, videos) into a knowledge graph you can query instead of grepping through files.

  • Code maps for free, fully local. Code is parsed with tree-sitter AST: deterministic, no LLM, nothing leaves your machine. (Docs, PDFs, images and video use your assistant's model, or a configured API key, for a semantic pass.)
  • Every edge is explained. Each connection is tagged EXTRACTED (explicit in the source) or INFERRED (resolved by graphify), so you can tell what was read directly from what was inferred.
  • Not a vector index. No embeddings, no vector store: a real graph you traverse. Ask a question, trace the path between two things, or explain one concept.

Want this always-on, updating in the background across your code, docs, and meetings rather than only on demand? That is what we are building at graphify.com, and early access is open now at app.graphify.com.

Get started (30 seconds):

bash
uv tool install graphifyy      # install the CLI (or: pipx install graphifyy)
graphify install               # register the skill with your AI assistant

Then, in your AI assistant:

text
/graphify .

That's it. You get three files:

text
graphify-out/
โ”œโ”€โ”€ graph.html       open in any browser โ€” click nodes, filter, search
โ”œโ”€โ”€ GRAPH_REPORT.md  the highlights: key concepts, surprising connections, suggested questions
โ””โ”€โ”€ graph.json       the full graph โ€” query it anytime without re-reading your files

Works in Claude Code, Cursor, Codex, Gemini CLI, GitHub Copilot, and 15+ more โ€” pick your platform.


See it in action

Once the graph is built you query it instead of reading files. Real output, graphify run on the FastAPI codebase shown above:

text
$ graphify explain "APIRouter"
Node: APIRouter
  Source:    routing.py L2210
  Community: 2
  Degree:    47

Connections (47):
  --> RequestValidationError [uses] [INFERRED]
  --> Dependant [uses] [INFERRED]
  --> .get() [method] [EXTRACTED]
  <-- __init__.py [imports] [EXTRACTED]
  ...

$ graphify path "FastAPI" "ModelField"
Shortest path (3 hops):
  FastAPI --uses--> DefaultPlaceholder <--references-- get_request_handler() --references--> ModelField

Every edge carries a confidence tag (EXTRACTED = explicit in the source, INFERRED = derived by resolution), so you can tell what was read directly from what was inferred. graphify query "<question>" returns a scoped subgraph for a plain-language question, and graphify path A B traces how any two things connect.


What it does

What you get out of the box:

Capability What you get
God nodes The most-connected concepts, so you see what everything flows through
Communities The graph split into subsystems (Leiden), with LLM-free labels
Cross-file links calls / imports / inherits / mixes_in resolved across ~40 languages via tree-sitter AST
Query, path, explain Ask a question, trace the path between two things, or explain one concept, all against graph.json
Rationale + doc refs # NOTE: / # WHY: comments and ADR/RFC citations become first-class nodes linked to the code
Beyond code Docs, PDFs, images, and video/audio all map into the same graph
Local-first Code is parsed locally with tree-sitter (no LLM, nothing leaves your machine); only the semantic pass over docs/media calls a backend, and only if you configure one

Benchmarks

Benchmark Metric graphify Field
LOCOMO (n=300) recall@10 0.497 mem0 0.048, supermemory 0.149
LOCOMO (n=300) QA accuracy 45.3% supermemory 49.7%, mem0 27.3%
LongMemEval-S (n=50) QA accuracy 76% tied with dense RAG
Graph build LLM credits 0 per-token for most systems

Every system ran on the same harness with the same model and budgets, scored by a judge blind-validated against a second judge (90.6% agreement, Cohen's kappa 0.81). Full per-system tables, the code-intelligence result, and reproduction commands: BENCHMARKS.md.


Prerequisites

Requirement Minimum Check Install
Python 3.10+ python --version python.org
uv (recommended) any uv --version curl -LsSf https://astral.sh/uv/install.sh | sh
pipx (alternative) any pipx --version pip install pipx

macOS quick install (Homebrew):

bash
brew install [email protected] uv

Windows quick install:

powershell
winget install astral-sh.uv

Ubuntu/Debian:

bash
sudo apt install python3.12 python3-pip pipx
# or install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh

Install

Official package: The PyPI package is graphifyy (double-y). Other graphify* packages on PyPI are not affiliated. The CLI command is still graphify.

Step 1 โ€” install the package:

bash
# Recommended (isolated env; if 'graphify' isn't found after, run: uv tool update-shell):
uv tool install graphifyy

# Alternatives:
pipx install graphifyy
pip install graphifyy  # may need PATH setup โ€” see note below

Step 2 โ€” register the skill with your AI assistant:

bash
graphify install

That's it. Open your AI assistant and type /graphify .

To install the assistant skill into the current repository instead of your user
profile, add --project:

bash
graphify install --project
graphify install --project --platform codex

Project-scoped installs write under the current directory, for example
.claude/skills/graphify/SKILL.md or .agents/skills/graphify/SKILL.md (plus a
references/ sidecar the skill loads on demand), and
print a git add hint for files that can be committed.
Per-platform commands that support project-scoped installs accept the same flag,
for example graphify claude install --project or graphify codex install --project.

PowerShell note: Use graphify . not /graphify . โ€” the leading slash is a path separator in PowerShell.

graphify: command not found? uv tool install / pipx install put the graphify command in their tool bin dir (~/.local/bin). If your shell can't find it right after install โ€” common on a fresh macOS + zsh setup โ€” that dir isn't on your PATH yet: run uv tool update-shell (or pipx ensurepath), then open a new terminal. With plain pip, add ~/.local/bin (Linux) or ~/Library/Python/3.x/bin (Mac) to your PATH, or run python -m graphify.

Running with uvx / uv tool run instead of installing? Name the package, not the command: uvx --from graphifyy graphify install. Plain uvx graphify โ€ฆ fails (No solution found โ€ฆ no versions of graphify) because uv tool run reads the first word as a package, and the package is graphifyy โ€” the graphify command lives inside it.

Avoid pip install on Mac/Windows if possible. The skill resolves Python at runtime from graphify-out/.graphify_python; if that points to a different environment than where pip installed the package, you'll get ModuleNotFoundError: No module named 'graphify'. uv tool install and pipx install isolate the package in their own env and avoid this entirely.

Git hooks and uv tool / pipx: graphify hook install embeds the current interpreter path directly into the hook scripts at install time, so the post-commit hook fires correctly even in GUI git clients and CI runners where ~/.local/bin is not on PATH. If you reinstall or upgrade graphify, re-run graphify hook install to refresh the embedded path.

Strict mode (Claude Code): graphify install --project --strict makes the assistant actually use the graph. The default install nudges it to run graphify query before reading files; strict mode blocks the first raw source read of a session and redirects it to the graph, then reverts to the nudge (so it fires at most once per session and never gets stuck). Toggle at runtime with GRAPHIFY_HOOK_STRICT=1/0; the default install is unchanged (soft nudge).

Pick your platform (20+ assistants, click to expand)

Platform Install command
Claude Code (Linux/Mac) graphify install
Claude Code (Windows) graphify install (auto-detected) or graphify install --platform windows
CodeBuddy graphify install --platform codebuddy
Codex graphify install --platform codex
OpenCode graphify install --platform opencode
Kilo Code graphify install --platform kilo
GitHub Copilot CLI graphify install --platform copilot
VS Code Copilot Chat graphify vscode install
Aider graphify install --platform aider
OpenClaw graphify install --platform claw
Factory Droid graphify install --platform droid
Trae graphify install --platform trae
Trae CN graphify install --platform trae-cn
Gemini CLI graphify install --platform gemini
Hermes graphify install --platform hermes
Kimi Code graphify install --platform kimi
Amp graphify amp install
Agent Skills (cross-framework) graphify install --platform agents (alias --platform skills)
Kiro IDE/CLI graphify kiro install
Pi coding agent graphify install --platform pi
Cursor graphify cursor install
Devin CLI graphify devin install
Google Antigravity graphify antigravity install

Codex users also need multi_agent = true under [features] in ~/.codex/config.toml for parallel extraction. CodeBuddy uses the same Agent tool and PreToolUse hook mechanism as Claude Code. Factory Droid uses the Task tool for parallel subagent dispatch. OpenClaw and Aider use sequential extraction (parallel agent support is still early on those platforms). Trae uses the Agent tool for parallel subagent dispatch and does not support PreToolUse hooks, so AGENTS.md is the always-on mechanism.

--platform agents (alias --platform skills) targets the generic cross-framework Agent-Skills locations: the spec's user-global ~/.agents/skills/ (read by npx skills and spec-compliant frameworks) for a global install, and ./.agents/skills/ for a project (--project) install. The bare graphify install stays single-platform (Claude Code) by design โ€” use the named agents platform when you want the skill discoverable by any framework that reads .agents/skills.

Codex uses $graphify instead of /graphify.

Optional extras (install only what you need)

Extra What it adds Install
pdf PDF extraction uv tool install "graphifyy[pdf]"
office .docx and .xlsx support uv tool install "graphifyy[office]"
google Google Sheets rendering uv tool install "graphifyy[google]"
video Video/audio transcription (faster-whisper + yt-dlp) uv tool install "graphifyy[video]"
mcp MCP stdio server uv tool install "graphifyy[mcp]"
neo4j Neo4j push support uv tool install "graphifyy[neo4j]"
falkordb FalkorDB push support uv tool install "graphifyy[falkordb]"
svg SVG graph export uv tool install "graphifyy[svg]"
leiden Leiden community detection (Python < 3.13 only) uv tool install "graphifyy[leiden]"
ollama Ollama local inference uv tool install "graphifyy[ollama]"
openai OpenAI / OpenAI-compatible APIs uv tool install "graphifyy[openai]"
gemini Google Gemini API uv tool install "graphifyy[gemini]"
anthropic Anthropic Claude API (--backend claude, uses ANTHROPIC_API_KEY) uv tool install "graphifyy[anthropic]"
bedrock AWS Bedrock (uses IAM, no API key) uv tool install "graphifyy[bedrock]"
azure Azure OpenAI Service (--backend azure, uses AZURE_OPENAI_API_KEY + AZURE_OPENAI_ENDPOINT) uv tool install "graphifyy[openai]"
sql SQL schema extraction uv tool install "graphifyy[sql]"
postgres Live PostgreSQL introspection (--postgres DSN) uv tool install "graphifyy[postgres]"
dm BYOND DreamMaker .dm/.dme AST extraction (may need a C compiler + python3-dev if no wheel matches your platform) uv tool install "graphifyy[dm]"
terraform Terraform / HCL .tf/.tfvars/.hcl AST extraction uv tool install "graphifyy[terraform]"
pascal Pascal / Delphi .pas/.dpr/.dpk/.inc AST extraction (more accurate calls/inherits edges; falls back to a regex extractor when absent) uv tool install "graphifyy[pascal]"
ocaml OCaml .ml/.mli AST extraction uv tool install "graphifyy[ocaml]"
commonlisp Common Lisp .lisp/.cl/.lsp/.asd AST extraction uv tool install "graphifyy[commonlisp]"
chinese Chinese query segmentation (jieba) uv tool install "graphifyy[chinese]"
all Everything above uv tool install "graphifyy[all]"

Make your assistant always use the graph

Run this once in your project after building a graph:

Platform Command
Claude Code graphify claude install
CodeBuddy graphify codebuddy install
Codex graphify codex install
OpenCode graphify opencode install
Kilo Code graphify kilo install
GitHub Copilot CLI graphify copilot install
VS Code Copilot Chat graphify vscode install
Aider graphify aider install
OpenClaw graphify claw install
Factory Droid graphify droid install
Trae graphify trae install
Trae CN graphify trae-cn install
Cursor graphify cursor install
Gemini CLI graphify gemini install
Hermes graphify hermes install
Kimi Code graphify install --platform kimi
Amp graphify amp install
Agent Skills (cross-framework) graphify agents install (alias graphify skills install)
Kiro IDE/CLI graphify kiro install
Pi coding agent graphify pi install
Devin CLI graphify devin install
Google Antigravity graphify antigravity install

This writes a small config file that tells your assistant to consult the knowledge graph for codebase questions, preferring scoped queries like graphify query "<question>" over reading the full report or grepping raw files.

  • Hook platforms (Claude Code, Gemini CLI): a hook fires automatically before search-style tool calls (and, on Claude Code, before reading source files one by one via the Read/Glob tools) and nudges your assistant toward the graph path.
  • Instruction-file platforms (Codex, OpenCode, Cursor, etc.): persistent instruction files (AGENTS.md, .cursor/rules/, etc.) provide the same query-first guidance.

GRAPH_REPORT.md is still available for broad architecture review.

CodeBuddy does the same two things as Claude Code: writes a CODEBUDDY.md section telling CodeBuddy to read graphify-out/GRAPH_REPORT.md before answering architecture questions, and installs PreToolUse hooks (.codebuddy/settings.json) that fire before Bash search commands and file reads, nudging toward graphify query instead.

Codex writes to AGENTS.md, which is what actually carries the always-on graph guidance on this platform. graphify codex install also registers a PreToolUse hook in .codex/hooks.json (graphify hook-check), but that entry is deliberately a no-op: Codex Desktop rejects hookSpecificOutput.additionalContext on PreToolUse, so emitting a nudge there would break Bash tool calls. Unlike Claude Code, where the hook (graphify hook-guard) does the nudging, on Codex the hook fires and intentionally does nothing, and AGENTS.md is the always-on mechanism.

Kilo Code installs the Graphify skill to ~/.config/kilo/skills/graphify/SKILL.md and a native /graphify command to ~/.config/kilo/command/graphify.md. graphify kilo install also writes AGENTS.md plus a native tool.execute.before plugin (.kilo/plugins/graphify.js + .kilo/kilo.json or .kilo/kilo.jsonc registration) so Kilo gets the same always-on graph reminder behavior through native .kilo config.

Cursor writes .cursor/rules/graphify.mdc with alwaysApply: true, so Cursor includes it in every conversation automatically, no hook needed.

To remove graphify from all platforms at once: graphify uninstall (add --purge to also delete graphify-out/). Or use the per-platform command (e.g. graphify claude uninstall).


What's in the report

  • God nodes โ€” the most-connected concepts in your project. Everything flows through these.
  • Surprising connections โ€” links between things that live in different files or modules. Ranked by how unexpected they are.
  • The "why" โ€” inline comments (# NOTE:, # WHY:, # HACK:), docstrings, and design rationale from docs are extracted as separate nodes linked to the code they explain.
  • Suggested questions โ€” 4โ€“5 questions the graph is uniquely positioned to answer.
  • Confidence tags โ€” every inferred relationship is marked EXTRACTED, INFERRED, or AMBIGUOUS. You always know what was found vs guessed.

What files it handles

Type Extensions
Code (37 tree-sitter grammars) .py .ts .mts .cts .js .jsx .tsx .mjs .go .rs .java .c .cpp .cc .cxx .h .hpp .cu .cuh .metal .rb .cs .kt .kts .scala .php .swift .lua .luau .toc .zig .ps1 .psm1 .psd1 .ex .exs .m .mm .ml .mli .jl .vue .svelte .astro .groovy .gradle .dart .v .sv .svh .sql .f .f90 .f95 .f03 .f08 .pas .pp .dpr .dpk .lpr .inc .dfm .lfm .lpk .sh .bash .json .dm .dme .dmi .dmm .dmf .sln .slnx .csproj .fsproj .vbproj .xaml .razor .cshtml (.dm/.dme requires uv tool install graphifyy[dm], .ml/.mli requires uv tool install graphifyy[ocaml]; .mts/.cts reuse the TypeScript grammar, .cc/.cxx and CUDA .cu/.cuh and Metal .metal reuse the C++ grammar)
Salesforce Apex .cls .trigger (regex-based; classes, interfaces, enums, methods, triggers, SOQL/DML edges)
Terraform / HCL .tf .tfvars .hcl (requires uv tool install graphifyy[terraform])
OCaml .ml .mli (requires uv tool install graphifyy[ocaml])
Common Lisp .lisp .cl .lsp .asd (requires uv tool install graphifyy[commonlisp])
MCP configs .mcp.json mcp.json mcp_servers.json claude_desktop_config.json โ€” extracts server nodes, package refs, env var requirements
Package manifests apm.yml pyproject.toml go.mod pom.xml โ€” one canonical package node per package (by name) plus depends_on edges, so a package referenced from many manifests is a single hub
Docs .md .mdx .qmd .html .txt .rst .yaml .yml (markdown [text](./other.md) links and [[wikilinks]] become references edges between docs)
Office .docx .xlsx (requires uv tool install graphifyy[office])
Google Workspace .gdoc .gsheet .gslides (opt-in; requires gws auth and --google-workspace; Sheets need uv tool install graphifyy[google])
PDFs .pdf
Images .png .jpg .webp .gif
Video / Audio .mp4 .mov .mp3 .wav and more (requires uv tool install graphifyy[video])
YouTube / URLs any video URL (requires uv tool install graphifyy[video])

Code is extracted locally with no API calls (AST via tree-sitter). Everything else goes through your AI assistant's model API.

Google Drive for desktop .gdoc, .gsheet, and .gslides files are shortcut
pointers, not document content. To include native Google Docs, Sheets, and Slides
in a headless extraction, install and authenticate the
gws CLI, then run:

bash
uv tool install "graphifyy[google]"  # needed for Google Sheets table rendering
gws auth login -s drive
graphify extract ./docs --google-workspace

You can also set GRAPHIFY_GOOGLE_WORKSPACE=1. Graphify exports shortcuts into
graphify-out/converted/ as Markdown sidecars, then extracts those files.


Common commands

bash
/graphify .                        # build graph for current folder
/graphify ./docs --update          # re-extract only changed files
/graphify . --cluster-only         # rerun clustering without re-extracting
/graphify . --cluster-only --resolution 1.5      # more granular communities
/graphify . --cluster-only --exclude-hubs 99     # suppress utility super-hubs from god-node rankings
/graphify . --no-viz               # skip the HTML, just the report + JSON
/graphify . --wiki                 # build a markdown wiki from the graph
graphify export callflow-html      # Mermaid architecture/call-flow HTML (auto-regenerates on every git commit if hook is installed)

/graphify query "what connects auth to the database?"
/graphify path "UserService" "DatabasePool"
/graphify explain "RateLimiter"

/graphify add https://arxiv.org/abs/1706.03762   # fetch a paper and add it
/graphify add <youtube-url>                       # transcribe and add a video

graphify hook install              # auto-rebuild on git commit
graphify merge-graphs a.json b.json              # combine two graphs

graphify prs                       # PR dashboard: CI state, review status, worktree mapping
graphify prs 42                    # deep dive on PR #42 with graph impact
graphify prs --triage              # AI ranks your review queue (uses whatever backend is configured)
graphify prs --conflicts           # PRs sharing graph communities โ€” merge-order risk

See the full command reference below.


Ignoring files

Create a .graphifyignore in your project root โ€” same syntax as .gitignore, including ! negation.

.gitignore is respected automatically. graphify reads the .gitignore in each directory. If a .graphifyignore is also present, the two are merged โ€” .graphifyignore patterns are evaluated last, so they win on conflicts (including ! negations). Adding a .graphifyignore only ever excludes more; it never re-includes a file your .gitignore already excluded. Subdirectory scoping works the same way as git โ€” an ignore file only affects its own subtree.

Pass --no-gitignore to graphify extract when git-ignored generated or transpiled code belongs in the graph. This disables .gitignore and .git/info/exclude; .graphifyignore still applies.

text
# .graphifyignore
node_modules/
dist/
*.generated.py

# only index src/, ignore everything else
*
!src/
!src/**

Team setup

graphify-out/ is meant to be committed to git so everyone on the team starts with a map.

Recommended .gitignore additions:

text
graphify-out/cost.json        # local only
# graphify-out/cache/         # optional: commit for speed, skip to keep repo small

manifest.json is now portable โ€” keys are stored as relative paths and re-anchored on load, so committing it is safe and avoids a full rebuild on first checkout.

Workflow:

  1. One person runs /graphify . and commits graphify-out/.
  2. Everyone pulls โ€” their assistant reads the graph immediately.
  3. Run graphify hook install to auto-rebuild after each commit (AST only, no API cost). This also sets up a git merge driver so graph.json is never left with conflict markers โ€” two devs committing in parallel get their graphs union-merged automatically.
  4. When docs or papers change, run /graphify --update to refresh those nodes.

Using the graph directly

bash
# query the graph from the terminal
graphify query "show the auth flow"
graphify query "what connects DigestAuth to Response?" --graph graphify-out/graph.json

# expose the graph as an MCP server (for repeated tool-call access)
python -m graphify.serve graphify-out/graph.json
python -m graphify.serve --graph graphify-out/graph.json  # --graph flag also accepted

# register with Kimi Code:
kimi mcp add --transport stdio graphify -- python -m graphify.serve graphify-out/graph.json

# or serve over HTTP so a whole team points at one URL (no local graphify needed):
python -m graphify.serve graphify-out/graph.json --transport http --port 8080
python -m graphify.serve graphify-out/graph.json --transport http --host 0.0.0.0 --api-key "$SECRET"

The MCP server gives your assistant structured access: query_graph, get_node, get_neighbors, shortest_path, list_prs, get_pr_impact, triage_prs.

Shared HTTP server

--transport stdio (the default) spawns one local server per developer. --transport http serves the same tools over the MCP Streamable HTTP transport, so a single shared process can serve the graph for the whole team โ€” clients point their IDE MCP config at http://<host>:8080/mcp instead of running graphify locally.

Flag Default Purpose
--transport {stdio,http} stdio Transport to serve on
--host 127.0.0.1 HTTP bind host (use 0.0.0.0 to expose beyond localhost)
--port 8080 HTTP bind port
--api-key env GRAPHIFY_API_KEY Require Authorization: Bearer <key> (or X-API-Key)
--path /mcp HTTP mount path
--json-response off Return plain JSON instead of SSE streams
--stateless off No per-session state (for load-balanced / CI deployments)
--session-timeout 3600 Reap idle stateful sessions after N seconds (0 disables)

The default 127.0.0.1 bind is loopback-only. Set --host 0.0.0.0 and --api-key together when exposing on a shared host. Run it in a container:

bash
docker build -t graphify .
docker run -p 8080:8080 -v "$(pwd)/graphify-out:/data" graphify \
  /data/graph.json --transport http --host 0.0.0.0 --api-key "$SECRET"

WSL / Linux note: Ubuntu ships python3, not python. Use a venv to avoid conflicts:

bash
python3 -m venv .venv && .venv/bin/pip install "graphifyy[mcp]"

Environment variables

These are only needed for headless / CI extraction (graphify extract). When running via the /graphify skill inside your IDE, the model API is provided by your IDE session โ€” no extra keys needed.

Variable Used for When required
ANTHROPIC_API_KEY Claude (Anthropic) backend --backend claude
ANTHROPIC_BASE_URL Anthropic-compatible endpoint URL (LiteLLM proxy, gateways, ...) --backend claude (default: https://api.anthropic.com)
ANTHROPIC_MODEL Model name for the Claude backend โ€” for custom endpoints, use the model name/alias your server exposes --backend claude (default: claude-sonnet-4-6)
GEMINI_API_KEY or GOOGLE_API_KEY Google Gemini backend --backend gemini
OPENAI_API_KEY OpenAI or OpenAI-compatible APIs --backend openai (local servers accept any non-empty value)
OPENAI_BASE_URL OpenAI-compatible server URL (llama.cpp, vLLM, LM Studio, ...) --backend openai (default: https://api.openai.com/v1)
OPENAI_MODEL Model name for the OpenAI backend โ€” for self-hosted servers, use the model name/alias your server exposes (check its /v1/models endpoint), e.g. LFM2.5-8B-A1B-UD-Q4_K_XL for llama.cpp --backend openai (default: gpt-4.1-mini)
DEEPSEEK_API_KEY DeepSeek backend --backend deepseek
MOONSHOT_API_KEY Kimi Code backend --backend kimi
OLLAMA_BASE_URL Ollama local inference URL --backend ollama (default: http://localhost:11434)
OLLAMA_MODEL Ollama model name --backend ollama (default: auto-detect)
GRAPHIFY_OLLAMA_NUM_CTX Override Ollama KV-cache window size optional โ€” auto-sized by default
GRAPHIFY_OLLAMA_KEEP_ALIVE Minutes to keep Ollama model loaded optional โ€” set 0 to unload after each chunk
AZURE_OPENAI_API_KEY Azure OpenAI Service backend --backend azure
AZURE_OPENAI_ENDPOINT Azure resource endpoint URL --backend azure (required alongside API key)
AZURE_OPENAI_API_VERSION Azure API version override optional โ€” default 2024-12-01-preview
AZURE_OPENAI_DEPLOYMENT or GRAPHIFY_AZURE_MODEL Azure deployment name optional โ€” default gpt-4o
AWS_* / ~/.aws/credentials AWS Bedrock โ€” standard credential chain --backend bedrock (no API key, uses IAM)
GRAPHIFY_MAX_WORKERS AST parallelism thread count optional โ€” also --max-workers flag
GRAPHIFY_MAX_OUTPUT_TOKENS Raise output cap for dense corpora optional โ€” e.g. 32768 for large files
GRAPHIFY_API_TIMEOUT Per-call timeout in seconds for HTTP, claude-cli, Anthropic SDK, and Bedrock backends (default: 600) optional โ€” also --api-timeout flag
GRAPHIFY_MAX_RETRIES How many times to retry a rate-limited (429) request before giving up (default: 6; honors Retry-After) optional โ€” raise for strict per-org limits (e.g. kimi); 0 disables
GRAPHIFY_FORCE Force graph rebuild even with fewer nodes optional โ€” also --force flag
GRAPHIFY_GOOGLE_WORKSPACE Auto-enable Google Workspace export optional โ€” set to 1
GRAPHIFY_TRIAGE_BACKEND Backend for graphify prs --triage optional โ€” auto-detected from available keys
GRAPHIFY_TRIAGE_MODEL Model override for triage optional โ€” e.g. claude-opus-4-7
GRAPHIFY_QUERY_LOG_ENABLE Set to 1 to turn on the local query log at ~/.cache/graphify-queries.log (records each query/path/explain question + corpus path). Off by default โ€” nothing is written unless you opt in (#1797) optional
GRAPHIFY_QUERY_LOG Enable the query log and write it to this path instead of the default optional โ€” off unless this or _ENABLE is set
GRAPHIFY_QUERY_LOG_DISABLE Set to 1 to force the query log off (wins over the enable vars) optional
GRAPHIFY_QUERY_LOG_RESPONSES When the log is enabled, also record full subgraph responses (off by default) optional
GRAPHIFY_MAX_GRAPH_BYTES Override the 512 MiB graph.json size cap โ€” e.g. 700MB, 2GB, or plain bytes optional โ€” useful for very large corpora
GRAPHIFY_MAX_CONTEXTS Maximum number of non-default project graphs retained by one multi-project MCP server optional โ€” default: 8; invalid values use 8, and values below 1 use 1
GRAPHIFY_LLM_TEMPERATURE Override LLM temperature for semantic extraction โ€” e.g. 0.7, or none to omit optional โ€” auto-omitted for o1/o3/o4/gpt-5 reasoning models

Privacy

  • Code files โ€” processed locally via tree-sitter. Nothing leaves your machine. A code-only corpus requires no API key โ€” graphify extract runs fully offline. On a mixed repo, add --code-only to index just the code and skip the docs/PDFs/images that would otherwise need an LLM.
  • Video / audio โ€” transcribed locally with faster-whisper. Nothing leaves your machine.
  • Docs, PDFs, images โ€” sent to your AI assistant for semantic extraction (via the /graphify skill, using whatever model your IDE session runs). Headless graphify extract requires GEMINI_API_KEY / GOOGLE_API_KEY (Gemini), MOONSHOT_API_KEY (Kimi), ANTHROPIC_API_KEY (Claude), OPENAI_API_KEY (OpenAI), DEEPSEEK_API_KEY (DeepSeek), a running Ollama instance (OLLAMA_BASE_URL), AWS credentials via the standard provider chain (Bedrock - no API key needed, uses IAM), or the claude CLI binary (Claude Code - no API key needed, uses your Claude subscription). The --dedup-llm flag uses the same key.
  • Data residency โ€” graphify extract auto-detects which provider to use based on which API key is set (priority: Gemini โ†’ Kimi โ†’ Claude โ†’ OpenAI โ†’ DeepSeek โ†’ Azure โ†’ Bedrock โ†’ Ollama). For code with data-residency requirements, use --backend ollama (fully local) or pass an explicit --backend flag. Kimi (MOONSHOT_API_KEY) routes to Moonshot AI servers in China.
  • No telemetry, no usage tracking, no analytics.
  • Query logging โ€” every graphify query, graphify path, graphify explain, and MCP query_graph call is logged to ~/.cache/graphify-queries.log in JSON Lines format (timestamp, question, corpus, nodes returned, duration). Full subgraph responses are not stored by default. Set GRAPHIFY_QUERY_LOG_DISABLE=1 to opt out, or GRAPHIFY_QUERY_LOG=/dev/null to silence without disabling the code path.

Troubleshooting

graphify: command not found after installing
The CLI is installed but its bin directory isn't on your shell's PATH. Pick the fix for how you installed:

  • uv (uv tool install graphifyy): the command lands in uv's tool bin dir (~/.local/bin), which a fresh macOS/zsh setup often doesn't have on PATH. Run uv tool update-shell, then open a new terminal. (Find the dir with uv tool dir --bin.)
  • pipx (pipx install graphifyy): run pipx ensurepath, then open a new terminal.
  • pip (pip install graphifyy): pip installs scripts to a user bin dir that may not be on PATH โ€” add ~/Library/Python/3.x/bin (macOS) or ~/.local/bin (Linux) to your PATH in ~/.zshrc/~/.bashrc, or just run python -m graphify.

uvx graphify โ€ฆ or uv tool run graphify โ€ฆ fails to resolve graphify
The PyPI package is graphifyy; graphify is only the command it provides. uv tool run treats the first word as a package name, so it looks for a package called graphify and reports No solution found โ€ฆ no versions of graphify. Name the package explicitly: uvx --from graphifyy graphify install (same as uv tool run --from graphifyy graphify install). Or uv tool install graphifyy once and then call graphify directly.

uv run --with graphifyy python -m graphify silently runs an older install
uv run uses your system Python, so if an older graphifyy also lives there (e.g. a past pip install graphifyy), Python can find that copy first on sys.path and --with graphifyy won't override it. It runs with no error, but you get the old version's behavior โ€” e.g. env overrides like OPENAI_BASE_URL are silently ignored, so requests hit the default endpoint and fail with a 401 that looks like a bad key. The fingerprint is a warning: skill is from graphify <newer>, package is <older> line โ€” that means a different install was loaded, not just a stale skill. Check which copy actually loaded:

bash
python -c "import graphify; print(graphify.__file__)"

Then run the installed command directly (it uses the uv-managed copy), or drop the stale system copy:

bash
uvx --from graphifyy graphify extract . --backend openai   # names the package explicitly
pip uninstall graphifyy                                    # or remove the old system install

python -m graphify works but graphify command doesn't
Your shell's PATH doesn't include the bin directory the command was installed to. Prefer uv tool install / pipx install over plain pip, then run uv tool update-shell / pipx ensurepath and open a new terminal (see the install notes above).

/graphify . causes "path not recognized" in PowerShell
PowerShell treats a leading / as a path separator. Use graphify . (no slash) on Windows.

Graph has fewer nodes after --update or rebuild
If a refactor deleted files, the old nodes linger. Pass --force (or set GRAPHIFY_FORCE=1) to overwrite even when the rebuild has fewer nodes.

extract exits with "extraction was incomplete ... refusing to overwrite"
When an extraction pass crashes or a walk can't fully read the corpus, the run would be smaller than a complete one, so graphify extract refuses to overwrite a larger existing graph with the partial result (protecting your graph.json). Fix the underlying failure and re-run, or pass --allow-partial to overwrite anyway.

Graph has duplicate nodes for the same entity (ghost duplicates)
Ghost duplicates (same symbol appearing twice โ€” once from AST extraction with a source location, once from semantic extraction without) are now automatically merged at build time. If you see this in a graph built before v0.8.33, run a full re-extract to clean up:

bash
graphify extract . --force

Ollama runs out of VRAM / context window exceeded
The KV-cache window is auto-sized but may be too large for your GPU. Reduce it:

bash
GRAPHIFY_OLLAMA_NUM_CTX=8192 graphify extract ./docs --backend ollama --token-budget 4000

LLM returned invalid JSON / Unterminated string warnings
The model's JSON response hit its output-token limit and was cut off mid-string. graphify auto-recovers (it splits the chunk and re-extracts the halves, and an oversized single document is first sliced at heading/paragraph boundaries so the whole file is still covered), so these warnings are noisy but not data loss. To reduce the churn, raise the output cap or shrink each chunk's output:

bash
GRAPHIFY_MAX_OUTPUT_TOKENS=16384 graphify extract . --mode deep   # lift the cap
graphify extract . --mode deep --token-budget 4000                # smaller input chunks -> smaller output

With a cloud gateway like OpenRouter, prefer --backend openai (set OPENAI_BASE_URL) over the Ollama shim โ€” it's a cleaner OpenAI-compatible path. If the model has its own max-output ceiling, lowering --token-budget is the reliable lever.

Graph HTML is too large to open in a browser (>5000 nodes)
Skip HTML generation and use the JSON directly:

bash
graphify cluster-only ./my-project --no-viz
graphify query "..."

graph.json has conflict markers after two devs commit at once
Run graphify hook install โ€” it sets up a git merge driver that union-merges graph.json automatically so conflicts never happen.

Extraction returns empty nodes/edges for docs or PDFs
Docs, PDFs, and images require an LLM call โ€” code-only corpora need no key. Check that your API key is set and the backend is correct:

bash
ANTHROPIC_API_KEY=sk-... graphify extract ./docs --backend claude

Skill version mismatch warning in your IDE
Your installed graphify version is different from the skill file. Update:

bash
uv tool upgrade graphifyy
graphify install  # overwrites the skill file

Claude Code prompt cache invalidated after every graphify extract
Graphify writes output files (graph.json, graphify-out/) into the workspace. If those paths aren't ignored, every write invalidates Claude Code's prompt cache, forcing a full re-upload at cache-write rates on the next turn. Add them to .claudeignore:

text
# .claudeignore
graph.json
graphify-out/

Full command reference

text
/* Detailed source-code truncated for AI context efficiency. */

Community names: inside an agent (Claude Code, Gemini CLI) the agent names communities itself. When you run the bare CLI, cluster-only auto-names them with the configured backend (built-in or custom OpenAI-compatible provider) โ€” pass --no-label to keep Community N, or run graphify label to (re)generate names on demand.


Learn more


graphify Enterprise

graphify Enterprise is the always-on layer built on top of graphify โ€” it applies the same graph approach to your entire working context: meetings, files, docs, and code, updating continuously in the background.

Built for people and teams whose work lives across hundreds of conversations and documents they can never fully reconstruct.

Join the waitlist at graphify.com. Free trial launching soon.


Contributing

Development setup

The project uses uv for dev workflow. Install it once, then:

bash
git clone https://github.com/safishamsi/graphify.git
cd graphify
git checkout v8                        # active development branch

# Create the project venv and install graphify + all extras + the dev group
# (pytest). uv installs the dev dependency group by default; pass --no-dev to
# skip it.
uv sync --all-extras

Verify the editable install:

bash
uv run graphify --version
uv run python -c "import graphify; print(graphify.__file__)"

Running tests

bash
uv run pytest tests/ -q                # run the full suite
uv run pytest tests/test_extract.py -q # one module
uv run pytest tests/ -q -k "python"    # filter by name

CI parity checks

The authoritative CI commands live in .github/workflows/.
For local CI-style verification, use Python 3.10 or 3.12 and run:

bash
uv sync --all-extras --frozen
uv run --frozen pytest tests/ -q --tb=short
uv run --frozen python -m tools.skillgen --check
uv run --frozen python -m tools.skillgen --audit-coverage
uv run --frozen python -m tools.skillgen --schema-singleton
uv run --frozen python -m tools.skillgen --monolith-roundtrip
uv run --frozen python -m tools.skillgen --always-on-roundtrip
uv run --frozen graphify --help
uv run --frozen graphify install

Ruff is useful as an additional local check (uv run --frozen ruff check .),
but is not currently a blocking CI job. Pyright is also local/advisory unless it
is added to CI later. The Bandit and pip-audit CI steps currently use
continue-on-error, so their findings are advisory rather than blocking.

macOS note: the test suite includes both sample.f90 and sample.F90 fixtures. These collide on case-insensitive HFS+ / APFS file systems. Run on Linux or in a Docker container if you need to test both Fortran variants simultaneously.

Windows note: the native Windows test suite exercises symbolic links, long
paths, POSIX permissions, path separators, and UTF-8 filesystem behavior.
Enable Windows Developer Mode to allow unprivileged symbolic-link creation, or
run the tests from an elevated shell. Enable the Windows LongPathsEnabled
policy before relying on long-path tests. Restart affected shells or applications
after changing either setting. For exact parity with the blocking GitHub Actions
test matrix, run the suite in WSL or Linux; CI currently runs on Ubuntu with
Python 3.10 and 3.12. Pyright is available as a local advisory check, but it is
not currently a blocking CI job.

Git workflow

  • Active development happens on the v8 branch.
  • Commit style: fix: <description> / feat: <description> / docs: <description>
  • Before opening a PR, run uv run pytest tests/ -q and confirm it passes.
  • Add a fixture file to tests/fixtures/ and tests to tests/test_languages.py for any new language extractor.

What to contribute

Worked examples are the most useful contribution. Run /graphify on a real corpus, save the output to worked/{slug}/, write an honest review.md covering what the graph got right and wrong, and open a PR.

Extraction bugs โ€” open an issue with the input file, the cache entry (graphify-out/cache/), and what was missed or wrong.

See ARCHITECTURE.md for module responsibilities and how to add a language.



File: worked/mixed-corpus/README.md

Mixed Corpus Benchmark

A small mixed-input corpus: Python source files, a markdown paper with arXiv citations, and one image. Tests graphify on different file types in a single run.

Corpus (5 files)

text
raw/
โ”œโ”€โ”€ analyze.py          โ€” graph analysis module (god_nodes, surprising_connections)
โ”œโ”€โ”€ build.py            โ€” graph builder (build_from_json, NetworkX wrapper)
โ”œโ”€โ”€ cluster.py          โ€” Leiden community detection (cluster, score_all)
โ”œโ”€โ”€ attention_notes.md  โ€” Transformer paper notes (Vaswani et al., 2017) with arXiv citation

Note: the original benchmark included attention_arabic.png (an Arabic-language figure from the Attention paper). PNG files are not stored in this repo. To reproduce with the image, save any diagram from the Attention Is All You Need paper as raw/attention_arabic.png.

How to run

bash
pip install graphifyy

graphify install                        # Claude Code
graphify install --platform codex       # Codex
graphify install --platform opencode    # OpenCode
graphify install --platform claw        # OpenClaw

Then open your AI coding assistant in this directory and type:

text
/graphify ./raw

What to expect

  • ~20 nodes, ~19 edges from AST alone (3 Python modules)
  • 3 communities: Graph Analysis, Clustering and Scoring, Graph Building
  • God nodes: analyze.py, cluster.py, build.py
  • attention_notes.md classified as paper (arXiv heuristic fires on 1706.03762)
  • If you include the image: 1 extra node describing the figure content via vision
  • Token reduction: 5.4x

Actual output is in this folder: GRAPH_REPORT.md and graph.json. Full eval: review.md.


File: worked/karpathy-repos/README.md

Karpathy Repos Benchmark

This is the corpus that produced the 71.5x token reduction benchmark.

Corpus (52 files)

Code โ€” clone these 3 repos

bash
git clone https://github.com/karpathy/nanoGPT
git clone https://github.com/karpathy/minGPT
git clone https://github.com/karpathy/micrograd

Papers โ€” download these 5 PDFs

Images โ€” save these 4

  • gpt2_124M_loss.png โ€” nanoGPT training loss curve (in the nanoGPT repo)
  • gout.svg โ€” micrograd computation graph (in the micrograd repo)
  • moon_mlp.png โ€” MLP decision boundary (in the micrograd repo)
  • Any screenshot or diagram from the Attention Is All You Need paper

How to run

Put all files into a single folder called raw/:

text
raw/
โ”œโ”€โ”€ nanoGPT/
โ”œโ”€โ”€ minGPT/
โ”œโ”€โ”€ micrograd/
โ”œโ”€โ”€ attention.pdf
โ”œโ”€โ”€ flashattention.pdf
โ”œโ”€โ”€ flashattention2.pdf
โ”œโ”€โ”€ attn_residuals.pdf
โ”œโ”€โ”€ neuralwalker.pdf
โ”œโ”€โ”€ gpt2_124M_loss.png
โ”œโ”€โ”€ gout.svg
โ””โ”€โ”€ moon_mlp.png

Install and set up the skill for your platform:

bash
pip install graphifyy

graphify install                        # Claude Code
graphify install --platform codex       # Codex
graphify install --platform opencode    # OpenCode
graphify install --platform claw        # OpenClaw

Then open your AI coding assistant in this directory and type:

text
/graphify ./raw

What to expect

  • ~285 nodes, ~340 edges, ~17 meaningful communities
  • God nodes: Value (micrograd), GPT (nanoGPT), Training Script, Layer
  • Surprising connections: nanoGPT Block and minGPT Block linked across repos, FlashAttention paper bridging into CausalSelfAttention in both repos
  • Token reduction: 71.5x vs reading all 52 files directly

Actual output is in this folder: GRAPH_REPORT.md and graph.json. Full eval with scores: review.md.


File: worked/httpx/README.md

httpx Corpus Benchmark

A synthetic 6-file Python codebase modeled after httpx's architecture. Tests graphify on a realistic library with clean layering: exceptions โ†’ models โ†’ auth/transport โ†’ client.

Corpus (6 files)

text
raw/
โ”œโ”€โ”€ exceptions.py   โ€” HTTPError hierarchy
โ”œโ”€โ”€ models.py       โ€” URL, Headers, Cookies, Request, Response
โ”œโ”€โ”€ auth.py         โ€” BasicAuth, BearerAuth, DigestAuth, NetRCAuth
โ”œโ”€โ”€ utils.py        โ€” header normalization, query params, content-type parsing
โ”œโ”€โ”€ transport.py    โ€” ConnectionPool, HTTPTransport, AsyncHTTPTransport, MockTransport
โ””โ”€โ”€ client.py       โ€” Timeout, Limits, BaseClient, Client, AsyncClient

How to run

bash
pip install graphifyy

graphify install                        # Claude Code
graphify install --platform codex       # Codex
graphify install --platform opencode    # OpenCode
graphify install --platform claw        # OpenClaw

Then open your AI coding assistant in this directory and type:

text
/graphify ./raw

What to expect

  • 144 nodes, 330 edges, 6 communities
  • God nodes: Client, AsyncClient, Response, Request, BaseClient, HTTPTransport
  • Surprising connection: DigestAuth linked to Response โ€” auth.py reads Response to parse WWW-Authenticate headers
  • Token reduction: ~1x โ€” 6 files fits in a context window, so there is no compression win here

The graph value on a small corpus is structural, not compressive: you can see the full dependency graph, identify god nodes, and understand architecture at a glance. Token reduction scales with corpus size โ€” at 52 files (Karpathy benchmark) graphify achieves 71.5x.

Run graphify benchmark worked/httpx/graph.json to verify the numbers. Actual output is in this folder: GRAPH_REPORT.md and graph.json. Full eval: review.md.


File: worked/example/README.md

Reproducible Example

A small document pipeline (parser, validator, processor, storage, API) with architecture notes and research notes. Six files, two languages, clear call relationships between modules.

Run graphify on it and you get a knowledge graph showing how the modules connect, which functions call which, and how the architecture notes relate to the code.

Input files

text
raw/
โ”œโ”€โ”€ parser.py        reads files, detects format, kicks off the pipeline
โ”œโ”€โ”€ validator.py     schema checks, calls processor for text normalization
โ”œโ”€โ”€ processor.py     keyword extraction, cross-reference detection
โ”œโ”€โ”€ storage.py       persists everything, maintains the index
โ”œโ”€โ”€ api.py           HTTP handlers that orchestrate the above four modules
โ”œโ”€โ”€ architecture.md  design decisions and module responsibilities
โ””โ”€โ”€ notes.md         open questions and tradeoffs, written informally

How to run it

bash
pip install graphifyy && graphify install

Then open Claude Code in this directory and type:

text
/graphify ./raw

Takes under a minute. No PDF or image extraction, so it runs entirely on AST and markdown parsing with no token cost for semantic extraction.

What to expect

The graph should show:

  • api.py as a hub node connected to all four modules
  • parser.py calling validator.py and storage.py
  • validator.py calling processor.py for normalize_text
  • processor.py calling storage.py for load_index and save_processed
  • architecture.md and notes.md linked to the code modules they discuss

The community detection will likely cluster the four Python modules together and the two markdown files together, or split api.py into its own cluster given its high connectivity.

God nodes will be storage.py (everything reads and writes through it) and api.py (connects to everything at the top level).

After it runs

Ask questions in Claude Code and it answers from the graph:

  • "what calls storage directly?"
  • "what is the shortest path between parser and processor?"
  • "which module has the most connections?"
  • "what does the architecture doc say about the storage design?"

The graph lives in graphify-out/ and persists across sessions.