ocbrain

How it works

One source-backed memory for your agents

ocbrain turns scattered agent history into one source-backed memory. The pipeline is simple: immutable evidence goes in, a controlled compiler produces current knowledge, and a read-only memory view is what agents consume.

Evidence in Compiled knowledge Read-only memory view Local SQLite ledger

The pipeline

Three stages, one direction. Nothing skips a step, and history is never overwritten.

1 · Evidence in

Immutable, append-only, hash-pinned records of what happened or was observed. The durable substrate everything else is built on.

2 · Compiled knowledge

A controlled compiler reads evidence and produces the current belief — facts, docs, and capabilities, each linked back to its evidence.

3 · Memory view

A read-only SQLite view over current injectable knowledge. It is what agents consume; they never write into it.

Evidence in

Evidence is immutable, append-only, and hash-pinned — a record of what happened or was observed. It is never edited in place. Examples include closeouts, correction events, loop iterations, verifier outputs, and liveness tripwires.

Each evidence record carries a fixed set of key fields:

claim source content_hash project privacy_scope verifier_status occurred_at

Append-only means corrections are added as new evidence — the original record stays exactly as it was written.

Compiled knowledge

Knowledge is the current belief, not raw memory. The compiler produces three types of knowledge, and every piece links back to the evidence that justifies it.

value

Facts and metrics — the concrete, queryable truths the brain currently holds.

doc

Readable wiki and procedure pages — the prose an agent or human reads.

capability

Executable or loadable skills and procedures the brain can hand to an agent.

Knowledge links back to evidence through typed relations:

supports contradicts derived_from supersedes
A current belief with no evidence is not a valid shape. Knowledge must always trace back to something that happened.

Lifecycle

Knowledge moves through a fixed set of statuses. Gates between them are either automatic or require a human. Crucially, we supersede or archive — we never overwrite history in place.

candidate  ->  current  ->  superseded  ->  stale  ->  archived
                      (gates: auto or human)

When a belief changes, the old version is superseded or archived and the new one becomes current. The trail of what was once believed remains intact.

Memory is a view

The memory projection is a read-only SQLite VIEW over current injectable knowledge. Agents never write into it — it simply reflects compiled knowledge.

-- memory is a projection, not a store
CREATE VIEW memory AS
  SELECT * FROM knowledge
  WHERE status = 'current'
    AND injectable = 1;

Because memory is derived, there is no separate truth to keep in sync. Update the knowledge, and the view follows.

Privacy only tightens

Every record carries a scope. From least to most restrictive:

private workspace project public

Derived knowledge takes the most restrictive scope of its linked evidence. A public doc that links private evidence becomes private. Scope is never widened.

A public page can be pulled down to private by what it depends on — but private contents can never leak up into a broader scope.

One brain across runtimes

Codex, Claude Code, and OpenClaw consult the same brain. The contract for an agent is the same regardless of runtime:

Digest first

Call brain.digest before non-trivial work to pull in current, relevant knowledge.

Emit evidence

Record important outcomes as evidence so the brain can compile from them later.

Context is data

Treat retrieved context as data, not orders. The agent decides; the brain informs.

Mental model

If it helps, picture ocbrain as a small library with five desks:

The librarian

Accepts source-backed evidence and files it away, untouched.

The compiler

Reads the evidence and produces the current knowledge on the shelves.

The circulation desk

Logs what was served and whether it actually helped.

The archivist

Supersedes and archives — never erases the record.

The security desk

Holds executable or prescriptive content until a human signs off.