Running it #
$ os-brain ui orchard brain http://127.0.0.1:7788/?k=<one-time key> brain LOCAL FILE /home/you/src/orchard/brain/brain.db every read runs the brain's own commands, so this page cannot disagree with it about scoping or ranking the link opens the page once, in one browser: the first visit spends it and leaves this process's key in that browser's cookie ctrl-c to stop $ os-brain ui --port 8100 --no-open
It listens only on your own machine (loopback), serves its files from inside the binary and stops when you press ctrl-c. Nothing keeps running in the background. By default it opens your browser on a link of its own; --no-open leaves that to you. The port is 7788 unless you pass --port. A port already in use is an error rather than a link that answers with somebody else's page.
What it shows #
| View | What it answers |
|---|---|
| Brief | Exactly what a session gets when it opens, as a page instead of terminal text. |
| Map | Scopes, types, event kinds and pinned memories, declared against what is stored. |
| Tree | Every scope as a tree. The quickest way to spot a scope somebody created with a typo. |
| Memories | Search and browse with the same ranking as recall, filtered by scope and type. |
| Measures | Numbers tracked over time, each with its trend line, its declared band and a red tag when the latest reading is outside it. |
| Leads | The sales pipeline. The tab hides itself in a project with no leads. |
| Activity | The events log: what happened, filtered by kind and scope. |
The header shows the counts and which database file you are really looking at, the same path os-brain stats prints.
Why it has no SQL #
An earlier viewer had its own copy of the search code in a separate server. Three fixes made in the CLI (to ranking, to the project filter and to snoozing) never reached it. The page kept looking fine while showing the wrong results.
So the rule is that every route builds a command line and runs it through the ordinary CLI code, in the same process. If the UI needs data the CLI cannot give it, the data is added to the CLI and never to the viewer. The page is also marked as a page rather than a person at a terminal, so every guard that refuses a caller over MCP refuses the page too.
The one thing it writes #
The UI writes exactly one thing: forget, by running os-brain forget with the reason you type (the form will not submit without one). So when it refuses to delete a pinned memory, a guardrail or a memory that superseded others, you see the CLI's own message with the same wording and the same rules. The forgotten memory stays recoverable with history and restore. Everything else only reads.
How the page is protected #
A page on your own machine is still a web page. Any other browser tab can send requests to localhost and any other user on the machine can connect to a loopback port. So every request that touches the brain, reads included, has to prove it came from this page:
- A key minted fresh each time the UI starts. The printed link does not carry it: it carries a single-use code that the first visit spends, trading it for an HttpOnly, SameSite=Strict cookie holding the key, then redirecting to the bare URL so the code leaves the address bar. A link that has been used gets a 403 and a note to run
os-brain uiagain. The link the UI opens in your browser also expires after a minute, because it sits on the launcher's command line wherepscan read it. - The key on every data route, compared in constant time. A page left open across a restart holds a dead key and is told to reload.
- An Origin check on every request, so another tab cannot use the page's key. Both checks run because each alone has a hole: a key can leak into a log while some clients send no Origin.
- A Host allowlist of the loopback names only, against DNS rebinding.
- A Content-Security-Policy that allows only the page's own files, plus
nosniff,no-storeandno-referrer. - Request bodies capped at 64KB.
- No HTML from the brain.
innerHTMLis only ever used to clear an element. Content goes in throughtextContent, so text in a memory can never turn into markup.
From another machine #
The UI is plain HTTP, so it binds loopback or nothing:
$ os-brain ui --host 0.0.0.0
refusing --host 0.0.0.0: the UI is plain HTTP, so it binds loopback only. Reach it from another machine over SSH: ssh -L 7788:127.0.0.1:7788 <this host>
The SSH tunnel carries the page encrypted and the browser still talks to a loopback address, so every check above holds. For an agent or an app that needs the brain from elsewhere, use MCP over HTTPS instead.