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]| Flag | Description |
|---|---|
--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-run | Print 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 reviewaudit
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| Flag | Description |
|---|---|
--window <duration> | How far back to scan, for example 24h or 7d. Default 24 hours. |
--apply | Quarantine 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. |
--rebaseline | Record 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]| Subcommand | Description |
|---|---|
show | This writer's key id and public key. |
list | The 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. |
status | Counts memories by signature state: valid, unsigned, invalid, untrusted-signer. Lists the invalid ones. |
sign-existing | Signs 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.
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| Subcommand | Description |
|---|---|
ingest | Reads the transcripts and writes the episodes. It keeps prompts, replies and one line per tool call, drops tool results, and redacts recognisable credentials. |
search | Lines that contain every term, or that match --regex, newest first. Each hit carries a citation of the form episode:<source>/<session>#L<n>. |
read | A line range of one episode. Without --from and --to, the first 80 lines. |
stats | How 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| Format | What it is |
|---|---|
claude-memory | Claude Code's file-based memory: one Markdown file per memory plus a MEMORY.md index. |
markdown | One line per memory, [YYYY-MM-DD] - <title>: <text>. |
agentcore | AWS Bedrock AgentCore Memory BatchCreateMemoryRecords request bodies. |
agent-memory | One 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.
| Flag | Description |
|---|---|
--trust | Store the imports with origin user. Right only for an export of your own memory. |
--dry-run | Print 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>]| Flag | Description |
|---|---|
--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. |
--list | List 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]| Flag | Description |
|---|---|
--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:
| Field | Meaning |
|---|---|
memory_count | Memories in the brain. |
pinned | The always-present memories that apply here. |
skills_index | Name and description of each advertised skill. |
context_recall | Memories relevant to this project. Each carries a receipt. |
recall_mode | all when the brain is small enough that every current memory is listed, otherwise ranked. |
due_for_review | How many memories are due for review. |
expired_pins | Pins whose validity window has closed. They are left out of pinned. |
pending_verification, pending_verification_items | How many memories wait in quarantine, and up to five already visible in this session. |
low_confidence_alerts | Low-confidence memories that are used often. |
faded_excluded | Present when memories were left out because their decayed strength is below ambient_min_strength. |
signature_held | Present when memories were held back under signature_mode: enforce. |
low_trust_suppressed | Present when low-trust memories were held back by recall_low_trust_max. |
sleep_due | Present when maintenance is overdue: seven days since the last sleep with at least 10 new memories, or 40 new memories at any age. |
unsaved_notables | Present when recent sessions flagged items in notable_unsaved that no later write picked up. |
recall_usage_7d | How much of what brain surfaced over the last week the agent used. |
budget | The 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| Command | Description |
|---|---|
login | Authenticates 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-stdin | Logs 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. |
logout | Clears the stored credentials. |
brains | Lists 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. |
sync | Merges this brain and the cloud, memory by memory. Nothing is lost on either side. |
push | Uploads ~/.brain/. If the cloud has changes this device has not seen, it merges both sides first. |
push --force | Uploads without merging and replaces what the cloud holds. |
pull | Merges the cloud's changes into ~/.brain/ without uploading. |
pull --overwrite | Writes the cloud's files over the local ones, after taking a local backup. _archived/ and config.json are left as they are. |
status | Shows 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.