How do you resolve conflicts in shared memory?

Short answer: Detect contradictory memories, supersede with one current state, and keep provenance instead of last-writer-wins or blind append.

Multi-agent stores conflict when reality changes or roles observe differently. Leaving both advice equally searchable causes flip-flopping. Engram transform steps rewrite, keep, or delete before commit. Bounded topics help single-current profiles; procedural stores still need merge logic. Product policy sets how aggressive auto-merge may be.

Shared memory only helps a team when the store stays coherent. Two agents can both be right about different moments and still leave the index holding incompatible advice. One says keep relative humidity at forty-five percent. Another later learns the loan contract requires fifty percent during a traveling show. If both memories remain equally retrievable, the next agent will flip between them. Conflict resolution is how a memory system notices contradiction, chooses a superseding state, and keeps provenance clear enough to audit. This chapter explains why conflicts appear in multi-agent memory, what naive policies get wrong, and how Weaviate Engram resolves them through transform steps that rewrite, keep, or delete memories before commit.

Why Do Shared Agent Memories Conflict in the First Place?

Conflicts are not only bugs. Reality changes. Procedures improve. Different roles observe different slices of the same job. A morning agent records a working default. An afternoon agent records a correction after a failed run. Both writes can be honest.

Research on governed shared memory names contradiction persistence as a first-class failure mode. Stale propagation is related. An old lesson keeps traveling because nothing marked it superseded. Provenance collapse makes the problem worse. If you cannot tell who wrote a claim or why it won, you cannot trust the resolution.

Semantic memory adds a twist that key-value locks do not. Two sentences can conflict without sharing an identical string. “Never open Gallery A4 vents overnight” and “Open Gallery A4 vents for two hours after humidification” may both match a ventilation query. Similarity search will happily return both unless something reconciles them.

What Goes Wrong With Last-Writer-Wins and Blind Append?

Last-writer-wins is tempting because it is simple. It is often unsafe for agent memory. The latest writer may be less informed. A noisy specialist can overwrite a verified house rule. Timestamp order is not the same as epistemic quality.

Blind append is the opposite mistake. Every new claim is stored beside the old one. The index grows. Retrieval returns a debate. Agents then re-argue the same conflict in the prompt on every run. That wastes tokens and recreates inconsistency downstream.

Majority vote and one-shot judge selection also fall short when they only pick an answer for the current turn. They do not leave a durable record of which claim is current, which is contested, and which is superseded. The next session starts the fight again. Conflict handling has to happen at write time, not only at answer time.

What Does Good Conflict Resolution Look Like in a Memory Store?

Good resolution maintains state. It amends the wrong fact instead of burying a correction under paraphrases. It deduplicates near-repeats into one canonical lesson. It can forget on purpose when a temporary constraint expires. Those custodial duties are what keep memory useful at scale.

Modern conflict-aware designs also keep history readable. A superseded claim may remain in an audit sense even when it should no longer guide action. Bounded topics help when a scope should hold only one current profile or summary. Unbounded procedural stores still need merge logic so competing procedures do not accumulate as peers forever.

Application policy still matters. Trusted team continual learning can auto-merge aggressively. Open multi-tenant settings may require human confirmation before a shared rule changes. Engram gives the machinery. The product chooses how strict the judge instructions are. Clear topic descriptions and transform instructions are the levers that make those choices stick.

How Does Weaviate Engram Resolve Conflicts During the Pipeline?

Weaviate Engram treats reconciliation as a transform problem, not a retrieval afterthought. After extraction, steps such as TransformWithContext retrieve related memories already in storage. An LLM tool call then decides an action for each memory in play: rewrite, keep, or delete.

In the classic update pattern, a new fact does not land as a second peer. The existing memory is rewritten to include the change. The duplicate new extract is deleted. History can be preserved inside the rewritten content when topic instructions ask for that. Committed operations later show what was created, updated, or deleted, so operators can see the resolution instead of guessing.

Transforms can also consolidate a batch of multi-agent fragments into one experience memory, and they honor bounded topics by collapsing multiple candidates into the single object allowed for that scope. Because transforms only become durable at commit, half-resolved conflict states are less likely to leak into search. In-order processing by scope further reduces races where a correction is applied before the fact it was meant to replace.

How Can a Team Encode a Correction Without Leaving Dual Advice?

Consider a museum climate desk for Gallery A4. Overnight, a facilities agent writes a default humidity rule. During a traveling loan, a collections agent learns the contract requires a higher band. The shared store must end with one actionable lesson, not two fighting peers.

from engram import EngramClient, HybridRetrieval

client = EngramClient(api_key=os.environ["ENGRAM_API_KEY"])
gallery = "gallery-climate-a4"

# Earlier shared default from facilities.
client.memories.add(
    "Keep Gallery A4 relative humidity at 45 percent overnight.",
    group="continual_learning",
    properties={"gallery_id": gallery},
)

# Later correction from collections during a loan exhibition.
# Engram's TransformWithContext can rewrite the prior memory and
# drop the duplicate extract so search does not return both rules.
run = client.memories.add(
    "Update: during the traveling ceramics loan, keep Gallery A4 at 50 percent RH day and night.",
    group="continual_learning",
    properties={"gallery_id": gallery},
)
status = client.runs.wait(run.run_id)
print(status.status, status.committed_operations)

# Retrieval should surface the reconciled procedure.
current = client.memories.search(
    query="What humidity should Gallery A4 hold overnight during the loan?",
    group="continual_learning",
    properties={"gallery_id": gallery},
    retrieval_config=HybridRetrieval(limit=5),
)

# Manual supersession remains available when policy requires an explicit erase.
for memory in current:
    if "45 percent" in memory.content and "50 percent" not in memory.content:
        client.memories.delete(
            memory.id,
            group="continual_learning",
        )

In normal operation the pipeline rewrite is enough. The delete path is the escape hatch for stubborn residues or compliance-driven removal. Either way, the goal is the same. The next agent should inherit one current rule, not a coin flip.

Once conflicts can be resolved, agents can use the store as more than a private notebook. They can leave durable messages for each other through memory itself. Our next chapter, How can memory act as a communication channel between agents?, explores that pattern and its limits.