agent-coherence
A library that stops one AI agent from silently overwriting another's concurrent edits to shared state such as a plan file or memory store, using a MESI-style coherence protocol and optimistic-concurrency commits verified in TLA+, across LangGraph, CrewAI and AutoGen.
agent-coherence addresses a specific failure mode in multi-agent systems: two agents share an artifact such as a plan.md file, a memory.json file or a key-value store entry; one agent reads it and works from that version while a peer commits a newer version, and the first agent's write silently overwrites the peer's work with no error raised. Because an agent system keeps two records of what happened - the actual committed state, and the model's own narration that a task is complete - this kind of lost update looks like a clean run and gets debugged as a model problem instead of a concurrency bug.
The library applies MESI-style ownership and invalidation to shared agent state, so a stale write is refused or returned as a retryable conflict rather than silently applied, along with a read-generation fence for writers recovering from a crash. The same protocol and library work across LangGraph, CrewAI, AutoGen, the OpenAI Agents SDK, plain files shared across processes, any MCP client through a bundled stale-write-guard-fs server, or a custom orchestrator, and behave the same regardless of which model provider the agents use.
Its safety invariants are machine-checked in TLA+.