Brain Docs

Reference

Python SDKInstallationHTTP clientWire clientSync vs async
encoderecallforgetencode_vectormemory_listmemory_inspectgraph_fetchlinkunlink
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Python SDKMemoryforget

forget

Remove a memory — the soft tombstone, the hard zero, and why a repeat call is safe.

PURPOSE

forget removes a memory. Two modes: a soft tombstone, which makes it unreadable but keeps the record, and a hard zero, which overwrites the stored bytes. Both are idempotent.

DELETE/v1/memoriesBearer API keystable
forget(memory_id: str, hard: bool = False) -> ForgetResult
Handshake credentialstable
forget(request: ForgetRequest) -> ForgetResponse

Parameters

ParameterTypeRequired
memory_idstring (wire: 64-bit integer)required

The memory to forget. An id that does not exist is not an error — see the result below.

hardbooleanoptional

false (the default) tombstones the memory: it stops being readable and stops matching recall, and the record stays. true zeroes the stored bytes. On the wire this is a ForgetMode — Soft (0) or Hard (1).

Returns

FieldTypePresence
memory_idstring (wire: 64-bit integer)always

The id you passed back.

was_already_forgottenbooleanalways

true when the memory was already gone. The call still succeeds — this is what makes forget safe to retry, and safe to call from a cleanup job that does not track what it has already removed.

edges_removedintegeralways

How many memory edges were detached along with it.

Example

res = brain.forget(memory_id, hard=False)
if not res.was_already_forgotten:
    print(f"removed, detaching {res.edges_removed} edges")

Hard is not undoable

A hard forget overwrites the stored text. There is no restore, no grace period, and no audit record that can reconstruct it. Use the soft mode unless you are servicing an erasure request.

Forgetting a memory does not retract the statements extracted from it. Those have their own lifecycle — see retract_statement.

ForgetBuilder

ParameterTypeRequired
ForgetBuilder(memory_id: int)ForgetBuilderrequired
The memory id.
.hard()ForgetBuilderoptional
Switch to ForgetMode.HARD.
.with_mode(mode: int)ForgetBuilderoptional
Set the mode explicitly. Defaults to SOFT.
.act_as(namespace, space)ForgetBuilderoptional
Forget inside another space.
.build()ForgetRequestrequired
Produces the request, with a fresh request_id.
from brain_db_sdk import ForgetBuilder
client.forget(ForgetBuilder(memory_id).hard().build())
See also
encoderetract_statementDecay and retention

Was this page helpful?

recall

Retrieve memories for a cue — the Single / Many / None answer shape, scope, and the retrieval trace.

encode_vector

Store a memory with an embedding you computed yourself, bypassing Brain's embedder.

On this page

ParametersReturnsExampleForgetBuilder
Suggest an editOpen in Playground