Conflict detection
Multi-agent systems generate contradictory memories all the time. Without conflict detection, both end up in the vector store and search() retrieves whichever ranks higher by cosine similarity — silently picking a winner.
Every add() runs a same-namespace nearest-neighbour search before persisting. If a near-duplicate is found above conflict_threshold similarity (default 0.65), memledger fires the on_conflict hook and writes a CONFLICTS edge into the chain store.
# Both records are stored — neither is silently overwritten —
# and a CONFLICTS edge connects them.
await ml.add(
content="scale payment-svc to 50 replicas",
namespace="/ops/payment-svc",
created_by="agent-a",
)
await ml.add(
content="scale payment-svc to 100 replicas",
namespace="/ops/payment-svc",
created_by="agent-b",
)
After the second add(), the resulting record carries a conflicts: list[ConflictRef] field surfaced via ml.get(). Downstream agents can inspect the conflict and reason about which side to act on; compliance reviewers can audit how the system arrived at its decision.
For the conceptual framing — including the on_conflict hook signature and conflict-resolver strategies — see Conflicts.
The full configuration reference — threshold tuning per backend, custom resolver registration — ships in a future release.