Agent Coherence — Stale Write Guard (FS) — Claude Code MCP Server
An MCP server that blocks stale writes to shared workspace files like plan.md. It stops concurrent agents from silently clobbering each other's progress.
claude mcp add stale-write-guard-fs -- uvx agent-coherenceWhat Agent Coherence — Stale Write Guard (FS) does
When multiple agents edit the same plan.md or memory.json, silent overwrites happen. One worker reads a snapshot while another writes changes. The last write wins silently. This server blocks those updates and returns explicit conflict signals instead.
Under the hood, the server implements MESI-style artifact tracking and optimistic compare-and-swap via write_cas. Reads register the active version generation. If a teammate updates the file before your write arrives, the commit fails closed. Safety invariants are verified by nine formal TLA+ specifications.
Setup requires Python 3.11 or higher. The coordination logic runs on a single host only. It does not track external side effects like outgoing emails or webhooks.
What it helps with
- prevent silent overwrites on shared
plan.mdfiles - reject outdated edits via optimistic commit-CAS
- coordinate concurrent agent file access on a single host
- guard against lost state updates in
memory.json
Example prompts for the agent
- Read
plan.mdthrough the stale write guard before updating tasks. - Commit these updates to
memory.jsonusing optimistic concurrency.
How to install Agent Coherence — Stale Write Guard (FS)
Platform CLI
claude mcp add stale-write-guard-fs -- uvx agent-coherenceuvx runs the command named after the package; if the README names another one, use uvx --from agent-coherence <command>
Platform CLI
codex mcp add agent-coherence-stale-write-guard-fs -- uvx agent-coherenceuvx runs the command named after the package; if the README names another one, use uvx --from agent-coherence <command>
Config file
{
"mcpServers": {
"agent-coherence-stale-write-guard-fs": {
"command": "uvx",
"args": [
"agent-coherence"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from agent-coherence <command>
Config file
{
"servers": {
"agent-coherence-stale-write-guard-fs": {
"type": "stdio",
"command": "uvx",
"args": [
"agent-coherence"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from agent-coherence <command>
Platform CLI
gemini mcp add agent-coherence-stale-write-guard-fs uvx agent-coherenceuvx runs the command named after the package; if the README names another one, use uvx --from agent-coherence <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Agent Coherence — Stale Write Guard (FS)
How do I install Agent Coherence — Stale Write Guard (FS) in Claude Code?
Run claude mcp add stale-write-guard-fs -- uvx agent-coherence in your terminal.
What does the stale-write-guard-fs server do?
It tracks shared file versions on the local disk and denies stale write attempts if an agent worked on an outdated snapshot. This prevents silent clobbering across agent runs.
What are the runtime requirements for this server?
It requires Python 3.11 or newer. The uvx runner executes the agent-coherence package directly on your local machine.