Skip to main content

Function: forgetUserMemory()

forgetUserMemory(options): Promise<ForgetMemoryReport>

Defined in: packages/agentos/src/cognition/memory/io/forgetUserMemory.ts:209

Deletes one subject's memory from a store for good and keeps it deleted.

In order: the subject's pending writes and compiles are waited for (drain); the tombstone is written to the ledger's copy and then to the store, and from then on every new write of the subject is refused; the subject's conversation traces are deleted under this agent's key and under every other agent's key of the subject, the soft-deleted rows, the graph copies, the full-text entries and the document chunks with them; for a user, the traces that name the user under other scopes, after each page of another user or session compiled from one of them, which the next compile builds again from that subject's own traces; each compiled page of the subject with its chunks; the scope's registry row; for the user older memory is attributed to (legacy), that memory and the attribution; then the full-text index is rebuilt where a delete's own rebuild failed, the vector index is written again from what is left, and the write-ahead log is emptied. A page left keeps the traces it was found by, so the deletion made again finds it. A store that throws is named as not reached and the next one still runs. No model call is made, and Memory.forget() (a soft delete) is never used.

Parameters​

options​

ForgetUserMemoryOptions

Returns​

Promise<ForgetMemoryReport>

The report. One memory.forget_done line is logged with its counts.

Throws​

TypeError when the subject has another kind or no id, or an id no conversation key can be built from: a missing id never widens the deletion.

Throws​

Error when the store has no forgotten-user ledger.

Throws​

What the ledger throws when the tombstone cannot be written to both of its copies: nothing is deleted without it.