01 / The mechanisms

Six mechanisms
instead of a bigger file.

A markdown file of notes can only grow. Here are six things it cannot do.

01 · Arrival

It's there before you type

Open a session and your agent already has the brief: today's date and the part of the day (no more good morning at 11pm), where git stands, your project's rules and how you like to work. Then every prompt you type pulls in the memories that match it. It keeps what you type too (here is what it stores). Nothing depends on the agent remembering to look.

What arrives and in what order →
02 · Ranking

The best match wins

Ask a question and the memories that answer most of it come first. Old news sinks. The part of the project you are working in counts more than the rest. Importance and confidence only break a tie between comparable matches: when they were allowed to do more, the memory that answered the question was sometimes pushed down by twelve places.

The scoring model →
03 · Decay

Old news fades on its own

"TLS terminates at nginx on 8443" stays true for years. "The box is rebooting" matters for an afternoon. Your agent gives each memory a type when it saves it and the type sets how fast it fades: a state memory has a half-life of about four days, an infra fact never decays. Two weeks later the reboot is buried. Nothing gets deleted.

Types and tiers →
04 · Supersession

Fix it once

When something changes, your agent saves the new fact as a replacement and the old one stops coming back, even if you ask in the old words. Try to save the same thing twice and the brain stops you, shows what it already has and asks which you meant.

How corrections work →
05 · Provenance

It knows when a fact may be stale

A memory is stamped with the commit it was stored at. For the types that describe what the code does right now (a gotcha, an incident, a state) recall says whether the code has moved since. Nothing changed: use it. Fourteen commits later: check it against the source first. Facts about the world, such as hosts and keys, get a review date instead.

Provenance and verification →
06 · Refusal

When in doubt, it does nothing

If it cannot tell what you meant, it stops and says so instead of guessing. A script that searches and finds nothing gets nothing back, never the closest thing. Anything that deletes in bulk shows you the list first and waits for you to say so.

What each guard protects →
02 / Retrieval

Ask the brain before
you burn a million tokens.

Ask an agent without a brain "why do deploys stop at 06:45?" and watch it dig. It greps for "deploy", reads every markdown file, opens the deploy scripts looking for a comment and scrolls the git log for the commit that moved the time. The real reason (a billing cron that double-sends invoices when a deploy overlaps it) was never written in the code. After all that reading, it may still guess.

With a brain it is one recall and a few hundred tokens. The answer comes back with where it came from and the last line says the code has not changed since, so your agent can just answer.

$ os-brain recall "billing cron deploys" --scope deploy:prod

#7  [deploy:prod/gotcha] (score 2.101) The billing cron runs
    at 07:00 UTC, so deploys stop at 06:45 [confirmed]
      a deploy that overlaps the cron double-sends
      the morning invoices
      (stated by the user)
      tree unchanged since stored (f265c122)

Memories are filed in nested scopes such as deploy:prod. A search there also sees deploy and anything global, never the other way round.

$ os-brain recall "TLS nginx 8443"

#6  [global/infra] (score 1.151) TLS terminates at the
    load balancer, not nginx
      moved off nginx in 1.4
      matched the RETRACTED #4 (2026-11-20): TLS
      terminates at nginx on 8443, not at the app

Asked in the old words, recall answers with the correction and says which fact it replaced.

03 / When it is not sure

It stops and
tells you.

It never does the biggest thing it could. Every command is checked against three cases before it ships: nothing matches, the filter is empty, the caller made a typo. In each one it stops and tells you what happened.

On the right, your agent tried to save something the brain already knows. Rather than keep two answers to one question, it asks which one is right.

$ os-brain remember --type gotcha --scope deploy \
    --title "migrations lock the invoices table so run them before 7am"

#5 in deploy is already about this (82% title overlap):
  stored:  Migrations lock the invoices table, so they run before 7am
  yours:   migrations lock the invoices table so run them before 7am
Storing both would put two answers to one question in the brain. Pick one:
  the fact CHANGED       --supersedes 5
  same fact, better words  os-brain update 5 --body ...
  genuinely separate     --allow-duplicate
  • Pinned memories and guardrails (the policy and constraint types) cannot be deleted by accident. Neither can a fact that replaced older ones, because deleting it would put the old facts back into recall as live.
  • recall --json with no match returns an empty result, never the whole scope. A script that fed recall into forget once destroyed real memories that way.
  • prune refuses to guess what to prune, is a dry run until --apply and backs up the brain before it deletes anything. It stops at 25 unless you add --yes and leaves the types that never fade alone unless you add --i-mean-it.
  • Emptying a whole project is forget --all: a dry run first, then --apply --i-mean-it, with a dump of that project written before anything goes.
  • --confidence confirmed is refused unless something a stranger could check backs it: a file, a command, a URL or "stated by the user".
  • Text that looks like a password or a key is refused on every save, unless you mark a false positive with --allow-secret. The brain file is readable only by you (mode 600) and never goes into git.

The more you use it,
the better it gets.

Free and open source. Any number of projects, for as long as you like.

$ go install github.com/chka/os-brain/cmd/os-brain@latest
$ cd ~/projects/yours && os-brain init