Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
encoderecallforgetencodeVectormemoryListmemoryInspectgraphFetchlinkunlink
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript 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(input: ForgetInput): Promise<ForgetResult>
Handshake credentialstable
forget(request: ForgetRequest): Promise<ForgetResponse>

Parameters

ParameterTypeRequired
memoryIdstring (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
memoryIdstring (wire: 64-bit integer)always

The id you passed back.

wasAlreadyForgottenbooleanalways

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.

edgesRemovedintegeralways

How many memory edges were detached along with it.

Example

const res = await brain.forget({ memoryId, hard: false });
if (!res.wasAlreadyForgotten) {
  console.log(`removed, detaching ${res.edgesRemoved} 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 retractStatement.

ForgetBuilder

ParameterTypeRequired
new ForgetBuilder(memoryId: bigint)ForgetBuilderrequired
The memory id.
.hard()thisoptional
Switch to ForgetMode.Hard.
.withMode(mode: ForgetMode)thisoptional
Set the mode explicitly. Defaults to Soft.
.actAs(namespace, space)thisoptional
Forget inside another space.
.build()ForgetRequestrequired
Produces the request, with a fresh requestId.
import { ForgetBuilder } from "@brain-db/sdk";
await client.forget(new ForgetBuilder(memoryId).hard().build());
See also
encoderetractStatementDecay and retention

Was this page helpful?

recall

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

encodeVector

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

On this page

ParametersReturnsExampleForgetBuilder
Suggest an editOpen in Playground