CLI Surface

Command Reference with Examples

High-signal commands by workflow. The full CLI surface has 139 canonical commands (+3 alias pairs), but most teams rely on a smaller daily core.

Convention: all examples assume the current directory is a repository root that has already run roam init.

Core Daily Commands

CommandExampleWhen to use
roam understandroam understandGet a full codebase briefing before diving into files.
roam contextroam context PaymentServiceRanked file/line reading plan for a symbol.
roam impactroam impact PaymentServiceBlast radius and likely affected areas.
roam preflightroam preflight PaymentServiceSafety check before edits.
roam diffroam diff --stagedUnderstand current change set risk.
roam healthroam health --gateTrack and enforce architecture health (gate thresholds via .roam-gates.yml).

Exploration and Structure

CommandExampleOutput focus
roam searchroam search authName matches over indexed symbols.
roam search-semanticroam search-semantic "database connection pool" --backend autoHybrid BM25 + TF-IDF + optional local ONNX semantic retrieval with pre-indexed framework packs for cold-start queries.
roam symbolroam symbol src/auth/service.pySymbol list in one file.
roam usesroam uses loginWho calls a symbol (callers and consumers).
roam fanroam fan loginFan-in/fan-out for a symbol.
roam traceroam trace LoginController UserRepoPath through the call graph.
roam depsroam deps src/Module dependency graph summary.
roam layersroam layersDetected architecture layering.
roam clustersroam clusters --min-size 3Louvain module communities.
roam hotspotsroam hotspotsComplexity/churn hotspots.
roam algoroam algoDetect 23 algorithm anti-patterns with Big-O improvements and fix suggestions.
roam visualizeroam visualize --format mermaidDiagram output for architecture views.

Quality, Rules, and Governance

CommandExamplePurpose
roam check-rulesroam check-rules --severity errorRun built-in and custom governance rules.
roam rulesroam rules --rules-dir rules/communityEvaluate YAML rule packs (path/symbol/AST).
roam rules --initroam rules --initGenerate starter custom rules.
roam smellsroam smells --min-severity warningCode smell detector catalog.
roam secretsroam --sarif secretsSecret leakage detection with remediation hints.
roam vulnsroam --json vulnsDependency vulnerability scan and reachability.
roam test-gapsroam test-gaps --changedChanged code lacking nearby tests.
roam verify-importsroam verify-imports --file src/auth/service.pyImport hallucination and unresolved reference checks.

Change Intelligence and Refactoring

CommandExamplePurpose
roam semantic-diffroam semantic-diff --base HEAD~1Structural deltas: symbols, signatures, imports.
roam api-changesroam api-changes --base HEAD~1Breaking API risk detection.
roam affectedroam affected --changedFiles/tests likely impacted by current edits.
roam safe-deleteroam safe-delete old_helperEvidence-based dead code removal check.
roam docs-coverageroam docs-coverage --threshold 70Doc coverage + stale-doc drift + PageRank-ranked missing docs.
roam simulateroam simulate move AuthService src/core/Counterfactual architecture changes without editing files.
roam partitionroam partition --agents 3Split work for multi-agent execution.
roam orchestrateroam orchestrate --agents 3Generate an agent task graph and dependencies.

MCP and Automation

CommandExamplePurpose
roam mcpROAM_MCP_PRESET=core roam mcpRun MCP server with constrained tool set (presets: core, review, refactor, debug, architecture, full).
roam mcp --list-toolsroam mcp --list-toolsInspect tool catalog and metadata.
roam mcp-setuproam mcp-setup cursorGenerate client configuration.
roam hooksroam hooks installAuto-index on post-merge/post-checkout flows.
roam watchroam watch --webhook-port 8787 --guardian --guardian-report .roam/guardian.jsonlDaemon mode with polling/webhook refresh plus optional continuous architecture-guardian snapshots.
roam dashboardroam --json dashboardSingle endpoint for key quality/project metrics.

Output Modes and Stability Tips

roam --json context PaymentService
roam --sarif health --gate
roam --budget 600 impact PaymentService