Your agent's memory should know when the customer changed their mind.
Apply ADD, UPDATE, DELETE, or NOOP as one explicit memory operation.
Recall the current fact, inspect how it changed, and fail CI if an old
memory returns.
Short answer: Memory Evolution is ContextDB's
state machine for changing factual agent memory. ADD stores a new fact.
UPDATE corrects a known fact and records lineage. DELETE removes a
target or current slot. NOOP records that nothing should change.
The Cloud API and Console expose the same closed operations with
bounded functional evidence from the hosted service. Hosted Memory
Evolution is not generally available. No public availability SLO,
sustained-load result, or failover claim is made.
Append-only memory turns yesterday's truth into tomorrow's mistake.
A caller says Thursday works. Later, they correct it to Friday. If your
memory layer stores both statements as unrelated vectors, retrieval can
return either one. The model then has to guess which fact is current.
ContextDB makes the change explicit before retrieval. One operation
closes the old fact, writes or removes the current fact, advances the
project memory version when state changes, and appends the related audit
event.
01 / Current
Thursday is active
The current fact has an opaque ID and project-scoped memory version.
mem_old · version 41
02 / Correct
Customer changes the fact
UPDATE targets the current memory ID or its stable entity and attribute slot.
UPDATE mem_old
03 / Commit
Friday becomes current
The new fact, supersession link, version, WAL position, and write audit commit together.
mem_new · version 42
04 / Recall
Old fact leaves current recall
The caller can pass the version and WAL floors when the next turn must observe the change.
superseded_by mem_new
05 / Test
Memory CI checks both IDs
The case requires the successor and forbids the superseded evidence ID.
require new · forbid old
Four closed operations
Say what happened instead of asking retrieval to infer it.
Atomic factual memory operation contract
Operation
Input
State result
Returned proof
ADD
Content and source, plus an optional entity and attribute for a stable slot.
A new durable fact becomes active.
Current memory ID, memory version, and primary WAL position.
UPDATE
An opaque target memory ID or stable slot, plus corrected content and source.
The successor becomes active and the prior memory becomes superseded.
New memory ID, previous memory IDs, memory version, and WAL position.
DELETE
One scoped target ID or the current value in a stable slot.
The target row is hard-deleted.
Deleted memory IDs, memory version, and WAL position.
NOOP
A verified scoped reference and bounded reason such as duplicate.
No memory row changes and the project memory version does not advance.
The NOOP reason and content-free audit event.
Python
Correct the fact, then require the next recall to see it.
Every Evolution call requires a stable idempotency key. The result
includes the current memory, prior IDs, project-scoped memory version,
and primary PostgreSQL WAL position.
Pass both consistency values into a follow-up recall when the next turn
must observe the correction.
from contextdb_cloud_client import CloudClient
async with CloudClient(
"https://api.contextdb.ai",
api_key="cdb_…",
) as db:
changed = await db.evolve(
"caller-123",
"update",
target_memory_id=current_memory_id,
content="Friday morning works best.",
source="user_stated",
idempotency_key="call-884-correction-v1",
)
current = await db.recall(
"caller-123",
"When should I book the visit?",
min_memory_version=changed.memory_version,
min_primary_wal_lsn=changed.primary_wal_lsn,
)
TypeScript
Retract a fact or record a duplicate without another write.
Target IDs are opaque. Store and pass them unchanged. Cross-project,
cross-user, and missing targets all return the same not-found shape.
The package is server-only. Keep the project API key in Node.js,
workers, server actions, or another trusted backend.
The response includes the primary WAL position. The current deployment
has no read replica, and its read and primary pools both connect to the
primary. Replica wait with primary fallback remains a consistency
contract for a topology with a replica. It is not evidence of deployed
read scaling.
Fail-closed target scopeunknown target → 404 · no mutation
UPDATE and DELETE do not turn a missing or foreign target into an ADD.
A target that cannot be proven inside the project and user partition is
not found.
Lineage without old content
See the change graph without reopening deleted text.
The Console lineage view returns opaque IDs, lifecycle state, slot,
timestamps, supersession links, operation, and reason code. It does not
return historical memory content.
After DELETE, the target row is gone. The append-only audit can retain
the operation and opaque ID so an operator can verify that a deletion
happened without restoring the deleted fact.
Synthetic demoCloud memory history. Deleted content is not reconstructed.
Formation can plan the same lifecycle
Completed conversations can produce a correction, retraction, or no change.
ContextDB Formation receives bounded,
project-scoped current memory alongside PII-processed turns. The hosted
planner proposes one of the four operations. Deterministic gates then
verify quotes, targets, slots, explicit retractions, and NOOP reasons
before commit.
"Actually, make that Friday"correction + known target → UPDATE
Propose UPDATE against the current appointment-day memory.
"Yes, Friday is still right"same fact + same slot → NOOP
Propose NOOP rather than writing a second copy.
"Forget my shipping address"retraction + known target → DELETE
Propose DELETE only when the turn contains an explicit retraction.
Test current and obsolete evidence
Require the new memory ID and forbid the old one.
Memory CI supports deterministic evidence-ID
assertions. A correction test can require mem_new and
forbid mem_old. A deletion test can forbid the deleted ID.
JSON and JUnit exports contain opaque IDs, statuses, counts, outcomes,
and machine codes. They omit queries, assertions, and memory content.
case: corrected appointment day
query: "When should I book?"
expected_evidence_ids:
- mem_new
forbidden_evidence_ids:
- mem_old
result: passed
Memory Evolution use cases
Use Evolution wherever stale memory can change the next action.
Voice scheduling
Correct a caller's appointment day after an explicit statement, then require that version before booking.
UPDATE → consistency floor → action gate
Support account changes
Retract obsolete plan or service context so a later agent does not rely on it.
DELETE → forbid old evidence
Customer profile sync
Map a changed source record to UPDATE and repeated source versions to NOOP.
source version → UPDATE | NOOP
Agent-platform memory
Offer one lifecycle contract across frameworks instead of rebuilding correction logic in every agent.
one lifecycle contract
A current memory can inform an action, but it does not authorize one.
ContextDB advises. The customer host enforces. The host applies the Action
Gate outcome before booking, refunding, or changing an account.
Verified on August 24, 2026
What the bounded hosted proof established.
Direct operationsADD · UPDATE · NOOP · DELETE
Direct ADD, UPDATE, NOOP, and DELETE passed with idempotent replay, project and user isolation, recall floors, and WAL tokens.
Gemini 2.5 Flash independently selected and committed UPDATE, NOOP, and DELETE against live project-scoped context.
Lineageopaque IDs · no historical content
Metadata-only lineage showed supersession and later deletion without returning historical memory content.
Memory CIrequire current · forbid old
Memory CI required the current evidence ID, forbade the old ID, and passed through the durable worker.
Control stateaudit · exports · scans
Signed audit, content-free exports, plaintext control-state scans, and teardown checks passed.
Cleanupmutable proof rows → 0
Cleanup left zero synthetic projects, organizations, keys, sessions, jobs, attempts, commits, suites, credentials, or memory rows.
This is bounded functional evidence from the hosted service. It is not
sustained-load, failover, availability, latency, COGS, or SLO evidence.
Formation remains Hosted Alpha, while the SDK is Available.
Memory Evolution FAQ
Memory Evolution, answered directly.
What is memory evolution for AI agents?
Memory evolution is the explicit process of adding, correcting, retracting, or leaving factual memory unchanged as new evidence arrives. ContextDB represents those outcomes as ADD, UPDATE, DELETE, and NOOP.
Why not store the correction as another vector?
Two unrelated vectors leave retrieval and the model to decide which statement is current. UPDATE closes the prior memory, links it to the new memory, and returns a consistency floor for the next recall.
Does UPDATE overwrite the old memory?
No. UPDATE creates a new current memory and marks the previous memory as superseded. Metadata-only lineage connects their opaque IDs. Ordinary recall returns the current memory.
Does DELETE keep the deleted memory content?
The target memory row is hard-deleted. Append-only audit and lineage can retain the operation, opaque ID, timestamp, and reason code without returning the deleted content.
Does NOOP advance the memory version?
No. NOOP records why nothing changed and leaves the project memory version unchanged.
Can Formation choose UPDATE or DELETE automatically?
Yes, in Hosted Alpha. The provider proposes an operation from bounded current context and structured turns. Deterministic gates still require a known target and explicit evidence, especially for deletion.
Do I need ContextDB if I only retrieve documents?
No. A conventional RAG stack can be enough for mostly static documents. ContextDB is for per-user facts that change over time and may influence bookings, refunds, updates, or other actions.
Is Memory Evolution generally available?
The SDK is Available. Hosted Memory Evolution is on Cloud, not generally available. The evidence above is bounded functional evidence from the hosted service. It does not establish a public availability SLO, sustained-load result, or failover.
Test one correction from write to recall.
Start with one correction, pass its consistency token into recall, then add the old ID to Memory CI's forbidden evidence.