Brain Docs
Build

Wire it in

Drop it into an existing loopA chatbot that remembersHandling corrections

Production

Alongside your RAGOne space per customerErasing a subject

Working with the API

Error handlingRetries and cancellationIdempotencyStreamingGraph queriesFaithfulness checkingIdentity walkthroughNamespace lifecycle

Reference

Brain/Docs
✦ ASKBrain on GitHubDashboard
BuildHandling corrections

Handling corrections

When a user says "actually, no" — the highest-value write an agent can make, and why it needs no special API, only a timely encode.

PURPOSE

A correction is the user telling you your memory is wrong. Most agents throw that signal away.

Why this is the highest-value write

Every other memory is a guess about what will matter later. A correction is the user explicitly telling you what they want known — and telling you that something you currently believe is false.

Miss it and the wrong fact stays current, gets recalled next turn, and the user has to correct you again. Few things erode trust faster.

There is no special API

Write it like any other memory:

// user: "no, we moved to the EU region last month"
await brain.encode({ text: "They moved to the EU region in October 2026" });
# user: "no, we moved to the EU region last month"
brain.encode(text="They moved to the EU region in October 2026")

Extraction resolves the subject, types the claim, and finds that it competes with the existing region claim — same subject, same predicate, different object. The old one is superseded: closed off in time, linked, retained.

You don't call an update endpoint. You don't look up the old memory's id. You state what is now true, and the engine works out what that displaces.

Writing the correction records it — it does not change what recall returns. recall ranks memories by resemblance and both sentences remain stored, so the stale one can still come back, often ranked higher. Read the statement graph when you need the current claim, and keep genuinely authoritative state in your own database. Where supersession applies has the detail.

Write the claim, not the exchange

The correction arrives as conversation. Don't store it as conversation.

✓  "They moved to the EU region in October 2026"
✗  "User said: no, that's wrong, we moved to the EU region last month"

The second is about the conversation. It has no clean subject, its tense is relative ("last month" from when?), and it will never collide with the claim it was meant to replace — so the stale fact survives alongside it.

Resolve relative time to absolute before writing. "Last month" is only meaningful at the moment it was typed.

Watch for corrections that aren't phrased as corrections. "It's actually Postgres 14", "we don't use that anymore", "she left in June" are all corrections. A rule that only fires on "no" or "wrong" will miss most of them.

Correction versus retraction

Two different things, and the difference is whether the old claim was ever true:

Situation
What to do
The world changed
They were in US-East, now they're in EU
Encode the new claim. Supersession closes the old one, history is preserved
We recorded it wrongly
The agent hallucinated their region and stored it
Retract the statement — it was never true and shouldn't appear in history

Supersession says "this stopped being true." Retraction says "this was never true." If you use supersession for a hallucination, your history now claims the agent was right until it was corrected — which is a worse record than none.

When supersession fires, and when it does not

Automatic supersession is not a general "newest wins" rule. It fires when a write collides with an existing claim on the same subject and predicate where the schema says the predicate holds one value. The response tells you: createStatement returns auto_superseded carrying the id of what it displaced.

Three cases behave differently, and knowing which you are in saves a long debugging session:

OptionTypeDefault / Env
Single-valued predicatesupersedes automatically

works_at, lives_in, plan_tier. The new claim closes the old one and the chain records the order.

Multi-valued predicateboth stay current

speaks_language, owns_device. Nothing is displaced, because nothing contradicts. If you meant to replace rather than add, supersede explicitly.

An Eventnever supersedes

Events record that something happened. A later event does not make an earlier one false, so Brain never auto-supersedes one. See Supersession.

If the predicate is single-valued and the write still did not supersede, the usual cause is that entity resolution was ambiguous — the claim was stored with no subject attached, so it collided with nothing. That outcome writes no link and logs no error; the only signals are the resolve verb's Ambiguous outcome and the brain_extractor_resolver_outcome_total counter.

Close the loop with the user

When a correction lands, say so. "Got it — updated." costs one clause and tells the user the correction took, which is the difference between a system that feels like it listens and one that feels like it forgets.

Try it

In the playground, run Relocation — a location, then a later one that replaces it.

Open Graph and look at the supersession edge. Then ask in Read where they are: one answer, the current one, with the old one still on record.

See also
SupersessionSupersede a statementErasure is not correction

Was this page helpful?

A chatbot that remembers

Give a chat agent continuity across sessions by recalling on the cue rather than replaying the transcript — bounded context that does not grow with history.

Alongside your RAG

Documents and memory answer different questions — keep both, route the query to the right one, and let each do the job the other structurally cannot.

On this page

Why this is the highest-value writeThere is no special APIWrite the claim, not the exchangeCorrection versus retractionWhen supersession fires, and when it does notClose the loop with the userTry it
Suggest an editOpen in Playground