Skip to content

Consolidation

Extraction turns new turns into candidate memories. Consolidation decides what each candidate means for what is already known. The model sees the candidate and the most similar current memories (by meaning and by shared subject) and picks one operation:

OperationWhenWhat happens
ADDNew informationA new memory is stored.
UPDATERefines one existing memory that is still trueA new version is stored; the old row points at it with superseded_by.
INVALIDATEContradicts a memory because the world changedThe old memory's valid_to is set, and the candidate is added as a new memory.
NOOPNothing newNothing changes; the decision is logged.

Nothing is overwritten

UPDATE and INVALIDATE never edit text in place. The old version stays in the database with its validity closed, so you can ask what was true before, and every decision lands in the op log with the model that made it and a one-sentence reason. Read it with GET /v1/memories/{id}/history or GET /v1/users/{uid}/ops.

{
  "op": "INVALIDATE",
  "reason": "Residence changed from Pune to Berlin.",
  "before": { "text": "The user lives in Pune.", "valid_to": null },
  "after": { "text": "The user lives in Pune.", "valid_to": "2026-03-01T00:00:00Z" }
}

Safety rails

  • The model may only target memories it was shown. Anything else falls back to ADD.
  • All writes for one candidate (memory rows, entity links, op log and the job's progress counter) commit in one transaction.
  • Consolidation for one user runs under a Postgres advisory lock, so two conversations arriving at once can't both add the same fact.
  • Jobs are resumable: candidates are extracted once and stored on the job, and a retry after a crash continues from the first unapplied candidate. Candidate text is removed from the job when it finishes.

Command palette

Jump to a page, search the docs or change the theme.