The words, in plain terms #
One sentence each. The rest of the page explains how they work.
| Word | What it means |
|---|---|
| brief | The short handover your agent gets before its first turn: the rules, how you like to work, pinned facts and the state of the code. It is capped at 6000 bytes by default (about 1.5k tokens). |
| recall | A search of the memories with the best match first. You can run it, the agent can run it and a hook runs it on every message you type. |
| scope | A label such as deploy:prod that says where a memory applies. A narrow scope sees the wider ones above it, never the other way round. |
| tier | The shelf life a memory gets from its type. It decides how fast newer facts start to rank above it. |
| supersede | To save a correction that replaces an older memory, so a question asked in the old words gets the new answer. |
| guardrail | A memory of type policy or constraint. It goes into every brief, pinned or not. |
| axiom | A rule that holds in every project on the machine, shown at the top of each brief. The defaults are listed here. |
| hook | A command your agent runs by itself at a fixed moment, such as when a session opens. The brain reaches the model without the model having to ask. |
| shared store | One file every project on the machine reads, at ~/.claude/os-brain/brain.db. It holds axioms, notes and the project index (no project's memories unless that project chose to move in). |
What a memory holds #
A memory is a title, a body and a set of fields that decide how it ages and where it ranks. Each field has fixed values. None of them is free text the tool has to guess at.
| Field | What it decides |
|---|---|
| title | Together with scope, it says which memory this is. Case, punctuation and accents are ignored, so saving the same title again refines that memory in place instead of adding a second copy. |
| body | The fact. Write it for a stranger reading it six months from now, not for the session saving it. |
| type | How fast it fades, whether a commit can make it wrong and whether it gets a review date. |
| scope | Where it applies. Levels are split by : and a memory is seen from its own level and the ones below it. |
| confidence | confirmed, reported or assumed. It helps break ties when ranking. |
| importance | 1 to 5, with 3 as neutral. How much it matters, not how well it matches. |
| source | Where the fact comes from. You need one to save something as confirmed. |
| trust | stated, imported or external. Where the memory came from, which is a different question from how solid it is. |
| source_commit | Added by itself on the types a commit can make wrong. It is how recall tells you whether the code has moved. |
| valid_from / valid_to | When the fact became true and when it stops being true, for facts with known dates. |
| review | A date to check the fact again. Set by default on infra and access. |
| superseded_by | The correction that replaced it. Recall follows this link to the newer fact. |
| pin | Always in the brief. |
| session | Which session saved it. It matters once more than one agent works on a project and the ladder reads it. |
Types and how fast they fade #
The type you pick sets the shelf life. It is the choice that matters most when you save a memory, which is why in practice you always pass --type. Leave it off and you get note, a plain document with no weight.
| Tier | Half-life | Weight | Types |
|---|---|---|---|
| A | never decays | 1.30 | infra access gotcha incident |
| B | never decays | 1.20 | decision constraint commitment |
| C | 60 days | 1.00 | preference relationship |
| D | 4 days | 0.70 | state |
| N | never decays | 1.00, neutral | knowledge brand sop process standard policy report note |
An unknown type is refused with the list of valid ones. --type task gets a pointer to os-brain task add as well, because a task is its own table with a schedule and a state.
Preferences fade in search results but not in the brief. A preference is tier C, so in a search it slowly gives way to newer facts. The brief's "how they want to work" section ignores fading. It takes up to eight preferences and relationships, picked by importance and by when they were last updated. A rule you stated once, such as "answers first, reasoning after", keeps showing up at the start of every session until you replace it or more important ones push it out of those eight. Pin it if it must always be there.
Fading never deletes. A tier D memory a month past its half-life is still there and an exact search still finds it. It just no longer ranks above things that still matter. That is what you want from "the box is rebooting" and nobody has to remember to clean up.
incident is tier A, not tier D
An outage feels short-lived but the record of it is not. What happened to a system stays true and an incident record is worth most to whoever asks about it months later.
How results are ordered #
Recall works in two steps. First it finds the memories that match your words. Then it puts them in order.
Finding the candidates
The search is full-text, using SQLite's built-in FTS5 index. Any word of your question can find a memory. A memory then stays only if it holds most of the question's words: all of them for a one or two word query, three in five (rounded up) for a longer one. When nothing gets that far, which is normal for a full sentence, recall keeps the weaker matches and says so on its first line ("loose": true in --json).
Ordering them
score = relevance × coverage × recency × stakes × scope relevance how strongly the words matched, mapped onto 0.35..1 so a matched row can never score as if it had not matched coverage the share of your question the memory holds: all of it scores 1, half of it 0.5 recency 0.5 ^ (days / tier half-life), or 1.0 for the tiers that never decay stakes tier × (importance / 3) × usage × confidence, clamped to the band 0.70 .. 1.43 scope when you ask in a scope: 1.6 for that scope, 0.25 less per step out to its parents, never below 0.8
A pinned memory doubles its score only when you browse with nothing to match. When you ask a specific question a pin does not push it up, since it is in every brief anyway.
Why the stakes term has a cap
It had none at first. Measured over ten real queries on a brain of 571 memories, how well the words matched varied by 1.12x while the multipliers varied by 43.75x. In practice the multipliers decided everything: 54% of result pairs came back out of word-match order, some moved twelve places and in every worst case the memory pushed down was the one that answered the question.
The rule now is that what kind of memory it is breaks ties and never beats what matched. The cap is the widest gap between tier weights (1 / 0.70), so types still rank in their usual order and only several signals stacking up is held back.
Fading sits outside the cap on purpose. It says whether something is still true, not how much it matters, so a four-day memory that is thirty days old can sink out of sight.
The usage term
A memory that keeps coming back in results gets a small boost with a ceiling: 1 + min(0.15 × ln(1+uses), 0.5). Every recall counts as a use unless you pass --no-touch. That flag exists so cleanup runs and scripts do not pump up the very numbers they are checking.
Where a memory applies #
A scope is a path with levels split by :. A search sees its own level and every level above it, never the levels beside or below.
$ os-brain recall "cert renewal" --scope deploy:prod #8 [deploy:prod/infra] (score 1.692) prod invoices run behind the eu edge proxy cert renewal is on the proxy, not the app # sees: deploy:prod, deploy, global # never sees: deploy:staging, where a memory about staging certificates sits
Everything defaults to global, which means "everywhere in this project", not "everywhere in the world". You declare scopes in brain.json with os-brain scope add deploy:prod --desc "...". Once brain.json declares any scope, a save into one it does not list still works but warns you and names the command that declares it. os-brain map compares what is declared with what is actually stored, so a scope someone made up by a typo shows up under UNDECLARED SCOPES IN USE.
Use scopes when a project has truly separate areas. Two or three are worth it. A dozen is a filing system you will stop keeping up and a memory left in global is still found.
How sure and from where #
Confidence says how sure the fact is. Trust says where it came from. The brain keeps both.
| Confidence | Weight | Means |
|---|---|---|
| confirmed | 1.15 | It has a source somebody else could check: a path, a command, a URL, a commit or the user saying so. |
| reported | 1.00 | The default. Believed, not proven. |
| assumed | 0.80 | Worked out, not checked. Kept because losing it would be worse and ranked lower for it. |
high, medium and low also work and mean the same three. Other tools use those words and translating them is better than quietly saving a value nothing understands. A value that is neither is refused.
Your agent cannot just call something confirmed. It needs a source:
$ os-brain remember --type note --confidence confirmed \ --title "rounding happens per line, not per invoice total" --body "..." 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.
A standing preference has no source but the person who said it, so --source "stated by the user" counts. os-brain prefer --confirmed sets that for you.
Trust is a separate field. stated is the default and means it came from this project's own work. imported is set on everything that arrives through import or absorb. external marks a claim from outside. An imported dump is outside input like any other and the label stays on it so a later session can tell.
Corrections #
A markdown file has no way to say that one statement replaced another. The brain does.
$ os-brain remember --type decision --supersedes 2 \ --title "Invoices render as PDF in the worker queue, never in the browser" \ --body "moved off the request path 2026-11-02; large invoices timed out the HTTP handler" remembered #4 [global/decision] Invoices render as PDF in the worker queue, never in the browser (supersedes #2) $ os-brain recall "PDF browser" #4 [global/decision] (score 0.420) Invoices render as PDF in the worker queue, never in the browser moved off the request path 2026-11-02; large invoices timed out the HTTP handler matched the RETRACTED #2 (2026-11-20): Invoices render as PDF on the server, never in the browser
The new memory takes over the old one's identity. The old one stays as history with a superseded_by link and recall follows that link: a search in the old words gets the current fact, not both at equal weight. --all shows the replaced versions when you want the history.
Two guards protect this:
forgetrefuses to delete a memory that replaced others. Deleting it would put the facts it withdrew back into recall as live ones, so the refusal lists them and asks you to supersede it with a correct version instead (or--forceto accept them coming back).--supersedeson a memory that another correction already replaced is refused as a fork. You chain onto the newer correction, drop--supersedesif both facts are true or pass--fork-ok. Two current versions of one fact is exactly what corrections are meant to stop.
os-brain update <id> --unsupersede clears a link made by mistake and leaves both memories standing.
Saving the same thing twice #
A memory is identified by its scope and its title. Saving the same title again refines that memory in place. If the body is different, the brain refuses until you pass --update (the old body is kept in history) or --supersedes, so a careless save cannot overwrite a fact.
The harder case is a second memory about the same subject under a different title. The brain refuses that too: if half or more of the words in two titles in one scope overlap, the save is blocked and you get the existing id and three ways forward.
#2 in global is already about this (58% title overlap): stored: Invoices render as PDF on the server, never in the browser yours: Invoices render as PDF on the server through the queue Storing both would put two answers to one question in the brain. Pick one: the fact CHANGED --supersedes 2 same fact, better words os-brain update 2 --body ... genuinely separate --allow-duplicate
os-brain review also reports duplicates but only after the second copy exists and usually to a different session than the one that made it. The moment of saving is the only time the agent still has the text in hand.
Titles under five words are not checked. prod db host and prod db port overlap 0.50 and are different facts. When the check is unsure it lets the save through, which is the right call for a rule of thumb: you get the behaviour the store always had.
Is this fact still current? #
A memory about the code records the commit it was true at. When recall returns it, you get one of these lines under it:
tree unchanged since stored (1cbd7d50) 2 commits since stored (1cbd7d50) — re-check against source
So you still read the files sometimes but only for the facts that need it. The brain tells you which ones are safe to act on without opening anything.
Only gotcha, state and incident get the commit stamp. The list is short on purpose: a warning that shows on every memory is a warning everyone learns to skip. A decision never gets one, since only the person who made a decision can make it wrong. Telling a session that a settled call is twelve commits old only invites it to argue the call again.
os-brain verify <id> stamps a memory as checked today. For a claim about the code it also re-dates it to the current commit, so the freshness line agrees with what you just checked.
Facts that need a recheck #
Some facts change outside your code. A host moves, an IP is reassigned or a key is rotated and nothing in the project records it. There is no commit to count and nobody to correct it, so the fact looks just as current on the day it goes wrong. A session once named a box as staging from a 25-day-old note. It had been production for a fortnight.
So infra and access memories get a review date 30 days out by default and the save tells you so. Thirty days because a reminder that fires every week is one everybody learns to scroll past.
$ os-brain remember --type infra \ --title "TLS terminates at nginx on 8443, not at the app" \ --body "the app listens on 127.0.0.1:8080 and never sees a cert" remembered #1 [global/infra] TLS terminates at nginx on 8443, not at the app review on 2026-12-20 (default for infra, 30d — --review <date> to move it, --no-review if it is permanent) $ os-brain verify 1 --source "checked the nginx config on the box" $ os-brain review --stale-days 90 # tier A and B facts nobody has re-checked in 90 days
Guardrails and rules #
policy and constraint memories go into every brief, pinned or not. A rule that could lose its place to something more topical would not be a rule. The brief shows up to twenty, most important first. Any beyond that are counted on a line of their own with the command that lists them, never dropped without a word.
A rule saved as the wrong type is the common mistake, so the save checks for it. A title that reads like a standing rule ("never", "always", "must not") stored as a type the brief does not always carry gets a warning:
[brain] this reads as a standing rule and decision is not a type the brief always carries.
A rule stored as decision falls out of the brief and then binds nobody: --type constraint keeps it in front of every session.
Guardrails are also harder to delete. forget refuses a pinned memory or a guardrail until you have re-read it and pass --force, because the usual reason a session wants a rule gone is that the rule got in its way.
Above guardrails sit axioms (which hold in every project) and house standards (defaults a new project starts from). Sharing explains the difference.
What your agent gets at the start #
The brief your agent gets when a session opens is not a dump of everything. It is built in order of priority and it has a size limit: 6000 bytes by default, about 1.5k tokens. When it runs over, it cuts the least important parts, names what it cut and prints the command to see the rest.
The priority decides what gets cut, not the order things are printed in. Guardrails are kept first, then any warning that the brain has shrunk, then how the user wants to be worked with, pinned memories and facts due for review. Axioms, measures, the working tree and what is new come after, with the inbox, standards and the sales pipeline near the end. If something has to go, it goes from the end of that list. Empty sections are left out.
The printed order is different. The brief opens with the clock, the project, git and which file the brain is (on this machine only, no accounts). Then come axioms, then this project's own sections with how the user wants to work ahead of guardrails, because it shapes how the agent reads everything below it.
Two of the hooks init wires deliver it. SessionStart runs os-brain wakeup before your first turn. UserPromptSubmit runs os-brain hook-recall, which searches the brain for what you just typed and adds what it finds. Neither waits for the model to decide to look. Why hooks and not CLAUDE.md.
What is not a memory #
Several things live in the brain but are kept apart from memories on purpose, because mixing them in would throw off the ranking.
- Measures. A memory tells you what is true. A measure tells you what a number was and which way it is going. Readings are not searched or ranked, so a number can never push a fact down.
- Tasks. A memory is true until something changes it. A task is owed until it is done. Tasks show up through the hooks that already run, so a task on a project nobody opens for two weeks waits two weeks.
- Events. The activity log (
os-brain log,os-brain events). It only grows, it is never ranked and it is how you find out what the last session actually did. - Utterances. What you typed, kept verbatim for 30 days. The user model page covers them.
What is worth storing #
The real risk is a full brain nobody trusts, which is worse than an empty one. What goes in decides whether anyone reads what comes out.
Do not save what the repository already has: how the code is laid out, what a function does, a fix that is in the git history, anything in the project's own instructions file. A session can read those and an out-of-date copy is worse than none.
Do save the reasoning nobody wrote down: why the obvious approach was turned down, what broke last time and what it looked like, the limit that is not in any file, the preference the user stated once and expects to stick. init writes brain/BEST-PRACTICES.md into every project, which is the long version. The same file is in the repository.