Brain Docs
Learn

Why memory exists

Why agents forgetWhy a bigger window doesn't fix itWhy RAG isn't memory

What a memory is

What a memory isThe statement kindsWhen facts collide

How it answers

How recall decidesDecay and retention

Using it well

What to write, and what not to

Reference

Brain/Docs
✦ ASKBrain on GitHubDashboard
LearnWhen facts collide

When facts collide

Preferences supersede, facts contradict, events never move, relations obey cardinality and entities merge — five resolutions for five kinds of collision, and none of them overwrite.

PURPOSE

This is the behaviour the whole data model exists to make possible. It is also the page most often read wrong, because "a newer claim replaces an older one" is true of exactly one of the three statement kinds.

Nothing is overwritten — but not everything supersedes

Start with the thing people assume, because it is only a third right.

A new claim that disagrees with a stored one does not generically replace it. What happens depends entirely on the statement kind, and the three outcomes are genuinely different:

OptionTypeDefault / Env
Preferencesupersedes — automatically

A new Preference on the same (subject, predicate) closes the old one. This fires on create, inside the same transaction, without a second call. This is the only kind where "newer wins" is the rule.

Factcontradicts — both stay live

A new Fact on the same (subject, predicate) with a different object is a contradiction, not a supersession. Both rows are stored, both stay active, and Brain does not pick a winner. Superseding a Fact is possible but only as an explicit, deliberate call.

Eventnever — it is rejected

Events are point-in-time records. STATEMENT_SUPERSEDE on an Event returns INVALID_ARGUMENT. A correction is a new Event whose provenance notes the correction; the original stays as the record of what was believed then.

A promotion is not a supersession. "Diego joined as a senior engineer in January" and "Diego was promoted to tech lead in June" are two Events, and Events never supersede. Both are permanently true and the second does not close the first.

What would supersede is a Preference — "Diego prefers async standups" followed by "Diego prefers live standups". If you find yourself wanting last-write-wins for something, you are describing a Preference predicate, not a Fact or Event one.

What supersession actually does

When it does fire, nothing is deleted:

  • the older statement gets a valid_to — it stops being current
  • it gets superseded_by pointing at the new one
  • the new one gets supersedes pointing back, and version: 2
  • both share a chain_root, so the whole history is one walkable chain
  • the older statement is still there — not tombstoned, still queryable

How Brain decides: the supersession ladder

For a Preference arriving via create, the auto-supersession step has to decide whether the new row supersedes the current one, coexists with it (different wording, same intent, both legitimate), or contradicts it. It runs a ladder, first match wins:

TierTriggerOutcome
0Exact match on (subject, predicate_id)Supersede — the deterministic fast path
1Statement-vector cosine ≥ 0.92Auto-supersede — near-synonym, surface form drifted
2Cosine in [0.82, 0.92)LLM judge returns SUPERSEDES / COEXISTS / CONTRADICTS
3Cosine < 0.82Coexist — different enough that no decision is warranted

Tier 1 is what catches "prefers async meetings" against "prefers asynchronous meetings" — same intent, drifted wording. Tier 2 is the genuinely ambiguous band, and it is the only tier that costs an LLM call; the judge sees both statements plus the subject's recent context. Tiers 1 and 3 are cheap rank-ordering over a vector already sitting in the statement index.

Every supersession writes an audit record — who superseded whom, when, and on which tier — retained indefinitely.

Relations supersede too, by cardinality

The statement ladder is not the only path. A relation between two entities carries a cardinality on its type, and that cardinality drives the same mechanism:

CardinalityWhat a new relation does
ManyToOne — reports_toSupersedes the existing one on the from side
OneToMany — employed_bySupersedes on the to side
OneToOne — married_toSupersedes on both sides
ManyToMany — discussed_withNothing — concurrent relations are valid

So asserting that Priya now reports to Dev closes her previous reports_to automatically, links the chain, and leaves the old edge queryable — without you issuing a second call, and without a Preference anywhere in sight.

A relation type interned without a schema never auto-supersedes. Types created implicitly on first write default to ManyToMany with no constraints, so the cardinality that would have triggered supersession doesn't exist yet. Two reports_to edges both stay current and no cardinality violation is raised.

Declaring the type later preserves the id and starts enforcing on new writes. It does not go back and close the edges that should have been superseded.

Contradiction: the case Brain refuses to resolve

Two active Facts contradict when all six hold: both are Facts, same subject, same predicate, different object, both active (not tombstoned, not superseded), and their validity intervals overlap.

When that happens Brain stores the new one anyway. Both Facts coexist. Neither is marked right.

The contradiction is not signalled on the success path. STATEMENT_CREATE returns a normal success with a new id. A client that cares must query for it explicitly, and the default "current facts about this subject" listing returns all active non-superseded Facts — which may include a contradictory pair. Consumers rank or post-process.

Two reasons it works this way, and both are worth agreeing with before you build on it:

  1. Brain doesn't know what's true. It receives claims from extractors, agents and humans. Refusing the conflicting claim would silently drop information from a source that might be the correct one.
  2. Contradiction is signal. Two contradictory claims mean the upstream source is inconsistent. The right response is to surface that, not hide it behind a write that quietly won.

The trade is explicit: you get the information, and you own the resolution. When you ask for it, the conflict comes back as a view carrying every conflicting statement, which one holds the highest confidence, and a recommendation — resolve by confidence, by recency, or unresolved when neither signal separates them.

Confidence is how a contradiction usually settles

You rarely have to adjudicate by hand, because the two rows will not usually carry equal confidence. A statement's confidence aggregates over its evidence by noisy-OR:

confidence(S, now) = 1 − Π (1 − cᵢ · decay(ageᵢ, kind))
                        i ∈ evidence

Each piece of evidence is an independent vote; the result is the probability that at least one is right. Two independent 0.9-confidence observations give 1 − (0.1 × 0.1) = 0.99, not 0.9. No evidence gives 0.0 — a claim with nothing behind it has no confidence by construction.

Decay is per kind: a Fact's evidence halves roughly every 365 days, a Preference's faster, and an Event's does not decay at all. So a stale Fact loses to a freshly-corroborated one on confidence alone, with no supersession recorded — which is the mechanism that makes "both stay live" tolerable rather than paralysing.

Repeated identical observations are deduplicated before aggregation: the same (memory_id, extractor_id, source_kind) counts once. Without that, telling Brain the same thing ten times would manufacture near-certainty from a single source. Different extractors confirming each other are still treated as independent — slightly optimistic, and accepted deliberately.

Evidence itself lives inline on the statement for up to 8 entries — enough for the common 1–5 — and spills to an overflow row beyond that, which is what happens to a long-lived Preference reaffirmed across fifty conversations.

Identity collides too, and it has its own bands

Everything above assumes you know which Priya a claim is about. Sometimes you don't, and the resolver proposes that two entities are the same person. That is a collision at the identity level, and merging is irreversible in a way a statement write is not — so it is gated by confidence:

ConfidenceSystem-initiated (the resolver)Operator-initiated
≥ 0.95Merges autonomously; audit row writtenApplies immediately
0.70 – 0.95Not applied. Queued for review, surfaced as a pending proposalApplies immediately — the operator is the reviewer
< 0.70Not a candidateRejected as INVALID_ARGUMENT — a caller bug, not a policy call

The band that matters is the middle one. A machine guess in [0.70, 0.95) doesn't merge and doesn't vanish: it parks in a review queue with its reason and an evidence summary, bucketed so an operator sees the strongest proposals first.

And it doesn't sit there forever waiting for a human. An ambiguity resolver re-runs entity resolution against every pending proposal as new evidence arrives — more statements citing one or the other, new aliases, fresh mentions — every six hours. If confidence crosses 0.95 the merge applies on its own; if it falls below 0.70 the proposal is dropped and both entities stay separate.

That worker is the part worth internalising: ambiguity is allowed to remain ambiguous while evidence accumulates. The system is not forced to guess at write time and is not forced to interrupt a human either. It is the same instinct as storing both contradicting Facts — defer the decision to the point where there is enough information to make it.

A merged-away entity's id becomes a redirect rather than a dangling reference, so an id you stored before the merge still resolves afterwards.

Reading the chain

The chain is readable two ways: walk superseded_by / supersedes from any member, or range-scan the chain index at (chain_root, *) to get every version in order. The second is what STATEMENT_HISTORY exposes, and it has three properties worth knowing:

  • Any anchor works. Pass the chain root or any statement id in the chain — including one you got from a superseded_by field. You don't have to find the root first.
  • It's keyset-paginated on version. Because version is immutable and dense, a page can neither gap nor duplicate a row across fetches, even while the chain is being extended.
  • It's cheap. Full history is one prefix scan; the current version is a reverse prefix scan at effectively O(1); the N-th version is a point lookup. A hundred-version chain traverses in under a millisecond.

Two invariants hold over every chain, and they are what make "current" a well-defined idea rather than a convention: versions are dense 1..=N with no gaps, and exactly one statement per chain is current (not superseded, not tombstoned). Tombstone the current entry and no statement in the chain is current — a (subject, predicate) query returns empty rather than silently resurrecting the previous version.

Chains never cross shards. Statements are sharded by subject, supersession requires the subject to match, and a mismatched subject is rejected — so a chain is always one shard's problem.

Superseded is not deleted, and not retracted

Three distinct end-states. Conflating them is a common and expensive bug:

State
What it means
Superseded
`superseded_by` set, `valid_to` closed
Was true, isn't now. Retained, auditable, answers historical queries.
Retracted
Withdrawn via the statement's retract path
Was never true — an error or a hallucination. Not aged out; cancelled.
Tombstoned
`tombstoned: true`, then reclaimed after the grace period
Gone. This is erasure, for deletion requests — not for correction.

"Diego moved roles" is supersession. "We recorded that wrongly" is retraction. "Delete everything about this person" is tombstoning. A system with only DELETE collapses all three and can't tell you which happened.

And a tombstone itself records why it happened — the claim's source memory was forgotten, somebody requested erasure, a schema change made it unrepresentable, or the extractor that produced it withdrew it. Four genuinely different events; a single deleted flag would lose the only information that makes a row's absence explicable later. The first of them is how cascading deletes stay auditable: forget a memory and every claim resting on it tombstones with a reason pointing back at the cause.

Why this needs structure, not similarity

Every resolution above — supersede, contradict, coexist, merge — is mechanical: compare subject, predicate, object and interval. That comparison is only possible because a statement is decomposed into those parts.

Two sentences in a vector index have none of them. No subject to match on, no interval to overlap, and no field in which the newer one could say "I replace the first." The index can only tell you they're similar — which is exactly the wrong answer, because the stale claim is usually more similar to the query than the correction is. It's shorter, more on-topic, and doesn't spend words explaining what changed.

Where this applies, and where it doesn't

All of it is a property of the typed graph, not of memories. The sentences you encoded are both still stored, verbatim, forever. What supersedes, contradicts or merges is the structure extracted from them.

recall does not apply supersession. It returns memories ranked by fused retrieval, so a cue matching both sentences gets both back — and the stale one frequently ranks higher, because it is shorter and more on-topic than the correction that explains what changed.

Measured against a live deployment: encoding "Dmitri leads payments" then "Dmitri left payments; Lena now leads" and recalling returned both, the superseded one at 0.954 against 0.935.

So "what is true right now" is a question for the statement graph, not for recall:

You wantRead
Text that resembles this cuerecall
The current claim about a subjectstatements — filter on open valid_to
Every version of a belief, in orderSTATEMENT_HISTORY on the chain_root
What we believed in Augustthe chain member whose interval contains August
Whether two claims disagreethe contradiction query for (subject, predicate)
Whether two entities are the samethe pending-resolution list
Why a belief changedthe evidence on the superseding statement

Design around this rather than against it. Authoritative current state — who owns a service, which plan a customer is on — belongs in a row you can update, where exactly one answer exists by construction. Use recall for what it is good at: finding things that resemble the situation you're in, where contradiction is informative rather than a defect.

Try it

Run Promotion in the playground, then open Graph. Look at what the two claims actually are before assuming one closed the other — if they came out as Events, both are open and permanently true.

Then switch the console to Read and ask who leads the billing team. Both sentences can come back: recall is ranking memories by resemblance, not reading the graph you just looked at. Seeing those two views disagree is the clearest way to understand the split.

See also
The statement kindsHow recall decidesHandling corrections

Was this page helpful?

The statement kinds

Fact, preference and event — three kinds over one storage schema, three mutation contracts, why there are exactly three, and the modelling error that silently erases history.

How recall decides

Three retrievers fan out, their ranks fuse with RRF at k=60, a filter chain trims, and a relevance band — not a top-K cut — decides whether the answer is Single, Many or None.

On this page

Nothing is overwritten — but not everything supersedesWhat supersession actually doesHow Brain decides: the supersession ladderRelations supersede too, by cardinalityContradiction: the case Brain refuses to resolveConfidence is how a contradiction usually settlesIdentity collides too, and it has its own bandsReading the chainSuperseded is not deleted, and not retractedWhy this needs structure, not similarityWhere this applies, and where it doesn'tTry it
Suggest an editOpen in Playground