Reference

Command Reference

The five core verbs that cover ~80% of agent workflows, plus the most-used commands grouped by intent. Every command is local, credential-free, and emits a structured envelope an agent can read. Run roam --help for the full surface; roam <cmd> --help for any command's flags.

Every command supports --json for machine output and (where applicable) --sarif for CI Code Scanning. Verdicts use VERDICT: first-line convention.

How to read this reference

The command surface is organised around the nine engineering senses agents miss (see homepage), plus five tiers of approachability. Most users start with Tier 1.

TierWhat it coversWhen to reach for it
Tier 1 — Core workflowunderstand · retrieve · context · preflight · critique (plus one-time init)First-day, every-day. Five core verbs cover ~80% of agent workflows; init is run once per repo.
Tier 2 — High-value practicalimpact · affected-tests · test-gaps · safe-delete · clones · pr-risk · verify-imports · math / algoWhen you're acting on real changes, not just exploring.
Tier 3 — Agent / MCPmcp · mcp-setup · agent-export · skill-generate · minimap · agent-contextWiring Roam into Claude Code, Cursor, Codex, your own agent.
Tier 4 — CI / enterprisepr-analyze · pr-comment-render · attest · audit-trail-export · audit-trail-verify · --sarifProduction CI gates, audit evidence, signed attestations.
Tier 5 — Advanced / experimentalSpecialised commands for specific workflows (catalogued below).You know what you're looking for; the surface is exhaustive.

Tier 1 — The 5 Core Verbs

These are the "start here" commands. Most agents need only these.

VerbWhat it doesExample
understand Landing-pad summary of the codebase: layers, sizes, hotspots, entry points. roam understand
retrieve Free-form natural-language task → budget-bounded ranked spans (graph-aware FTS5 + rerank). roam retrieve "where is auth?"
context Files + line ranges to read before changing a symbol, prioritised by callers and tests. roam context AuthService
preflight Blast radius, affected tests, complexity, fitness rules — all in one verdict. roam preflight AuthService
critique Patch verifier. Pipe a diff in; get clones-not-edited + blast-radius severity. Exits 5 on high-severity findings. git diff | roam critique

Exploration

CommandWhat it does
roam search <pattern>FTS5 symbol search (BM25-ranked, qname-aware)
roam symbol <name>Show symbol definition, callers, and callees
roam file <path>Detailed file info: complexity, ownership, recent changes
roam impact <name>Caller list — what breaks if you change this symbol
roam trace <a> <b>k-shortest paths between two symbols in the call graph
roam tourWalk through the most architecturally-central symbols
roam diagnose <name>Root-cause ranking for a failing symbol
roam ask "<question>"Natural-language intent dispatch over the recipe registry

Health & Quality

CommandWhat it does
roam healthComposite health score (0-100) with risk breakdown
roam health --gateSame, but exits non-zero on threshold breach
roam complexitySonarSource-compatible cognitive complexity per symbol
roam debtTech-debt aggregate; --roi ranks refactor candidates
roam check-rulesRun all built-in + community rule packs
roam test-gapsSymbols that no test covers; --changed for diff scope
roam why-slowRuntime hotspots from ingested traces

Refactoring

CommandWhat it does
roam suggest-refactoringTop-N refactor candidates by ROI
roam plan-refactor <name>Step-by-step plan to refactor without breaking callers
roam mutate move <sym> <file>Apply a structural transform with import rewriting
roam simulate move <sym> <file>What-if architecture — clone the graph and apply a move
roam clones --persistDetect AST-level clones; persist to clone_pairs for critique
roam migration-planCurrent architecture → target architecture roadmap
roam stale-refs [--gate] [--fix preview|apply] [--attest path]Find dangling file references — markdown links / HTML href-src / backtick paths / anchors whose target is missing. Index-free. Supports SARIF, in-toto attestations, LSP code actions, repo-config (--init), and --root for monorepos.

Security & Governance

CommandWhat it does
roam taintGraph-reach BFS for vulnerability reachability (OpenVEX-correct)
roam vuln-reachMap a CVE to reachable code paths
roam adversarialAttack-surface review per symbol
roam cga emitSign an in-toto v1 Code Graph Attestation
roam cga verifyVerify a CGA attestation (cosign-aware)
roam attestSLSA-style provenance for the index itself

Multi-Agent & MCP

CommandWhat it does
roam mcpStart the MCP server (stdio transport)
roam mcp --list-toolsPrint every MCP tool exposed by the active preset (default: 57 core tools plus the roam_expand_toolset meta-tool; 227 in full)
roam mcp-setup <client>Generate config for Claude Code, Cursor, Gemini, Codex
roam fleet planPartition work across N agents (Louvain + co-change + PageRank)
roam orchestrateMulti-agent coordination plan with conflict-aware partitions
roam skill-generateEmit a SKILL.md file from the Capability Registry

Output Modes

Every command supports these flags at the top level (before the subcommand):

FlagEffect
--jsonStable JSON envelope with schema versioning. For agent + script consumption.
--sarifSARIF 2.1.0 — for GitHub Code Scanning. Supported on SARIF-capable analysis commands including health, complexity, dead, smells, clones, vulns, taint, secrets, n1, dark-matter, supply-chain, critique, stale-refs. Run roam --help for the live list.
--agentCompact JSON + 500-token default budget. Optimised for sub-agent CLI calls.
--budget <n>Cap output to N tokens (0 = unlimited).

Where to find more

See it run: The 5-minute canonical demo — install → health → preflight → critique → signed ChangeEvidence packet, end to end.

Complete Reference

Auto-generated from roam --help. Every canonical command + alias.

Getting Started

CommandDescription
roam askRun the recipe that matches a free-form query.
roam workflowInspect a workflow recipe DAG, review lenses, and next co...
roam indexBuild or rebuild the codebase index.
roam index-exportExport the roam index as a portable, integrity-checked ta...
roam index-importImport a portable roam index bundle into the current repo.
roam watchWatch for file changes and auto-re-index incrementally.
roam initInitialize Roam for this project: index + config.
roam hooksManage git hook integration for automatic re-indexing.
roam resetDelete the index DB and rebuild from scratch.
roam cleanRemove orphaned entries from the index (files no longer o...
roam configManage per-project roam configuration (.roam/config.json).
roam doctorDiagnose environment setup: Python, dependencies, and ind...
roam understandSingle-call codebase comprehension — everything in one shot.
roam dashboardUnified codebase status: health, hotspots, debt, bus fact...
roam tourGenerate a codebase onboarding tour.
roam describeAuto-generate a project description for AI coding agents.
roam minimapGenerate a compact codebase minimap for CLAUDE.md injection.
roam agent-exportGenerate an AI agent context file from the roam index.
roam wsManage multi-repo workspaces with cross-repo dependency t...
roam schemaShow the roam JSON envelope schema and validate output fi...
roam mcpStart the roam MCP server.
roam mcp-setupGenerate MCP server config for AI coding platforms.
roam mcp-statusReport MCP server status: preset, tools, backpressure, ca...
roam ci-setupGenerate CI/CD pipeline config for roam-code integration.
roam adrsDiscover Architecture Decision Records and link them to c...
roam auditOne-shot codebase architecture audit.
roam changelogList commits since the last tag, optionally as a markdown...
roam exit-codesList every roam exit code with its meaning.
roam help-searchFuzzy search across every command's help text.
roam pluginsList discovered roam plugins (commands, detectors, langua...
roam pre-commitInstall or preview a roam-critique pre-commit git hook.
roam recipesList every ``roam ask`` recipe with intent + example quer...
roam versionPrint the installed roam-code version (and check PyPI wit...
roam index-statsReport .roam index size, row counts, and fragmentation.
roam statsAggregate metrics: language, role, kind counts + recent a...
roam telemetryShow local telemetry: slowest commands + recent runs.
roam surfacePrint the canonical capability surface (commands, aliases...
roam explain-commandShow what a command does, what it depends on, and how sta...
roam db-checkIntegrity sweep over the local index. Reports orphans, br...

Daily Workflow

CommandDescription
roam preflightRun a pre-change safety checklist for a symbol, file, or ...
roam permitStructural-permission verdict facade for AI agents.
roam postmortemReplay current detectors against past commits.
roam pr-replayGenerate a PR Replay report.
roam guardCheck breaking-change risk for a symbol before editing.
roam agent-planDecompose partitions into dependency-ordered multi-agent ...
roam agent-contextGenerate per-worker context: write scope, read-only deps,...
roam pr-riskCompute risk score for pending changes.
roam pr-prepOne-shot pre-PR fitness check: diff + critique + pr-risk.
roam pr-analyzeAnalyse a PR diff for structural risk and AI-likelihood.
roam pr-bundleBuild a proof-carrying PR bundle (intent + context + affected symbols + risks + tests + non-goals). --auto-collect folds in envelopes from prior roam runs. CI-gateable via validate.
roam pr-comment-renderRender a markdown PR comment from a pr-analyze envelope.
roam rules-validateLint a `.roam/rules.yml` file before shipping it to your ...
roam metrics-pushPush metrics-only summary to Roam Cloud Lite.
roam audit-trail-verifyVerify SHA-256 chain integrity of a roam audit trail.
roam audit-trail-exportExport the audit trail for procurement / compliance review.
roam audit-trail-conformance-checkScore the audit trail against an EU AI Act Article 12 che...
roam article-12-checkEU AI Act Article 12 readiness assessment for the indexed...
roam capabilitiesEmit the capability registry — every command's machine-re...
roam skill-generateGenerate an agent-runtime skill manifest from the capabil...
roam compareStructural diff between two roam indices.
roam migration-planGenerate an ordered migration plan with risk + blast-radi...
roam dogfoodRun the v2 stack on the current repo and emit one combine...
roam dogfood-aggregateAggregate the dogfood eval corpus into a backlog/triage v...
roam suppressSuppress a math / over-fetch / missing-index / auth-gaps ...
roam pr-diffShow structural impact of pending changes.
roam evidence-diffDiff two ChangeEvidence packets.
roam evidence-doctorDiagnose a ChangeEvidence packet's health.
roam evidence-oscalEmit an OSCAL v1.2 document (Control Mapping or Assessment Results).
roam api-changesDetect breaking and non-breaking API changes vs a git ref.
roam semantic-diffShow structural change summary vs a git ref.
roam test-gapsMap changed symbols to missing test coverage.
roam affectedIdentify affected files/modules from a git diff via depen...
roam attestGenerate a proof-carrying PR attestation.
roam adversarialAdversarial architecture review -- challenge your changes.
roam verifyVerify changed files follow codebase conventions.
roam verify-importsValidate import/require statements against the indexed sy...
roam diffShow blast radius: what code is affected by your changes.
roam contextGet the minimal context needed to safely modify a symbol.
roam hoverShow a one-line architectural summary for SYMBOL.
roam retrieveReturn ranked code spans for a free-form task.
roam critiqueVerify a patch against the indexed graph.
roam fleetGraph-aware planner for multi-agent code work.
roam affected-testsTrace from a changed symbol or file to test files that ex...
roam test-impactList tests transitively reachable from symbols changed in...
roam diagnoseRoot cause analysis for a failing symbol.
roam why-failFind recently-changed symbols transitively reached by a f...
roam recommendRecommend related symbols using call-graph, co-change, an...
roam apiList the public API surface (exported public symbols).
roam disambiguateList every symbol matching <name> with disambiguators.
roam annotateAnnotate a symbol or file with a persistent note.
roam annotationsList annotations for a symbol, file, or the whole project.
roam planGenerate a structured execution plan for modifying code.
roam syntax-checkCheck files for syntax errors using tree-sitter AST parsing.
roam triageManage security finding suppressions.
roam oracleContainer for the boolean oracle commands (symbol-exists, route-exists, is-test-only, is-reachable-from-entry, is-clone-of).
roam memoryRepo-local agent memory.
roam runsPer-agent-run event ledger.
roam lawsSelf-installing constitution.
roam constitutionRepo-local agent constitution -- capstone for agent-OS su...
roam agents-mdGenerate an ``AGENTS.md`` describing this codebase to AI ...
roam nextSuggest the next roam command based on current repo state.
roam briefOne-page agent briefing covering mode / next / highlights...
roam replayRe-narrate a past run and (optionally) rerun its commands.
roam agent-scoreAggregate runs and score each agent on a 0..100 composite.
roam modeShow, switch, or query the active agent mode.
roam intent-checkVerify INTENDED_COMMAND would be allowed by the active mode.
roam leaseMulti-agent lease system.

Codebase Health

CommandDescription
roam healthShow code health: cycles, god components, bottlenecks.
roam smellsDetect code smells: brain methods, god classes, deep nest...
roam vibe-checkDetect AI code anti-patterns and compute AI rot score.
roam llm-smellsDetect LLM-API integration anti-patterns.
roam test-hermeticityScan Python test files for non-hermetic patterns (AI-test flakiness risk).
roam boundarySurface public-by-accident exports + changed-range layer violations.
roam ai-readinessEstimate how effectively AI agents can work on this codeb...
roam check-rulesRun structural governance rules against the indexed codeb...
roam ai-ratioEstimate the percentage of AI-generated code from git pat...
roam trendsHealth trend timeline, anomaly detection, per-metric trac...
roam weatherRank files by churn x complexity score (highest-leverage ...
roam timelineShow commits that touched the file owning <symbol>.
roam debtHotspot-weighted technical debt prioritization.
roam complexityShow cognitive complexity metrics for functions and methods.
roam py-typesShow Python type-annotation health for the indexed project.
roam py-modernModern-Python adoption: walrus, match, PEP 604/585/695, f...
roam pytest-fixturesShow the pytest fixture chain for SYMBOL, or a project su...
roam algoDetect suboptimal algorithms and suggest better approaches.
roam n1Detect implicit N+1 I/O patterns in ORM models.
roam over-fetchDetect models that serialize more fields than necessary i...
roam missing-indexDetect queries that filter or sort on columns without ind...
roam alertsDetect health degradation trends and generate actionable ...
roam fitnessRun architectural fitness functions from .roam/fitness.yaml.
roam forecastPredict when metrics will exceed thresholds using trend a...
roam bisectFind which snapshots caused architectural degradation.
roam ingest-traceIngest runtime trace data and match spans to symbols.
roam hotspotsShow runtime hotspots comparing static analysis vs runtim...
roam why-slowFind runtime hotspots — symbols slow under real productio...
roam eval-retrieveRun the retrieval eval harness over a labeled task set.

Architecture

CommandDescription
roam mapShow project skeleton with entry points and key symbols.
roam graph-exportExport the indexed graph for external tooling.
roam graph-statsReport density, connected components, and degree statistics.
roam graph-diffStructural diff between two graph snapshots.
roam architecture-driftArchitectural-trend report over a sliding window of snaps...
roam layersShow dependency layers and violations.
roam clustersShow code clusters and directory mismatches.
roam spectralSpectral bisection: Fiedler vector partition tree.
roam couplingShow temporal coupling: file pairs that change together.
roam dark-matterDetect dark matter: file pairs that co-change but have no...
roam effectsShow what functions DO — side-effect classification.
roam side-effectsClassify symbols by their side effects (none / io_read / ...
roam idempotencyClassify symbols by idempotency (idempotent / non_idempot...
roam causal-graphBuild per-symbol causal graphs (input → sink data depende...
roam tx-boundariesClassify functions by transactional safety.
roam cutMinimum cut analysis — find fragile domain boundaries.
roam simulateCounterfactual architecture simulator.
roam orchestratePartition the codebase for parallel multi-agent work.
roam partitionGenerate a multi-agent partition manifest with conflict a...
roam entry-pointsEntry point catalog with protocol classification.
roam patternsDetect common architectural patterns in the codebase.
roam safe-zonesIdentify safe refactoring boundaries for a symbol or file.
roam visualizeGenerate a Mermaid or DOT architecture diagram.
roam x-langShow cross-language symbol bridges detected in the project.
roam fingerprintTopology fingerprint for cross-repo comparison.
roam clonesDetect near-duplicate code via AST structural hashing.

Exploration

CommandDescription
roam searchFind symbols matching a name substring (case-insensitive).
roam search-semanticFind symbols by natural language query (hybrid BM25 + vec...
roam batch-searchSearch up to 10 symbol-name patterns in a single command.
roam completeReturn left-anchored prefix completions for the given par...
roam grepContext-enriched grep with reachability, clone, and bridg...
roam refs-textAudit literal strings across the project: per-surface ref...
roam history-grepThrough-history search using git pickaxe (-S / -G).
roam fileShow file skeleton: all definitions with signatures.
roam symbolShow symbol definition, callers, and callees.
roam moduleShow directory contents: exports, signatures, deps.
roam traceShow shortest path between two symbols.
roam depsShow file import/imported-by relationships.
roam usesShow all consumers of a symbol: callers, importers, inher...
roam fanShow fan-in/fan-out: most connected symbols or files.
roam impactShow blast radius: what breaks if a symbol changes.
roam relateShow how a set of symbols relate to each other.
roam endpointsList all detected REST/GraphQL/gRPC endpoints with handlers.
roam metricsShow unified metrics for a file or symbol.
roam findingsQuery the central findings registry (cross-detector view).

Reports & CI

CommandDescription
roam reportRun a compound report preset — multiple commands in one s...
roam budgetCheck pending changes against architectural budgets.
roam breakingDetect potential breaking changes vs a git ref.
roam coverage-gapsFind entry points with no path to a required gate symbol.
roam auth-gapsFind endpoints missing authentication or authorization ch...
roam orphan-routesFind backend API routes that have no frontend consumers (...
roam bus-factorDetect knowledge loss risk per module (bus factor analysis).
roam simulate-departureSimulate what happens when a developer leaves the team.
roam suggest-reviewersSuggest optimal code reviewers for changed files.
roam dev-profileAnalyze developer commit patterns and behavioral metrics.
roam ownerShow code ownership: who owns a file or directory.
roam codeownersAnalyze CODEOWNERS coverage and ownership distribution.
roam driftDetect ownership drift: where declared owners differ from...
roam secretsScan for hardcoded secrets, API keys, tokens, and passwords.
roam supply-chainDependency risk dashboard: pin coverage, risk scoring, su...
roam riskShow domain-weighted risk ranking of symbols.
roam migration-safetyCheck migration files for non-idempotent (unsafe if run t...
roam api-driftDetect mismatches between backend API responses and front...
roam path-coverageFind critical untested paths from entry points to sensiti...
roam capsuleExport the structural graph as a portable JSON capsule.
roam rulesEvaluate custom governance rules defined in .roam/rules/.
roam vuln-mapIngest vulnerability scanner reports and match to codebas...
roam vuln-reachQuery reachability of ingested vulnerabilities through th...
roam vulnsScan and manage vulnerability inventory.
roam sbomGenerate a Software Bill of Materials (SBOM) enriched wit...
roam taintReach-analysis from rule sources to sinks over the indexe...
roam cgaCode Graph Attestation: sign-ready in-toto evidence over ...
roam congestionDetect developer congestion: files with too many concurre...
roam compatibilityDetect outbound surface regressions vs a baseline snapshot.

Refactoring

CommandDescription
roam deadShow unreferenced exported symbols (dead code).
roam orphan-importsList imports that don't resolve to any indexed module / i...
roam flag-deadDetect potentially stale feature flag code (conditionally...
roam duplicatesDetect semantically duplicate functions via structural si...
roam safe-deleteCheck if a symbol can be safely deleted.
roam delete-checkGate the working diff on surviving references to deleted ...
roam splitAnalyze a file's internal structure and suggest how to sp...
roam fn-couplingShow function-level temporal coupling (hidden dependencies).
roam doc-stalenessDetect stale docstrings where the code body changed long ...
roam docs-coverageAnalyze exported-symbol doc coverage and stale docs in on...
roam stale-refsFind dangling file references — markdown links, HTML href...
roam lspRun the roam-stale-refs language server on stdin/stdout (...
roam suggest-refactoringRank symbols that are likely to yield high-value refactor...
roam plan-refactorBuild an ordered refactoring plan with risk, test, and im...
roam conventionsAuto-detect codebase naming, file, import, and export con...
roam sketchShow compact structural skeleton of a directory.
roam test-mapMap a symbol or file to its test coverage.
roam test-pyramidCount tests by kind (unit/integration/e2e/smoke), flag in...
roam pr-riskCompute risk score for pending changes.
roam whyExplain why a symbol matters — role, reach, criticality, ...
roam invariantsDiscover implicit contracts for symbols.
roam intentLink documentation to code -- find what docs describe wha...
roam closureCompute the minimal set of changes needed when modifying ...
roam mutateSyntax-less agentic editing.
roam test-scaffoldGenerate test file skeletons from indexed symbols.

Other

CommandDescription
roam churnRank files by churn x complexity score (highest-leverage ...
roam digestHealth trend timeline, anomaly detection, per-metric trac...
roam mathDetect suboptimal algorithms and suggest better approaches.
roam onboardSingle-call codebase comprehension — everything in one shot.
roam refsShow all consumers of a symbol: callers, importers, inher...
roam snapshotHealth trend timeline, anomaly detection, per-metric trac...
roam trendHealth trend timeline, anomaly detection, per-metric trac...