Skip to content

Forget

Forget removes an entity from active use. It will no longer appear in recall results or be accessible through standard queries. XTDB retains the data in its transaction log — this is a logical delete, not a physical one.

POST /forget {entity_id}
┌──────────────────────────────────┐
│ DATABASE (Transaction) │
│ 1. Collect memory IDs │
│ 2. Delete relationships │
│ 3. Delete summaries │
│ 4. Delete memories │
│ All-or-nothing: COMMIT/ROLLBACK │
└──────────────┬───────────────────┘
┌───────┴───────┐
▼ ▼
ForgetResponse VECTOR STORE
(async cleanup)
DataRecovery
memories (all versions)XTDB history
relationshipsXTDB history
memory_closureRebuildable
access_countsXTDB history
summariesXTDB history
embeddingsRe-embed from history

Order matters due to foreign key constraints:

  1. relationships — references memories
  2. memory_closure — references memories
  3. memory_access_counts — references memories
  4. summaries — references entity_id
  5. memories — root table, deleted last
PropertyGuarantee
AtomicityDB deletes are transactional (all-or-nothing)
IdempotencyForgetting non-existent entity succeeds with 0 counts
BitemporalAll versions removed from active queries (XTDB history retained)
ConsistencyEntity will not appear in future recall results

Non-existent entity: Returns success with memories_removed: 0. Intentionally idempotent.

Vector store failure: Logged but doesn’t fail the operation. Orphaned embeddings may exist temporarily. DB is the source of truth.

Terminal window
curl -X POST https://api.memlayer.dev/api/v1/forget \
-H "Content-Type: application/json" \
-d '{"entity_id": "alice-location"}'
FieldTypeRequiredDescription
entity_idstringYesThe entity to forget