Memory and State Management

Memory and State Management

Memory Conflict Resolution

50 of 69 in this book · 3 min read

What it is

Deciding what the system holds to be true when two stored memories cannot both be: a changed address, two agents recording different outcomes for one run, a user correcting last month's statement, an import that disagrees with what was learned in conversation. The inputs are genuinely incompatible claims about the same subject, and the output is a decision about which one is retrieved, asserted to a person, and acted on.

Why it matters

Conflicts are not an edge case; they are the normal consequence of a store that keeps learning about a world that keeps changing. A system with no stated policy still has one — whatever the index happens to return first — and that policy is invisible, varies between requests, and cannot be explained to a user who wants to know why the agent still thinks they live somewhere they moved away from. Worse, an unresolved contradiction placed in a prompt is resolved by the model, silently, differently each time.

Key decisions

  • The default rule: newest wins, highest confidence wins, most authoritative source wins, or a statement by the subject beats an inference about them. Newest-wins is the only one that needs no metadata and the only one that cannot tell a correction from a stale re-import.
  • Whether resolution happens at write — one current value in the store, history kept beside it — or at read, where everything is stored and retrieval chooses. Write-time is simpler to query; read-time can be re-decided when the rule improves.
  • What ordering means when writes come from several agents, devices, or regions with no shared clock, and whether a causal ordering is maintained instead of a wall-clock one.
  • Whether unresolved conflict is representable at all — "both are asserted, we do not know" — or whether the schema forces a single value and therefore forces a guess.
  • When the agent should stop deciding and ask the person, balanced against the cost of asking about things it could have worked out.
  • Whether a resolution is recorded as an event, so that a rule later found to be wrong can be reversed rather than merely changed going forward.

Failure modes

  • Wall-clock newest-wins across services with skewed clocks: a correction is overwritten by the stale value it was correcting, and the ordering looks correct in the data.
  • A bulk re-import writes historical values with current timestamps and silently reverts months of user corrections in one job.
  • Conflicts are left to retrieval order, so the agent answers the same question differently on consecutive turns and neither answer is wrong by its own logic.
  • The schema allows one value per subject, so a genuine ambiguity — two valid addresses, two roles — is forced into an arbitrary choice that then looks authoritative.
  • An explicit user correction is written as a new low-confidence item while the model's original inference kept a high one, so the correction never wins.
  • Resolution overwrites the losing claim, so a wrong rule cannot be audited and its damage cannot be undone.
  • Two agents resolve the same conflict independently and in opposite directions, and the store oscillates between them with every pass.
  • The conflict is only detectable by meaning, not by field, so "works remotely" and "based in the Dublin office" sit beside each other and are both retrieved as current.

Related capabilities


Applies: Production readiness · Design questions