DocsRunning cass
CLI Reference
On this page
The cass binary supports both interactive use and automation.
# 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 |
Run TUI and save terminal output as asciicast v2 |
index |
Discover sessions and refresh the canonical DB plus derived search assets |
index |
Same as index, but lowers its own CPU/I/O priority first (used by auto-refresh, schedule, and the daemon timer) |
index |
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 |
JSON output for automation pipelines |
pack |
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 , 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 |
Read-only shared-repo operations snapshot across Beads, Agent Mail metadata, git, build pressure, cass readiness, and proof refs |
swarm |
Advisory one-agent packet with readiness, suggested reservations, verification commands, and closeout checklist; it does not claim or reserve |
swarm lint |
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); , lint recorded input |
swarm |
Read-only sibling dependency sentinel for Cargo.toml pins, optional local checkout HEAD/dirty state, strict validation commands, and release-risk recommendations |
sessions |
Discover recent session files for follow-up actions |
context <path> |
Find related sessions by workspace, day, or agent |
view <path> |
View source file at specific line (follow-up on search) |
export <path> |
Export conversation to markdown/JSON |
|
Export as self-contained HTML with optional encryption |
expand <path> |
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 , , , and as non-wizard modes. (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, (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 does not open. |
pages key list|add-password|add-recovery|revoke|rotate |
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 (current password on line 1, new password on line 2), never from argv; 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 (, , ) |
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 |
|
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; 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; runs it), clear |
forget |
Prune archived conversations with repeatable literal or , , and/or ; at least one selector is required. Source paths/globs form a union, intersected with workspace and age. Preview is strictly read-only; add 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 and hybrid falls back to lexical until cass index catches up. Readers refuse stale pre-forget generations during repair. If deletion or rebuilding fails, retry the same selectors with to finish; cass index can repair derived data for already-committed deletions |
forget / forget |
Inspect recorded exclusions or explicitly release matching records. Use literal , , or exact , , and selectors; supplied selectors are ANDed. Re-inclusion requires a selector and previews by default; add , 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 |
Fleet-safe upgrade rehearsal (dry run) with bounded post-upgrade verification; 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 |
|
Verify release distribution channels (GitHub, Homebrew, Scoop, crates.io, installer) from a recorded observation () or 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 |
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 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 ; semantic enrichment remains a separate operation. Inspect the dry-run plan first for the exact confirmation flags and step number.
cass guide 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 and , 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 :
| Command | Purpose |
|---|---|
serve |
Persistent search service: reuses one read-only lexical index reader across a stream of newline-delimited JSON requests (or MCP with ), with per-request deadlines (), cross-process reader admission (, ) and a resident-memory cap (). Search, status and startup never open the canonical database; 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 plus and (external also requires explicit endpoint consent), and refine needs (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 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 |
|
Plan or apply canonical consolidation of duplicate Codex conversations caused by rollout path layout changes (sessions/YYYY/MM/DD/... vs flat rollouts) |
|
Inspect or prune quarantined lexical index generations under <data-dir>/quarantine/lexical/ |
|
Reclaim stale or superseded semantic index artifacts and staging directories |
Specialized Validation and Recording Tools#
| Tool | Purpose |
|---|---|
cass tui |
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:
# 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 |
Read-only truth surface for archive coverage, source authority, locks, storage pressure, semantic fallback, and recommended action | Never mutates |
cass doctor |
Read-only source inventory, raw mirror, coverage, sole-copy, and remote sync gap inspection | Never mutates |
cass doctor repair |
Builds a fingerprinted repair plan and candidate/promotion gates | Read-only plan |
cass doctor repair |
Applies exactly the inspected repair fingerprint | Candidate-based, receipt-backed |
cass doctor backups list/verify/restore ... |
Lists backups, verifies manifests, rehearses restore, then applies by fingerprint | Restore apply requires a matching rehearsal fingerprint |
cass doctor |
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 |
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 untouched |
Backs up the live bundle first as a backup (cass doctor backups restore <id>) |
cass doctor cleanup |
Plans cleanup for derived or explicitly reclaimable assets | Apply requires a matching fingerprint |
cass doctor |
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.tomlare 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:
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 |
|---|---|---|
|
search | Show query parsing and strategy |
|
search | Validate without executing |
|
most commands | Extra detail in output |
|
all | Append execution trace to file |
|
index | Emit per-ingest-batch NDJSON timing and lookup counters on stderr |
Model Management#
Commands for managing the semantic search ML model:
# 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 , 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 rulesconfig.json- Model configurationspecial_tokens_map.json- Special token definitionstokenizer_config.json- Tokenizer settings