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
BuildErasing a subject

Erasing a subject

Deleting everything about a person — soft versus hard forget, why the cascade matters, and which parts of a data-subject request are yours to own.

PURPOSE

"Delete everything you know about this person" — a request you will get, and one that's tractable here because subjects are canonical.

Soft and hard

curl -X DELETE "$BRAIN_BASE_URL/v1/memories" \
  -H "Authorization: Bearer $BRAIN_API_KEY" \
  -d '{ "memory_id": "…", "hard": true }'

Soft (the default) tombstones the record and lets a grace period run — 7 days by default, configurable — before a maintenance worker reclaims the slot. Inside the window it is genuinely reversible, which matters when the delete was a mistake: POST /v1/memories/{id}/restore on the admin plane un-tombstones the memory and replays a forget undo log, re-attaching the evidence the cascade stripped from dependent statements and relations and recomputing their confidence. The replay is idempotent, so re-running it is a no-op. After grace, slot reclamation has reaped the undo rows too and the forget is irreversible.

Hard zeroes the slot immediately. Not recoverable, no undo log, no window. This is the one for an erasure request.

Soft delete is not erasure. If you're answering a legal deletion request, hard: true is the only correct call — a tombstone inside its grace window is still data you hold.

The cascade is the useful part

Removing a memory also removes the typed records derived from it. A statement whose evidence no longer exists is an unattributed claim, and the write path refuses to admit those — so it can't keep them either.

That's what makes erasure tractable rather than forensic. Because entities are canonical and statements point at them by id, the subject is a real handle rather than a string you hope you can find every copy of. You aren't grepping for name spellings across a corpus of chunks.

The cascade is asynchronous — the index is not

forget marks the memory in the index's tombstone set synchronously, so the very next search filters it. The cascade that tears down the memory's graph rows runs on a worker, so a statement sourced from it can linger for one worker cycle. A verification check run immediately after the delete can therefore still see the statement while recall already cannot see the memory. Re-check, rather than concluding the cascade failed.

A dependent row whose evidence the cascade reduces to nothing is tombstoned with the reason SourceMemoryForgotten, which is also what the restore path looks for when reversing a soft forget.

Deleting a whole space

When your tenant unit is the person — one space per end user — erasure is one call rather than a walk:

curl -X DELETE "$BRAIN_BASE_URL/v1/spaces" \
  -H "Authorization: Bearer $USER_SCOPED_KEY"

This is the strongest argument for one space per subject when your product allows it. Deletion becomes structural instead of a query you have to get exhaustively right.

What you still own

Brain gives you the mechanism. These remain your decisions, and an auditor will ask about all three:

Where else the data went. If you put recalled memories into prompts sent to a model provider, those are now in that provider's logs under their retention terms. Erasure here doesn't reach them.

Your own copies. Transcripts, analytics events, backups. A memory layer is one store among several.

Timing. Hard delete is immediate; your backups are not. Know your restore window and what re-appears if you use it.

Proving it's gone

Two checks worth running, and worth keeping as a test:

  1. Recall the subject. answer_kind should come back "none" — an explicit "nothing stored answers this", not an empty-looking list of weak matches.
  2. List with tombstones included. GET /v1/memories takes include_tombstoned, so you can confirm nothing is lingering in a grace window rather than assuming. After a hard forget there should be nothing to include.
  3. Check the statements, not just the memories. The cascade is asynchronous. GET /v1/statements filtered by the subject entity is the check that the graph followed.

Write the erasure path as an integration test on day one, before you need it. The worst time to discover your deletion is incomplete is while answering a regulator.

Erasure is not correction

If the goal is "this fact is wrong", don't delete — that destroys the history of what you believed and when. Encode the correction and let supersession close the old claim, or retract it if it was never true. Erasure is for "this person must not be in your system", and it should be reserved for that.

Retraction has its own clock, and it is not the forget grace period: retract returns will_zero_at_unix_nanos, the moment the bytes go. Physical removal of retracted statement rows is a separate, opt-in worker ([workers.statement_reclaim], 30 days when enabled) — off by default, so retracted rows stay in storage, invisible to retrieval, until an operator turns it on. If your erasure obligation covers retracted claims, that worker is part of your configuration, not something you get for free.

See also
DELETE /v1/memoriesOne space per customerBackups and retention

Was this page helpful?

One space per customer

Namespace is the hard boundary, space is the isolation unit, and a trusted backend selects a tenant's space with act_as — a wire-tier capability the HTTP API does not have.

Error handling

Catch the BrainError hierarchy from the wire client, decide retry vs surface, and know which of the nine error categories are transient.

On this page

Soft and hardThe cascade is the useful partDeleting a whole spaceWhat you still ownProving it's goneErasure is not correction
Suggest an editOpen in Playground