Switching to Brain
Moving from another memory layer — what ports mechanically, the four concepts that have no equivalent elsewhere, how Brain actually differs from mem0, Zep and supermemory, and a cutover plan that does not require trusting it on day one.
What ports mechanically
Most memory layers expose some version of the same three operations, and those map cleanly:
| What you have | Brain |
|---|---|
| A write that takes text and extracts from it | encode |
| A search that takes a query and returns hits | recall |
| A delete by id | forget |
| A per-user or per-session id argument | The (namespace, space) the key resolves to |
| A list of everything stored | memoryList |
If your integration only uses those, the port is mostly renaming.
Four things that do not map
These are where a mechanical translation produces working code that behaves wrongly — the worst kind of migration bug, because nothing errors.
1. A read returns a verdict, not just a list
recall answers with a membership shape — single, many or none —
alongside the hits. none is an explicit "nothing stored answers this", not an
empty list that might mean "nothing matched well enough".
Code ported from a ranked-list API usually does if (results.length), which
throws the verdict away. Branch on the kind instead: it is the difference
between an agent that can say "I don't know" and one that pads the prompt with
weak matches. See How recall decides.
Over HTTP the verdict is lowercase — "single" / "many" / "none". Over
the native wire protocol it is the variant name — "Single" / "Many" /
"None". A comparison written for one tier silently never matches on the
other, so a port that starts on HTTP and later moves to the wire client
turns every empty answer into a non-empty one rendering zero items.
2. Identity comes from the credential, not an argument
There is no user_id=, session_id= or containerTag= parameter on any Brain
verb. The key resolves to a (namespace, space) and every operation runs
inside it. Selecting another space per request is act_as, a wire-tier
capability — the HTTP API accepts no selector on any route.
This is the single biggest structural difference from every layer on this page, and it is deliberate: a scope that arrives as an argument is a scope a compromised client can change. A scope that arrives as a credential is not.
The instinct when porting a user_id argument is one key per user. At scale
that is key lifecycle for every signup. The shape that works is one
credential plus a per-request selector, with per-end-user isolation as a
storage-key prefix inside one space. See
One space per customer.
3. Corrections supersede rather than overwrite
Writing a corrected fact does not update a row. It writes a new claim that closes the old one in time, and the chain records the order — so "what did we believe in March" is still answerable. There is no update verb to port to.
The corollary catches people: supersession resolves the typed graph, not
the raw memories. Both sentences remain stored and recall ranks by
resemblance, so the stale one can still come back. Read the statements when
you need the current claim. See Supersession.
4. The schema is a gate, not a suggestion
Extraction is always on, but a derived entity, statement or relation whose type is not declared in an active schema is silently dropped. Import before you declare, and you get memories with no graph — and no error saying so.
Upload the schema first with uploadSchema, and
validate before you upload. The seeded brain:
namespace is always active, so you get something without declaring anything;
your own types need declaring.
How Brain actually differs
Worth being precise here, because the layers people arrive from are not all the same and some of them do parts of this well.
The four claims worth checking
Marketing comparisons age badly, so these are stated as things you can verify rather than things to believe.
It answers, rather than retrieves
none is a first-class result. Every other layer here returns a list, and
an empty list conflates "nothing is stored about this" with "nothing
scored high enough" — which is precisely the distinction an agent needs to
decide whether to answer or to ask.
Isolation is enforced, not advisory
There is no scope parameter to pass, forge or forget. Check it yourself:
the REST contract has no namespace or space argument on any
data-plane route, and whoami reports what the server resolved rather
than what you sent.
One process, no second datastore
Arena, write-ahead log, redb, an HNSW index, a tantivy full-text index and bundled embeddings, in one Apache-2.0 Rust binary. Embedded, self-hosted or clustered from the same crates — no vector DB to provision, no graph DB to keep in sync, and nothing that stops working when a vendor does.
The read path is inspectable
include_trace returns which retrievers ran, how their ranks fused, what
the filter chain dropped and what the reranker moved. Debugging a bad
answer is reading it, not guessing at an opaque score.
Where the layer you are leaving is ahead
Being straight about this is more useful than a feature table, and it tells you what you will have to rebuild.
Managed maturity. Zep Cloud and supermemory are hosted products with dashboards, usage views and support. Brain is a binary you run, or the Arc gateway in early access.
A ready-made prompt string. Zep's Context Block hands you a formatted block to paste into a system prompt. Brain hands you structured memories and expects you to format them, which is more control and more work.
Document ingestion breadth. supermemory ingests PDFs and transcribes media as a first-class path. Brain takes text; the extraction, chunking and transcription are yours.
Ecosystem. mem0 in particular has far more integrations, examples and Stack Overflow answers than Brain does. That is a real cost on day one.
And Brain is pre-1.0. The wire protocol, on-disk formats and schema model change in place, without compatibility shims. Pin an exact version.
Getting existing data in
Most stores accumulate conversation. Importing it verbatim gives you a space full of dialogue with no clean subject, which extraction cannot type and recall then has to rank around. If you can run a pass that restates each record as a standalone claim in the third person, the import is worth far more than the raw transcript was. See What to write.
Nothing in the typed graph can exist outside the schema, so importing before one is declared gives you memories and no statements — silently. Upload it, and validate before you upload.
This is the one that cannot be fixed afterwards. Pass the original
timestamp as occurred_at_unix_nanos on every write. Without it, a year of
imported history all appears to have happened at import, recency ranking
becomes noise, and every time-bounded read is wrong in a way that looks
plausible.
Build each request once and reuse it across retries — the builders mint a
fresh request id on every build(), so re-building is not retrying. Content
dedup catches byte-identical text as a second line of defence and reports it
as was_deduplicated rather than as an error. See
Idempotency.
Supersession is ordered. Loading a corrected fact before the claim it corrects produces a chain pointing the wrong way, and the current claim is then the stale one. Sort by event time ascending before you start.
Extraction is asynchronous. A verification step that runs immediately after the final write sees an empty graph and reports a failed import. Use the derived wait mode on the wire tier, or watch the change feed.
A keyless namespace imports memories and no statements
The extraction pipeline's LLM tier resolves a provider credential per
namespace. A namespace with none still writes, and still extracts entities
with the pattern and classifier tiers — but produces no statements. An
import run against an unconfigured namespace completes without error and
leaves you with a graph that is missing its claims. Check
capabilities().llm_extractor before a bulk load.
Verifying the import
An import that completed is not an import that worked. Four checks, in the order a failure is cheapest to find.
1. Did the memories land, and under the right identity?
from brain_db_sdk.http import BrainHttpClient
brain = BrainHttpClient(API_KEY, base_url=BASE_URL)
me = brain.whoami()
print(me.namespace, me.space_id) # the scope your key resolved to
page = brain.memory_list(limit=5)
print(page.total if hasattr(page, "total") else len(page.items))whoami first, always. A key bound to the wrong space produces an import that
looks perfect and is invisible to the application — which presents as a
retrieval problem and is not one.
2. Did event time survive?
The single most common silent import failure. Sort by created_at and by
occurred_at and compare: if they agree, every record was stamped at import
and the original timeline is gone.
page = brain.memory_list(limit=50)
stamps = {m.created_at_unix_nanos // 1_000_000_000 for m in page.items}
print(len(stamps), "distinct write seconds") # 1 means they all landed togetherOne distinct second across fifty records imported from a year of history means
occurred_at was never passed. Fix it now; there is no later.
3. Did the graph derive?
Memories without statements means the schema gate dropped everything, or the namespace has no LLM credential, or extraction has not finished yet.
caps = brain.capabilities()
print("llm tier:", caps.llm_extractor) # False → no statements will exist
print(brain.list_statements(limit=5))4. Does a known answer come back?
Pick ten facts you know are in the old system, and recall each one. You are
checking two things: that the memory is there, and that the verdict is
right. A many where you expected single usually means the import kept
near-duplicate phrasings of the same claim.
answer = brain.recall("where does Priya work", max_results=5)
print(answer.answer_kind, [m.text for m in answer.memories])If a fact you know you imported comes back none, the memory almost
certainly exists — it was written in a shape the cue cannot match. That is
the import's extraction pass telling you something, and it is cheaper to
learn now than after cutover. Run include_trace=True on the same query:
it reports every candidate each retriever considered, which distinguishes
"not stored" from "stored and ranked eleventh".
Cutting over without a flag day
You do not have to trust the new system on day one.
Keep writing to your existing layer and write to Brain as well. Nothing reads from Brain yet, so a failure here is a log line rather than an incident. Run it long enough to cover a full usage cycle.
Read from both, serve the old answer, and log where they disagree. This is where you find out whether your import preserved what mattered — and the usual finding is that a memory you expected was never written, which no amount of tuning fixes.
The rollback is one config flag. Keep it that way for at least as long as your longest support cycle.
Once the read path has been stable for a period you trust. Export once more first — this is the last moment the old system is authoritative.
True regardless of which memory layer you are on, and worth restating at migration time because a migration is when people are tempted to move everything. A memory layer is for observed, revisable claims. Entitlements, balances and anything you would have to defend in an audit belong in a system with transactions and a schema you control.
Guides
Coming from mem0
The closest mapping of the three — same verbs, different read shape. Where
user_id goes, and why reranking does not happen.
Coming from Zep
The nearest architecture — both build a bi-temporal graph. What is the same, what is not, and what Context Block has to be replaced with.
Coming from supermemory
Two retrieval paths collapsing into one. Container tags, the ingestion
pipeline you now own, and what isLatest becomes.
Coming from somewhere else
The four concepts above are the whole migration regardless of source. If your layer is a vector store rather than a memory layer, read Why RAG isn't memory first — the port is larger than a verb mapping, because chunk retrieval and membership answering are different questions.
Was this page helpful?
Brain over MCP
@brain-db/mcp exposes Brain's tenant surface as 49 Model Context Protocol tools over stdio or remote Streamable HTTP — the transports, the tool surface, the four-line error contract, and the identity model that makes one public deployment safe.
Migrating from mem0
Verb mapping, the identity model, and the differences that are not renames — the answer verdict, supersession, and where Brain is deliberately stricter.