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

# Plan a refactor with code impact analysis

> Run code impact analysis before a refactor: list every caller of a function, trace paths between modules, and find the tests to run, with Graphify.

Code impact analysis tells you what a change reaches before you make it. With Graphify you list the callers of a function, trace how two modules connect, and find the tests that touch it, all from one graph. This recipe plans a change to `_rebuild_code()` in the open-source [Graphify-Labs/graphify](https://github.com/Graphify-Labs/graphify) repository.

## What you'll build

* A list of every direct caller of the function you plan to change.
* The call path between two parts of the code.
* A short list of tests to run, taken from the graph.
* A rebuilt graph after the change, to confirm the impact.

## Setup

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
uv tool install graphifyy
git clone https://github.com/Graphify-Labs/graphify && cd graphify
graphify extract . --code-only
```

If you followed [Onboard to a codebase](https://docs.graphify.com/cookbooks/onboard-to-a-codebase.md), you already have the graph.

## Step 1: Check how central the target is

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify explain "_rebuild_code()"
```

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
Node: _rebuild_code()
  Source:    graphify/watch.py L1926
  Degree:    273
```

A degree of 273 means a lot of code touches this function. Plan for a careful change.

## Step 2: List what the change affects

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify affected "_rebuild_code()" --depth 1
```

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
Affected nodes for _rebuild_code()
Depth: 1
- dispatch_command() [calls] graphify/cli.py:L2894
- watch() [calls] graphify/watch.py:L3218
- test_update_writes_one_compact_line() [calls] tests/test_compact_graph_json.py:L78
- test_resolution_survives_incremental_rebuild() [calls] tests/test_elixir_import_resolution.py:L234
```

`affected` walks edges backwards: calls, imports, inheritance and similar relations. `--depth 1` gives direct callers. Raise it to see callers of callers. The test functions in the list are the tests to run first.

## Step 3: Trace how two modules connect

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify path "graphify/cli.py::dispatch_command()" "graphify/cluster.py::cluster()"
```

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
Shortest path (1 hops):
  dispatch_command() --calls [EXTRACTED]--> cluster()
```

Use `path` when you want to know whether a change in one area can reach another. If no directed path exists, add `--undirected` to find any connection.

## Step 4: See the community around it

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify query "what depends on _rebuild_code" --budget 1500
```

Each node in the answer carries its community. Code in the same community moves together. Code in a different community that still calls your function is where surprises live, so check those callers by hand.

## Step 5: Make the change, then rebuild

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify update .
graphify affected "_rebuild_code()" --depth 1
```

`update` re-extracts changed code without an API cost. Compare the new list with the one from Step 2. A caller that vanished or appeared is worth a second look in review.

## When it goes wrong

**`path` exits with code 3 and prints candidates.** The name matched more than one node. Copy one of the `path::symbol` candidates it prints.

**`affected` prints "No unique node match" and exits 0.** The label didn't match. Check the exact label with `graphify explain` or `graphify query`. Because the exit code is 0, a script won't fail on it, so check the output.

**A caller you know about is missing.** Impact results list direct connections the parser can see. Code called dynamically, through reflection, or by string name may not appear. Always run your test suite.

## Production patterns

* Paste the `affected` output into the pull request description so reviewers see the planned blast radius.
* Run the impact check in CI with [Graph impact comment on every PR](https://docs.graphify.com/cookbooks/pr-impact-comment-ci.md).
* In Graphify, the hosted product, ask your agent "what breaks if I change `_rebuild_code`?". The hosted MCP answers with the `graphify_impact` and `graphify_tests_for` tools.

## Complete example

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
graphify extract . --code-only
graphify explain "_rebuild_code()"
graphify affected "_rebuild_code()" --depth 1
graphify path "graphify/cli.py::dispatch_command()" "graphify/cluster.py::cluster()"
graphify query "what depends on _rebuild_code" --budget 1500
# make your change
graphify update .
graphify affected "_rebuild_code()" --depth 1
```

## What you built

You have a refactor plan backed by the graph: the callers, the paths between modules, the tests to run, and a before-and-after check.

## Next steps

> **[Check impact](https://docs.graphify.com/concepts/check-impact.md)**
>
> How Graphify works out what a change reaches.

> **[Review PRs as a team](https://docs.graphify.com/cookbooks/review-as-a-team.md)**
>
> Check the finished refactor against the same graph.

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