Course contentsShow
← AI Engineering
Lesson 605 of 1,88615. AI Agents - ArchitectureFree lesson

Memory Consistency and Conflicts

Handle contradictory information in memory: recency bias, confidence scoring, and conflict resolution.

Memory Consistency and Conflicts

What you'll learn: How AI agents resolve contradictory information stored in memory using recency bias, confidence scoring, and conflict resolution strategies.

The Problem: When Memory Contradicts Itself

As AI agents gather information across multiple interactions, they inevitably encounter contradictory facts. For example, a user might say "My favorite color is blue" on Monday, then "I prefer red" on Wednesday. Or different data sources might conflict: one document says a product costs 50,anothersays50, another says 60.

Without conflict resolution, your agent might hallucinate, give inconsistent answers, or appear confused.

Three Core Strategies

Recency Bias

Treat newer information as more authoritative. Like updating a contact's phone number—the latest one is probably correct. This works well for preferences and dynamic facts but can discard still-valid historical context.

Confidence Scoring

Assign reliability scores to each memory based on source quality, frequency of mention, or user confirmation. Higher-confidence memories win conflicts. Think of it like weighing expert testimony more than hearsay.

Explicit Conflict Resolution

Detect contradictions and handle them intentionally:

  • Ask for clarification: "You said blue before—has your preference changed?"
  • Track both versions: Store temporal facts like "favorite_color: blue (Jan 2024), red (March 2024)"
  • Priority rules: System-verified facts override casual mentions

Implementation Pattern

When writing to memory, check for conflicts with existing entries. Compare entity/topic keys, detect semantic similarity in vector stores, or use timestamps. Apply your resolution strategy before updating.

Key Takeaway: Memory conflicts are inevitable in long-running agents; resolve them proactively using recency bias, confidence scoring, or explicit conflict detection to maintain coherent, trustworthy agent behavior.