cass

DocsRunning cass

CLI Reference

On this page

The cass binary supports both interactive use and automation.

bash
# Interactive
cass [tui] [--data-dir DIR] [--once] [--asciicast FILE]

# Indexing
cass index [--full] [--watch] [--background] [--data-dir DIR] [--idempotency-key KEY]
cass schedule install [--interval-mins 15] [--nightly-hour 3] [--no-semantic] [--dry-run]
cass schedule status --json

# Search
cass search "query" --robot --limit 5 [--timeout 5000] [--explain] [--dry-run]
cass search "error" --robot --aggregate agent,workspace --fields minimal
cass pack "query" --robot --max-tokens 12000 [--limit 40] [--sessions-from FILE|-]
cass pack "query" --robot --freshness-policy strict --freshness-window-seconds 604800 --require-evidence
cass pack "query" --robot --max-tokens 4000 --max-evidence 8 --max-sessions 3 --max-excerpt-chars 600

# Inspection & Health
cass triage --json                    # One-shot agent preflight with exact next command
cass status --json                    # Quick health snapshot
cass health                           # Minimal pre-flight check (<50ms)
cass capabilities --json              # First-stop agent self-description
cass introspect --json                # Full API schema
cass swarm status --json              # Read-only Beads/Agent Mail/git/rch swarm snapshot
cass swarm work-packet --json         # Advisory claim packet; no mutations
cass swarm lint --json                # Coordination and proof-gap lint
cass context /path/to/session --json  # Find related sessions
cass view /path/to/file -n 42 --json  # View source at line

# Session Analysis
cass export /path/to/session --format markdown -o out.md  # Export conversation
cass expand /path/to/session -n 42 -C 5 --json            # Context around line
cass timeline --today --json                               # Activity timeline

# Remote Sources
cass sources add user@host --preset macos-defaults  # Add machine
cass sources sync                                    # Sync sessions
cass sources doctor                                  # Check connectivity
cass sources mappings list laptop                    # View path mappings

# Utilities
cass stats --json
cass completions bash > ~/.bash_completion.d/cass

Core Commands#

status separates archive readiness from source currency. healthy and index.fresh describe the archive and its searchable index; they do not prove that session files have been checked recently. The JSON source_scan block reports last_completed_at_ms, age_seconds, interval_seconds, and overdue. The timestamp is the canonical watermark: the start time of the last successfully completed source scan. Age is measured from that start, rather than its finish. An overdue scan appears in human output and recommends cass index when the archive is otherwise healthy. The interval follows CASS_AUTO_REFRESH_SOURCE_SCAN_SECS (default 300 seconds; 0 disables the age check). A missing or invalid completed-scan watermark is unknown (null), not proof of a recent scan. Status reads the recorded metadata without scanning session files or starting maintenance.

Command Purpose
cass (default) Start TUI (a stale index triggers a detached low-priority catch-up; see Keeping the Index Fresh)
cass tui --asciicast FILE Run TUI and save terminal output as asciicast v2
index --full Discover sessions and refresh the canonical DB plus derived search assets
index --background Same as index, but lowers its own CPU/I/O priority first (used by auto-refresh, schedule, and the daemon timer)
index --watch Foreground watch loop: reindex automatically on file changes
schedule install|uninstall|status|run Register incremental (15 min) + nightly (full source census, conditional lexical rebuild, bounded semantic backfill) jobs with launchd / systemd user timers
search --robot JSON output for automation pipelines
pack --robot Deterministic cited answer packs for agent/human handoffs; reports health, freshness, privacy, and warnings
triage / ready / preflight One-shot agent preflight: readiness, exact next command, docs, schemas, workflows, and recoveries
guide [INTENT] Intent-to-command planner (fix-ci, investigate-search-miss, prepare-release, repair-assets, export-session, onboard-source, support-capsule); dry-run by default. With --apply, read-only operations evaluate proofs, and guarded adapters can create a support bundle, repair the lexical index or incrementally index staged configured sources. Unsupported operations are reported without being executed
status / state Health snapshot: index freshness, completed source-scan age and overdue state, DB stats, recommended action
health Minimal health check (<50ms on a healthy archive; the strict, mutation-free owner-thread probe shared with status has a 30 s hard deadline and never checkpoints a dirty WAL), exit 0=healthy, 1=unhealthy
selftest Archive-independent executable probe for installers and binary-promotion gates; exercises an in-memory FrankenSQLite write/read round-trip
capabilities First-stop agent self-description: workflow recipes, mistake recoveries, commands, global flags, exit codes, env vars, and limits
introspect Full API schema: commands, arguments, response shapes
swarm status --json Read-only shared-repo operations snapshot across Beads, Agent Mail metadata, git, build pressure, cass readiness, and proof refs
swarm work-packet --json Advisory one-agent packet with readiness, suggested reservations, verification commands, and closeout checklist; it does not claim or reserve
swarm lint --json Read-only coordination protocol lint for missing mail, stale reservations, status mismatches, and proof gaps. Without a fixture it lints the repository's live Git, Beads, Agent Mail and evidence providers (the same bounded collection as swarm status); --fixture, --fixture-dir --fixture-id lint recorded input
swarm dependency-drift --json Read-only sibling dependency sentinel for Cargo.toml pins, optional local checkout HEAD/dirty state, strict validation commands, and release-risk recommendations
sessions [--workspace DIR] [--current] Discover recent session files for follow-up actions
context <path> Find related sessions by workspace, day, or agent
view <path> -n N View source file at specific line (follow-up on search)
export <path> Export conversation to markdown/JSON
export-html <path> Export as self-contained HTML with optional encryption
expand <path> -n N Show messages around a specific line number
timeline Activity timeline with grouping by hour/day
sources Manage remote sources: add/list/remove/doctor/sync/mappings
doctor Diagnose and repair installation issues (safe, never deletes data)

Other subcommands (all present in the Commands enum in src/lib.rs):

Command Purpose
pages Export an encrypted, searchable static-site archive with GitHub Pages / Cloudflare Pages deploy; runs the interactive wizard by default, with --export-only DIR, --verify BUNDLE, --preview BUNDLE, and --scan-secrets as non-wizard modes. --share-profile public|team|personal (config: bundle.share_profile; wizard: step 4) redacts every exported text, including titles, paths, metadata values, message bodies, their search indexes and snippets. public covers home paths, usernames, project names, hostnames, emails, phone numbers, IP addresses, social-security and card numbers, and internal URLs; team covers home paths, emails, social-security and card numbers; personal rewrites nothing. No profile rewrites a credential (API keys, private keys, connection strings): the staged secret scan rejects an export that contains one, so it fails closed instead of publishing a rewritten secret. The default is public for a plaintext export and team when encrypted. The bundle's export_meta records the profile and per-kind redaction counts, never the values. For a plaintext bundle, --verify (which every export also runs before it reports success) reads the declared profile and rescans every exported text surface, including both search indexes, with that profile's rules. It fails if any value the profile removes remains, reporting counts per surface. The home-path and username rules use the verifying account's home directory. An encrypted bundle keeps its profile inside the payload, which --verify does not open.
pages key list|add-password|add-recovery|revoke|rotate --archive BUNDLE Manage the key slots of an exported encrypted bundle (LUKS-style: several independently wrapped copies of one data key). Passwords come from an interactive prompt or --password-stdin (current password on line 1, new password on line 2), never from argv; --json for automation; recovery secrets are printed once and never stored. See docs/RECOVERY.md
upgrade Check for a newer release and optionally run the same checksum-verified installer the TUI uses (--check, --yes, --force)
man Generate the man page to stdout
storage On-disk storage footprint by component (DB, WAL, lexical index, raw mirror, semantic, quarantine)
dedup Collapse pre-existing duplicate conversation rows (projects/<rel> vs <rel> external-id twins); dry-run unless --apply
support-bundle Assemble a redacted, share-safe recovery/support evidence bundle
state Quick state/health check (alias of status)
onboarding Read-only first-run source onboarding + readiness wizard; --json for scripts, never launches the TUI
quarantine Inspect and manage the conversation-ingest quarantine: list (each excluded conversation, plus a status grouping by cause, version and retry eligibility with the next command), retry (bounded re-ingest plan; --apply runs it), clear
forget Prune archived conversations with repeatable literal --source-path PATH or --source-glob '<glob>', --workspace-glob '<glob>', and/or --older-than 90d; at least one selector is required. Source paths/globs form a union, intersected with workspace and age. Preview is strictly read-only; add --apply to validate the whole selection, commit bounded deletion batches and rebuild derived assets once under the indexing maintenance lock. Oversized optional FTS shadows are retired before writes; lexical rebuilding defaults to the bounded profile. Empty matches skip rebuilding unless an earlier forget needs repair. Age means the last message time, strictly before the reported before_ms cutoff; sessions with missing message times are kept. Shared stores such as OpenCode/Devin SQLite databases use durable session identities, so forgotten sessions stay out when siblings change while retained siblings keep updating. Single-session files retain size/mtime tombstones: an unchanged file stays forgotten across incremental/full indexing, and a changed file is indexed again. Source files and raw-mirror captures remain. Use CASS_EXCLUDE_PATHS or CASS_EXCLUDE_WORKSPACES for prospective exclusion, and cass mirror prune for explicit raw-capture retention. Semantic vectors are not rewritten: explicit semantic search reports semantic-unavailable and hybrid falls back to lexical until cass index --semantic catches up. Readers refuse stale pre-forget generations during repair. If deletion or rebuilding fails, retry the same selectors with --apply to finish; cass index --full can repair derived data for already-committed deletions
forget --list / forget --reinclude Inspect recorded exclusions or explicitly release matching records. Use literal --source-path, --source-glob, or exact --source-id, --agent, and --external-id selectors; supplied selectors are ANDed. Re-inclusion requires a selector and previews by default; add --apply, then run cass index. Other exclusions and current workspace/path policies remain in force. Historical exclusion records cannot be selected by workspace or age.
fleet upgrade-rehearsal Fleet-safe upgrade rehearsal (dry run) with bounded post-upgrade verification; --live opts in to SSH probes of configured remotes
lessons list|search Mine and query durable, redacted lessons from local evidence (commits, closed beads, proof manifests)
import chatgpt Import or refresh a ChatGPT web export (conversations.json) as files the ChatGPT connector can index
release-verify Verify release distribution channels (GitHub, Homebrew, Scoop, crates.io, installer) from a recorded observation (--from) or live (--live)
sources discover Auto-discover SSH hosts from ~/.ssh/config
sources reingest Re-ingest an already-synced mirror into the canonical archive without re-running rsync
sources artifact-manifest Build or verify a lexical-artifact evidence manifest for remote exchange

cass import chatgpt refreshes changed mapping-based conversations by stable node key and retains messages omitted from a partial export. Older dated snapshots cannot roll back newer messages; unchanged imports preserve file bytes and modification times. The JSON result distinguishes newly imported, updated, and unchanged skipped conversations. Changed unsupported export shapes or conflicting identities return an error while preserving the existing file. Run cass index after importing.

cass guide repair-assets --apply can rebuild the lexical index from the selected canonical database after the plan's step confirmation, cost acceptance, resource checks and stop-condition acknowledgement. It uses the existing bounded rebuild path and refuses missing or empty archives before source discovery. A successful receipt requires a fresh, complete lexical generation with unchanged canonical identity and conversation/message counts. Already-current assets are reported as already-ready; semantic enrichment remains a separate operation. Inspect the dry-run plan first for the exact confirmation flags and step number.

cass guide onboard-source --apply previews configured sources, then requires explicit confirmation before incremental indexing. Configured type = "local" sources are checked for readable paths using the indexer's path resolution, including ~/; they need no remote source or mirror. Remote sources retain the local dry-sync preview and require mirrors staged with cass sources sync first. Mixed configurations must pass both checks. The guide performs no registration, SSH transfer or model download. Indexing scans configured local paths, staged remote sources and normal local discovery roots, honors --db and --data-dir, and uses the existing index lock with a 120-second deadline. Completion requires an unchanged source configuration, a complete scan and a fresh canonical/lexical status check. The receipt separates indexer count observations from archive totals measured by that status check. Missing local paths or mirrors, scan errors, deferred work or a busy indexer fail the operation; a started operation may already have updated the archive. Review the dry-run plan for its exact privacy, cost, resource, stop-condition and step confirmations.

Five more commands are dispatched before the main parser (registered via allow_external_subcommands in src/main.rs); use their own --help:

Command Purpose
serve --stdio [--mcp] (--data-dir DIR | --index PATH) Persistent search service: reuses one read-only lexical index reader across a stream of newline-delimited JSON requests (or MCP with --mcp), with per-request deadlines (--request-timeout-ms), cross-process reader admission (--admission-dir, --admission-slots) and a resident-memory cap (--max-resident-mib). Search, status and startup never open the canonical database; --db opts in to canonical view/view_batch requests. Operations: search, semantic_search, refine, view, view_batch, status, reload, unload, shutdown. search is lexical; semantic_search needs --semantic-embedder minilm|multilingual-minilm|hash|external plus --data-dir and --db (external also requires explicit endpoint consent), and refine needs --reranker-model PATH (installed local assets only, never downloaded). See docs/SEARCH_SERVICE.md
archive export|verify|search|view|import Bounded, versioned logical archive of the canonical rows: export --output FILE --archive-id ID --include-private streams a read-only snapshot to a new private JSONL file; verify checks framing, identities, counts and digest without a database; search/view read verified message bodies without restoring; import restores into a new database and never replaces an existing archive
codex-layout-migrate [--apply] [--json] Plan or apply canonical consolidation of duplicate Codex conversations caused by rollout path layout changes (sessions/YYYY/MM/DD/... vs flat rollouts)
lexical-quarantine [list|inspect|prune] [--json] Inspect or prune quarantined lexical index generations under <data-dir>/quarantine/lexical/
semantic-reclaim [--apply] [--json] Reclaim stale or superseded semantic index artifacts and staging directories

Specialized Validation and Recording Tools#

Tool Purpose
cass tui --asciicast FILE Record TUI output as an asciicast v2 artifact; there is no separate cass cast subcommand
scripts/bakeoff/cass_validation_e2e.sh Run the bake-off validation harness for lexical, semantic, hybrid, and reranked search scenarios
scripts/bakeoff/cass_embedder_e2e.sh Exercise embedder bake-off flows against a generated validation corpus
scripts/bakeoff/cass_rerank_e2e.sh Exercise reranker bake-off flows and append results to the bake-off log

Diagnostic Commands#

Commands for troubleshooting, debugging, and understanding system state:

bash
# One-shot agent preflight
cass triage --json
# → { "surface": "triage", "status": "healthy", "next_command": null, ... }

# Health check (fast, <50ms; the archive probe is bounded by a 30 s hard deadline)
cass health --json
# → { "healthy": true, "index_age_seconds": 120, "message_count": 5000 }

# Detailed status with recommendations
cass status --json
# → Includes index freshness, staleness threshold, recommended action

# System diagnostics
cass diag --verbose --json
# → Database stats, index info, connector status, environment

# Query explanation (debug why results are what they are)
cass search "auth" --explain --dry-run --robot
# → Shows parsed query, index strategy, cost estimate without executing

# Find related sessions
cass context /path/to/session.jsonl --json
# → Sessions from same workspace, same day, or same agent

# Archive-first diagnostic check
cass doctor check --json
# → Read-only checks for archive coverage, source authority, locks, backups,
#   storage pressure, semantic fallback, and recommended next action

# Fingerprinted repair plan and apply
cass doctor repair --dry-run --json
cass doctor repair --yes --plan-fingerprint <plan_fingerprint> --json
# → Builds candidates and applies only the inspected matching fingerprint

# Legacy safe auto-run for low-risk derived repairs
cass doctor --fix --json
# → Emits operation_outcome and receipts; fails closed on archive/source risk

The Doctor Command#

cass doctor is a comprehensive diagnostic and repair tool designed for troubleshooting installation and data issues. Its current recovery model is archive-first: preserve cass-owned evidence, prove source authority and coverage, then repair through candidates and receipts. The full operator runbook is docs/planning/RECOVERY_RUNBOOK.md.

What it checks:

Surface Purpose Mutation Policy
cass doctor check --json Read-only truth surface for archive coverage, source authority, locks, storage pressure, semantic fallback, and recommended action Never mutates
cass doctor archive-scan --json Read-only source inventory, raw mirror, coverage, sole-copy, and remote sync gap inspection Never mutates
cass doctor repair --dry-run --json Builds a fingerprinted repair plan and candidate/promotion gates Read-only plan
cass doctor repair --yes --plan-fingerprint <fp> --json Applies exactly the inspected repair fingerprint Candidate-based, receipt-backed
cass doctor backups list/verify/restore ... --json Lists backups, verifies manifests, rehearses restore, then applies by fingerprint Restore apply requires a matching rehearsal fingerprint
cass doctor --repair-leaked-pages --dry-run --json Classifies the engine's integrity verdict: clean, leaked_pages (pages no table, index or freelist owns — page N is never used), or other_damage Read-only
cass doctor --repair-leaked-pages --yes --json Frees leaked pages in place when they are the only damage; re-runs integrity_check and compares conversation/message counts. Any other damage exits 5 data-corruption untouched Backs up the live bundle first as a leaked-pages-repair backup (cass doctor backups restore <id>)
cass doctor cleanup --json Plans cleanup for derived or explicitly reclaimable assets Apply requires a matching fingerprint
cass doctor support-bundle --json Creates a scrubbed diagnostic handoff bundle Redacted by default; not a backup

Safety guarantees:

  • Preserves source evidence - Claude, Codex, Cursor, Gemini, remote mirrors, raw-mirror blobs, manifests, and source ledgers are treated as evidence.
  • Preserves archive state - canonical SQLite archives, WAL/SHM sidecars, backup bundles, restore receipts, bookmarks, TUI state, and sources.toml are not cleanup targets.
  • Separates diagnosis from mutation - check, archive-scan, baseline diff, backup verify, and support-bundle verify are read-only.
  • Requires fingerprints for risky mutations - repair, restore apply, cleanup apply, archive normalize apply, and archive export apply consume the exact dry-run plan_fingerprint.
  • Fails closed on coverage risk - source pruning, sole-copy warnings, ambiguous authority, failed probes, or repeated repair markers block unsafe repair until inspected.
  • Keeps support bundles scrubbed - default bundles include redacted summaries and checksummed manifests, not raw session logs or full archive copies.

Recommended support checklist:

bash
cass doctor check --json
cass doctor baseline diff <baseline_id> --json
cass doctor support-bundle --json
cass doctor support-bundle verify <bundle_or_manifest_path> --json

Send the doctor JSON, latest failure_context.json if present, support-bundle manifest.json, any baseline diff, relevant artifact_manifest_path and event_log_path values, and the exact command/exit code. Do not attach raw sessions, full SQLite archives, private source files, or encrypted payloads unless the user explicitly opts into sensitive evidence attachment.

Diagnostic Flags:

Flag Available On Effect
--explain search Show query parsing and strategy
--dry-run search Validate without executing
--verbose most commands Extra detail in output
--trace-file all Append execution trace to file
--robot-trace-ingest index Emit per-ingest-batch NDJSON timing and lookup counters on stderr

Model Management#

Commands for managing the semantic search ML model:

bash
# Check current model status (abbreviated schema — real output also
# includes cache_lifecycle, files[], revision, license, and more):
cass models status --json
# → {
#     "model_id": "all-minilm-l6-v2",
#     "model_dir": "~/.local/share/coding-agent-search/models/all-MiniLM-L6-v2",
#     "installed": false,
#     "state": "not_acquired",
#     "state_detail": "model not acquired (user consent required); missing ...",
#     "next_step": "Run `cass models install`, or keep using lexical search.",
#     "lexical_fail_open": true,
#     "revision": "c9745ed1...",
#     "license": "Apache-2.0",
#     "total_size_bytes": 90872535,
#     "installed_size_bytes": 0,
#     "observed_file_bytes": 0,
#     "policy_source": "semantic_policy"
#   }

# Install model (downloads ~90MB from Hugging Face on explicit request)
cass models install
# → Downloads from Hugging Face, verifies checksum

# Install from local directory (air-gapped environments)
cass models install --from-file /path/to/model-dir

# Verify model integrity
cass models verify --json
# → all_valid bool + per-file SHA-256 checks (see `cass models verify --help`)

# Check for model updates
cass models check-update --json
# → { "update_available": bool, "reason": str,
#     "current_revision": str|null, "latest_revision": str }

In cass status --json, semantic.preferred_backend is "fastembed" when the native MiniLM lane is selected and "hash" for the hash tier; fastembed is only the id of the native pure-Rust MiniLM lane — no ONNX runtime is involved.

Model Files (stored in $CASS_DATA_DIR/models/all-MiniLM-L6-v2/):

  • model.safetensors - The neural network weights (~90MB)
  • tokenizer.json - Vocabulary and tokenization rules
  • config.json - Model configuration
  • special_tokens_map.json - Special token definitions
  • tokenizer_config.json - Tokenizer settings