Conflict-Free Replicated Data Types
- Data Type — a list, a map, a counter, a piece of text.
- Replicated — the same one exists as several copies, on different machines, each editable while offline.
- Conflict-free — built so that when those copies diverge and come back together, merging them can never fail and never needs a human to pick a winner.
Why the trick works
- Commutative — order doesn't matter.
+1then+1is the same as+1then+1, whoever went first. - Associative — grouping doesn't matter. It doesn't matter which two replicas sync before the third joins.
- Idempotent — applying the same thing twice is the same as once, so a message delivered twice does no harm.
The two families
| State-based (CvRDT) | Operation-based (CmRDT) | |
| What travels | The whole state | Individual operations |
| Merge is | A function combining two states | Applying each operation once |
| Network needs | Only eventual delivery — resend freely | Exactly-once delivery, often causally ordered |
| Cost | Bandwidth | Delivery machinery |
v and m stand for. In practice most modern systems are operation-based with a sync protocol that reconstructs what the other side is missing, which gets the bandwidth profile of op-based without demanding a perfect network. The hard case: text
Root or Id(counter, ActorId, index) — who created it and when , never where it sits .
[1lbkh5]
What it costs
Tombstones, and why deletion is the hard part
And you cannot garbage-collect them without coordination
gc , compact , truncate , prune , or forget operation anywhere in the public API . save() exists and is genuinely efficient, but its own doc comment says it saves "the entirety of this document in a compact form." Smaller bytes, same history, forever. The document stops being files
grep , an editor, a sync tool, a search indexer, an AI agent that reads a directory — needs an export step first. For a system whose value proposition is "the working format is just a directory you can open" , that is a direct trade, not a detail. Where you actually meet one
- Yjs — the other major implementation; same bet, different encoding, and the one most often found inside collaborative editors.
- Distributed databases — Riak popularised CRDT-backed counters, sets, and maps; Redis and others have followed.
When not to reach for one
Related
- Directed Acyclic Graphs — the shape a CRDT's change history takes, and where the acronym cluster around this one is unpacked
-
ai-labs/studies/sync-and-content-version-control— the pinned reading collection these notes came out of; the Automerge profile there cites line numbers
Citations
[3zof3r] Shapiro, M., Preguiça, N., Baquero, C., & Zawirski, M. (2011). Conflict-free Replicated Data Types . INRIA Research Report RR-7687. Also published in the 13th International Symposium on Stabilization, Safety, and Security of Distributed Systems (SSS 2011). PDF
[0tjacq] CRDT Glossary — crdt.tech, the community reference site maintained around the original research.
[1lbkh5] Read directly from pinned source: automerge/rust/automerge/src/exid.rs , types.rs , value.rs , automerge.rs , at commit 47908d6c (2026-08-17). Pinned in ai-labs/studies/sync-and-content-version-control .
[5uj4s7] Implementing a Garbage-Collected Graph CRDT — CMPS290S, UC Santa Cruz. On tombstone accumulation and why collecting them reintroduces a coordination step.
[98jq9l] automerge/automerge — README, project description and status.
[c9j3ga] Kleppmann, M., Wiggins, A., van Hardenberg, P., & McGranaghan, M. Local-first software: you own your data, in spite of the cloud . Ink & Switch. The essay Automerge's README names as the project's objective.