# ivar graph
> Graph commands — index, explore, callers, impact, affected tests, the viewer, the MCP server and its tools.
Source: https://ivar.run/docs/reference/graph

`ivar graph` indexes every repo in the hall into `.ivar/memory.db` and answers
structural questions about it. The [Code graph guide](/docs/guide/graph) covers
how indexing and feature layers work.

Every subcommand accepts the global options:

| Option | Description |
| --- | --- |
| `--json` | Emit machine-readable output |
| `--compact` | Token-optimized pipe-delimited records with a schema header |
| `--color <COLOR>` | `auto` (default), `always` or `never` |

## Index

### index

```sh
ivar graph index
```

Incrementally update or build the index.

| Option | Description |
| --- | --- |
| `--repo <REPO>` | Index one repository; all declared repos if omitted |
| `--full` | Force a full reindex regardless of the last indexed commit |
| `--no-mcp` | Do not declare the graph MCP server in `ivar.json` |

### stats

```sh
ivar graph stats
```

Repositories, files, symbols, edges and database size.

### clean

```sh
ivar graph clean --feature billing-currency
```

Remove indexed data.

| Option | Description |
| --- | --- |
| `--repo <REPO>` | Remove one repository from the index |
| `--feature <FEATURE>` | Remove one feature's layers |
| `--all` | Remove all repositories and data |

## Query

### explore

```sh
ivar graph explore renderInvoice
```

Symbol discovery, source, callers and impact in one answer.

| Argument / option | Description |
| --- | --- |
| `<QUERY>` | Symbol name or query pattern |
| `--repo <REPO>` | Limit to one repository |

### find

```sh
ivar graph find Invoice --limit 20
```

| Argument / option | Description |
| --- | --- |
| `<QUERY>` | Symbol name pattern |
| `--repo <REPO>` | Restrict to one repository |
| `--limit <LIMIT>` | Maximum matching symbols |

### callers

```sh
ivar graph callers formatAmount --cross-repo
```

| Argument / option | Description |
| --- | --- |
| `<SYMBOL>` | Symbol name |
| `--repo <REPO>` | Restrict to one repository |
| `--cross-repo` | Include callers in other repositories |
| `--min-confidence <MIN_CONFIDENCE>` | Minimum edge confidence, 0.0 to 1.0 |

### callees

```sh
ivar graph callees 42
```

Outgoing calls from a symbol. `<SYMBOL_ID>` is the symbol's row ID, as `--json`
output from other queries reports it.

### file

```sh
ivar graph file api src/billing.ts
```

Outline of one file: every symbol it defines. Takes `<REPO>` and `<PATH>`.

### impact

```sh
ivar graph impact 42 --max-depth 3
```

Transitive blast radius of a symbol, by `<SYMBOL_ID>`.

| Option | Description |
| --- | --- |
| `--max-depth <MAX_DEPTH>` | Maximum traversal depth |

### affected

```sh
git diff --name-only | ivar graph affected --stdin
```

Test files that transitively depend on the changed files.

| Argument / option | Description |
| --- | --- |
| `[FILES]...` | Changed file paths |
| `--stdin` | Read paths from stdin, one per line |
| `--repo <REPO>` | Restrict to one repository |
| `--max-depth <MAX_DEPTH>` | Maximum search depth |

### path

```sh
ivar graph path checkout formatAmount --max-hops 6
```

Shortest path between two symbols or files, `<FROM>` and `<TO>`.

| Option | Description |
| --- | --- |
| `--max-hops <MAX_HOPS>` | Maximum traversal hops |

### hierarchy

```sh
ivar graph hierarchy Provider
```

Class, struct and trait inheritance or implementation for `<SYMBOL>`. Takes
`--repo <REPO>`.

### dead-code

```sh
ivar graph dead-code --limit 50
```

Unreferenced private symbols. Takes `--repo <REPO>` and `--limit <LIMIT>`.

### complexity

```sh
ivar graph complexity --threshold 15
```

Functions and methods ranked by cyclomatic complexity.

| Option | Description |
| --- | --- |
| `--threshold <THRESHOLD>` | Minimum complexity, default `10` |
| `--repo <REPO>` | Limit to one repository |
| `--limit <LIMIT>` | Maximum items |

## Visualise

### view

```sh
ivar graph view --repo api --depth 2
```

Interactive viewer served on a loopback port.

| Option | Description |
| --- | --- |
| `--repo <REPO>` | Focus on a repository |
| `--symbol <SYMBOL>` | Focus on a symbol |
| `--file <FILE>` | Focus on a file path |
| `--impact <IMPACT>` | Focus on the transitive impact of a symbol |
| `--depth <DEPTH>` | Neighborhood depth, 1 to 2 |
| `--limit <LIMIT>` | Nodes loaded initially, 1 to 500 |
| `--no-open` | Do not open the browser |
| `--port <PORT>` | Port to listen on; an ephemeral port if omitted |

### viz

```sh
ivar graph viz --output graph.html
```

Write a standalone HTML visualizer with no dependencies.

| Option | Description |
| --- | --- |
| `-o`, `--output <OUTPUT>` | Output path, default `graph.html` |
| `--repo <REPO>` | Limit to one repository |

## MCP server

```sh
ivar graph mcp --tools all
```

Serves the graph over MCP on stdio.

| Option | Description |
| --- | --- |
| `--tools <TOOLS>` | `explore` (default) advertises only `graph_explore`; `all` advertises every tool |

### MCP tools

| Tool | What it returns |
| --- | --- |
| `graph_explore` | Line-numbered source of the relevant files, who depends on them, and the call path between named symbols. Takes `query`, `paths`, `repo`, `format` |
| `get_callers` | Every call site and type use of a symbol across repos, where it is defined, and which files import it |
| `get_callees` | Every outgoing call a symbol makes |
| `get_file_outline` | Symbols and imports declared in one file, with line numbers |
| `get_affected_tests` | Test files transitively reachable from changed source files |
| `get_path` | Shortest call or import chain between two symbols |
| `get_impact` | Everything transitively affected by changing a symbol |
| `refresh_index` | Force a reindex now; rarely needed while a watcher leader is running |
| `get_dead_code` | Unreferenced private symbols |
| `get_complexity` | Functions ranked by cyclomatic complexity |
| `get_hierarchy` | Inheritance and implementation hierarchy of a symbol |
