Docs · CLI reference

Every command.
Six of them
do the work.

You reach for the rest when something is wrong, when a fact needs fixing or when you work across projects. Every command and flag on this page was generated from the binary's own help output, so nothing is missing and nothing is invented. os-brain help <command> shows the same list in your terminal.

The six you use every day #

Learn these six and you know the tool. Everything after this section can wait until you need it.

$ os-brain brief                        # what this project believes. Read it first.
$ os-brain recall "nginx timeout"       # before you search files
$ os-brain remember "..." --body "..." --type gotcha
$ os-brain prefer "commit messages stay lowercase" --why "corrected twice"
$ os-brain log "deployed 1.4 to the edge box" --kind deploy
$ os-brain note billing-api "rounding moved to the ledger"  # never write into another project

Add --json to any command and you get structured output instead of the text a person reads. For recall this matters: the output carries matched and a script must check it before acting on the results, because a miss returns nothing rather than the whole scope.

Flags take one dash or two (-n 5 and --n 5 are the same) and may come before or after the positional words, so recall foo --json works. The tables below list every flag each command registers, taken from os-brain help <command>. Positional arguments (a subcommand, an id, a query) follow the command name.

Writing #

Three commands put things into the brain. Each one is a single line on purpose: when saving a fact takes effort, nobody saves it.

remember store a memory (same scope+title updates in place)

Saves a fact that should last. A memory is identified by its scope plus its title (normalised for case, punctuation and accents), so saving the same title again in the same scope improves that memory instead of adding a copy. Words typed straight after remember are the title.

Three refusals protect the store. A different body under an existing title is refused unless you say what you mean: --update replaces it (the old version goes to history), --supersedes records that the fact changed. A second memory about the same subject in the same scope is refused with the id already held. And --confidence confirmed is refused unless someone outside this session could check it, because confirmed outranks everything else for good and so takes evidence rather than a self-assessment.

$ os-brain remember "nginx terminates TLS on the edge box" --type infra \
      --body "The edge box runs nginx; the app servers only speak plain HTTP on loopback."
remembered #1 [global/infra] nginx terminates TLS on the edge box

$ os-brain remember "Invoice rounding happens in the ledger" --type decision \
      --body "Rounding moved from the API to the ledger so totals match the PDF." --confidence confirmed
refusing 'confirmed': nothing here can be checked by anyone who was not in this session.
  'confirmed' outranks everything else forever, so it takes evidence, not a self-assessment.
  Add --source "<file, command or URL>", --ref "<path:line>", or --source "stated by the user" (the phrase itself, not a source that contains the word); or store it as --confidence reported.
FlagWhat it does
--allow-duplicateStore it even though the brain thinks another memory in this scope is about the same thing. For when that check is wrong.
--allow-secretStore text the credential scanner flagged. Scanners get it wrong sometimes and this is how you say so.
--body <text>The fact itself. - reads it from stdin (not over MCP, where stdin is the protocol).
--body-file <text>Read the body from a file, for anything long enough that shell quoting could break it. Over MCP the file has to be inside the project.
--claim-okThe body mentions "supersedes #N" only as history. Without it, a body that claims to replace a live memory is refused unless --supersedes names that id, because writing it in the text retires nothing.
--confidence <text>confirmed | reported | assumed. Ranking multiplies by 1.15, 1.0 and 0.8.
--date <text>When it happened, if you are recording it later.
--everywhereAlways refused: a local brain has no level above the project to store it at. The refusal says so rather than storing it in this project and calling it global.
--fork-okSupersede a memory that another correction already superseded. Without it this is refused, because two current versions of one fact is what superseding exists to prevent.
--importance <n>1 to 5, 3 neutral. How much is at stake, not how relevant it is. Default 3.
--no-reviewStore no review date, even for a type that defaults to one.
--pinAlways shown in the brief, whatever its rank.
--ref <text>Repeatable. A link to another memory, a ticket or a path.
--review <text>Ask for a re-check on this date. infra and access default to 30 days out.
--scope <text>Where it applies. global means everywhere in this project. Scopes nest on :. Default global.
--snooze-until <text>Keep it out of the brief until this date.
--source <text>Where the fact came from: a file, a command, a URL or stated by the user. session, the default, points at nothing.
--source-date <text>When the source said it, which may differ from when you saved it.
--supersedes <n>The id this memory replaces. The old one stays in history and a search in its wording returns the new one.
--title <text>Half of what identifies the memory. Use the words a future session would search for.
--trust <text>stated | imported | external. Whose claim it is. Default stated.
--type <text>Sets how fast the memory fades (its decay tier). Of all these flags this one matters most. See concepts. Default note.
--updateAllow replacing the body of an existing memory with the same title.
--valid-from <text>The date this became true.
--valid-to <text>The date it stops being true.

prefer store how the user wants to be worked with

Records how the user wants to be worked with. It is one short command because a preference that takes effort to save never gets saved. --why is the part that matters three months later, when the rule looks arbitrary and nobody remembers what caused it. The prompt hook spots preference language in what the user types and reminds the agent to save it.

$ os-brain prefer "answers first, reasoning after" --why "asked twice"
remembered #5 [global/preference] answers first, reasoning after
FlagWhat it does
--about <text>A person, which makes this a relationship memory rather than a general preference.
--confirmedThey stated it outright; you did not infer it.
--importance <n>1 to 5, 3 neutral.
--pinAlways shown in the brief.
--scope <text>Where it applies. Default global.
--source <text>Where it came from.
--supersedes <n>The id of the preference this one replaces.
--updateAllow replacing an existing preference with the same title.
--why <text>What prompted it. The part worth keeping.

log append an activity event

Adds an entry to the activity log. Log entries are never ranked and never fade. They answer "what did the last session actually do" and the brief reads them for exactly that. Declare kinds with os-brain kind add so map can tell a real kind from a typo.

$ os-brain log "deployed 1.4 to staging" --kind deploy
logged event #1 [deploy] deployed 1.4 to staging
FlagWhat it does
--actor <text>Who did it. Default claude.
--allow-secretLog text the credential scanner flagged.
--date <text>The day it happened, when that was not today.
--kind <text>What sort of event: deploy, incident or whatever this project declared. Default note.
--ref <text>A link: a commit, a ticket or a path.
--scope <text>Where it happened. Default global.
--summary <text>The text, when you would rather not pass it positionally.

Reading #

What a session reads. brief and wakeup are the handoff, recall is the search and the rest answer narrower questions.

recall retrieve ranked memories

Full-text search first, then the ranking score (relevance, type, confidence, age and use). A superseded memory does not vanish: recall follows the link to its replacement and returns that, so a search in the old wording still finds the current fact. When no memory holds most of the words in the query, the answer is labelled a loose match: leads, not answers.

A miss returns nothing. With --json, when nothing matches you get an empty result, not the whole scope. The output carries matched so a script can tell the two apart. It works this way because a script once fed a recall miss into a forget loop and deleted real memories: the warning was in the text output and the script was reading JSON.

An unknown --type or --tier is an error, never an empty result, so a typo cannot pass for "nothing stored".

$ os-brain recall "invoice rounding"
#2  [global/decision] (score 0.483) Invoice rounding happens in the ledger [confirmed]
      Rounding moved from the API to the ledger so totals match the PDF.
      (stated by the user)

$ os-brain recall "kubernetes ingress" --json
{
  "count": 0,
  "matched": false,
  "query": "kubernetes ingress",
  "results": [],
  ...
}
FlagWhat it does
--allInclude the superseded versions too, when you want the history rather than the answer.
--all-projectsSearch past this project, in a shared store. Private projects stay out.
--browseFor --json: on a miss, return the scope instead of nothing. The text output already does this.
--from <text>Saved or changed on or after this date.
--n <n>How many results. Default 8.
--no-touchDo not count this search as a use, so a cleanup sweep does not skew the usage numbers it is checking.
--on <text>Saved or changed on this one day.
--scope <text>Search from this scope. It sees this scope and every scope it nests in, never the ones inside it.
--since <n>Saved or changed within this many days.
--strictNever fall back to the scope, in either output.
--tier <text>A B C D N. Anything else is an error.
--to <text>Saved or changed on or before this date.
--type <text>Only one memory type. An unknown type is an error.

brief session handoff snapshot

The handoff a new session reads first: the wall clock and the part of the day, where the brain is, the axioms, how this person wants to be worked with, pinned facts, policies and constraints, what is new since the last brief, measures out of band, open tasks and recent activity. Ask for it whenever you want to know what the project believes right now.

$ os-brain brief
...
  now       2026-11-20 23:59:38 GMT (Friday night)
  project   orchard at /home/you/src/orchard
  brain     LOCAL FILE · /home/you/src/orchard/brain/brain.db
...
## HOW THEY WANT TO WORK
  #5 [preference] answers first, reasoning after
     asked twice

## PINNED (read first)
  #1 [infra] [never verified] nginx terminates TLS on the edge box
     The edge box runs nginx; the app servers only speak plain HTTP on loopback.
FlagWhat it does
--max-bytes <n>Trim from the least important end to fit; 0 keeps everything. brief prints everything unless you set a limit, because you asked for it. OS_BRAIN_MAX_BYTES sets the default.
--max-pinned <n>Cap on the pinned section. Default 15.
--max-prefs <n>Cap on the preferences section. Default 8.
--new-for <n>Days of "new since you were last here" it always shows. Default 1.
--new-project-below <n>While the brain holds fewer memories than this, show the house standards in full. Default 15.
--no-axiomsLeave out the rules that hold in every project.
--no-cursorDo not move the last-brief marker, so the next real session still sees what is new.

wakeup session open: the brief, the working tree and this project's own probes

What the session-start hook runs: the brief, plus the live state of the working tree read from git (staged, modified and untracked files by name, unpushed commits, a merge or rebase left half done), plus any probes this project declared. It goes straight into a session, so it is trimmed to 6000 bytes by default.

A probe is a shell command the project wants run when a session opens, declared with wakeup add --name --run and managed with rm and list. Probes live in brain.json, which is committed, so a probe list arrives with every clone. That is why a probe only runs after wakeup trust, which a person answers at a terminal after seeing the exact text. It is refused over MCP. Editing a probe revokes its approval. Over HTTP, add and rm are refused too: a remote caller does not get to edit what this machine runs.

$ os-brain wakeup add --name tests --run "go test ./... 2>&1 | tail -3"
$ os-brain wakeup trust          # a person, at a terminal, types yes
$ os-brain wakeup --no-probes    # the brief and the tree, nothing run
FlagWhat it does
--chars <n>Probe output kept. Default 1200, max 8000.
--emit <text>Print the envelope a host agent needs instead of plain text: cursor, gemini, codex or hermes. init sets this for you. Without it, plain text.
--max-bytes <n>Trim from the least important end to fit; 0 for all of it. OS_BRAIN_MAX_BYTES sets the default.
--name <text>Probe name, for add and rm.
--no-briefOnly the live state, without the brief.
--no-cursorDo not move the last-brief marker.
--no-probesSkip this project's declared probes.
--no-treeSkip the working-tree read.
--run <text>The shell command the probe runs, for add.
--timeout <n>Seconds a probe may take. Default 10, max 60.

get show one memory by id

Shows one memory in full: every metadata field, where it came from and what it supersedes or is superseded by.

$ os-brain get 1
FlagWhat it does
--all-projectsRead another project's memory (never a private one).

open what is outstanding: open tasks, work in flight, what just happened

What is still outstanding: open tasks, work in flight and what just happened, straight from the brain. It answers "where did we leave off" in a few hundred tokens where working it out from git log costs thousands. outstanding and status are other names for the same command.

$ os-brain open --full
FlagWhat it does
--compactThe hook's form: shortest extracts.
--fullTask bodies too and longer memory extracts.
--n <n>How many in-flight memories and events. Default 6.

events recent activity

The activity log, newest first.

$ os-brain events --kind deploy --since 7
FlagWhat it does
--all-projectsInclude other projects in a shared store.
--kind <text>Only this kind.
--n <n>How many. Default 20.
--scope <text>Only this scope.
--since <n>Within this many days.

stats counts

Counts. Its second line is the database file it actually opened. Check that path before you trust a count: a project on the shared store and a project on its own file look the same until you do.

$ os-brain stats
memories=4 (pinned 1, superseded 0) [A1 B2 C1] scopes=1 events=2 leads=0 measures=1/1 keys
db=/home/you/src/orchard/brain/brain.db

No flags of its own beyond --json.

map index of scopes, types, event kinds and pinned memories

Lists the scopes, types, event kinds and pinned memories, comparing what brain.json declares with what is actually stored. A scope somebody created with a typo shows up here.

$ os-brain map --top 5
FlagWhat it does
--top <n>Top memories to show per scope. Default 3.

coverage what this project knows about, by category

What this project knows about, by category. After a search that found nothing, --near shows what is stored close to it.

$ os-brain coverage --near "certificate renewal"
FlagWhat it does
--near <text>What is held near this, for a search that found nothing.

env date, time, paths, git and project context

The date, the time, every path it resolved and the git and project context. Run it first when something is not where you expected.

$ os-brain env

No flags of its own beyond --json.

Correcting #

A fact that was wrong, or stopped being true, is corrected in place rather than deleted. The old version stays in history so a mistake can always be traced.

update edit a memory

For the same fact in better words. It takes most of what remember takes. --trust, --valid-from, --valid-to, --supersedes and --allow-duplicate are set when a memory is first written and cannot be changed later. When the fact itself changed, use remember --supersedes instead, so a search in the old wording lands on the new fact.

$ os-brain update 2 --body ""
refusing to blank the body of #2 ('Invoice rounding happens in the ledger'), which holds 74 characters.
An empty --body is usually a command that failed to produce the text it meant to pass.
If you do mean to empty it, pass --force. To retire the fact instead, forget it or supersede it with the memory that replaces it
FlagWhat it does
--allow-secretStore text the credential scanner flagged.
--body <text>The new body.
--body-file <text>Read the new body from a file.
--confidence <text>confirmed | reported | assumed, with the same evidence rule as remember.
--date <text>When it happened.
--forceAllow --body "" to empty a body that is not empty.
--importance <n>1 to 5.
--no-reviewClear this memory's review date.
--pinAlways show it in the brief.
--ref <text>Repeatable. A link to another memory, a ticket or a path.
--review <text>Ask for a re-check on this date.
--scope <text>Refile into another scope.
--snooze-until <text>Keep it out of the brief until this date.
--source <text>Where it came from.
--source-date <text>When the source said it.
--title <text>A new title.
--type <text>A new type, which changes how it decays.
--unpinStop always showing it in the brief.
--unsupersedeClear this memory's superseded_by link, leaving both standing.

verify mark a memory re-checked today

Marks a memory re-checked today and can raise --confidence when you give a --source. That is what stops review --stale-days flagging it.

$ os-brain verify 1 --source "nginx -v on the edge box"
verified #1 at 2026-11-21 00:03
FlagWhat it does
--confidence <text>Raise or lower it while you are at it.
--source <text>What you checked it against.

history archived versions of memories

Archived versions of memories: every update, forget and supersede leaves one.

$ os-brain history --id 3
FlagWhat it does
--id <n>Only this memory's archived versions.
--n <n>How many versions to show. Default 20.

restore bring back an archived version

Brings an archived version back by its history id. Over a memory that is still current it needs --force, because rolling a live fact back is a different act from undoing a delete.

$ os-brain restore 7
FlagWhat it does
--forceRoll a live memory back to the archived version.

promote move a memory up to a wider scope

Moves a memory up to a wider scope, when it turns out to apply beyond where it was saved.

$ os-brain promote 12 --to channel
FlagWhat it does
--to <text>Destination scope. Default global.

Tasks and measures #

Neither one is a memory and we keep them apart on purpose: a task is something owed by a date and a measure is a number that only means something as a series. Tasks has its own page.

task what is owed, by whom and when: reminders, recurrence, an ordered list

What is owed, by whom and when. With no subcommand it lists the open tasks. The subcommands are add, list, due, done, drop, wait, reopen, snooze, set and todo. A flag the subcommand does not read is refused rather than ignored. A task is delivered when a session is open and somebody is typing: nothing here wakes a machine or acts unattended.

$ os-brain task add "renew the edge certificate" --when "every monday 9am"
task #1 [user] renew the edge certificate
  due 2026-11-23 09:00 (every mon at 09:00)

$ os-brain task list
[ ] #1   renew the edge certificate  (due 2026-11-23 09:00 · every mon at 09:00)

$ os-brain task snooze 1 --until "in 2 hours"
$ os-brain task done 1
$ os-brain task todo --out TODO.md
FlagWhat it does
--allClosed ones too.
--allow-outsideWith todo: write outside the project.
--allow-secretStore it anyway; it is a false positive.
--allow-trackedWith todo: write to a git-tracked path.
--body <text>With add or set: the detail.
--notifyWith add or set: mark the task for notification. The flag is stored and exported with the task.
--out <text>With todo: where to write it.
--owner <text>user | agent: who owes it.
--scope <text>With add or set: where it belongs.
--state <text>With list: open | waiting | done | dropped.
--title <text>With set: the new title; with add: instead of the words.
--until <text>Snooze this occurrence until.
--when <text>"in 3 hours", "tomorrow 9am", "every monday 9am", "daily 17:00"; with set, "none" clears it.

measure numbers that only mean something as a series

Numbers that only mean something as a series. The subcommands are add, series, list, limit, forget <id> and relabel <id>, which changes a reading's unit and never touches its value. A band declared with limit makes the brief flag a reading outside it.

$ os-brain measure add latency_p95 182 --unit ms
#1 latency_p95 = 182 ms on 2026-11-20

$ os-brain measure limit latency_p95 --high 250 --better down --why "slo"
band for latency_p95: low= high=250 better=down

$ os-brain measure series latency_p95 --from 2026-11-01
FlagWhat it does
--allow-secretStore it anyway; it is a false positive.
--better <text>With limit: up | down, which direction is good.
--confidence <text>confirmed | reported | assumed.
--date <text>When it was taken.
--from <text>With series: start date.
--high <n>Band ceiling.
--label <text>A human name for the key.
--low <n>Band floor.
--n <n>With series: how many readings.
--note <text>A note on this reading.
--ref <text>A link: a dashboard, a run, a path.
--scope <text>Where it belongs.
--source <text>Where the reading came from. Default session.
--to <text>With series: end date.
--unit <text>The unit: ms, %, EUR.
--why <text>With limit: why the band is where it is.

Keeping it healthy #

An old fact looks exactly like a current one. That is the biggest risk with any memory and these four commands are how you catch it.

review hygiene report: duplicates, decay, promotions

The hygiene report: duplicates, memories past their decay, memories worth promoting and tier A or B facts nobody has re-checked in --stale-days. The duplicate scan compares memories in pairs, so it is capped. It finishes with what this brain has never used at all, such as no event logged or no summary in the shared index.

$ os-brain review --stale-days 90
FlagWhat it does
--duplicatesRun the pairwise scan anyway.
--max-pairwise <n>Skip the pairwise duplicate scan when it would compare more memories than this. Default 600.
--n <n>How many items per section. Default 8.
--stale-days <n>Tier A/B unverified for this long is flagged. Default 180.

doctor check the brain for inconsistency

Checks the brain for inconsistency: dangling links, supersede cycles, index drift and series that mix units. --fix repairs what can be repaired and names the rest.

$ os-brain doctor
...
4 live memories for orchard · 4 rows including superseded · schema v16 · /home/you/src/orchard/brain/brain.db

no problems found
FlagWhat it does
--fixRepair the repairable problems.

reindex rebuild the FTS index from the memories table

Rebuilds the full-text index from the memories table, when doctor reports drift.

$ os-brain reindex

No flags of its own. It prints plain text even with --json.

vacuum checkpoint the WAL and compact the database

Checkpoints the write-ahead log and compacts the database file.

$ os-brain vacuum

No flags of its own beyond --json.

Deleting #

Agents drive the brain and an agent that typed a delete is not asked whether it is sure. If you typed it, you meant it. A guard flag is still needed in a few cases and each one catches an accident rather than a decision:

What they have in common: when the tool cannot tell what you meant, it does nothing and says so. It never does the biggest thing it could.

forget delete a memory (leaves a tombstone)

Deletes one memory and leaves a tombstone so the same fact is not learned again as new. It archives first (so restore can undo it) and records --reason. Without --force it refuses a pinned memory, a guardrail and a memory that supersedes others, because deleting that last one would put the facts it retracted back into search results.

--purge is for something that should never have been saved: no version is kept, every version already stored is deleted and nothing can bring it back. Typing it is the decision, so it includes --force. The tombstone stays, title only.

forget --all empties this project, pinned memories included. It is a dry run unless you add --apply and then --i-mean-it on top. It writes a dump of this project first. In a shared store it deletes this project's rows and nobody else's.

$ os-brain forget 1
#1 is pinned: 'nginx terminates TLS on the edge box'
Load-bearing memories are not deleted by accident. Re-read it (os-brain get 1), then use --force, or supersede it instead.

$ os-brain forget 4
#4 is the current version of 1 superseded memory. Deleting it would put these back into recall as live facts:
  #3 Rounding of invoices is done by the ledger
Supersede it with a correct version instead, or pass --force to accept the resurrection.

$ os-brain forget --all
...
would delete:
  memories         4
...
4 rows. Nothing has been changed. Add --apply --i-mean-it to do it.
FlagWhat it does
--allEvery memory in this project, pinned included.
--allow-outsideWrite the dump outside the project.
--allow-trackedWrite the dump to a git-tracked path.
--applyWith --all: actually do it (default: report the plan).
--backup <text>With --all: where to write the dump taken first.
--everything--all plus activity, measures, leads and history.
--forceDelete a pinned memory, a guardrail or the current version of a correction.
--i-mean-itWith --all --apply: confirm the wipe.
--purgeDestroy it: no archived version kept, every one already held deleted, nothing can restore it.
--reason <text>Why, recorded with the tombstone.

prune delete decayed or superseded memories (dry run by default)

Removes decayed and superseded memories. You say which with --tier or --superseded; with neither it refuses. It is a dry run unless you add --apply. It refuses tier A or B without --i-mean-it (those never decay, so pruning them deletes the load-bearing part of the brain), keeps any memory that supersedes another, refuses more than 25 deletions or half the brain without --yes and dumps the brain before deleting anything.

$ os-brain prune
say what to prune: --tier D (decayed ephemera) or --superseded

$ os-brain prune --tier A --older-than 1
tier A never decays: access, gotcha, incident, infra. Pruning it deletes the load-bearing part of the brain. Pass --i-mean-it if that is really the intent.

$ os-brain prune --tier D --apply
FlagWhat it does
--all-projectsEvery project in a shared store. Needs --i-mean-it.
--allow-outsideWrite the dump outside the project.
--allow-trackedWrite the dump to a git-tracked path.
--applyActually delete (dry run without it).
--backup <text>Where to dump before deleting.
--forceOverwrite a --backup file this tool did not generate.
--i-mean-itRequired for tier A/B and --all-projects.
--max-delete <n>Refuse a run that would delete more than this many without --yes. Default 25.
--older-than <n>Only memories older than this many days. Default 30.
--scope <text>Only this scope.
--supersededPrune retracted memories.
--tier <text>A B C D. A and B need --i-mean-it.
--yesAccept a large deletion.

Export, import, backup and snapshot #

Export carries everything, so you are never locked in. A snapshot is generated, never written by hand: keep a hand-written memory file next to a brain and sooner or later the two disagree without telling you.

Every command that writes a file follows the same rules. That means export --out, snapshot --out, backup --out, task todo --out and the dumps that prune, forget --all and uninstall take before deleting. They refuse to overwrite a file that lacks their own generated-by marker, refuse a path inside a git repository that is not gitignored, refuse a path outside the project, refuse to write through a symbolic link and write with mode 600. --force, --allow-tracked and --allow-outside each lift exactly one of those. Nothing lifts the symbolic link rule, because a link committed in a repository can point at any file you own.

$ os-brain export --out dumps/e.json
dumps/e.json is inside a git repository and is not gitignored.
A snapshot is every memory in cleartext.
  gitignore it, then re-run   no flag needed, and the usual answer
  a path outside the project  needs --allow-outside
  commit it deliberately      needs --allow-tracked

export dump the whole brain as JSON (take one before pruning)

The whole brain as JSON: memories with their provenance and links, events, leads, tasks and measures. Take one before pruning. Without --out it prints to stdout.

$ os-brain export --out dumps/orchard.json
exported 4 memories, 2 events, 0 leads to dumps/orchard.json
FlagWhat it does
--allow-outsideWrite outside the project.
--allow-trackedWrite to a path git would track.
--forceOverwrite a file this command did not generate.
--out <text>Write here instead of stdout.

import merge a JSON export into this brain

Merges a JSON export into this brain. Every row is checked before anything is written, so one bad row refuses the whole dump instead of leaving it half imported. A dump is untrusted input like anything else from outside: everything imported is marked trust: imported, arrives unpinned, is confirmed only with a citation, never lands in a private project and every text field goes through the secret scan. Axioms, standards, lessons and notes belong to the whole machine and are never imported. --dry-run reports first.

$ os-brain import dumps/orchard.json --dry-run
would add 0 memories, skip 4 already present
FlagWhat it does
--all-projectsRestore a whole multi-project store.
--allow-secretImport text the credential scanner flagged.
--dry-runReport what would change, write nothing.
--eventsAlso import the events.
--forceAccept guardrails from the dump and let it retract a pinned memory or a guardrail.
--i-mean-itWith --all-projects: write rows under another project's label.

backup timestamped full dump, every table enumerated from the schema

A timestamped full dump, every table enumerated from the schema so a new table is never left out. Safety copies are separate: one is made at session open, at most every 24 hours, under ~/.claude/os-brain/backups/. --auto is what the hook runs. --list shows them and --verify opens each one to prove it reads.

--restore <file> puts a safety copy back and is a dry run until --apply. It checks the copy before installing it, swaps the file in with a single rename and refuses while another session has the store open. In a shared store a backup covers only this project; --whole-store takes every project and is refused over MCP.

$ os-brain backup
backed up to /home/you/src/orchard/brain/brain-backup-20261121-000043.json (mode 600)
  events 2 · measure_limits 1 · measures 1 · history 1 · memories 4 · session_log 1 · tasks 1 · tombstones 1

$ os-brain backup --list --verify
FlagWhat it does
--allow-outsideWrite outside the project.
--allow-trackedWrite to a git-tracked path.
--applyWith --restore: actually do it.
--autoMake a safety copy if one is due (what the hook runs).
--forceOverwrite a file this tool did not generate.
--listThe safety copies for this store, newest first.
--out <text>Write the dump here.
--restore <text>Restore the store from this safety copy.
--verifyOpen the safety copies and prove they read.
--whole-storeEvery project in a shared store, not just this one (a person at a terminal).

snapshot generated markdown mirror of the brain

A generated markdown mirror of the brain, stamped as generated so nobody edits it by hand. Without --out it prints to stdout.

$ os-brain snapshot --out dumps/MEMORY.md
FlagWhat it does
--allow-outsideWrite outside the project.
--allow-trackedWrite to a path git would track.
--forceOverwrite a file this command did not generate.
--out <text>Write here instead of stdout.
--per-scope <n>Cap on memories per scope. Default 25.

Where the memories live #

Each project keeps its memories in its own brain/brain.db unless it moves into the shared store at ~/.claude/os-brain/brain.db. Sharing has its own page.

share move this project into the shared store, or back out (dry run by default)

Moves this project into the shared store, or back out to its own file with --off. It is a dry run until --apply and keeps the old file aside.

$ os-brain share                  # what would move
$ os-brain share --apply          # into the shared store
$ os-brain share --off --apply    # back to a file of its own
FlagWhat it does
--applyDo it (without this, it reports and stops).
--offMove back out to this project's own database.

private keep this project's memories out of other projects' --all-projects

Keeps this project's memories out of every other project's --all-projects search, in a shared store. --off --yes makes them readable again, retroactively, which is why it needs the second flag.

$ os-brain private
$ os-brain private --off --yes
FlagWhat it does
--offMake it readable by the other projects again.
--yesWith --off: expose every memory, including the private ones.

absorb pull a standalone brain.db in as a project

Pulls a standalone brain.db in as a project, for example when a project that had its own file joins a shared store.

$ os-brain absorb ../old-checkout/brain/brain.db --dry-run
FlagWhat it does
--allow-secretStore it anyway; it is a false positive.
--dry-runReport what would move, write nothing.
--force-labelAccept a label mismatch.
--i-mean-itWith --project naming another project: file the rows there.
--no-eventsLeave the activity log behind.
--project <text>File the rows under this project.

relabel claim rows filed under another label as this project

Claims rows filed under another project label as this project, after a rename or when memories were written under the wrong name. Dry run until --apply. --claim binds this project's name to this directory after a move; it is a person's act, refused over MCP and missing from the MCP schema altogether.

$ os-brain relabel old-name --expect 41 --apply
FlagWhat it does
--applyActually move the rows.
--claimBind this project's name to this directory, after a move (a person at a terminal).
--expect <n>How many memories you expect to move.
--i-mean-itThe label is not in the index and they are yours.

context project facts injected into every brief

Project facts injected into every brief, kept in brain.json: context set <key> <value>, context rm <key> and context list.

$ os-brain context set deploy "tag a release, CI ships it"

No flags of its own beyond --json.

scope declare scopes in brain.json

Declares a scope in brain.json so map can tell a real scope from a typo: scope add <name> --desc, scope rm, scope list.

$ os-brain scope add channel:deploy --desc "how releases go out"
FlagWhat it does
--desc <text>What it is for.

kind declare event kinds in brain.json

The same for event kinds: kind add <name> --desc, kind rm, kind list.

$ os-brain kind add deploy --desc "a release went out"
declared kind 'deploy'
FlagWhat it does
--desc <text>What it is for.

Across projects #

These live in the shared store that every project on the machine reads. Nothing that arrives through them has any authority. A note is information. Only the person at the keyboard gives orders.

axiom rules that hold in every project

Rules that hold in every project on the machine: list, add, edit --id, rm --id. os-brain ships a set of default axioms; the axioms page lists them with what each one prevents. No agent can add, edit or remove an axiom, even when a human asks it to. Changing one is refused over MCP, refused from a process running under an agent's session and, at a terminal, shows the change and waits for "yes". An axiom is read as a house rule by every project, so it is a person's decision.

$ os-brain axiom list
$ os-brain axiom add "Never push to main" --why "main deploys on push"   # a person, at a terminal
FlagWhat it does
--id <n>Which axiom, for edit and rm.
--why <text>What it prevents.

standard house defaults every new project inherits

House defaults every new project starts with: list, add, rm --id, under the same terminal rule as axiom.

$ os-brain standard add "Go for new services" --category stack --why "one static binary"
FlagWhat it does
--category <text>Files it: stack, security, deploy or any word you choose. Default general.
--from <n>Lift the text from a memory.
--id <n>Which standard, for rm.
--why <text>What it is for.

note leave a note for another project, or read yours

Leaves a note for another project with note <project> "...", or reads yours. A project name this machine has never seen is refused, so a note never goes nowhere. A note waits for the next session in that project; dm reaches a session that is already running.

$ os-brain note billing-api "rounding moved to the ledger"
$ os-brain note --inbox
$ os-brain note --ack 3

$ os-brain note nosuchproject "hello"
no project called 'nosuchproject' has ever opened this brain, so the note would reach nobody and it has NOT been sent. ...
FlagWhat it does
--ack <n>Done with it.
--allow-secretStore it anyway; it is a false positive.
--elsewhereAlways refused: a local brain has no other mailboxes to read.
--expires <n>Days until it drops out of their brief.
--inboxList the notes waiting for this project.
--kind <text>note | prompt. Default note.
--n <n>How many notes to list. Default 10.
--read <n>Read one in full.
--ref <text>A link to go with the note: a memory, a commit, a path.

sessions the running Claude Code sessions this brain can reach

The running agent sessions this brain can reach, with whose each one is, which project and machine and whether it is listening.

$ os-brain sessions
FlagWhat it does
--allInclude sessions that have ended.

dm send a direct message to one running session ("-" reads the body from stdin)

Sends a direct message to one running session: dm <session|project|project/prefix> "...". It is read on the session's next prompt, tool call or turn end, or at once if the session listens on the channel. When a project has several live sessions you have to pick one. --rdo sends an instruction rather than a message; the recipient lets it through with --accept at a terminal (never over MCP, since it releases another person's instruction into the session) or refuses it with --reject.

$ os-brain dm orchard "the staging deploy is mine for the next hour"
$ os-brain dm --mute
$ os-brain dm --inbox
FlagWhat it does
--accept <n>Release a pending remote-do addressed to you, by id.
--allow-secretSend it anyway; it is a false positive.
--everywhereWith --mute/--unmute: you, on every session.
--inboxWhat do-not-disturb held back.
--muteDo-not-disturb: hold plain messages for the inbox.
--n <n>How many to list. Default 10.
--rdoA remote-do (an instruction), not a plain message.
--reject <n>Refuse a pending remote-do addressed to you, by id.
--sentWhat this project sent and whether each one was read.
--unmuteTurn do-not-disturb off.

publish share one memory as a cross-project lesson

Shares one memory with the other projects on the machine as a lesson. --why says why they should see it and --retract takes it back.

$ os-brain publish 4 --why "every service that bills hits this"
FlagWhat it does
--retractTake a published lesson back out of the shared index.
--why <text>Why other projects should see it.

describe this project's spec in the shared index

This project's entry in the shared index, which other projects read in their brief and search with global --find.

$ os-brain describe "invoice service for orchard" --stack "go, postgres" --sync
FlagWhat it does
--does <text>What the project does, in one line.
--keywords <text>Search words.
--provides <text>What it offers other projects.
--stack <text>What it is built with.
--status <text>Where it stands.
--syncRestamp and push to the index.
--visibility <text>described | listed: whether other projects see the description or only the name.

global axioms, the project index, published lessons

Searches the shared side: --find searches the project index and --recall searches published lessons. Check here before solving a problem twice.

$ os-brain global --find "pdf rendering"
FlagWhat it does
--find <text>Search the project index.
--n <n>How many results. Default 10.
--recall <text>Search published lessons.

release publish the current brain version to the spine

release <version> --notes "..." records in the shared store which brain version is current. Every project's brief checks itself against it. It is announced in every project's brief, so it is refused over MCP and needs a person at a terminal.

$ os-brain release <version> --notes "recall loose matches are labelled"
FlagWhat it does
--notes <text>What changed.

The user model and other optional features #

These stay out of the way until you use them. The user model has its own page.

capture store what the user said, before the turn is answered

Stores what the user said, before the turn is answered. The prompt hook does this on every message; the command exists for agents without that hook.

$ os-brain capture "never deploy on a friday"
FlagWhat it does
--session <text>The session that heard it.

utterances what was said here and how it was classified

What was said in this project and how each line was classified. The prompt hook keeps up to 8000 characters per prompt for 30 days (utterance_days in brain.json changes it).

$ os-brain utterances --class directive
FlagWhat it does
--class <text>Only this class: command | taste | directive | exhibit.
--n <n>How many. Default 20.
--unclassifiedOnly what could not be classified.

whoami the user model and the evidence behind every line of it

The user model and the evidence behind every line of it. --observe key=value records a trait and needs --evidence; --forget key drops one.

$ os-brain whoami --observe reviews=terse --evidence "asked for one-line summaries three times"
FlagWhat it does
--evidence <text>What shows it; required with --observe.
--forget <text>Drop a trait by key.
--observe <text>Record a trait: key=value.

object record an objection to a memory, with its reasoning

Records an objection to a memory with its reasoning, which ladder then shows.

$ os-brain object 4 --why "the ledger only rounds EUR, not GBP"
FlagWhat it does
--why <text>The reasoning, which is the half worth keeping.

ladder where a memory stands: stated, hardened or law

How settled a memory is: stated once, hardened because later sessions stated it again, or law. With object it lets the brain show how well a fact stands instead of a session just claiming it.

$ os-brain ladder 4

No flags of its own beyond --json.

lead sales pipeline (optional)

A small sales pipeline, for projects that have one. With no subcommand it lists leads; then add, show <id>, update <id>, pipeline, hot and next. The brief shows the hot ones and the next actions.

$ os-brain lead add --name "Ada" --company "Orchard Foods" --status contacted --next-date 2026-12-01
FlagWhat it does
--append-note <text>Timestamped line onto the notes.
--channel <text>How you reach them.
--company <text>Their company.
--email <text>Their email.
--n <n>How many to list. Default 50.
--name <text>Their name.
--next-action <text>What to do next.
--next-date <text>When.
--notes <text>Free text, replacing the notes.
--role <text>Their role.
--segment <text>Which market segment.
--status <text>new | researching | contacted | replied | engaged | demo | trial | negotiating | won | lost | skip.
--tier <text>Your own grading.
--url <text>A link.
--value-est <n>What it might be worth.

Other ways in #

The same commands, reached without typing them: from a browser, over MCP, or from the agent's own hooks.

ui the web UI, served from this binary (no Node, no install)

The web UI, served from this binary on loopback. No Node, nothing to install. Plain HTTP, so any other --host is refused and the refusal tells you to use an SSH tunnel. The UI page covers it.

$ os-brain ui --no-open --port 8100
FlagWhat it does
--host <text>A loopback address. Anything else is refused. Default 127.0.0.1.
--no-openDo not open a browser.
--port <n>The port. Default 7788.

mcp serve every command over MCP (stdio, or --http for another machine)

Nearly every command as an MCP tool, over stdio or Streamable HTTP with --http <addr>. Off loopback it refuses to start without --tls-cert, --tls-key and --token. On loopback with no token it mints one into a mode-600 file. --public-url mounts OAuth for hosted clients. The MCP page covers it.

$ os-brain mcp                                    # stdio, started by the client
$ os-brain mcp --http 127.0.0.1:7801               # HTTP on /mcp, token minted
$ OS_BRAIN_MCP_TOKEN=... os-brain mcp --http 0.0.0.0:7801 \
      --tls-cert cert.pem --tls-key key.pem
FlagWhat it does
--allow-host <text>Comma-separated Host names answered besides loopback ones, for a reverse proxy that passes its public name through.
--http <text>Serve Streamable HTTP on this address instead of stdio, e.g. 127.0.0.1:7777.
--oauth-redirect-host <text>With --public-url: the only host an OAuth client may register an https redirect to (repeatable; e.g. claude.ai). Unset, any https redirect or http on loopback registers.
--origin <text>Comma-separated allowed Origins, or *.
--public-url <text>The https URL hosted clients reach this server at (e.g. a Tailscale Funnel name); mounts OAuth so the Claude app can connect, with --token as the password on the login page.
--tls-cert <text>Serve HTTPS with this certificate (PEM); required, with --tls-key, for any bind that is not loopback.
--tls-key <text>The certificate's private key (PEM).
--token <text>Bearer token; required off loopback and minted per process into a mode-600 file when omitted on loopback. With --public-url it is the login page's password and is not accepted as a bearer.

channel MCP channel server: wakes this session the moment a direct message arrives

An MCP channel server that wakes a Claude Code session the moment a direct message arrives. init --channel registers it in .mcp.json. It is not offered as an MCP tool, since it runs until killed.

$ os-brain init --channel

No flags of its own beyond --json.

hook-recall UserPromptSubmit hook: auto-recall from the prompt

What the per-prompt hook runs. It reads the hook payload on stdin, prints the clock and the gap since the last message, stores what was typed, then puts the memories that match the prompt into context. You never call it yourself; init wires it.

FlagWhat it does
--chars <n>Body characters per hit. Default 180.
--emit <text>Envelope the host agent needs: gemini, codex, hermes. Without it, plain text.
--idle-after <n>Minutes of silence before the gap is called out. Default 20.
--min-chars <n>Ignore prompts shorter than this. Default 15.
--min-score <n>The lowest score a memory needs to be shown. Default 0.55.
--n <n>How many memories at most. Default 3.
--no-clockLeave out the clock line.
--no-nudgeLeave out the reminder to save a preference when the prompt sounds like one.
--scope <text>Recall from this scope.

hook-stop Stop hook: what this session did and whether it stored any of it

What the end-of-turn hook runs: a record of what this session did and whether it stored any of it, for the next brief. It reads no stdin, so it stays an MCP tool.

FlagWhat it does
--emit <text>Envelope the host agent needs: gemini, codex. Without it, plain text.

hook-tool PostToolUse hook: hand a running session its direct messages mid-turn

What the after-each-tool hook runs: it hands a running session its direct messages in the middle of a turn.

No flags of its own beyond --json.

hook-end SessionEnd hook: mark this session gone, so nobody messages it

What the session-end hook runs: it marks the session gone, so nobody messages it.

No flags of its own beyond --json.

plugin-hook what an agent plugin runs: finds the brain itself, or says there is none

What an agent plugin runs in place of the per-project hooks init writes. A plugin is installed once per person and fires in every project, so it finds the brain the session is in. In a project with no brain, session start says so once and every other event says nothing. In a project init already wired it steps aside, so the session is not briefed twice. It runs only wakeup, hook-recall, hook-stop, hook-tool and hook-end. It never runs over MCP.

$ os-brain plugin-hook --host claude wakeup
FlagWhat it does
--host <text>The agent the plugin is installed in: claude, codex, copilot, cursor, devin, gemini, kilo, opencode or qwen. Required.

Install and lifecycle #

How a brain is created, seeded and removed again.

init create a brain in this project and wire the session hooks

Creates a brain in this project and wires the agent hooks. It writes brain/brain.json (meant to be committed), brain/brain.db (added to .gitignore), brain/HOWTO.md, brain/BEST-PRACTICES.md and brain/autoexec.sh (the script most agents call from their hooks). For Claude Code it also adds slash commands under .claude/commands/. At a terminal it asks which agent to wire; with no terminal it wires every agent whose config directory it finds in the project or your home directory. When an agent cannot be wired it prints the block to add by hand rather than pretending. It never writes into CLAUDE.md. Running it again is safe: it brings the database up to the current schema in place and never overwrites it. The agents page shows what it writes for each agent.

It refuses a project where a file it would write is a symbolic link or sits under one. It checks before writing anything: a cloned repository could commit a link at .claude/settings.json that points at a file in your home directory.

$ os-brain init --agent claude
brain ready at /home/you/src/orchard/brain/brain.db
  + brain.json for 'orchard'
  + brain.db at schema v16
  + .gitignore entry for brain/brain.db*
  + HOWTO.md
  + BEST-PRACTICES.md
  + SessionStart hook -> OS_BRAIN_HOME="$CLAUDE_PROJECT_DIR/brain" os-brain wakeup
  + Stop hook -> OS_BRAIN_HOME="$CLAUDE_PROJECT_DIR/brain" os-brain hook-stop
  ...
FlagWhat it does
--agent <text>Wire these agents (claude,codex,cursor,gemini,opencode,kilo,copilot,devin,qwen,hermes,continue) instead of detecting.
--channelRegister the direct-message channel in .mcp.json.
--dir <text>Where the brain goes, relative to the project. Default brain.
--no-auto-recallSkip the UserPromptSubmit hook.
--no-gitignoreDo not add brain.db to .gitignore.
--no-hookDo not touch .claude/settings.json.
--project <text>Name it calls itself (default: the directory).

uninstall remove it again: dry run unless --apply, keeps the database unless --purge

Removes the hooks, the docs and the config again. It is a dry run unless you add --apply. When it does act it takes a backup first, with or without --purge. It never deletes brain.db without --purge: one init recreates everything else while nothing recreates the database. It only acts on the brain the command opened; pointing it at another one with a path or --dir is refused.

$ os-brain uninstall            # the plan
$ os-brain uninstall --apply    # hooks and files gone, brain.db kept
FlagWhat it does
--allow-outsideWrite the dump outside the project.
--allow-trackedWrite the dump to a git-tracked path.
--applyActually do it (default: report the plan).
--backup <text>Where to write the dump taken first.
--dir <text>The brain directory, relative to the project. Default brain.
--forceOverwrite a --backup file this tool did not generate.
--purgeDelete brain.db too. It is the only copy.

bootstrap seed a new brain from past session transcripts

Seeds a new brain from this project's past Claude Code session transcripts. It writes no memories itself: it lists the transcripts and the agent reads them and stores what is worth keeping. --read marks one done, --done ends the pass and --again starts another.

$ os-brain bootstrap
FlagWhat it does
--againGo through the transcripts once more.
--doneRecord that the pass is finished.
--include-movedAlso read directories matching this project's name but not its path.
--n <n>How many transcripts to list. Default 12.
--read <text>Repeatable: mark one transcript read.

version print the version

Prints the build and the schema version. --version and -v work too.

$ os-brain version
os-brain 26110501 (schema v16)

No flags of its own. It prints plain text even with --json.

help show full command surface

help lists every command with the scoping rule and the decay tiers. help <command> prints that command's own flags, read from the same registration the MCP schemas use, so the list cannot drift from the code. The flag tables on this page were generated from it.

$ os-brain help recall

No flags of its own. It prints plain text even with --json.

Environment #

VariableWhat it overrides
OS_BRAIN_HOMEThe brain directory, the one holding brain.json, instead of searching upward from the working directory. The hooks init writes set it.
OS_BRAIN_PROJECTThe project name a write is filed under, instead of brain.json's. This one matters most over MCP on a shared store.
OS_BRAIN_DBThe database file this project uses.
OS_BRAIN_GLOBAL_DBThe shared store: axioms, standards, the project index, notes, published lessons and the memories of every shared project. Default ~/.claude/os-brain/brain.db. Safety copies and MCP token files go in the directory beside it.
CLAUDE_CONFIG_DIRWhere Claude Code keeps its files (default ~/.claude). Without OS_BRAIN_GLOBAL_DB the shared store is os-brain/brain.db under it.
OS_BRAIN_MAX_BYTESThe default --max-bytes for brief and wakeup.
OS_BRAIN_MCP_TOKENThe mcp --http token, so it stays off the command line where any user on the machine can read it with ps. A --token flag wins.
OS_BRAIN_MACHINEThe machine name the brain records and prints, instead of the hostname.
OS_BRAIN_SESSION_IDThe session a write is attributed to. Hooks set it from the agent's payload; you rarely need to.
Testing with throwaway paths. Every command registers its project in the shared index, so a throwaway brain on the default paths leaves rows in the store you really use. For anything disposable, point CLAUDE_CONFIG_DIR and OS_BRAIN_GLOBAL_DB at a scratch directory.

All commands #

The list os-brain help prints, in the order of this page.

CommandWhat it does
rememberstore a memory (same scope+title updates in place)
preferstore how the user wants to be worked with
logappend an activity event
recallretrieve ranked memories
briefsession handoff snapshot
wakeupsession open: the brief, the working tree and this project's own probes
getshow one memory by id
openwhat is outstanding: open tasks, work in flight, what just happened
eventsrecent activity
statscounts
mapindex of scopes, types, event kinds and pinned memories
coveragewhat this project knows about, by category
envdate, time, paths, git and project context
updateedit a memory
verifymark a memory re-checked today
historyarchived versions of memories
restorebring back an archived version
promotemove a memory up to a wider scope
taskwhat is owed, by whom and when: reminders, recurrence, an ordered list
measurenumbers that only mean something as a series
reviewhygiene report: duplicates, decay, promotions
doctorcheck the brain for inconsistency
reindexrebuild the FTS index from the memories table
vacuumcheckpoint the WAL and compact the database
forgetdelete a memory (leaves a tombstone)
prunedelete decayed or superseded memories (dry run by default)
exportdump the whole brain as JSON (take one before pruning)
importmerge a JSON export into this brain
backuptimestamped full dump, every table enumerated from the schema
snapshotgenerated markdown mirror of the brain
sharemove this project into the shared store, or back out (dry run by default)
privatekeep this project's memories out of other projects' --all-projects
absorbpull a standalone brain.db in as a project
relabelclaim rows filed under another label as this project
contextproject facts injected into every brief
scopedeclare scopes in brain.json
kinddeclare event kinds in brain.json
axiomrules that hold in every project
standardhouse defaults every new project inherits
noteleave a note for another project, or read yours
sessionsthe running Claude Code sessions this brain can reach
dmsend a direct message to one running session ("-" reads the body from stdin)
publishshare one memory as a cross-project lesson
describethis project's spec in the shared index
globalaxioms, the project index, published lessons
releasepublish the current brain version to the spine
capturestore what the user said, before the turn is answered
utteranceswhat was said here and how it was classified
whoamithe user model and the evidence behind every line of it
objectrecord an objection to a memory, with its reasoning
ladderwhere a memory stands: stated, hardened or law
leadsales pipeline (optional)
uithe web UI, served from this binary (no Node, no install)
mcpserve every command over MCP (stdio, or --http for another machine)
channelMCP channel server: wakes this session the moment a direct message arrives
hook-recallUserPromptSubmit hook: auto-recall from the prompt
hook-stopStop hook: what this session did and whether it stored any of it
hook-toolPostToolUse hook: hand a running session its direct messages mid-turn
hook-endSessionEnd hook: mark this session gone, so nobody messages it
plugin-hookwhat an agent plugin runs: finds the brain itself, or says there is none
initcreate a brain in this project and wire the session hooks
uninstallremove it again: dry run unless --apply, keeps the database unless --purge
bootstrapseed a new brain from past session transcripts
versionprint the version
helpshow full command surface