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

# Keep docs in sync with code using git hooks

> Keep docs in sync with code: rebuild the Graphify graph on every commit with git hooks or watch mode, then regenerate a code wiki that never goes stale.

To keep docs in sync with code, generate the structural part of them from the code, and regenerate it whenever the code changes. Graphify rebuilds its graph on each commit through git hooks, or on each save with `graphify watch`, and `graphify export wiki` turns that graph into Markdown. Hand-written guides stay hand-written. The map of what calls what never drifts.

## What you'll build

* Git hooks that rebuild the graph after commits, checkouts, merges and rebases.
* A watch process for live rebuilds while you code.
* A generated wiki in `graphify-out/wiki/` you can publish or read in your editor.
* A freshness check that tells you when a graph is stale.

## Setup

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

## Step 1: Install the git hooks

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify hook install
graphify hook status
```

This installs `post-commit`, `post-checkout`, `post-merge` and `post-rewrite` hooks. Each runs a code-only rebuild, so no API key is needed. The same command registers a merge driver for `graphify-out/graph.json`, covered in [Shared team graph](https://docs.graphify.com/cookbooks/shared-team-graph.md).

Make a commit and check the report's freshness line:

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
## Graph Freshness
- Built from commit: `0a8cd4e1`
```

The commit should match `git rev-parse HEAD`.

## Step 2: Rebuild on save with watch

When you want the graph to follow you between commits, install the `watch` extra and run watch:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
uv tool install "graphifyy[watch]"
graphify watch .
```

Watch rebuilds the graph when code files change. Each rebuild ends with:

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
[graphify watch] graph.json, graph.html and GRAPH_REPORT.md updated in graphify-out
```

Use hooks or watch, not both, on the same checkout. Hooks suit most people. Watch suits long refactors where you query the graph between saves.

## Step 3: Generate the wiki

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

This writes one Markdown article per community, plus `graphify-out/wiki/index.md`. On the open-source Graphify repository it wrote 904 articles. Each article lists the community's key members, how many connections each has, and its source file.

The hooks rebuild the graph in a background process, so the commit returns at once. Don't chain the wiki export onto the hook, because it can run before the rebuild finishes. Regenerate the wiki when you need it, or in CI (see Production patterns).

## Step 4: Name the communities (optional)

Without an LLM, communities are numbered. To give them readable names, run `graphify label` with a model configured. It reruns clustering and always generates names:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export ANTHROPIC_API_KEY=...   # or another supported backend
graphify label .
graphify export wiki
```

Labels cost tokens, so run this on a schedule rather than on every commit.

## When it goes wrong

**The hook didn't run.** Run `graphify hook status`. If your repository uses a hooks manager such as Husky or `core.hooksPath`, the hooks may live in a different folder. Check where git looks with `git config core.hooksPath`.

**Docs and diagrams changed but the graph didn't.** `update` and the hooks re-extract code only. For Markdown, PDFs and images, run `/graphify --update` in your AI assistant.

**The wiki is huge.** Large repositories produce hundreds of articles. Publish `index.md` and the communities that hold your [god nodes](https://docs.graphify.com/cookbooks/onboard-to-a-codebase.md), not all of them.

## Production patterns

* Don't hand-edit generated articles. Link to them from your guides instead.
* Rebuild the wiki in CI on the default branch so the published copy matches what shipped.
* In Graphify, the hosted product, the wiki is built for each connected repository and stays current as you push. See [Wiki](https://docs.graphify.com/platform/wiki.md).

## Complete example

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify extract . --code-only
graphify hook install
git commit --allow-empty -m "test graph hook"
graphify hook status
# after the background rebuild finishes:
graphify export wiki
```

## What you built

Your graph and wiki now rebuild themselves from the code. Docs that describe structure can't fall behind, because they come from the same commit.

## Next steps

> **[Keep the graph current](https://docs.graphify.com/guides/incremental-updates.md)**
>
> How update, watch and hooks rebuild the graph.

> **[Shared team graph](https://docs.graphify.com/cookbooks/shared-team-graph.md)**
>
> Commit the graph and merge it cleanly across branches.

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