Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

11.9 KB
Raw Blame

Ix Command Reference

Use bounded, composable CLI commands — never broad queries. Run every command with the ix prefix from the repo root of the mapped workspace.

This file routes a goal to a command. For the complete flag surface of any command — every option, its accepted values and its default — see flags.md.

The examples carry no --format. Set it once instead of per call: IX_FORMAT=llm in the environment, or ix config set format llm. llm is the format to read — records, one per line, and on ix context roughly a ninth of the bytes of the same answer in json. Reach for --format json on the one call whose output you are going to parse. See output-formats.md.

High-Level Workflow Commands (prefer first)

These aggregate multiple graph operations into single bounded responses.

Goal Command Example
Blast radius / impact ix impact ix impact UserService
Hotspot discovery ix rank ix rank --by dependents --kind class --top 10
One-shot summary ix overview ix overview IngestionService
Deterministic context bundle ix context ix context IngestionService
Files to read for an issue, ranked ix context --from-issue ix context --from-issue issue.md --format llm
Scoped entity listing ix inventory ix inventory --kind function --path auth.py

Finding & Understanding Code

Goal Command Example
Find entity by name ix search ix search IngestionService --kind class --limit 10
Understand a symbol ix explain ix explain IngestionService
Read source code ix read ix read src/auth.py:10-50 or ix read verify_token
Full entity details ix entity ix entity <id>
Fast text search ix text ix text "verify_token" --language python --limit 20
Find symbol (graph+text) ix locate ix locate AuthProvider --kind class

Navigating Relationships

Goal Command Example
What calls a function ix callers ix callers verify_token
What a function calls ix callees ix callees processPayment
Members of a class ix contains ix contains IngestionService
What an entity imports ix imports ix imports auth_provider.py
What imports an entity ix imported-by ix imported-by AuthProvider
Dependency impact ix depends ix depends verify_token --depth 2
Who depends on the code at a line you are editing ix around ix around src/auth.py:120

ix around <path>[:<line>[-<end>]] names the definitions whose span covers the line (innermost first, at most 3; the file's most-called top-level definitions when no line is given) and, for each, its callers at their call sites, the importing files that use it (including uses the graph has no edge for, such as a function passed by name), and the tests that reach it within two caller hops. The graph's spans are re-anchored to the file on disk first, so a file edited since the last map is still read correctly. Output is held to --budget tokens (default 300); lists are cut, never their totals.

The same answer is pushed to Claude Code after edits by ix hook claude-post-edit (PostToolUse). It reads the working tree's diff against HEAD rather than the tool's arguments, so match Bash too -- agents often edit through scripts:

{"hooks":{"PostToolUse":[{"matcher":"Edit|MultiEdit|Write|Bash",
  "hooks":[{"type":"command","command":"ix hook claude-post-edit"}]}]}}

Each edited symbol is reported once per session; a call that changed nothing new prints nothing and costs one git call. It prints nothing and exits 0 whenever it cannot help. When the agent edits a different checkout from the mapped one, pass --graph-root <mapped> and --worktree <agent checkout>.

History, Diffs & Contradictions

Goal Command Example
Entity history ix history ix history <entityId>
Changes between revisions ix diff ix diff 1 5 --summary
Detect contradictions ix conflicts ix conflicts

Architecture Analysis

Goal Command Example
Detect code smells ix smells ix smells
Score subsystems ix subsystems ix subsystems --level 2
List smell claims ix smells --list ix smells --list
List subsystem scores ix subsystems --list ix subsystems --list

Ingestion & Health

Goal Command Example
Update graph + map ix map --silent ix map --silent
Ingest GitHub data ix ingest ix ingest --github owner/repo --limit 50
Backend health ix status ix status
System doctor ix doctor ix doctor
Is the graph actually right? (nodes vs a re-parse) ix verify ix verify --sample 20 or ix verify src/auth.py
Start backend ix docker start ix docker start
Graph statistics ix stats ix stats

Session Metrics

Goal Command Example
Token savings so far ix savings ix savings
Per-command breakdown ix savings --detail ix savings --detail
Clear lifetime totals ix savings reset ix savings reset

ix savings reports how many tokens the graph saved against a naive read-the-files baseline, in two scopes. Neither is per-terminal: the CLI sends a bare GET /v1/savings with no session id, so the backend has nothing to attribute a count to one shell with. session is an in-memory counter the backend process has accumulated since it started, shared by every client that talks to it; lifetime is the persisted total. So a fresh shell against a backend that has been up all day reads that day's traffic from every other shell as its "session". Each scope carries the command count, tokens_saved, the naive_tokens / actual_tokens it was derived from, and money and water estimates.

Flag Value Default Effect
--detail — off Add one record per command type, within each scope
--model <model> opus|sonnet|haiku|gpt-4o opus Pricing table for money_saved only — token and water figures do not change
--format <fmt> text|json|llm IX_FORMAT, else format in config, else text See output-formats.md

ix savings reset clears both scopes (DELETE /v1/savings, which runs session.set(empty) *> store.resetSavings). It takes no flags, does not prompt, and cannot be undone — there is no way to zero one scope and keep the other, despite the CLI's own "Reset lifetime savings totals" description.

--format llm emits one savings header record and one scope record per scope; --detail adds command records that name their scope:

savings model="Claude Opus ($15/MTok in, $75/MTok out)"
scope name=session commands=726 tokens_saved=832739 naive_tokens=1099164 actual_tokens=266425 money_saved=27.48 water_saved_ml=1665.478
command scope=session name=callers count=329 tokens_saved=334995
command scope=session name=entity count=308 tokens_saved=423741
scope name=lifetime commands=4820 tokens_saved=6142880 naive_tokens=8003104 actual_tokens=1860224 money_saved=202.72 water_saved_ml=12285.76
command scope=lifetime name=callers count=2104 tokens_saved=2210488

command records are emitted inside the scope loop, so each scope's breakdown follows its own scope record rather than being grouped at the end. (Truncated above: a real run emits one command record per entry in each breakdown.)

Reading a graph command's savings needs the backend up: the numbers come from GET /v1/savings, not from a local file.

Decomposition Recipes

"How does ingestion work?"

ix overview IngestionService    # start here
ix contains IngestionService    # more detail if needed
ix callees parseFile

"What depends on verify_token?"

ix impact verify_token          # one-shot answer
ix callers verify_token         # or manually
ix imported-by verify_token

"What are the most important classes?"

ix rank --by dependents --kind class --top 10

"List all functions in a file"

ix inventory --kind function --path auth.py

Best Practices

  • Always use --kind with ix search to get bounded results. A module-level constant is --kind constant, not function — that covers a const bound to an object, an array, a Set, a schema or a string literal in TS/JS, and a Rust const, a Scala val/var, and their Java, C#, and Swift equivalents.
  • Use ix inventory instead of ix search "" for listing entities by kind.
  • Use ix diff --summary for broad revision comparisons; --full only when every individual change is needed.
  • Always use --limit to cap result sets. Not on ix diff --summary or ix diff --full, though: each already fixes the volume, so --limit alongside either is refused rather than silently ignored.
  • Page callers, callees, imports, imported-by, contains, inventory and text with --offset, following the next: hint (or next_offset= in llm output). Keep --limit the same while paging. text pages stop at its 500-row scan window; past that, narrow with --path or --language. inventory lists newest first, so its pages are stable only between ingests. The server returns at most 1000 edges and 5000 inventory rows; past those caps the output stays truncated and says to narrow.
  • Use --path or --language to restrict text searches.
  • Reuse exact entity IDs from previous JSON results when chaining commands.
  • Decompose large questions into multiple targeted calls.

Gotchas (surprises that already bit us)

  • ix reset is GLOBAL, not workspace-scoped. ix reset → POST /v1/reset, and ix reset --code → POST /v1/reset/code; neither sends a workspace_id, so both wipe EVERY workspace's graph in the shared backend — the cwd only decides which mtime cache gets cleared. Running ix reset -y --code in one repo also destroys the graphs of every other mapped workspace (e.g. packwise) and empties the --all combined view; re-run ix map per workspace to rebuild. The workspace-scoped reset is ix reset --workspace (/v1/reset/workspace for the registered workspace containing cwd, nothing else); with --ingest it is the repair for a degraded graph.

  • The OSS↔Pro command boundary is derived at runtime, not declared. run-cli.ts (which main.ts loads) snapshots ossCmdNames immediately after registering the OSS commands; the Pro probe (tryLoadProCommands) then diffs whatever commands exist against that set to decide which count as "Pro". Consequences:

    • Adding a register*Command call in oss.ts silently reclassifies that command as OSS — it vanishes from the Pro help diff.
    • A new OSS command also needs an entry in OSS_COMMAND_TABLE (register/oss-table.ts): with Pro absent, run-cli.ts loads only the table's module for the command being run. Without the entry the command still works (it takes the full path), but startup-fast-path.test.ts fails until it is added. The shared per-command setup is in register/oss-setup.ts.
    • Removing one from oss.ts makes Pro own it, or — without the license — a Pro stub replaces it (stubs skip any name already registered, so an OSS command left in place blocks its stub).
    • registerProCommands is async (each Pro command is dynamically imported) and MUST be awaited; skipping the await makes every ix <pro-cmd> fail with "unknown command".
    • Real example: registerPatchesCommand was defined but never called in oss.ts, so a patches entry in PRO_COMMANDS (now in register/pro-stubs.ts) shadowed it and ix patches answered "requires Ix Pro" (#371). #390 wired the call in and dropped the stub, so ix patches is an OSS command today.

Do NOT Use

  • ix query — deprecated, produces oversized low-signal responses.
  • NLP-style free-text QA in a single command — decompose into targeted calls.