CLI Reference

The brain CLI is what the slash commands call. This page covers the commands that have no slash-command page of their own. The others are documented with their slash command: recall, memorize, pin, skill, verify and import.

Run brain --help for the full list. Every command reads the brain at ~/.brain/, or at $BRAIN_DIR when that is set. Unless noted, output is JSON.

supersede

Marks memories that are already stored as ended by a newer one that is also already stored. Each old memory gets superseded_by and a valid_until (the successor's valid_from or created, unless you pass --valid-until), the successor records supersedes, and the two are linked. Nothing is deleted: recall demotes the old fact and can still answer "that was true until then".

brain supersede <old_id> [<old_id>...] --by <new_id> [--valid-until ISO] [--dry-run]
FlagDescription
--by <new_id>The successor. Required.
--valid-until <ISO>The date the old fact stopped being true, when it differs from the successor's start.
--dry-runPrint what would be superseded and what would be skipped, without writing.

An unknown id, a memory superseding itself, and a pair that would form a cycle are reported under skipped.

review

Lists maintenance proposals: duplicate memories, likely supersessions, faded memories and signature problems, each with the command that would apply it. It changes nothing.

brain review

audit

Scans the audit log, the index and the associations for anomalous writes: write bursts, co-tagged low-trust cliques and quietly reinforced low-trust memories. It also reports content_drift, memories whose bytes no longer match the baseline taken when they were written. The sleep cycle runs it as Phase 0. See Provenance & Trust.

brain audit [--window 24h|7d] [--apply] [--max-apply N]
brain audit --rebaseline
FlagDescription
--window <duration>How far back to scan, for example 24h or 7d. Default 24 hours.
--applyQuarantine the memories the scan proposes. They then wait in brain verify list.
--max-apply <N>The most memories one --apply run may quarantine. Default 20. truncated: true reports a cut.
--rebaselineRecord the current bytes of every memory as the trusted baseline. Run it after a bulk edit you made yourself.

keys

Every memory written by brain memorize is signed with an Ed25519 key kept on this machine in ~/.brain/.local/, which is never synced. Each device keeps its own list of trusted signers. brain keys shows this device's key and manages that list.

brain keys show
brain keys list
brain keys trust <public-key> [--label NAME]
brain keys untrust <key-id>
brain keys status
brain keys sign-existing [--dry-run]
SubcommandDescription
showThis writer's key id and public key.
listThe signers this device trusts.
trust <public-key>Trust another device's key or the connector's key. --label names it.
untrust <key-id>Stop trusting a signer.
statusCounts memories by signature state: valid, unsigned, invalid, untrusted-signer. Lists the invalid ones.
sign-existingSigns every memory that is unsigned or signed by an untrusted key, as this writer. Run it once to adopt signing. A memory with an invalid signature (edited since it was signed) is reported and never re-signed. --dry-run previews.

The signature_mode setting in ~/.brain/config.json decides what a signature state does. flag (the default) marks results with their signature state. enforce treats unsigned, invalid and untrusted-signer memories as external and holds them out of recall and session start. off disables the check.

info

A signature proves which key wrote a memory. It does not prove that the writer told the truth about where the fact came from.

episodes

Renders Claude Code and Codex transcripts into line-numbered files under ~/.brain/.local/episodes/, so an agent can search past sessions the way it searches code. Episodes stay on this machine and are never synced.

brain episodes ingest [--source claude-code|codex] [--since ISO] [--project P] [--limit N]
brain episodes search "<terms>" [--regex PATTERN] [--project P] [--source S] [--limit N] [--context N]
brain episodes read <episode-id> [--from L] [--to L]
brain episodes stats
SubcommandDescription
ingestReads the transcripts and writes the episodes. It keeps prompts, replies and one line per tool call, drops tool results, and redacts recognisable credentials.
searchLines that contain every term, or that match --regex, newest first. Each hit carries a citation of the form episode:<source>/<session>#L<n>.
readA line range of one episode. Without --from and --to, the first 80 lines.
statsHow many episodes exist, per source, and over what dates.

port

Moves memories between brain and other memory systems. See Moving Memory for the workflows.

brain port export --format <claude-memory|markdown|agentcore|agent-memory> [--out PATH]
brain port import --from <claude-memory|markdown|agentcore|agent-memory> <PATH> [--trust] [--dry-run]
brain port discover
FormatWhat it is
claude-memoryClaude Code's file-based memory: one Markdown file per memory plus a MEMORY.md index.
markdownOne line per memory, [YYYY-MM-DD] - <title>: <text>.
agentcoreAWS Bedrock AgentCore Memory BatchCreateMemoryRecords request bodies.
agent-memoryOne Markdown file per memory in the draft shared agent-memory record. The draft's field names are not final, so this format can change.

export writes only what recall could show. Memories pending verification, sensitive memories hidden for consent, and expired memories are left out and counted under skipped. claude-memory and agent-memory need --out <directory>. The other two print to standard output unless --out names a file. The result's fidelity field says which fields survive in that format.

import sends every memory through brain memorize, so the origin policy, the content lint and quarantine all apply. Imported memories get origin external and wait in brain verify list until you approve them.

FlagDescription
--trustStore the imports with origin user. Right only for an export of your own memory.
--dry-runPrint the memorize payload without writing it.

discover lists the Claude Code memory directories on this machine (~/.claude/projects/<repo>/memory/) with the import command for each. It also reports whether Codex's memories_v2 directory exists. Brain does not import that one, because it has no documented format.

restore

Rolls the whole brain back to an earlier restore point.

brain restore --list [--from git|cloud] [--limit N]
brain restore --to <commit|version> [--from git|cloud] [--passphrase <p>]
FlagDescription
--from <source>Where the restore points come from. git (the default) uses the commits in the Git sync history, one per push. cloud uses the snapshots Brain Cloud takes before each upload replaces the stored brain.
--listList the restore points.
--limit <N>How many to list. Default 20.
--to <point>The commit or version to restore.
--passphrase <p>The passphrase, when Git sync is encrypted.

A restore can be undone. From Git, a safety snapshot of the current state is committed first. From the cloud, a backup of the current state is written under ~/.brain/.cloud/ first. A restore from the cloud leaves _archived/ and config.json as they are, so memories archived since the snapshot are kept and this device's quarantine and consent settings do not change. audit.log is carried forward, and the restore is logged there.

session-start

Returns everything an agent should take in at the start of a session, in one call, bounded by the working-memory token budget. Agents and hooks call it. See Working Memory.

brain session-start [--project P] [--topics a,b] [--task T] [--top N] [--budget TOKENS] [--model ID]
FlagDescription
--project <P>The current project, used for context matching and project-scoped pins.
--topics <a,b>Topics of the session, comma-separated.
--task <T>The task type, for example debugging or implementing.
--top <N>How many memories to rank into context_recall. Default 5.
--budget <TOKENS>Lowers the token cap for this call. It never raises it.
--model <ID>The model that will read the payload. If model_budgets in ~/.brain/config.json has an entry whose key is a prefix of this id, the longest matching entry lowers the cap the same way --budget does. Brain ships no defaults for that table.

The payload:

FieldMeaning
memory_countMemories in the brain.
pinnedThe always-present memories that apply here.
skills_indexName and description of each advertised skill.
context_recallMemories relevant to this project. Each carries a receipt.
recall_modeall when the brain is small enough that every current memory is listed, otherwise ranked.
due_for_reviewHow many memories are due for review.
expired_pinsPins whose validity window has closed. They are left out of pinned.
pending_verification, pending_verification_itemsHow many memories wait in quarantine, and up to five already visible in this session.
low_confidence_alertsLow-confidence memories that are used often.
faded_excludedPresent when memories were left out because their decayed strength is below ambient_min_strength.
signature_heldPresent when memories were held back under signature_mode: enforce.
low_trust_suppressedPresent when low-trust memories were held back by recall_low_trust_max.
sleep_duePresent when maintenance is overdue: seven days since the last sleep with at least 10 new memories, or 40 new memories at any age.
unsaved_notablesPresent when recent sessions flagged items in notable_unsaved that no later write picked up.
recall_usage_7dHow much of what brain surfaced over the last week the agent used.
budgetThe caps, the tokens used, and how many entries were included and excluded.

reinforce

Applies spaced reinforcement to the given memories: a strength boost, a slower decay rate, an updated access_count, last_accessed and recall_history. Memories passed together also have the association edges between them strengthened. See Spaced Reinforcement.

brain reinforce <id> [<id>...]

Where brain's plugin hooks run (Claude Code and Codex), a memory cited with a ◉ memory: receipt is reinforced by the Stop hook, once per session, so this command is for hosts without those hooks.

unpin

Removes a memory from the always-present tier. It goes back to normal recall and decay. See /brain:pin.

brain unpin <id>

forget

Archives one memory. The file moves under _archived/, the memory leaves the index, its association links, the review queue and the search index, and the archival is recorded in audit.log. It can be recovered. Erasing a memory for good is the agent-driven /brain:forget --deep.

brain forget <id> [--force]
  • --force: archive a memory with salience 0.7 or higher, which is refused otherwise.

cloud

Syncs ~/.brain/ with Brain Cloud or with a store you host yourself. /brain:sync explains how the merge decides. Output is plain text.

brain cloud login [--api-url URL] [--brain NAME|ID]
brain cloud login --api-url URL --token-stdin
brain cloud logout
brain cloud brains
brain cloud use NAME|ID [--create]
brain cloud sync [--allow-deletions]
brain cloud push [--force] [--allow-deletions]
brain cloud pull [--overwrite] [--allow-deletions]
brain cloud status
CommandDescription
loginAuthenticates with the device code flow: open the printed URL and approve the code. --brain <name or id> links that brain, creating it if no brain has that name. Without it, the account's first brain is linked. --api-url names another store.
login --token-stdinLogs in to a self-hosted store with a token read from standard input. --token TOKEN and the BRAIN_STORE_TOKEN environment variable also work. --allow-http permits plain HTTP to a host other than this machine.
logoutClears the stored credentials.
brainsLists the account's brains. * marks the linked one.
use <name or id>Syncs with another brain. --create makes a new one. ~/.brain/ is left as it is.
syncMerges this brain and the cloud, memory by memory. Nothing is lost on either side.
pushUploads ~/.brain/. If the cloud has changes this device has not seen, it merges both sides first.
push --forceUploads without merging and replaces what the cloud holds.
pullMerges the cloud's changes into ~/.brain/ without uploading.
pull --overwriteWrites the cloud's files over the local ones, after taking a local backup. _archived/ and config.json are left as they are.
statusShows the API URL, the account, the linked brain, the cloud size and file count, and the last push, pull and sync.

A sync that would remove more than a fifth of the brain (and more than five memories) stops and changes nothing. --allow-deletions lets it through.