# Cohexa-ai/agent-coherence [Health: Active]

**Category:** 📂 File Systems  
**Repository:** https://github.com/Cohexa-ai/agent-coherence  
**GitHub Stars:** 11  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cohexa-ai-agent-coherence

## Description
Coherence guard for shared files: when two agents write the same file, the stale writer is denied instead of silently overwriting, then reacquires and retries. Single-host, TLA+-verified. Install: uvx --from "agent-coherence[mcp]" stale-write-guard-fs.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "agent-coherence": {
    "command": "uvx",
    "args": ["--from"]
  }
}
```

## Documentation

## What Cohexa-ai/agent-coherence MCP server does

Cohexa-ai/agent-coherence MCP server helps prevent lost updates when multiple agents share an artifact such as `plan.md`, a store key, or `memory.json`. The coordinator tracks which agent owns a writable view, which version was read, and whether another participant has committed a newer version. A writer using an invalidated or stale view is refused rather than allowed to overwrite newer work.

The package is designed to sit below agent orchestration code rather than depend on one model provider. The README describes the same protocol for LangGraph, CrewAI, AutoGen, the OpenAI Agents SDK, plain files, custom orchestrators, and MCP clients. The MCP distribution is named `stale-write-guard-fs` and is installed through the `mcp` extra.

## How it works

The coordination model combines MESI-style ownership and invalidation with optimistic concurrency. A normal stale-read overwrite is denied and must be followed by a reacquisition and fresh read. For concurrent writes, an optimistic commit-CAS allows one writer to succeed while returning a typed conflict to the other writer. Crash recovery adds a read-generation fence so a reclaimed agent cannot later commit using an old ownership epoch.

The implementation also accounts for invalidation signals that become obsolete, stale effects at an effect boundary, and inconsistent reads across multiple artifacts. A pinned multi-artifact session can fail closed if its snapshot expires instead of silently switching to live state. The project states that these safety invariants are machine-checked with TLA+/TLC and exercised in CI.

## Setup and configuration

The repository requires Python 3.11 or newer. The MCP server can be run with:

```bash
uvx --from "agent-coherence[mcp]" stale-write-guard-fs
```

The equivalent package installation shown in the README is `pip install "agent-coherence[mcp]"`. Other extras provide adapters for LangGraph, CrewAI, and the OpenAI Agents SDK, but those are separate installation choices rather than requirements for the MCP server.

The coordinator is intended for a single host and a single coordinator. The README describes both durable SQLite and in-memory registries, with the same concurrency contract for concurrent access from several threads. Automatic heartbeat or TTL-based reclaim is enabled by default according to the project documentation.

## Tools and capabilities

Cohexa-ai/agent-coherence MCP server is intended to protect shared filesystem state from stale writers. Its documented behavior includes:

- Denying stale writes instead of silently overwriting newer content.
- Detecting concurrent lost updates with an optimistic commit-CAS.
- Rejecting commits from writers reclaimed after a crash.
- Reacquiring ownership so an agent can reread current state and retry.
- Using content-hash checks to detect edits that bypass the coordinator at the read/write boundary.
- Supporting shared plain files through the `CoherentVolume` adapter.

The broader library also exposes integrations and APIs such as `CCSStore`, `CoherentVolume`, `write_cas`, and `gate`, but the excerpt does not define the MCP tool names or their individual schemas.

## Limitations and notes

Cohexa-ai/agent-coherence MCP server does not provide cross-host fencing; the documented scope is one host and one coordinator. Guarantees apply to writers that use the coordinator. Human edits, formatters, or regenerating scripts that bypass it are not coordinated directly, although the documented boundary checks can detect foreign file changes.

The system does not verify external actions taken by an agent, such as sending an email, firing a webhook, deploying, or opening a pull request. Those actions remain the responsibility of an outbox or idempotency layer. The README also notes that some adapter paths are unverified, including the CrewAI and AutoGen replay wiring.

_Full upstream README: https://allmcps.com/mcp/cohexa-ai-agent-coherence/readme_

