kuilt-crdt

A dependency-free delta-state CRDT zoo. Provides Quilted<S> value types only — no transport dependency. Live replication over a Seam lives in :kuilt-quilter.

The zoo

Every type implements Quilted<S>, a join-semilattice whose piece satisfies the three lattice laws (idempotent, commutative, associative). Mutations return a Patch — a small state fragment any replica absorbs with piece. Replicas that have absorbed the same set of patches converge to the same value regardless of delivery order or duplication.

TypeConvergence ruleRemove?
GCounterSum of per-replica maximaNo
PNCounterTwo GCounters: inc − decNo
GSetSet unionNo
TwoPhaseSetUnion; tombstones win permanentlyOnce
ORSetCausal: add-wins over concurrent removeYes
LWWRegisterLargest (timestamp, replicaId) tag winsVia overwrite
MVRegisterRetain all concurrent writesVia supersede
LWWMapPer-key LWWRegisterVia overwrite
ORMapPer-key add-wins; values merge via pieceYes
BoundedCounterEscrow-quota counter; spend within quotaVia transfer
RgaOp-log union; Lamport-ordered insert winsVia tombstone
JsonCrdtRecursive JSON: ORMap objects, Rga arrays, MVRegister leavesVia key remove
EphemeralMapPer-replica slot, higher clock wins; caller-driven TTL evictionVia graceful leave

Replication

Live replication is in :kuilt-quilter. Quilter<S> streams deltas over a Seam and converges any Quilted state across peers automatically.

MuxSeam (:kuilt-core) multiplexes several CRDTs over one underlying Seam, routing frames by channel tag.

The Causal layer

ORSet, MVRegister, and ORMap are all thin wrappers over Causal<DotStore>. A DotContext accumulates witnessed (ReplicaId, seq) dots; a remove drops the dots currently on the element from the store while retaining them in the context, so a concurrent add on a replica that minted a different dot survives the merge.

Packages

Link copied to clipboard
common