Skip to documentation
Docs navigation
Docs/Forgetting & privacy
Guide

Forgetting & privacy

Remove selected memory from active use, verify the result, and distinguish soft forgetting from physical data deletion.

Estimated time: 6 minutes
Level: Intermediate
Prerequisites:Installation·Quick Start

Overview

forget() and forgetMany() mark exact memory rows as forgotten. Forgotten memory remains available to history and snapshot inspection but is excluded from active recall, grafting, absorption, memory-edge construction, and maintenance.

When to use this

A user asks the application to stop using a retained fact.
An extracted memory is incorrect or inappropriate for future retrieval.
A reviewed batch of exact memory IDs should leave active recall.
The application needs an auditable soft lifecycle action.

Step 1: Resolve the exact memory

find-memory.ts
const result = await agent.recall("food preference", {
  limit: 10,
  minSimilarity: 0.4,
});

const target = result.facts.find((fact) => fact.value.includes("mushrooms"));
if (!target) throw new Error("Memory not found");

Step 2: Forget it

forget.ts
const changed = await agent.forget(target.id);
console.log(changed); // true only when state changed

Step 3: Verify active and audit views

verify.ts
const active = await agent.recall("food preference");
const snapshot = await agent.getGraphSnapshot();

console.log(active.facts.some((fact) => fact.id === target.id)); // false
console.log(snapshot.memories.some((memory) => memory.id === target.id)); // true

Full example

privacy-request.ts
async function forgetApprovedMemories(agent: MemoGrafterAgent, ids: string[]) {
  const changed = await agent.forgetMany(ids);
  const snapshot = await agent.getGraphSnapshot();
  const statuses = ids.map((id) => ({
    id,
    forgotten: snapshot.snapshotMemories.find(
      ({ memory }) => memory.id === id,
    )?.lifecycle.forgotten,
  }));
  return { changed, statuses };
}

Soft forgetting and hard deletion

MemoGrafter’s public forget API is intentionally one-way and soft. It does not expose restoreMemory(). If policy requires physical deletion, backups removal, or downstream erasure, implement that broader retention workflow at the application and storage layers.

Privacy checklist

Authenticate and authorize the requester.
Resolve exact memory IDs and scope them to the authorized user or session.
Record the request and result in the application’s audit system.
Verify active recall no longer returns the memory.
Handle backups, exports, logs, caches, and external systems according to the application’s retention policy.

Common mistakes

Calling forget() on an unverified ID.
Claiming the database row was physically deleted.
Expecting a public restore API.
Suppressing a topic when only one memory should be forgotten.
Ignoring data copies outside MemoGrafter’s graph store.