The Problem
The Multi-Agent
Race Condition
When two AI agents modify the same file, the last one to save wins— and your code breaks. We call this the Multi-Agent Race Condition (MARC).
MARC is worse than ordinary data races because the build still passes. You get syntactically valid but semantically incomplete code—with no error signal.
Common Failure Modes
Agent A's changes overwritten by Agent B. Silent data loss.
Rename/move operations conflict, causing repository corruption.
Retry storms under contention. 0% forward progress.
Interleaved partial writes cause build/deploy failures.
Research Results
Proven in the Lab
and in the Wild
Klock achieves near-pessimistic safety while preserving parallelism. These are real numbers from our research paper and implementation.
| Protocol | Success | Abort | Retries |
|---|---|---|---|
| Pessimistic | 100% | 0% | 0.0 |
| Klock | 100% | 0% | 1.7 |
| Optimistic | 84.8% | 15.2% | 3.1 |
| Chaos | 16.4% | 83.6% | — |
| Metric | Solo baseline | Concurrent | Loss |
|---|---|---|---|
| Lines changed | 3,027 | 2,311 | −716 |
| Auth routes | 100% | 0% | 100% lost |
| Validation schemas | 12 of 12 | 1 of 12 | −92% |
| Build status | Pass | Pass | — |
This is why Klock exists.
The Klock Protocol
Three Steps to
Safe Concurrency
Declare Intent
Before touching any file, agents declare what they intend to modify. Klock's conflict matrix detects collisions in O(1).
Acquire Lease
Klock grants an exclusive time-bounded lease using Wait-Die scheduling. Deadlocks are mathematically impossible.
Execute Safely
The agent works within its declared scope. On completion, the lease releases and waiting agents proceed.
One decorator. Full protection.
The @klock_protected decorator wraps any LangChain tool with Wait-Die concurrency control. No architecture changes required.
# klock-langchain integration from klock_langchain import klock_protected from langchain_core.tools import BaseTool # Wrap any tool with Wait-Die control class WriteFileTool(BaseTool): name = "write_file" @klock_protected( resources=["./src/**/*.ts"], agent_id="refactor-bot-01", priority=100 ) def _run(self, path, content): # Exclusive lease guaranteed write(path, content)
Pricing
Free to start.
Enterprise-ready.
Open source the client, monetize the cluster. Get addicted to import klock—then let us run it in production.
Local kernel, full SDK access. No credit card required. Perfect for solo developers.
Start buildingHosted coordination layer for distributed swarms. Centralized monitoring and high availability.
Talk to SalesIntegrations
Works where you work.
Drop Klock into any agent framework with a single decorator. No architecture overhaul required.
Ready to stop agent collisions?
Install the open-source kernel in 30 seconds. Coordinate your first multi-agent system today.