Skip to content
Agents: The Core LoopMemory — conflict and decay

Mid · Core path · 7 chapters

Memory — conflict and decay

Updating vs appending when a new fact contradicts an old one, expiry, recency vs relevance at read time

Poor memory policy turns harmless updates into silent, confident agent errors, so retention and conflict behavior need explicit tests rather than intuition.

Read these first

What you will know

  • Handle a new fact contradicting a stored one

    Without source, timestamp, and confidence, the system cannot distinguish a correction from a second valid state.

  • Choose between update and append, with consequences

    Replacement preserves a clean read path but destroys auditability; append preserves evidence but requires conflict resolution downstream.

  • Implement expiry or decay and defend the policy

    A fixed TTL can erase durable facts, while indefinite retention turns temporary conditions into confident errors.

  • Balance recency against relevance at read time

    A recent but weakly related item can outrank an older decisive constraint unless retrieval and reranking are evaluated together.

  • Show a stale memory producing a wrong answer

    The dangerous case is a plausible answer whose supporting memory is outdated, making the defect hard to detect from the response alone.


Chapters

  1. 1

    Two values in conflict cannot be resolved from the values alone

    The store says Berlin, the user says Lisbon, and nothing in those two strings says which is newer or which is right. This chapter names the metadata that makes the decision possible, namely source, timestamp and confidence on both records, and then the property that decides what kind of conflict it is: the attribute's cardinality. One birth date admits a correction; several active projects admit a second valid value.

  2. 2

    A contradiction is only visible when memories share a key

    Free-text sentences never collide; slots do. Before source, timestamp or cardinality can decide anything, a candidate write has to be matched against the record it would contradict — by a subject-and-attribute key where the store is schematised, by embedding match above a threshold where it is not, or by a model call asked which slot the sentence fills. Each option fails in both directions, and both failures are expensive: a missed match quietly admits a second truth nobody reconciles, while a false match overwrites an unrelated fact. How memories are keyed is also what gives an attribute a cardinality at all, so this is the structure the previous chapter's deciding property assumes.

  3. 3

    Update erases history; append moves the conflict to read time

    Replacing the old row gives you one clean value to read and no way to answer how it got there or to undo a mistaken change. Appending keeps every observation and hands retrieval a pile of contradictions to sort out, which is exactly how an agent still says Berlin four months after the move: the newer record went in with no supersession link, so similarity alone picks the winner.

  4. 4

    One contradicting observation is evidence, not a correction

    Eight months of 'vegetarian' should not be deleted by one chicken order, and the version where the user adds 'my sister is visiting' should not even be recorded as a conflict. Here you build the rule that separates a standing preference from a single event: how many observations, over what span, with what stated explanation. The output is a confidence adjustment far more often than a replacement.

  5. 5

    A single TTL is too short for a name and too long for a trip

    Ninety days on everything erases a job title that never changed and preserves a hotel booking that expired in April, so expiry has to be a property of the fact class rather than of the store. This chapter builds a policy with different lifetimes and decay curves per class, then stress-tests it in both directions: what it deleted that mattered, and what it kept that stopped being true.

  6. 6

    Recency is not relevance, and top-k lets it pass for it

    A note from yesterday about the same product can outrank a year-old allergy that decides the answer, because embedding similarity and recency boosts both reward the wrong record. You will write the test that catches this, and see why the obvious version passes on a broken system: it builds a case where the correct memory is also the most similar one, so nothing has to be ranked properly for it to succeed.

  7. 7

    A stale memory produces a plausible answer, not a visible error

    Nothing throws when retrieval returns a fact that stopped being true; the agent writes a fluent, confident reply built on it, and the user has no signal that anything is wrong. Construct that case end to end from the previous chapters' machinery, then find the detection that works: comparing a stored value against its system of record, or surfacing the memory and its write date alongside the answer.

External resources