Skip to content

CLI Reference

The CLI mirrors the MCP surface exactly: nine domains, each a real clap subcommand group (basemind <domain> <mode>). tests/cli_parity/ enforces it: every MCP mode maps to a CLI command with the same parameters and the same answer, and any command with no MCP counterpart is declared CLI-only with a reason. Some MCP modes live at the top level rather than under their domain (status, rescan, cache, delta, checkpoint, detect-waste). Multi-word mode names are kebab-cased on the CLI (by_path → by-path) but keep their snake_case spelling on the wire (MCP mode name, --json field names). Add --json to any tool subcommand for machine-readable output.

Flags with a closed set of values (--direction, --edges, --algorithm, --granularity, --format, --lane, --level, --window, --field, --hash-mode, --kind on memory proposals, shell names) are validated by clap: a typo fails with exit code 2 and the valid choices listed, and the completions offer them. The MCP parameters carry the same values as free strings.

Commands that return lists share a set of paging and budget flags where their MCP mode takes them:

Flag Commands Effect
--cursor <TOKEN> code symbols/grep/files/find/references/callers/implementations, git recent/search/touching/by-path/blame/blame-symbol/symbol-history, memory list/proposals, agents history/inbox/wait Resume from the previous page’s next_cursor.
--max-tokens <N> code outline/symbols/grep/files/find/references/callers/implementations/semantic, graph map, memory documents Token budget for the returned list; the overflow is dropped and the response is flagged budgeted.
--format json|toon code outline/symbols/grep/files/find/references/semantic, memory documents Response encoding. toon is a compact tabular form, printed as-is in human mode; --json always prints JSON.
--rerank-top-k <N> code semantic How many fused hits the cross-encoder reranks (default from config).
Domain Gate
code, graph, git, memory, admin always available
web --features crawl
agents, workspace --features comms
shell --features shells

A default cargo install basemind build exposes 5 domains; --features comms adds agents + workspace (7); --features full adds web + shell too (9). Prebuilt downloads (Homebrew, npm, pip, GitHub releases) ship the full 9-domain build.

Terminal window
basemind code outline <path> [--l2 --max-tokens --format]
basemind code symbols <name> [--kind --limit --cursor --max-tokens --format]
basemind code grep <pattern> [--language --path-contains --limit --no-context --cursor --max-tokens --format]
basemind code files [--path-contains --language --limit --cursor --max-tokens --format]
basemind code find <query> [--path-prefix --language --limit --cursor --max-tokens --format]
basemind code definition <path> <line> [--column]
basemind code references <name> [--limit --cursor --max-tokens --format]
basemind code callers <path> <name> [--kind --limit --cursor --max-tokens]
basemind code implementations <trait-name> [--language --limit --cursor --max-tokens]
basemind code dependents <module>
basemind code expand <path> <name> [--kind]
basemind code semantic <query> [--limit --lane --rerank --rerank-preset --rerank-top-k --max-tokens --format]
basemind code chunk <path> [--chunk-id --byte-start]
Command Purpose
outline <path> [--l2] A file’s structure: symbols, lines, signatures. --l2 adds calls + docs. Read this instead of the file. Code files only; documents are searched with memory documents.
symbols <name> [--kind --limit] Find a definition by name (case-sensitive substring) across every indexed file.
grep <pattern> [--language --path-contains --limit --no-context] Regex content search, filtered by language/path. --no-context suppresses the 1-line before/after context.
files [--path-contains --language --limit] Enumerate indexed files, code and documents alike.
find <query> [--path-prefix --language --limit] Fuzzy filename/path search (fzf/fd-style), ranked by score. Covers documents as well as code.
definition <path> <line> [--column] Resolve a reference position to the definition it binds to (scope-resolved).
references <name> [--limit] Every call site of a name — no scope resolution.
callers <path> <name> [--kind --limit] Callers of one specific definition, disambiguated by path.
implementations <trait-name> [--language --limit] Types implementing/inheriting a trait, interface, or base class.
dependents <module> Files whose imports mention a module (heuristic).
expand <path> <name> [--kind] One symbol’s raw source body — the inverse of an outline entry.
semantic <query> [--limit --lane --rerank --rerank-preset --rerank-top-k --max-tokens --format] Search code by meaning; returns pointers, fetch bodies with chunk. Needs --features code-search.
chunk <path> [--chunk-id --byte-start] Fetch one code chunk’s source body. Needs --features code-search.
Terminal window
basemind graph calls <name> [--direction --path --max-depth --max-nodes]
basemind graph neighbors <name> [--path --direction --depth --edges --min-confidence --max-nodes]
basemind graph path <from> <to> [--from-path --to-path --edges --include-contains --min-confidence]
basemind graph subgraph <name> [--path --depth --edges --min-confidence --max-nodes]
basemind graph communities [--edges --algorithm --min-confidence --max-communities --members-per-community]
basemind graph map [--granularity --focus --depth --edges --no-churn --churn-window --max-nodes --max-edges --max-tokens]
basemind graph export [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --write]
basemind graph display [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --no-open]
basemind graph open [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --no-open]
Command Purpose
calls <name> [--direction --path --max-depth --max-nodes] Walk the call chain up (callers) or down (callees) from one definition.
neighbors <name> [--path --direction --depth --edges --min-confidence --max-nodes] The n-hop neighborhood around a symbol.
path <from> <to> [--from-path --to-path --edges --include-contains --min-confidence] Confidence-weighted shortest path between two symbols. Containment edges excluded unless --include-contains.
subgraph <name> [--path --depth --edges --min-confidence --max-nodes] A symbol’s neighborhood cut to its most central nodes.
communities [--edges --algorithm --min-confidence --max-communities --members-per-community] Cluster the graph into de-facto modules. --algorithm is label_propagation (default) or louvain.
map [--granularity --focus --depth --edges --no-churn --churn-window --max-nodes --max-edges --max-tokens] Whole-repo architecture: hub modules by centrality, plus dependency cycles.
export [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --write] Render as node_link/dot/mermaid/graphml/cypher/html/svg. --write also caches the export and prints its path.
display [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --no-open] Render a visual view and open it in your default desktop viewer; --no-open only writes + prints the path.
open [--format --focus --edges --algorithm --min-confidence --max-nodes --max-edges --no-open] Return a live browsable URL for the interactive graph page (a file:// export when no daemon is serving).

Requires running inside a git repository.

Terminal window
basemind git status
basemind git recent [--limit --no-files --cursor]
basemind git touching <path> [--limit --cursor]
basemind git by-path <pattern> [--window --limit --cursor]
basemind git churn [--window --top-k]
basemind git diff <path> <rev-old> <rev-new>
basemind git diff-outline <path> [--rev]
basemind git blame <path> [--line-start --line-end --rev --limit --cursor]
basemind git blame-symbol <path> <name> [--kind --rev --limit --cursor]
basemind git symbol-history <path> <name> [--kind --limit --hash-mode --cursor]
basemind git search <pattern> [--field --limit --cursor]
Command Purpose
status Staged / unstaged / untracked working-tree status.
recent [--limit --no-files] Recent commits with paths + summaries (a recency window, not a search). --no-files omits the per-file change list.
touching <path> [--limit] Commits that modified a given path.
by-path <pattern> [--window --limit] Path-filtered commit log (regex over changed paths).
churn [--window --top-k] Churn-ranked files in a recent commit window.
diff <path> <rev-old> <rev-new> File content diff between two revisions.
diff-outline <path> [--rev] Which symbols a file gained, lost, or changed between revisions.
blame <path> [--line-start --line-end --rev --limit] Per-line blame for a file.
blame-symbol <path> <name> [--kind --rev --limit] Blame clamped to one symbol, resolved to its line span.
symbol-history <path> <name> [--kind --limit --hash-mode] Commits where a symbol’s structural hash actually changed.
search <pattern> [--field --limit] Full-text search over commit messages/authors at full branch depth. --field is author, message, or all (default).

memory — shared memory, documents, and the co-change proposal queue

Section titled “memory — shared memory, documents, and the co-change proposal queue”
Terminal window
basemind memory put <key> <value> [--tag --no-embed --individual]
basemind memory get <key> [--individual]
basemind memory list [--prefix --tag --limit --individual --cursor]
basemind memory search <query> [--limit --tag --individual]
basemind memory delete <key> [--individual]
basemind memory audit [--key --individual --dry-run --limit --include-archived]
basemind memory documents <query> [--limit --mime-type --scope --max-tokens --format]
basemind memory mine [--window --min-support --min-confidence --max-files-per-commit]
basemind memory proposals [--kind --limit --cursor]
basemind memory accept <id> [--key]
basemind memory reject <id> [--reason]
Command Purpose
put <key> <value> [--tag --no-embed --individual] Write a durable note. --individual uses the per-agent tier instead of shared (group).
get <key> [--individual] Read one memory entry by key.
list [--prefix --tag --limit --individual] Enumerate memory entries, newest first.
search <query> [--limit --tag --individual] Semantic search across stored memory.
delete <key> [--individual] Remove a memory entry by key.
audit [--key --individual --dry-run --limit --include-archived] The write history behind memory entries; refreshes verdicts and archives stale records.
documents <query> [--limit --mime-type --scope] Semantic search over indexed PDFs / Office / HTML instead of opening them.
mine [--window --min-support --min-confidence --max-files-per-commit] Derive co-change proposals from git history.
proposals [--kind --limit] List proposals awaiting review.
accept <id> [--key] Accept a proposal into memory.
reject <id> [--reason] Reject a proposal.
Terminal window
basemind admin repo
basemind admin telemetry [--window today|1h|24h|all] [--tool]
basemind admin compress [--path --text --level off|light|moderate|aggressive|maximum --target-tokens --no-preserve-code]
basemind admin tokens --stdin
basemind admin eval --tasks <FILE> [--out --report --markdown --baseline --tolerance --cost-tolerance --min-recall --warmup --mode]

The rest of the former admin verbs live at the top level: status, rescan, cache stats|gc|clear, delta, checkpoint and detect-waste (see Other commands).

Command Purpose
repo Repository identity: workdir, branch, HEAD sha.
telemetry [--window --tool] Aggregate recorded tool calls into a usage and token-savings summary.
compress [--path --text --level --target-tokens --no-preserve-code] Shrink content for re-use in a smaller context: an indexed file’s outline, or a prose pass read from --text/stdin.
tokens --stdin Count tokens in stdin with the o200k tokenizer and print just the integer (needs the tokenizer feature, which documents includes). CLI-only; no --json envelope.
eval --tasks <FILE> [...] Score retrieval quality, latency and token savings over a JSONL task file. CLI-only; see Evaluation.

Requires --features crawl.

Terminal window
basemind web scrape <url> [--no-index --scope]
basemind web crawl <url> [--max-pages --max-depth --scope]
basemind web map <url> [--limit]
Command Purpose
scrape <url> [--no-index --scope] Fetch one URL, extract markdown, and index it. --no-index fetches metadata only.
crawl <url> [--max-pages --max-depth --scope] Follow links breadth-first from a seed URL and index every page.
map <url> [--limit] Discover a site’s URLs from its sitemap and link map without fetching bodies.

Requires --features comms. A thread is addressed by at least two of --subject, --path, and --member; thread-start rejects fewer than two. Every command accepts --as-agent <id> to act as a named sub-identity instead of the CLI’s default agent (used for orchestrating several named subagents).

Terminal window
basemind agents register [--name --description --version --skill --as-agent]
basemind agents list [--thread --as-agent]
basemind agents thread-start [--subject --path --member --as-agent]
basemind agents thread-list [--subject-contains --include-archived --as-agent]
basemind agents join <thread> [--as-agent]
basemind agents leave <thread> [--as-agent]
basemind agents members <thread> [--as-agent]
basemind agents add-member <thread> <member> [--as-agent]
basemind agents remove-member <thread> <member> [--as-agent]
basemind agents archive <thread> [--as-agent]
basemind agents post <thread> <subject> [--body --tag --reply-to --as-agent]
basemind agents history <thread> [--cursor --limit --since-hours --as-agent]
basemind agents message <message-id> [--as-agent]
basemind agents inbox [--cursor --limit --mark-read --since-hours --as-agent]
basemind agents ack [--message-id --thread --to-seq --as-agent]
basemind agents wait [--thread --timeout-secs --since-hours --cursor --as-agent]
basemind agents cleanup [--dry-run --apply --message-ttl-hours --thread-idle-hours --thread-retention-hours --agent-ttl-hours --claim-ttl-hours --as-agent]
basemind agents status [--agent-ttl-hours --as-agent]
Command Purpose
register [--name --description --version --skill --as-agent] Publish or update this agent’s identity card with the broker.
list [--thread --as-agent] Agents known to the broker, optionally restricted to one thread’s members.
thread-start [--subject --path --member --as-agent] Open a thread addressed by subject, path-glob, and/or members.
thread-list [--subject-contains --include-archived --as-agent] Threads discoverable to you: membership, cwd path-match, or subject filter — never all threads.
join <thread> [--as-agent] Join a thread so its messages reach your inbox.
leave <thread> [--as-agent] Leave a thread you joined.
members <thread> [--as-agent] Who belongs to a thread.
add-member <thread> <member> [--as-agent] Add an agent to a thread you created.
remove-member <thread> <member> [--as-agent] Remove an agent from a thread you created.
archive <thread> [--as-agent] Close a thread; creator or human admin only.
post <thread> <subject> [--body --tag --reply-to --as-agent] Send a message to a thread.
history <thread> [--cursor --limit --since-hours --as-agent] A thread’s messages as front-matter only; bodies come from message.
message <message-id> [--as-agent] Read one message body by id — the only path to a body.
inbox [--cursor --limit --mark-read --since-hours --as-agent] Unread messages across your joined threads, front-matter only. --mark-read advances read cursors.
ack [--message-id --thread --to-seq --as-agent] Clear messages you have read from your inbox.
wait [--thread --timeout-secs --since-hours --cursor --as-agent] Block until a peer posts, or the timeout elapses (default 30s, capped at 40s so the call ends before typical MCP host timeouts).
cleanup [--dry-run --apply ...] Preview stale agent, claim, message and thread retention; --apply performs it. TTL flags override the windows in hours.
status [--agent-ttl-hours --as-agent] Active and stale agent counts plus the last maintenance time.

workspace — machine-wide repo/worktree registry

Section titled “workspace — machine-wide repo/worktree registry”

Requires --features comms. Worktree claims are advisory: they record intent in the registry but enforce nothing.

Terminal window
basemind workspace workspaces [--as-agent]
basemind workspace worktrees <repo-id> [--as-agent]
basemind workspace branches <repo-id> [--as-agent]
basemind workspace claim <repo-id> <name> [--as-agent]
basemind workspace release <repo-id> <name> [--as-agent]
Command Purpose
workspaces [--as-agent] Every repository the machine daemon has indexed.
worktrees <repo-id> [--as-agent] Git worktrees of a registered repo, with their branches and claims.
branches <repo-id> [--as-agent] Branches known to a registered repo.
claim <repo-id> <name> [--as-agent] Take ownership of a worktree so another session does not edit it.
release <repo-id> <name> [--as-agent] Give up a worktree claim this session holds.

shell — headless agent terminal sessions

Section titled “shell — headless agent terminal sessions”

Requires --features shells.

Terminal window
basemind shell spawn <command> [--cwd --env --title]
basemind shell send <session-id> <text> [--no-enter]
basemind shell capture <session-id> [--lines]
basemind shell kill <session-id>
basemind shell list
basemind shell broadcast <text> --session <id>… [--no-enter]
Command Purpose
spawn <command> [--cwd --env --title] Start a detached headless shell session; prints session_id.
send <session-id> <text> [--no-enter] Type into a session’s stdin. --no-enter omits the trailing newline.
capture <session-id> [--lines] Read a session’s visible screen; --lines returns only the last N non-blank lines.
kill <session-id> Terminate a session.
list List every session the shell daemon currently hosts.
broadcast <text> --session <id>… [--no-enter] Type the same input into several sessions at once.

Requires --features comms. This is the ONLY surviving basemind comms surface — the messaging verbs it used to carry (register, agents, thread-start, threads, join, post, read, inbox, wait, …) now live under basemind agents (above); comms read <id> became agents message <id>, comms agents became agents list, comms threads became agents thread-list.

Terminal window
basemind comms daemon
basemind comms start
basemind comms stop [--all]
basemind comms status
basemind comms doctor [--probe --clear-fatal]
Command Purpose
daemon Run the broker loop in the foreground: bind the singleton socket, serve front-ends, block until shutdown.
start Ensure the daemon is running (spawn if needed); no-op when already alive.
stop [--all] Ask the running daemon to drain and stop. --all stops every live daemon registered on this machine, not just the current one.
status Report the daemon’s pid / version / uptime / room + subscriber counts.
doctor [--probe --clear-fatal] List every live daemon on this machine (pid / comms dir / version / uptime), flag a pile-up over the ceiling, and prune dead registry entries. Reports process liveness only unless --probe is given, which also asks each daemon whether it can serve. --clear-fatal acknowledges and deletes the recorded fatal store error for this comms dir.
Terminal window
basemind scan [--staged | --rev <REV>] [--no-git-history --rebuild-git-history] [--documents-* --llm-*]
basemind rescan [PATH...] [--full --no-git-history --rebuild-git-history]
basemind watch
basemind serve
basemind status
basemind doctor
basemind completions <bash|zsh|fish|elvish|powershell>
basemind man
basemind init [--yes --with --without --rules-target --settings-target --config-dir .config|.config/basemind --no-rules --no-usage-rules --no-setup-notes --print]
basemind lang list|install|clean
basemind hook install [--force]
basemind cache stats
basemind cache gc [--dry-run]
basemind cache clear [--component]
basemind daemon ensure
basemind statusline
basemind compress-output [--family]
basemind delta --old <FILE> [--new <FILE>]
basemind checkpoint
basemind detect-waste [--log <FILE>]
Command Purpose
scan [--staged | --rev <REV>] [--no-git-history --rebuild-git-history] Full index of the project. --staged indexes the git index instead of the working tree; --rev indexes a revision into a separate rev-<sha7> view. The --documents-* and --llm-* flags override the matching [documents] / [llm] keys for this run (each also has a BASEMIND_DOCUMENTS_* / BASEMIND_LLM_* env var). Ctrl-C stops the scan cleanly.
rescan [PATH...] [--full --no-git-history --rebuild-git-history] Update one or more paths incrementally, or the whole tree with --full. When the daemon is running the rescan is forwarded to it (the daemon is the sole index writer); otherwise it runs in-process under the workspace writer lock. Ctrl-C stops it cleanly. The summary (also when forwarded to the daemon) reports docs_degraded and doc_timeouts when non-zero.
watch Long-running watcher; keeps the code map current as files change (no server).
serve Ensure the daemon is up and relay this process’s stdio to it as the MCP server. The daemon keeps the index fresh.
status Index health for this workspace: file counts, languages, scan age.
doctor Check root, config, index, grammars, pre-commit hook and daemon; exits 1 when a check fails.
completions <shell> Print a shell completion script to stdout.
man Print the man page (roff) to stdout.
init [--yes --with --without --rules-target --settings-target --config-dir --no-rules --no-usage-rules --no-setup-notes --print] Re-runnable onboarding: write basemind.toml, select capabilities, inject usage rules into a gitignored local rules file by default, optionally auto-approve basemind’s tools in Claude Code settings. See Get started.
lang list|install|clean Manage downloaded tree-sitter grammars. install also fetches every grammar marked preload = true under [languages.<name>].
hook install [--force] Add a git pre-commit hook that runs basemind scan --staged. Honours core.hooksPath, works in linked worktrees, never blocks a commit, and refuses to replace a hook basemind did not write unless --force (the old one is kept as pre-commit.bak).
cache stats, cache gc [--dry-run], cache clear [--component --yes] Offline path directly against the machine-global cache. gc runs the real cross-workspace reference-counted sweep (blobs younger than six hours are kept; BASEMIND_BLOB_GC_GRACE_SECS overrides) and prints what it removed. clear is the only way to clear views/all, which the MCP admin cache_clear mode refuses because they back the live index. gc --dry-run only counts blobs and deletes nothing. --component is blobs, views, lance, git-cache (default), telemetry, all, or views:<name> for one view. Everything except git-cache is destructive: it prompts on a terminal and requires --yes otherwise (exit 2). clear exits 3 while a writer holds the workspace lock, and for blobs while the daemon runs; blobs is the machine-global extraction store shared by every workspace.
daemon ensure Ensure the daemon’s streamable-HTTP MCP transport is up; idempotent. Needs --features comms.
statusline Print a one-line summary of the daemon’s hot workspaces, for a shell statusline. Silent and exits 0 when no daemon is running.
compress-output [--family] Backend for the output-compression guardrail: compress stdin (e.g. piped command output) by detected or given family.
delta --old <FILE> [--new <FILE>] Backend for the delta-reads guardrail: diff the --old file against --new (stdin when omitted), emitting a compact +N/-M line diff.
checkpoint Extract decisions/errors/changed-files from session text on stdin into a JSON checkpoint.
detect-waste Flag wasteful tool use from a JSON-Lines tool-call log on stdin.

Human output is a generic table or key/value view. Table cells and outline signatures wider than 200 characters are cut with an ellipsis (key/value fields never are), and the number of cut cells is reported on stderr; --json always carries the full values. The timing footer (startup time plus the tool’s own latency) and other diagnostics go to stderr, so stdout stays pipeable.

Exit code Meaning
0 Success.
1 Runtime error (I/O, scan failure, a tool reported an error, a failed doctor check).
2 Usage error: a bad flag or value (clap), a path outside the repo, or a destructive command without --yes.
3 Busy: another process holds the workspace writer lock. Retry later, or start the daemon so the call is forwarded.
4 Unavailable: the operation needs the comms daemon and none is reachable.
130 Interrupted (Ctrl-C). Work committed before the interrupt is kept; a second Ctrl-C aborts immediately.

When the comms daemon is running it is the sole index writer, so the one-shot tool subcommands open the store without the index and forward index-dependent work to the daemon: memory, code references / callers, the code grep trigram prefilter, and rescan. Without a daemon they read the index directly and read-only.