Command reference
This reference groups the public compass command surface by responsibility. Run compass <command --help for the exact options in the installed version; this…
Command reference
This reference groups the public compass command surface by responsibility.
Run compass <command> --help for the exact options in the installed version;
this page explains how the families fit together and which outputs are stable
for automation.
Global entry points
compass --help
compass --version
compass <command> --helpThe shipped product executable is compass; there is no legacy command
frontend or alias.
Build and analysis
init
Configure repository scope and perform the first structural build:
compass init [PATH]
[--include PATH_OR_GLOB]
[--exclude GLOB]
[--program]
[--store json|sqlite]
[--inference-level low|medium|high|max]
[--yes]
[--force]Includes and excludes are repeatable. Interactive mode previews the effective
corpus before writing .compass/config.toml; scripts must pass --yes.
Replacing an existing configuration requires --force. Init builds the
structural graph by default; pass --program when the initial workspace also
needs Program IR.
The initial build publishes JSON and a SQLite query snapshot by default. Pass
--store json when only the portable JSON artifact is wanted. The database
lives below the output root at store/store.sqlite3; the
snapshot contains only the small reference beside graph.json.
update
Make a saved current-tree graph match the project:
compass update [PATH]
[--program]
[--program-artifact PATH]
[--out DIR]
[--store json|sqlite]
[--inference-level low|medium|high|max]
[--no-program]
[--no-cluster]
[--force]
[--no-viz]
[--no-gitignore]
[--exclude PATTERN]
[--resolution N]
[--exclude-hubs N]Use for normal cold/incremental structural builds. The default publishes the
structural graph only; pass --program when Program IR inspection or graph
enrichment is needed. --no-program remains accepted as an explicit
structural-only compatibility flag. Supply a verified offline SCIP index with
repeatable --program-artifact (which also enables Program IR). For Java,
fresh exact symbol evidence can disambiguate AST-proven call sites in
graph.json; stale, unverified, conflicting, and non-call references are not
projected. --no-program conflicts with --program-artifact.
Graph storage defaults to sqlite; --store json opts out of the validated
local store sidecar without replacing graph.json. JSON remains the portable
authority, while the sidecar keeps large graphs queryable under bounded memory.
Inference defaults to low and publishes exact relationships only. Use
medium for source-backed inferred resolution, high to additionally retain
explicitly qualified external references, or explicit max to retain all
inferred relationships including deferred receivers.
extract
Expose the full build surface:
compass extract [PATH]
[--program]
[--program-artifact PATH]
[--no-program]
[--code-only]
[--cargo]
[--google-workspace]
[--postgres DSN]
[--backend NAME]
[--model MODEL]
[--mode deep]
[--token-budget N]
[--max-concurrency N]
[--max-workers N]
[--api-timeout SECONDS]
[--allow-partial]
[--dedup-llm]
[--timing]
[--out DIR]
[--store json|sqlite]
[--inference-level low|medium|high|max]
[--no-cluster]
[--force]
[--no-viz]
[--no-gitignore]
[--exclude PATTERN]
[--resolution N]
[--exclude-hubs N]Use --code-only for an explicit fully local structural profile; it limits
structural node and edge extraction to code-classified files while retaining
the scanned file inventory. Program IR is opt-in with --program;
--program-artifact also enables it. --no-program is retained for callers
that already use the structural-only spelling.
update, extract, and watch rebuilds may succeed with a warning that Compass
published a partial graph. The warning reports exact omitted node, omitted
edge, and identity-collision counts. The retained graph.json remains strictly
valid and queryable; record examples and the exact summary are in
graph.diagnostics. Document-level corruption, an unsafe inventory, no usable
nodes, serialization failure, and atomic publication failure still return a
nonzero exit.
watch
compass watch [PATH]
[--debounce SECONDS]
[--program]
[--program-artifact PATH]
[--no-program]
[--store json|sqlite]
[--inference-level low|medium|high|max]
[--out DIR]
[--no-cluster]
[--no-viz]
[--no-gitignore]
[--exclude PATTERN]
[--poll]
Watch builds omit Program IR by default. Pass `--program` or
`--program-artifact PATH` when the watcher should maintain the artifact.Long-running adaptive filesystem watcher. Compass synchronizes once at startup,
then coalesces native filesystem events with a 150 ms quiet window and a 750 ms
maximum delay. --debounce changes the quiet window; the maximum becomes five
times that value, capped at five seconds.
Only one build runs at a time. Changes received during a build queue one
follow-up, transient build failures retry with bounded backoff, and an idle
five-minute reconciliation catches missed events. Native watcher startup
automatically falls back to content-aware polling; --poll forces that backend.
A manual compass update remains the recovery oracle.
cluster-only
Recluster/analyze an existing graph or path:
compass cluster-only [PATH]
[--graph PATH]
[--no-viz]
[--no-label]
[--resolution N]
[--exclude-hubs N]
[--min-community-size=N]label
Generate/update semantic community labels:
compass label [PATH]
[--graph PATH]
[--backend NAME]
[--model NAME]
[--missing-only]
[--no-viz]
[--resolution N]
[--exclude-hubs N]
[--max-concurrency N]
[--batch-size N]
[--min-community-size=N]
[--timing]Read and query
query
Natural-language graph discovery:
compass query "<question>"
[--traverse]
[--dfs]
[--context VALUE]
[--direction auto|incoming|outgoing|both]
[--scope KIND:VALUE]
[--format text|json]
[--result-envelope]
[--text-budget N]
[--cursor TOKEN]
[--budget N]
[--page N]
[--max-nodes N]
[--max-edges N]
[--graph PATH | --at REV]Plain questions against a typed graph use bounded
compass.query.discovery/1 discovery. Direction, repeatable OR scope,
relationship context, and DFS compose within that contract. --result-envelope
requires --format json and opt-in wraps the unchanged discovery result in
compass.query.discovery-result/1 with a query-owned semanticResultDigest.
Without this flag, the existing JSON shape remains unchanged. --traverse,
--budget, or --page explicitly select legacy relevance traversal and cannot
be mixed with discovery controls. CompassQL routing is unchanged.
The default focused neighborhood is 64 nodes and 128 edges. Use
--max-nodes 500 --max-edges 1000 when a query intentionally needs the full
supported breadth; these remain hard ceilings rather than new defaults.
--context VALUE is a relationship filter for traversal evidence contexts such
as call, import, or route. It is not a node, file, package, community, or
subsystem selector. Use repeatable --scope KIND:VALUE for explicit OR scope
over community, source, package, or node.
--text-budget bounds the discovery text projection. Its opaque cursor binds
the contract version, normalized request/options, selected graph generation and
digest, semantic-response digest, and next stable section/item. Fetch the next
page with --cursor TOKEN and otherwise unchanged semantic inputs. The
presentation-only --text-budget may change between pages. Pages contain whole
deterministic entries; changed inputs fail instead of silently continuing a
different result. JSON rejects text pagination controls. Legacy --budget and
numeric --page retain their existing meaning only with legacy traversal.
Query seeds prefer source-backed declarations over unresolved external-symbol
placeholders with the same callable label. Source-less placeholder nodes retain
an explicit wiring=FILE:LOCATION site, and traversed relationships render
their occurrence as at=FILE:LOCATION; neither is presented as a declaration
location.
CompassQL:
compass query --cql QUERY
[--param NAME=VALUE]
[--format table|json|jsonl]
[--graph PATH | --at REV]
compass query --cql --file PATH
[--params-file PATH]
[--output PATH]
compass query --cql --stdin
compass query --cql --replLimits:
--timeout-ms N
--max-rows N
--max-path-depth N
--max-expanded-relationships N
--max-memory-bytes N--budget and --page apply only to natural-language query rendering. Page
CompassQL rows explicitly with a stable ORDER BY plus SKIP and LIMIT, for
example RETURN n.id ORDER BY n.id SKIP 100 LIMIT 100.
Canonical language contract: CompassQL.
path
compass path "<source>" "<target>" [--graph PATH | --at REV]Renders a shortest known graph path while preserving relationship direction.
If a route exists only by ignoring one or more edge directions, the typed response
reports direction_mismatch; swap the operands to request that route.
explain
compass explain "<node>"
[--budget N]
[--page N]
[--graph PATH | --at REV]Shows one node and incoming/outgoing connections. An exact node ID resolves directly. When a label names multiple source-backed declarations, Compass lists the candidates and their source ranges and asks for the full node ID instead of silently selecting one. Connection lines include the stored relationship site. Connections and ambiguous candidates use the same bounded, deterministic pagination contract as natural-language queries instead of silently cutting off after the first group.
affected
compass affected "<node-or-label>"
[--relation R]
[--depth N]
[--graph PATH]Traverses incoming impact-relevant relations.
context
compass context explain|modify|debug|test TARGET
[--graph PATH] [--program PATH] [--root PATH] [--memory PATH]
[--engine default|json|store] [--format text|json]
[--max-depth N] [--max-nodes N] [--max-edges N]
[--max-paths N] [--max-candidates N] [--max-source-bytes N]
[--max-knowledge-items N] [--max-response-bytes N]Emits compass.task-context/1 after exact target resolution. It composes
digest-verified source, exact calls, related tests, bounded impact, and
identity-linked reflection memory. Ambiguous and fuzzy-only targets retain
candidates but do not compose structural evidence.
tree
compass tree
[--graph PATH]
[--output HTML]
[--root PATH]
[--max-children N]
[--top-k-edges N]
[--label NAME]Defaults:
- graph:
compass-out/graph.json; - output:
compass-out/GRAPH_TREE.html; - max children: 200;
- top outbound edges: 12.
After a successful interactive HTML export, Compass asks whether to open the page in the default browser. The answer defaults to no. With redirected input or output, in pipes, and in CI, Compass neither prompts nor launches a browser.
benchmark
compass benchmark [GRAPH_JSON]Runs the native graph-query benchmark surface.
Versioned history and diffs
history
compass history enable [build-profile options]
compass history disable
compass history status [REV] [--format text|json]
compass history build REV [--all [--first-parent]] [build-profile options|--profile-from REV|REALIZATION] [--format text|json]
compass history rebuild REV [build-profile options] [--replace-corrupt] [--format text|json]
compass history list [REV] [--format text|json]
compass history show REALIZATION [--format text|json]
compass history prefer REV REALIZATION [--format text|json]
compass history export REV --format graph-json|compass-out --output PATH
compass history gc [--prune-non-preferred] [--yes] [--format text|json]history build REV --all resolves REV once, then builds every locally
reachable commit (including merged branches) in oldest-first topological order.
Add --first-parent to limit the batch to the ref's first-parent lineage.
The selected build profile is fixed for the whole batch. Validated preferred
realizations with that profile are skipped, so rerunning the command resumes
without rebuilding completed commits. Compass continues after individual
commit failures, emits a complete final report, and exits 1 if any failed.
compass history build main --all --code-only
compass history build main --all --first-parentBuild-profile options include:
--code-only
--backend NAME
--model NAME
--exclude PATTERN
--cargodiff
compass diff OLD NEW
[--format text|json|html]
[--output PATH]
[--limit N]
[--all]
[--explain FINDING_ID]
[--fingerprint SHA]The default output is an actionable PR-review summary: likely breaks, behavior
changes, affected callers/modules, and test evidence. Routine symbol churn is
collapsed; --limit N changes the visible per-section budget, while --all
expands routine findings and is exhaustive. --explain prints the evidence
and reasoning for one finding. Diff requires comparable build profiles;
rebuild the newer revision with --profile-from OLD when needed.
--format html requires --output PATH and writes a self-contained
interactive report containing the reviewer findings, unified/split source
diffs, the exact Git patch fallback, and meaningful code-graph changes.
--output is rejected for text and JSON; there is no alternate semantic-diff
export command.
review
compass review --base REV --head REV
[--repo OWNER/REPO] [--host HOST] [--pull-request-number N]
[--fingerprint SHA256]
[--format text|json|markdown|sarif]
[--readiness]
[--output PATH]
[--max-findings N --max-output-bytes N]
compass review --pr NUMBER --repo OWNER/REPO [--host HOST]
[--fingerprint SHA256]
[--format text|json|markdown|sarif]
[--output PATH]review emits the canonical compass.pr_intelligence.report/1 result or one
of its deterministic projections. Local mode resolves exact objects and never
fetches. --repo, --host, and --pull-request-number bind a frozen CI
identity without selecting the GitHub adapter. --pr selects bounded GitHub
metadata/file pagination through gh and requires those full objects locally.
The command creates or reuses comparable immutable graph realizations and
fails explicitly on profile mismatch. A clean candidate is analyzed at its
deterministic synthetic merge; a conflict uses the PR-head realization and
reports unavailable/indeterminate merge-dependent conclusions. --output
writes atomically. Markdown-only budgets report exact projection omissions.
Advisory risk and typed gate state do not change the CLI success code.
With --readiness, JSON or Markdown emits the additive
compass.pr-readiness/1 envelope referencing the unchanged report digest.
See PR Intelligence for schema, rubric, bounds, MCP, and gate semantics.
Service
serve
compass serve [GRAPH_PATH]
[--graph PATH]
[--transport stdio|http]
[--host HOST]
[--port PORT]
[--api-key KEY]
[--path PATH]
[--json-response]
[--stateless]
[--session-timeout SECONDS]Prefer stdio for a single local client. Avoid putting secret values directly in shell history; use the deployment's supported secret mechanism.
Export and visualization
export
Formats include:
html
json
workbench-json
callflow-html
obsidian
wiki
svg
graphml
cypher / graph database formats represented by current help
neo4j
falkordbEach format has its own exact flags:
compass export --help
compass export callflow-html --helpCommon inputs include --graph PATH, labels/report/sections, output directory,
node/diagram limits, and database connection arguments.
html, json, and workbench-json accept repeatable graph views. Compass
preserves their command-line order and puts them in one navigable workbench:
compass export html --code-graph --architecture-graph
compass export html --call-graph checkout --impact-graph checkout
compass export html --affected-graph checkout --relation calls --relation imports
compass export html --artifact-lens routes --artifact-lens data
compass export html --history-graph main~10..mainThe equivalent generic syntax is repeatable --view with code,
architecture, call:SYMBOL, impact:SYMBOL, affected:NODE,
history:OLD..NEW, or artifact:LENS. Call, impact, and affected views share
bounded --depth, --max-nodes, and --max-edges controls. --direction
applies to call views, --include-heuristic to impact views, repeatable
--relation to affected views, and --program PATH enriches call views with
Program IR evidence. Unsupported, misspelled, and format-incompatible options
fail instead of being ignored.
With no requested view, html contains a code-graph workbench and plain
json retains the existing compass.viewer.graph/1 response. Any requested
view makes json return compass.viewer.workbench/1; workbench-json always
returns that contract. --community remains a graph-only JSON operation and
cannot be combined with workbench views. --output PATH selects the HTML file.
For html and callflow-html, an interactive terminal asks before opening the
generated page in the default browser. Non-interactive commands never prompt or
launch a browser.
For database credentials, prefer supported environment variables over
--password.
tree
Listed under read/query; produces a filesystem/symbol HTML visualization.
Graph diagnostics and merge operations
diagnose
The diagnose command groups integrity checks for saved graph artifacts. Its
current public diagnostic is multigraph.
diagnose multigraph
compass diagnose multigraph
[--graph PATH]
[--json]
[--max-examples N]
[--directed | --undirected]
[--extract-path PATH]merge-graphs
compass merge-graphs graph1.json graph2.json [...]
[--out merged.json]Inputs must have compatible directed/multigraph semantics.
merge-driver
compass merge-driver BASE CURRENT OTHERLow-level managed integration surface for graph merge behavior.
cache-check
compass cache-check FILES_FROM
[--root DIR]
[--mode M | --deep]
[--prompt-file PATH]Checks whether cached semantic results can be reused for a file list, root,
mode, and prompt contract. Results are written visibly below the selected
output root as cached.json (when hits exist) and
uncached.txt.
merge-chunks
compass merge-chunks CHUNK_FILES... --out PATHValidates and combines semantic chunk files into one output artifact.
merge-semantic
compass merge-semantic
--cached PATH
--new PATH
--out PATHThese are pipeline helpers; use them when implementing or diagnosing semantic workflows.
Assistant and hook lifecycle
install
compass install
[--project | --user]
[--strict]
[--platform P ... | --all]
[--dry-run]
[--require-all]
[--format text|json]Run compass install --help for the version's platform list. --strict
requires a project-scoped Claude target. With no explicit platform, Compass
detects agents and also installs the portable Agent Skills package. Dry-run
output includes the complete skill and adapter path plan and performs read-only
preflight checks.
uninstall
compass uninstall
[--project]
[--purge]
[--platform P | P]Review targets before --purge.
upgrade
compass upgradeReads the bounded compass.release/1 static manifest from the latest stable
Compass release, downloads the exact immutable-tag archive for the current
platform, verifies its declared size, SHA-256 digest, and reported version,
then replaces the running executable. Release discovery does not use the
rate-limited GitHub REST API. If the installed version is current or newer,
the command exits successfully without changing it.
hook
compass hook [install|uninstall|status]hook-check
compass hook-checkManaged integration probe invoked by older Compass-generated integration
configuration. Current contextual integrations use hook-guard; people do not
normally invoke this command directly.
hook-guard
compass hook-guard [search|read [--strict]|gemini]Managed stdin/stdout adapter used by installed search, read, and Gemini integration hooks. Treat its input/output behavior as an internal integration contract unless a release explicitly documents it as a public automation API.
Providers and optional sources
provider
compass provider list
compass provider show NAME
compass provider add NAME
--base-url URL
--default-model MODEL
--env-key KEY_VARIABLE_NAME
[--pricing-input N]
[--pricing-output N]
compass provider remove NAMEBuilt-in provider names cannot be overridden.
add
compass add URL
[--author NAME]
[--contributor NAME]
[--dir ./raw]Remote ingestion changes the filesystem and network state.
clone
compass clone GITHUB_URL
[--branch BRANCH]
[--out DIR]Treat cloned content as untrusted.
Cross-project and collaboration
global
compass global add graph.json [--as REPO_TAG]
compass global remove REPO_TAG
compass global list
compass global pathprs
compass prs [NUMBER]
[--triage]
[--worktrees]
[--conflicts]
[--wrong-base]
[--base BRANCH]
[--repo OWNER/REPO]
[--graph PATH]GitHub/network credentials may be required.
Result memory and reflection
save-result
compass save-result
--question Q
(--answer A | --answer-file PATH)
[--type T]
[--nodes N1 N2 ...]
[--outcome useful|dead_end|corrected]
[--correction TEXT]
[--memory-dir DIR]reflect
compass reflect
[--memory-dir DIR]
[--out PATH]
[--graph PATH]
[--analysis PATH]
[--labels PATH]
[--half-life-days N]
[--min-corroboration N]
[--if-stale]check-update
compass check-update PATHManaged integration/update probe.
Input selection conventions
- Current read commands default to
compass-out/graph.json. --graph PATHselects a graph JSON.- Typed code-query commands (
search,callers,callees,impact,explore, andnode) usegraph.jsonby default. Their--engine default|json|storeoption selects the engine;defaultuses the validated SQLite sidecar when the build published one and otherwise falls back to JSON,jsonalways reads graph.json, andstorerequires the sidecar and fails closed when it is missing or corrupt. --at REVselects an exact historical graph for supported reads.--graphand--atare mutually exclusive.- Build
PATHdefaults are command-specific; run help before scripting. COMPASS_OUTcan change the default output root for several compatible command families; explicit--outis clearer in automation.
Store health and recovery
compass store status [OUTPUT] [--format text|json]
compass store validate [OUTPUT] [--format text|json]
compass store backup [OUTPUT] --output BACKUP_DIR [--format text|json]
compass store restore --from BACKUP_DIR --into OUTPUT [--format text|json]status is read-only and reports graph, shared SQLite store, selector, schema,
and digest state. validate requires a matching
store/store.sqlite3, the current snapshot, and that snapshot's store.ref;
a mismatch is an error, never an empty graph.
backup creates a new digest-bound directory after checkpointing SQLite.
restore validates that bundle and writes only to a new or empty destination.
The commands currently operate on the local SQLite adapter. The redb adapter is
library-only, and PostgreSQL/DynamoDB are future backends.
graph.json remains the complete portable authority. The default query engine
uses the validated SQLite sidecar when present; use --engine json to force
JSON or --engine store to require the sidecar. The explicit rebuild
runbook is scripts/rebuild_compass_store.sh;
the detailed operational workflow is in the
Operations guide.
IDE and graph-inspection commands
compass capabilities --format json
compass export json [--community ID]
compass export workbench-json [VIEW ...]
compass export html [VIEW ...]
compass export callflow-json --output PATH
compass program call-graph (--symbol SYMBOL | --source FILE --byte BYTE)
[--direction callers|callees|both] [--depth N] --format json
compass history timeline [--rev REV] [--limit N [--after CURSOR]] --format json
compass history change-counts REV [--parent REV] --format json
compass history diff OLD NEW [--root NAME] [--output PATH] --format jsonl
compass history export REV --format json [--community ID] [--node-limit N] --output PATHhistory timeline is inspection-only and defaults to all commits reachable
from local refs. --limit returns the newest bounded page, and --after uses
the preceding page's opaque nextCursor. A cursor rejects local-ref changes
instead of silently mixing snapshots. Responses include hasMore,
nextCursor, and totalEntries once the final page establishes the exact
count. history change-counts requires existing preferred realizations with
the same complete build profile and never builds them. Its bounded structural
counts exclude source-coordinate, clustering/layout, and anchor-derived edge
identity churn while preserving topology and relationship multiplicity.
history diff streams an exhaustive,
deterministic record-level diff for selected immutable roots. It may lazily
materialize a missing revision, requires identical complete build profiles and
compatible graph engines, refuses to overwrite --output, and bounds stdout
for safety. This is distinct from the ranked compass diff semantic-review
report. Guided writers accept --events jsonl; stdout then contains
compass.ide.progress/1 events and human diagnostics move to stderr.
json is the canonical versioned graph-presentation export. viewer-json
remains accepted as a deprecated compatibility alias.
Output and exit conventions
Human text goes to stdout on success. Diagnostics go to stderr.
History:
- success and read-only no-store status/list operations: exit
0; - usage: exit
2; - Git/provider/validation/corruption/storage: exit
1.
CompassQL:
- source/options/compile: exit
2; - graph loading: exit
3; - execution/limit/cancellation/output: exit
4.
Other command families preserve documented compatibility-specific codes. Test the exact command boundary your automation uses.
Related pages
Next step: run compass <command> --help for the command you will automate,
then pin its input, structured output, and exit expectations in an integration
test.
CompassQL support matrix
This matrix is the public compatibility boundary. “Supported” means native parsing, semantic validation, deterministic execution, and checked evidence.…
Compatibility and evolution
Compass is an independent native product. Its public behavior is defined by Compass documentation, native tests, and versioned Compass formats. It has no…