ivar graph
Graph commands — index, explore, callers, impact, affected tests, the viewer, the MCP server and its tools.
ivar graph indexes every repo in the hall into .ivar/graph.db and answers
structural questions about it. The Code graph guide 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
ivar graph indexIncrementally update or build the index.
| Option | Description |
|---|---|
--repo <REPO> | Index one repository; all declared repos if omitted |
--path <DIR> | Also index a hall-root directory (repeatable); saved to graph.paths in ivar.json and refreshed by later runs |
--full | Force a full reindex regardless of the last indexed commit |
--no-mcp | Do not declare the graph MCP server in ivar.json |
A bare ivar graph index also drops graph state the hall no longer has: repos
missing from ivar.json, layers of deleted features and watcher scopes with
nothing behind them. The outcome lists them under removed. --repo and
--path reconcile nothing.
stats
ivar graph statsRepositories, files, symbols, edges, database size, feature layers and hall paths.
clean
ivar graph clean --feature billing-currencyRemove indexed data.
| Option | Description |
|---|---|
--repo <REPO> | Remove one repository from the index |
--path <DIR> | Remove one hall directory from the index and from graph.paths |
--feature <FEATURE> | Remove one feature's layers |
--all | Remove all repositories and data |
Doctor findings
ivar doctor reports these graph findings; each names the command that fixes
it.
| Code | Meaning | Fix |
|---|---|---|
graph.repo_not_in_manifest | An indexed repo ivar.json no longer declares | ivar graph clean --repo <name> or ivar graph index |
graph.layer_orphaned | A layer of a feature that no longer exists | ivar graph index |
graph.watch_scope_orphaned | A watcher scope with no repo, feature or path behind it | ivar graph index |
graph.watch_scope_failed | A scope with a live target the watcher could not reindex | ivar graph index; a leader retries once the scope is watched again |
graph.repo_stale | A repo indexed behind its worktree HEAD | ivar graph index --repo <name> |
graph.hall_paths_unset | The hall has docs, brand or .ivar/skills with files and graph.paths is empty | ivar graph index --path <dir> lists the directory in graph.paths and indexes it |
graph.schema_mismatch | Database schema older or newer than the binary | ivar graph index or ivar upgrade |
graph.db_missing | The graph MCP server is registered but .ivar/graph.db is gone | ivar graph index |
graph.open_failed | .ivar/graph.db exists but cannot be opened | Remove it and run ivar graph index to rebuild it |
graph.watch_catchup_pending | A scope has changes no watcher indexed and no leader is running | ivar graph index, or start ivar graph mcp to catch up |
Query
explore
ivar graph explore renderInvoiceSymbol discovery, source, callers and impact in one answer.
| Argument / option | Description |
|---|---|
<QUERY> | Symbol name or query pattern |
--repo <REPO> | Limit to one repository |
find
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
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
ivar graph callees 42Outgoing calls from a symbol. <SYMBOL_ID> is the symbol's row ID, as --json
output from other queries reports it.
file
ivar graph file api src/billing.tsOutline of one file: every symbol it defines. Takes <REPO> and <PATH>.
impact
ivar graph impact 42 --max-depth 3Transitive blast radius of a symbol, by <SYMBOL_ID>.
| Option | Description |
|---|---|
--max-depth <MAX_DEPTH> | Maximum traversal depth |
affected
git diff --name-only | ivar graph affected --stdinTest 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
ivar graph path checkout formatAmount --max-hops 6Shortest path between two symbols or files, <FROM> and <TO>.
| Option | Description |
|---|---|
--max-hops <MAX_HOPS> | Maximum traversal hops |
hierarchy
ivar graph hierarchy ProviderClass, struct and trait inheritance or implementation for <SYMBOL>. Takes
--repo <REPO>.
dead-code
ivar graph dead-code --limit 50Unreferenced private symbols. Takes --repo <REPO> and --limit <LIMIT>.
complexity
ivar graph complexity --threshold 15Functions 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
ivar graph view --repo api --depth 2Interactive 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
ivar graph viz --output graph.htmlWrite 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
ivar graph mcp --tools allServes the code graph and the hall memory over MCP on
stdio, as the server ivar. Your provider sees it as <hall>-ivar.
| Option | Description |
|---|---|
--tools <TOOLS> | explore (default) advertises graph_explore, graph_feedback and the eighteen memory tools, 20 in all; all adds every graph tool below, 30 in all |
Earlier versions registered the server as graph. ivar doctor reports
mcp.legacy_name when ivar.json still has a graph entry that runs
ivar graph mcp, and
mcp.provider_config_stale when a provider file still has <hall>-graph.
ivar sync fixes both.
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 |
graph_feedback | Records a feedback miss with the query asked and why the answer did not help; ivar graph misses lists it |
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 |
Related memory. When durable memory pages are anchored to the files or
primary symbols of an answer, graph_explore ends with up to 3 of them (path,
kind, title), ordered by matching anchors, then tier. It is the first part
dropped when the answer exceeds its byte budget; the answer then carries a
memory_query continuation instead.