forget
Remove a memory — the soft tombstone, the hard zero, and why a repeat call is safe.
forget(input: ForgetInput): Promise<ForgetResult>forget(request: ForgetRequest): Promise<ForgetResponse>Parameters
memoryIdstring (wire: 64-bit integer)requiredThe memory to forget. An id that does not exist is not an error — see the result below.
hardbooleanoptionalfalse (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
memoryIdstring (wire: 64-bit integer)alwaysThe id you passed back.
wasAlreadyForgottenbooleanalwaystrue 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.
edgesRemovedintegeralwaysHow 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
new ForgetBuilder(memoryId: bigint)ForgetBuilderrequired.hard()thisoptionalForgetMode.Hard..withMode(mode: ForgetMode)thisoptionalSoft..actAs(namespace, space)thisoptional.build()ForgetRequestrequiredrequestId.import { ForgetBuilder } from "@brain-db/sdk";
await client.forget(new ForgetBuilder(memoryId).hard().build());Was this page helpful?