Why agents forget
Inference is stateless, so an agent's only memory is the text you rebuild into the prompt — and the stack teams assemble to decide what that text should be has six invisible bills.
A model has two kinds of knowledge, and neither is memory
Weights. What it learned in training. Frozen at inference — nothing you say changes them. Months out of date by the time you call it, and they contain nothing about your user.
The context window. The text you send with this request. The model reads it, answers, and it's gone. There is no third place.
It's worth being precise about "gone", because people reasonably assume some residue persists. It doesn't: the same prompt sent twice produces two independent evaluations, and a fact established in turn three exists in turn four only because the bytes were sent again. Nothing accumulates server-side between calls that you did not put there.
So when an agent "remembers" that Priya prefers dark mode, what actually happened is that your code put the sentence "Priya prefers dark mode" into the prompt before sending it. The model didn't remember. You re-told it.
That's the whole mechanism, and it has an uncomfortable corollary: every remembering system is really a decision about what text to re-send. The quality of your agent's memory is the quality of that decision.
The decision needs five different kinds of access
The reason this gets hard is that "what should I re-send?" is not one question. A long-running agent — a coding assistant tracking a project, a support agent maintaining a relationship, a research assistant accumulating findings — needs its state to answer all of these:
Recall by similarity
What did the user say earlier that's relevant to this question?
Recall by reference
What did we decide on Tuesday? — a specific thing, not a similar one.
Planning over structure
Given what I know, what's the path from here to the goal?
Reasoning over relations
Why did this happen? What depends on what?
Forgetting
Graceful decay of the unimportant; hard erasure of the sensitive.
No single existing storage system does all five natively. So agent stacks duct-tape three or four together: a vector database for similarity, a relational database for structured facts, a graph database for relationships, a document store for raw events — plus application code to orchestrate them.
Three ways teams make the decision first
Each is a reasonable first move. Each fails in a different direction, and the third fails in the way that's hardest to see — which is why it gets the page after next.
Notice that all three answer the same question — what text? — and none of them answers is this still true? That omission is the thread running through every page in this section.
The integration tax
The fourth move — assemble the stores yourself — is where most serious teams end up, and its cost is almost entirely invisible until production. Six specific bills come due:
Latency stackingthe one you feel firstOne turn might hit the vector store, then SQL, then a graph store, then the model. Each round trip is 1–10 ms at best, against a total budget of 100–300 ms for "feels responsive". An agent consulting memory five times a turn spends more time waiting on stores than thinking.
Consistency across storesraces you can't transact awayA new memory has to land in the vector index, the metadata table and the graph edges atomically. There is no distributed transaction across heterogeneous stores, so a reader sees the metadata but not the vector — and your application grows compensating logic (quorum reads, retry loops, idempotency keys, soft-delete patterns) that should have been the database's job.
Embedding lifecyclethe silent oneVectors are only valid relative to the model that produced them. Upgrade the model and every stored vector becomes incomparable to every new one. Most systems handle this by not handling it: keep using mismatched vectors and absorb the quality drop, or freeze on an old model long past its sell-by date.
Working-set fragmentationworse than any one partHot memories belong in RAM, cold ones on disk. Each store has its own caching and tiering and they don't coordinate, so the whole has worse cache utilisation than any single component would alone.
Operational complexityfour disciplinesFour backup stories, four monitoring stories, four replication and scaling and failure stories. Recovery from a partial failure — one store up, another down — is unsolved in most deployments: the application either tolerates inconsistency or refuses requests.
Some operations don't decomposethe structural oneplan is not a function of CRUD calls against a vector store. Neither is
reason. They need the index, the graph, the salience scores and the
working set together, in tight loops, without round trips. Built on top as
application code they come out slow, brittle and approximate.
What's actually missing
Notice what none of the three simple approaches track, and what the assembled stack tracks only by convention:
- Who a statement is about. A transcript knows the words, not the subject.
- When it was true. "Priya manages billing" was true in March. Is it now?
- Whether it still is. Nothing in a chunk of text can disagree with another chunk of text.
- Where it came from. If the model hallucinated it in turn 4 and you stored the turn, it's now a fact.
Each of those is a field, not a quality. You cannot improve a transcript into having a subject column, and no embedding model is good enough to make a text span carry a validity interval. That is the sense in which this is an architectural gap and not a tuning one.
An agent doesn't need a bigger scratchpad. It needs the thing underneath: a record of what it learned, attached to a subject, bounded in time, traceable to a source, and able to be contradicted.
The shape of the fix
The analogy Brain is built on is the one Codd made in 1970. Applications were each implementing their own ad-hoc record management and all making the same mistakes in slightly different ways; the relational model gave them one declarative language — describe what you want, not how to fetch it — over one storage substrate.
Brain proposes that separation for memory. The agent asks in its own terms — recall things similar to this cue, plan a path from here to there, reason about why this happened — and the database decides how. Storage layout, indexing strategy, recall algorithm, working-set management and the embedding lifecycle all stop being the application's problem.
What a purpose-built substrate actually buys
"Build it properly" is easy to assert. Five differentiators carry the argument, and each one has a cost worth naming alongside what it buys — if none of them matter to you, the honest answer is that you don't need this layer.
A typed, bi-temporal graph rather than flat vectors. Four record types with explicit provenance, and four timestamps on every claim. Costs: schema authoring, and roughly 2× the metadata of a pure-vector store. Buys: time-travel queries, structured filters, entity-anchored retrieval, supersession that is distinguishable from contradiction, and provenance back to a source memory on every claim.
An owned embedding model. The model runs in-process — text in, vectors never leave. Costs: about 30 MB of weights the operator has to distribute. Buys: latency under your control with no network hop on the write path; determinism, since the same text always yields the same vector; no per-call cost; privacy, because text never leaves the deployment to be embedded; and no vendor lock — changing models is a config change plus a re-embed pass.
WAL-first durability. Every write hits the per-shard log with group commit before the ack returns, with a checksum on every record that halts on mismatch. Costs: no multi-master writes, and write latency bounded by fsync. Buys: no eventually-consistent cliff edge. A successful ack means durable, recovery is deterministic replay, and the system never returns silently corrupt data.
One codebase across deployment modes. The same crates run embedded, self-hosted, or clustered. Costs: no cloud edition with extra features. Buys: prototype embedded, deploy self-hosted, grow to a cluster without rewriting application code.
Apache 2.0, with no feature gating. Costs: no premium features to up-sell. Buys: you can self-host anything that's documented, and there is no open-core rug pull waiting.
And the parts that aren't differentiators. HNSW for the vector index, RRF
at k=60 for fusion, per-shard tantivy for lexical search, the async runtime
— these are table stakes or implementation detail. Competent alternatives use
the same or close kin, and choosing Brain for them would be choosing it for
nothing.
Worth saying plainly, because a docs site that presents every component as a breakthrough teaches you nothing about where the real trade-offs are.
What it looks like when it isn't assembled
The concrete alternative to four stores and orchestration code is one process with seven internal layers and a rule that forbids cross-layer access:
| Level | Layer | Does |
|---|---|---|
| L1 | Connection | One runtime per CPU core, no work-stealing; auth, framing, backpressure |
| L2 | Embedding | Tokenise, batch, infer, cache on text hash — in-process, no network hop |
| L3 | Planner | Pure function: (op, query, stats) → plan |
| L4 | Execution | ANN, lexical, graph walk and vector algebra over a lock-free read path |
| L5 | Storage | Vector arena, write-ahead log, metadata and graph in one transaction domain |
| L6 | Workers | Decay, consolidation, index maintenance — on their own cores |
| L7 | Observability | Metrics, logs and traces across all of it |
Read that against the six bills and the mapping is exact. Latency stacking goes
away because L2–L5 are function calls rather than round trips. The consistency
problem goes away because the vector, the metadata and the edges are in one
transaction at L5 rather than three systems. The embedding lifecycle has an
owner because L2 is inside. Working-set fragmentation goes away because one
cache hierarchy serves the whole path. Four operational disciplines become one
binary. And plan and reason become implementable because L4 can reach the
index, the graph and the salience scores in a tight loop with nothing in
between.
That is the entire argument for a purpose-built substrate, and it is an argument about boundaries, not about any single component being cleverer.
What it deliberately isn't
A substrate defined only by what it adds is a substrate that will keep adding. The boundaries are as load-bearing as the features, and four of them explain most "why can't I just…" questions:
- Not a general-purpose vector database. If your need is search over a corpus of pre-computed embeddings, that is a different product and a better one for the job.
- No query language. There is no SQL-alike to learn and no runtime-provided expression evaluated server-side — which is also a security position, not only an ergonomic one.
- No built-in LLM inference. Brain does not run your model. It answers memory questions; assembling a prompt is the agent's job, and keeping that boundary is what stops a database from quietly becoming a framework.
- Not a generic graph database. The typed graph is shaped for claims about entities, not for arbitrary property-graph workloads.
Patterns it refuses on purpose
More useful than the non-goals are the things that were specifically considered and rejected, because each rejection names a cost someone else pays:
| Pattern | Refused because |
|---|---|
| Save everything via an LLM on the write path | Puts a model call in the latency budget, and the junk rate is the problem that approach has, not its solution |
| The agent declares the memory layout | Breaks single-writer-per-shard; clients get typed records, not heap regions they manage |
| Return concatenated prior context as the recall result | That is prompt assembly, and prompt assembly belongs to the agent |
| Require a schema before the system is usable | The typed graph is the differentiator, but schemaless has to be the on-ramp |
| Ack the write before the durability barrier | Trades the one guarantee that makes "it succeeded" mean anything |
And three that are permanent rather than deferred: no runtime-provided code in queries, no agent-selected embedding model, and no implicit cross-region writes. Together they close a class of supply-chain and cross-tenant attack that has repeatedly bitten other databases.
The pattern worth stealing from that list even if you never use Brain: the refusals are written down with their rationale. A system that records why it said no is a system you can predict, and predicting it is most of what choosing infrastructure consists of.
The abstraction shift is the whole bet, and it is not free: it is a new system to learn, deploy and operate. SQL took a decade to be widely adopted because the abstraction was unfamiliar. The argument for paying that cost is the six bills above — if your agent never hits them, you don't need this layer, and the honest answer is to keep re-sending the transcript.
Try it
Open the playground — anonymous, no account — and run the New hire fixture. Then look at the Memories tab.
You gave it one English sentence. What came back has a subject, a type, a timestamp, and a link to the sentence it came from. That's the difference between storing text and storing a memory.
Then run it a second time, in a new session, and ask the console to recall something from the first. Nothing in the model remembers the earlier run — the console re-sent what the database selected. That round trip, made explicit and inspectable, is the whole subject of the next seven pages.
Was this page helpful?
Learn
How memory for AI agents actually works — nine pages in order, from why the problem exists to the write policy that decides whether your deployment succeeds.
Why a bigger window doesn't fix it
Four limits that don't go away with capacity — cost, quadratic prefill, measured attention degradation, and a flat token sequence having no structure — plus the arithmetic of the alternative.