Docs · troubleshooting

When it says no,
it is usually right.

Most of what looks like a bug is the brain refusing to guess. Each refusal below says what it protects. If you do not know why a guard is there you will find a way around it. Getting around these is how memories get lost.

Run these first #

$ os-brain env       # the clock, the project, git and which file the brain is
$ os-brain stats     # counts and the database path on line two
$ os-brain doctor    # dangling links, loops, index drift, integrity
$ os-brain version   # the build and the schema it writes
os-brain 26110501 (schema v16)

Together those four answer almost every "it is not doing what I expected": which file, which project, which build and whether the brain is in good shape.

$ os-brain stats
memories=5 (pinned 0, superseded 1) [A2 B2 C1] scopes=1 events=6 leads=1 measures=4/1 keys (1 outside band) ...
db=/home/you/.claude/os-brain/brain.db

The brief did not appear at session start #

First check the command works, then check the hook does. They break in different ways.

$ os-brain wakeup
$ os-brain wakeup   # outside any project
no brain here: /home/you/scratch and its parents hold no brain.json.
Run `os-brain init` in the project root to create one, or set OS_BRAIN_HOME to an existing brain directory.

An agent that cannot run shell commands has no hooks at all. The MCP page says what such an agent can still do.

Recall returns nothing #

A script that searches with recall --json and matches nothing gets nothing back, never the closest thing or everything in the scope. That is on purpose: a script once fed a recall miss into forget and destroyed real memories. Try these, in order:

Wrong store, wrong project #

SymptomWhat it is
0 memories in a brain you know has someRight command, wrong file. os-brain stats prints the path. A project that moved into the shared store with share no longer reads its old brain/brain.db and the reverse is also true.
no memory #N in this project for an id you can seeIt belongs to another project in a shared store. Read it with get N --all-projects if that project is not private. Leave a note to change it.
Memories filed under another project's nameSomething named the wrong project, usually over MCP. os-brain relabel <label> --expect <n> --apply moves them back.
A second directory refused for a project nameThe name is bound to the directory that first used it, so a clone or a same-named checkout cannot read the first one's memories. Give the new one its own "project" in brain.json, or run os-brain relabel --claim at a terminal if you really moved it.
Phantom projects in the indexSomething meant for a scratch directory ran against your real shared store. For anything throwaway, point CLAUDE_CONFIG_DIR and OS_BRAIN_GLOBAL_DB at scratch paths first.
A project's brain.json points at a server or an encrypted brainos-brain keeps memories only in local files, so it cannot read that project's memories. It refuses rather than answer from a local file that does not hold them.

Refusals and what each one protects #

RefusalWhat it protects you fromHow to get past it
"#42 in global is already about this"Two answers to one question in one scope, which is worse than one answer that admits it does not know.--supersedes 42, update 42 or --allow-duplicate
"already holds this title ... Storing this would destroy the existing body"A careless save overwriting a fact.--update (the old body goes to history) or --supersedes
"#2 has already been superseded by #4"Two current versions of one fact.--supersedes 4 to chain, or --fork-ok
"refusing 'confirmed'"A session marking its own guess as fact.--source, --ref or --source "stated by the user"
"refusing to store what looks like" a credential or API keyA token in a memory, which then sits in every backup, snapshot and export.Store a pointer to where it lives instead. --allow-secret only for a false positive. The prompt hook, lead and object have no override.
forget refuses a pinned memory or a guardrailA session deleting a rule because it got in the way.Re-read it, then --force, or supersede it
forget refuses a memory that supersedes othersDeleting it would bring back the old facts it replaced on purpose.Supersede it with a correct version, or --force to accept them coming back
update refuses an empty bodyWiping a memory by accident. An empty --body is usually a shell substitution that failed.--force
prune refuses tier A or BThe tiers that never fade hold the facts that are hardest to work out again.--i-mean-it, after reading the dump it took
prune refuses a same-day cutoffAn --older-than 0 that means "everything written this session".Pick a real cutoff of a day or more
prune refuses a large deletionMore than 25 deletions, or more than half of what it can reach, in one go.--yes, or a narrower --scope or --tier
forget --all --apply refusesEmptying the project on a guess.--i-mean-it, after the plan
export, snapshot or a dump refuses to overwriteOverwriting a file this tool did not make, which is somebody's work.--force, or write elsewhere
refuses a path git would trackA full copy of the brain committed to a repository for good.Gitignore it, or --allow-tracked if you mean it
refuses a path outside the projectEvery memory in cleartext landing somewhere nobody looks after it.--allow-outside
"changing an axiom needs a person at a controlling terminal"An agent (or a prompt-injected one) rewriting the rules every project follows.Run it yourself, in a terminal you opened
"no project called '...' has ever opened this brain"A note that would reach nobody, usually a typo in the name.Use the name in that project's brain.json
"--everywhere stores a memory at the org"A memory filed in this project while claiming to reach every project. A local brain has no organisation above it.Publish a lesson with os-brain publish instead

What doctor finds #

$ os-brain doctor
========================================================================
INVOICES BRAIN — DOCTOR
========================================================================
5 live memories for invoices · 7 rows total, every project in this store · schema v16 · ...

no problems found

## NOTES
  - 1 measure outside the declared band: pdf_render_p95 1250 above
$ os-brain doctor --fix   # repairs the repairable, names the rest

In a shared store doctor checks the whole file, because a fault in another project's rows is still a fault in the database you use. It shows counts and ids, never titles or bodies. --fix touches only your project's rows after dumping them.

Safety copies #

A copy of the whole store is made at session open, at most once a day and only when the store has changed. You do not run this. wakeup does and says nothing unless it acted.

$ os-brain backup --list
1 safety copy in /home/you/.claude/os-brain/backups/db7f48d762a42bbb
  2026-11-20 23:59  288kB       7 memories  schema v16  ok
$ os-brain backup --verify                   # open each one and prove it reads
$ os-brain backup --restore <file>           # dry run: the copy against the live store
restore from /home/you/.claude/os-brain/backups/db7f48d762a42bbb/brain-20261120-235952.db
  copy       7 memories  schema v16
  live       7 memories

This was a dry run and nothing was written. Add --apply to do it.
$ os-brain backup --restore <file> --apply

Restore refuses while any other session has the store open (a hook, an MCP server, the UI, another project on a shared store), because that session would go on writing into the file being thrown away. Close them first.

os-brain backup on its own writes a timestamped full dump on demand. To get copies off the machine, declare a command under "backups": {"push": "..."} in brain.json, with {file} where the path goes. It runs after a copy verifies and needs approval on each machine, because brain.json is committed and a cloned repository must not run a stranger's command at session open.

Export, import and snapshots #

$ os-brain export --out brain-backup.json   # the whole project, as JSON
$ os-brain import brain-backup.json --dry-run
$ os-brain import brain-backup.json          # merge: titles already here are skipped
$ os-brain import brain-backup.json --events # also replay the activity log
$ os-brain snapshot --out MEMORY.md          # a generated, readable mirror

JSON is for moving rows between stores. Safety copies are for recovery. Every file these commands write is mode 600, refuses a path git would track or a path outside the project, refuses to overwrite a file without its own generated-by header and refuses to write through a symbolic link.

A dump is a file somebody handed over, so it does not get to say what a memory is worth. Rows arrive unpinned, with trust imported and confirmed only if a citation earns it. A dump that brings guardrails, or that would retract a pinned memory or a guardrail already here, is refused until you have read the dry run and pass --force. Axioms, standards, lessons and notes belong to every project and never come from a dump. Measures go in only when the project has none, because readings cannot be merged without doubling the series.

New versions and the schema #

$ os-brain backup                                  # first: the database is the only copy
$ go install github.com/chka/os-brain/cmd/os-brain@latest      # or git pull and go build in your clone
$ os-brain init                                    # in a project with its own file: refreshes hooks and docs
$ os-brain doctor

A newer binary migrates the database when it first opens it. Migrations only add (a column, a table, values rewritten in place), never drop data. Each one runs in a single transaction with the version stamp, so a failure leaves the database exactly as it was. Our tests migrate real old databases through every version in between, because migration bugs show up on old databases and never on new ones.

An older binary opens a newer database only when the database says that binary can read it safely. If not, it refuses instead of writing rows it does not understand. Since every project on the machine opens the shared store, that refusal means the binary on this machine needs replacing with a current one.

If a brain will not open after an update, do not try fixes of your own. List the safety copies with os-brain backup --list --verify and restore one.

Undoing a mistake #

$ os-brain history --id 42   # archived versions of one memory
$ os-brain restore h7        # bring an archived version back
$ os-brain update 42 --unsupersede   # a supersede made by mistake

A body replaced with --update and a memory removed with forget are archived first, so they can come back. prune and forget --all write a full dump before deleting anything and print its path (os-brain import <dump> puts it back). forget also leaves a tombstone, so the same wrong fact is not learned again later. forget --purge is the exception: it keeps no archived version and nothing can restore it.

"Clear the memory" and "remove the brain" are different requests. os-brain forget --all empties the project (a plan until --apply --i-mean-it, with a dump first). os-brain uninstall takes the brain out of the project, as a dry run until --apply. It keeps the database unless you add --purge.

Reporting a bug #

If you are an agent in a project with a brain, the seventh axiom applies: tell the user what you ran, what you expected and what happened. Do not fix the tool yourself and do not quietly work around it. A bug one project hides is one every other project will hit.

Reports go to GitHub issues. Include the exact command, what you expected, what happened and the output of os-brain version. Leave memory contents and paths out unless they matter to the bug: an issue is public. Help has the rest.