Migrating from supermemory
Two retrieval paths collapsing into one, an ingestion pipeline you now own, container tags becoming a credential, and what isLatest turns into.
A supermemory workspace you can export from, a Brain API key, and a backend
to point at. If encode and recall are new, read
Your first memory first.
Verb mapping
Check which supermemory API version you are on first
The surface has moved more than once. containerTags (an array) is
deprecated in favour of a single containerTag; the v4 API accepts only the
singular form, while documents.list still takes an array. Endpoint paths
have moved across /v3, /v4 and a v5-style namespace model, and there is
no v5 Python SDK yet — the Python tab in their docs shows the legacy client.
Map from the calls your code actually makes, not from the newest docs page, or you will map a surface you are not on.
| supermemory | Brain |
|---|---|
client.add(content, containerTag) | encode under the key's scope |
client.search.memories(q) | recall |
client.search.documents(q) | No equivalent — see "Two paths become one" |
client.documents.list(containerTags) | memoryList |
containerTag / namespace | The (namespace, space) the key resolves to |
| Metadata filters on search | subject, kinds, sessions, confidence, salience_floor |
isLatest on a fact | The supersession chain — superseded_by, valid_to |
Document status (queued → done) | encode returns on durability; derivation is async |
| The "dreaming" merge phase | The consolidation worker — off by default, see below |
1. Two retrieval paths become one
This is the largest change, and it is a change in how you think about the store rather than a rename.
supermemory splits retrieval. Documents go through a search path over chunked, embedded content — classic RAG over things you uploaded. User memory goes through a graph that tracks facts and how they change. You choose which to query.
Brain has one path. recall fuses three retrievers — semantic, lexical
and entity-graph — with reciprocal-rank fusion at k = 60, and returns a
membership verdict over the merged result. There is no document search to port
to, because there are no documents: there are memories, and the graph derived
from them.
What this costs you: if you were using supermemory as a document store — upload a PDF, ask questions over it — Brain is not a replacement for that half. It takes text, not files, and it is built to answer "what do we know about X" rather than "find the passage that says X".
A chunk retriever and a membership answerer are different questions. Feeding
Brain 400 chunks of a contract and asking recall("termination clause")
gives you memories that resemble the cue — which is not the same as the
clause, and the verdict will say many because several chunks resemble it
equally. Keep document retrieval where it is, or build it on a vector index,
and use Brain for the claims you extract from those documents. See
Why RAG isn't memory, and
Brain alongside RAG for running both.
2. The ingestion pipeline becomes yours
supermemory's document path does a lot before anything is stored: text
extraction, transcription for media, chunking, embedding, indexing, with a
status you can poll through queued → extracting → chunking →
embedding → indexing → done.
Brain's write path takes text. Everything upstream of that — opening the PDF, transcribing the call, deciding where one memory ends and the next begins — is yours now.
Text extractionyou own itPDFs, DOCX, HTML. Any of the usual libraries; the output is a string you
pass to encode.
Transcriptionyou own itAudio and video. Whisper or a provider API, then encode the transcript —
ideally segmented by speaker turn with the original timestamps.
Chunkingyou own it, and should rethink itSee below. Chunk boundaries that were right for retrieval are usually wrong for memory.
Embedding + indexingBrain does itBundled in-process — bge-small-en-v1.5, an HNSW index and a tantivy
full-text index. No embedding API call, no vector DB to provision.
Chunking for memory is not chunking for retrieval
A RAG chunker optimises for a window that will be pasted into a prompt: fixed token counts, overlapping, boundaries wherever they fall. That produces memories with no clean subject — "…and so we agreed to move it to Tuesday, which Priya said" is a fragment extraction cannot type.
For memory, the unit is a claim that stands alone. One restatement pass over your export — "Priya moved the planning session to Tuesday" — is worth more than any amount of retrieval tuning afterwards, because extraction can type it and recall can match a cue against it. See What to write.
3. Container tags become a credential
supermemory scopes with a tag on the call: containerTag: "user_123" on write
and on search. Brain has no such argument. The key resolves to a
(namespace, space) server-side and every operation runs inside it.
That is a security property rather than an ergonomic one: a scope that arrives as an argument is a scope a compromised client can change, and a tag that is simply omitted on one code path silently reads the wrong set. A scope that arrives as a credential has neither failure mode.
Three shapes:
One key per tenantworks on any tierMint a key per organisation, resolve it when you resolve the session. Isolation is enforced by the server; the cost is key lifecycle.
One pooled key + act_aswire tier onlyOne credential, every request stamped with the identity it runs as. This
is the direct analogue of a container tag — and the HTTP API does not have
it, so it needs BrainClient over a socket.
One spacesingle-tenant appsEverything together. Fine for an internal tool; not isolation.
act_as takes an opaque selector string — a tenant slug, a user id,
whatever is stable in your system — and the server derives the storage id
from it. Do not generate a UUID and pass it as if it were the space's
identifier: clients cannot forge a space id, and that is the point.
Identity from a JWT walks the whole flow.
A filter gotcha that does not port
In supermemory, a memory tagged with several tags does not match a search
for just one of them. There is no equivalent trap in Brain, because there
are no tags — but the habit it teaches (over-tagging to be safe, then
under-matching on read) is worth unlearning rather than reproducing with
subject filters.
isLatest becomes a supersession chain
supermemory keeps superseded facts and marks the current one, so retrieval stays on the latest without erasing history. Brain does the same thing with more structure and one important caveat.
A correction writes a new statement that closes the old one: the old
statement's superseded_by points at the new one and its valid_to is set.
"What is true now" returns only the newest; "what did we believe in March"
walks the chain.
Supersession resolves the graph, not the raw memories
This catches everyone. Both sentences remain stored as memories, and
recall ranks memories by resemblance — so the stale one can still come
back in a result set. isLatest filtered the thing you were reading; here
the filtering happens one layer down.
When you need the current claim, read the statements
(listStatements), not the memories.
When you want context for a prompt, memories are right and the staleness is
usually acceptable. Knowing which you are doing is the whole of it. See
Supersession.
The "dreaming" phase, honestly
supermemory runs a second pass that merges and arranges stored content into
memories. Brain has the equivalent — a consolidation worker that clusters
related episodic memories into Consolidated ones — and you should know two
things about it before you migrate:
Consolidation ships off
[summarizer] backend = "disabled" is the shipped default, because
consolidation needs an LLM backend wired, and the published container is not
built with one. On a default deployment you get Episodic and Semantic
memories and no Consolidated ones — which is fine for most uses and is
not what supermemory's dreaming phase gives you.
If the merge-and-arrange behaviour is load-bearing for your product, plan for it: either enable the summarizer with a provider backend, or do the consolidation pass yourself before writing.
What is always on is extraction: every write runs the pattern, classifier and LLM tiers and derives entities, statements and relations. That is the part that makes a claim queryable, and it is not optional or configurable.
The call sites, ported
import Supermemory from "supermemory";
const client = new Supermemory({ apiKey: process.env.SUPERMEMORY_API_KEY! });
// Write — scope is an argument on the call.
await client.add({
content: "Priya moved the planning session to Tuesday",
containerTag: `user_${userId}`,
});
// Read — scope is an argument again, and it is possible to forget it.
const hits = await client.search.memories({
q: "when is planning",
containerTag: `user_${userId}`,
});
const context = hits.results.map((r) => r.content).join("\n");import { BrainHttpClient } from "@brain-db/sdk/http";
// Scope is resolved once, from the credential. There is no per-call tag,
// so there is no per-call way to get it wrong.
const brain = new BrainHttpClient({
apiKey: await keyForTenant(tenantId),
baseUrl: process.env.BRAIN_BASE_URL,
});
await brain.encode({ text: "Priya moved the planning session to Tuesday" });
const answer = await brain.recall({ query: "when is planning", maxResults: 6 });
// The verdict is the answer. An empty list and "nothing is known" are
// different states, and only one of them should reach the prompt.
const context =
answer.answerKind === "none"
? ""
: answer.memories.map((m) => `- ${m.text}`).join("\n");Two things disappeared and one appeared.
The tag is gone from both calls. A whole class of bug goes with it: the read path that forgot the tag and quietly searched the wrong set, and the write path that tagged with a stale variable. Neither is expressible.
The client is per-tenant, not per-process. That is the trade for the line above — resolving the credential moves to wherever you resolve the session.
answerKind appeared, and it is not decoration. Porting
if (hits.results.length) compiles and silently discards the membership
verdict, which is the capability you migrated for.
A chunk-retrieval habit is to over-fetch and let the model sort it out.
Brain has already decided which memories answer the cue, so asking for
thirty does not make the answer better — it makes the prompt longer. Six to
ten for a chat turn. There is deliberately no score threshold to tune
either: the verdict already encodes that judgement, and re-thresholding on
similarityScore is how an app discards the one memory that answered the
question.
Verifying the import
Four checks, cheapest failure first.
me = brain.whoami()
print(me.namespace, me.space_id) # 1. the right scope?
page = brain.memory_list(limit=50) # 2. did event time survive?
secs = {m.created_at_unix_nanos // 1_000_000_000 for m in page.items}
print(len(secs), "distinct write seconds")
caps = brain.capabilities() # 3. will statements exist at all?
print("llm tier:", caps.llm_extractor)
print(brain.list_statements(limit=5))
answer = brain.recall("where does Priya work") # 4. does a known fact return?
print(answer.answer_kind, [m.text for m in answer.memories])One distinct write second across fifty records imported from a year of
history means occurred_at was never passed — fix it now, there is no later.
llm_extractor: False means the namespace has no provider credential, so the
import will produce memories and no statements, completing without error.
A `none` on a fact you know you imported is information
The memory almost certainly exists; it was written in a shape the cue
cannot match. That is the restatement pass telling you it was skipped or
was too fragmentary. Re-run the same query with include_trace=True to
tell "not stored" from "stored and ranked eleventh".
Importing
Export content, not derived memories. Brain re-derives on write, so importing supermemory's extracted facts would give you two extractions of the same source — the second one trying to type a sentence that is already a conclusion.
Anything Brain extracts whose type is not declared in an active schema is silently dropped. Import before declaring and you get memories with no graph, and no error saying so.
Documents you uploaded for retrieval may not belong in Brain at all — see the pitfall above. The things that do are the claims: what the user told you, what you observed, what you decided.
A chunking pass tuned for retrieval leaves fragments. One LLM pass that restates each record as a standalone third-person claim is the highest-value hour in this migration.
Supersession is ordered: loading a correction before the claim it corrects builds the chain backwards and leaves the stale claim current.
occurred_at_unix_nanos on every write. Without it the whole import lands
at import time and every time-based read is wrong in a way that looks
plausible. This is the one that cannot be fixed afterwards.
import os
from brain_db_sdk.http import BrainHttpClient
brain = BrainHttpClient(os.environ["BRAIN_API_KEY"], base_url=BASE_URL)
for record in supermemory_export_oldest_first(container_tag):
claim = restate(record.content) # standalone, third person
if claim is None: # not everything is a memory
continue
brain.encode(claim, occurred_at=record.created_at_unix_nanos)Verify after derivation settles, not after the last write
encode returns when the memory is durable, not when the graph has derived
from it. A verification pass straight after the final write sees an empty
graph and reports a failed import. Watch the
change feed, or use the derived wait mode on the
wire tier.
What you gain
An answer, not a ranked list
recall returns single / many / none. none means nothing stored
answers this cue — a real answer, and the one that lets an agent say "I don't
know" rather than reasoning over whatever scored highest. Porting
if (results.length) throws away the thing worth migrating for.
One process, no managed dependency
supermemory is a hosted service. Brain is one Apache-2.0 Rust binary — arena, write-ahead log, redb, HNSW, tantivy and embeddings in-process — that runs embedded, self-hosted or clustered from the same crates. No vector DB to provision, no second datastore to keep in sync, and nothing that stops working when a vendor does.
The read path is inspectable
answer = brain.recall(cue, include_trace=True)Which retrievers ran, how their ranks fused, what the filter chain dropped, what the reranker moved. When an answer is wrong you read what happened instead of inferring it from a score. It is large — a three-hit recall over ~700 memories measured 121 KB — so use it for one request, never an endpoint.
Isolation you can audit
There is no scope argument anywhere in the REST contract, so there is
nothing to forge and nothing to forget on one code path. whoami reports what
the server resolved, so it cannot agree with a mistake.
What you give up
Document ingestionrebuild or keepPDF extraction, transcription, chunking and the status pipeline. Either rebuild the parts you need, or keep document retrieval where it is and use Brain for the claims.
A hosted dashboardrun it yourself/healthz, Prometheus metrics, and the Arc console in early access.
Automatic consolidationoff by defaultThe dreaming-phase analogue needs an LLM backend wired and is not in the published image.
Stabilitypre-1.0Wire protocol, on-disk formats and schema model change in place with no compatibility shims. Pin an exact version.
The honest summary
If supermemory is doing document RAG for you and the memory graph is a bonus, this is not a one-for-one migration and you should expect to keep a retrieval stack. If what you use is the fact graph — "what do we know about this user, and what changed" — then the port is a verb mapping plus a restatement pass, and what you get for it is the verdict, one binary you control, and isolation that is enforced rather than passed as a string.
Was this page helpful?