crdt-merge Documentation

April 8, 2026 · View on GitHub

Production-grade CRDT merging for data, ML models, and distributed systems.

Version0.9.5
Architecture7-layer + Accelerators + CLI
Codebase44,304 LOC · 104 modules · 212 classes · 1,586 functions
Guide tests309 tests across 7 guide test suites — all passing
LicenseBUSL-1.1 → Apache 2.0 (2028-03-29)

Guides

25 in-depth guides covering every major use case. Every code example is verified by an automated test suite.

Data & Records

GuideWhat it covers
CRDT FundamentalsCRDT theory, OR-Set, LWW, G-Counter
CRDT Primitives ReferenceWorking examples for every primitive type
CRDT Verification Toolkitverify_crdt, verify_commutative, property testing
Merge StrategiesLWW, MaxWins, MinWins, UnionSet, Priority, Custom, and more
Schema EvolutionBackwards-compatible schema changes
MergeQL — Distributed KnowledgeSQL-like merge interface
Probabilistic CRDT AnalyticsHyperLogLog, MinHash, CMS
Performance Tuningparallel_merge, chunking, DuckDB, profiling
TroubleshootingCommon errors and fixes

Transport & Sync

GuideWhat it covers
Wire ProtocolBinary format, serialize/deserialize, peek_type
Gossip & Serverless SyncGossipState, peer-to-peer propagation
Delta Sync & Merkle VerificationBandwidth-efficient sync, content integrity

AI & ML Models

GuideWhat it covers
Federated Model MergingCRDTMergeState, 26 strategies, no parameter server
Model Merge StrategiesSLERP, TIES, DARE, DARE-TIES, Fisher, and more
Model CRDT MatrixStrategy × CRDT-compliance comparison table
LoRA Adapter MergingLoRAMerge, LoRAMergeSchema, per-layer strategies
Continual Learning Without ForgettingContinualMerge, replay, EWC integration

Agentic & Context

GuideWhat it covers
Convergent Multi-Agent AIAgentState, ContextMerge, ContextManifest
Agentic Memory at ScaleContextBloom, MemorySidecar, budget-bounded merge

Privacy, Provenance & Compliance

GuideWhat it covers
Provenance — Complete AIAuditLog, AuditedMerge, tamper-evident chain
Right to Forget in AICRDT remove(), GDPR erasure, model unmerge
Privacy-Preserving MergeEncryptedMerge, field-level encryption, RBAC
Security HardeningThreat model, key rotation, audit integration
Security GuideEncryption backends, StaticKeyProvider, RBAC policies
Compliance GuideGDPR Art.5, HIPAA PHI, SOX, EU AI Act

E4 Trust-Delta Architecture

The E4 subsystem adds recursive trust as a native CRDT dimension. Every merge carries proof, every delta carries trust.

E4 API Reference (detailed)

DocumentScope
E4 Core ModulesTypedTrustScore, PCO, ProjectionDelta, TrustBoundMerkle, CausalTrustClock, and more
E4 Integration BridgesGossipBridge, StreamBridge, AgentBridge, E4Config, bootstrap
E4 Resilience Subsystem18 hardening modules: Sybil defence, post-quantum sigs, epoch rotation, partition reconciliation

Cookbooks

Runnable tutorials covering common E4 workflows end-to-end.

CookbookWhat it covers
E4 Trust QuickstartTrust scoring, PCO, projection deltas, adaptive verification, disabling E4
Federated Trust with Byzantine ToleranceMulti-peer lattice, gossip bridge, Byzantine detection, circuit breaker, 5-node demo
Trust-Weighted Agent Memory SynchronisationAgent bridge, trust-weighted conflict resolution, multi-agent convergence, stream validation

30-Second Demo

import pandas as pd
from crdt_merge import merge, MergeSchema, LWW, MaxWins

df_a = pd.DataFrame({"id": [1, 2], "name": ["Alice", "Charlie"], "score": [80, 70], "_ts": [1000.0, 1000.0]})
df_b = pd.DataFrame({"id": [1, 3], "name": ["Bob",   "Diana"  ], "score": [90, 85], "_ts": [2000.0, 1000.0]})

schema = MergeSchema(name=LWW(), score=MaxWins())
result = merge(df_a, df_b, key="id", schema=schema, timestamp_col="_ts")
#    id     name  score      _ts
# 0   1      Bob     90   2000.0  ← Bob (newer), 90 (higher)
# 1   2  Charlie     70   1000.0  ← Only in df_a
# 2   3    Diana     85   1000.0  ← Only in df_b

Model merging:

import numpy as np
from crdt_merge.model import CRDTMergeState

# Three teams fine-tuning the same base — merge in any order, get identical result
team_a = CRDTMergeState("weight_average")
team_b = CRDTMergeState("weight_average")
team_c = CRDTMergeState("weight_average")

team_a.add(math_tensors,      model_id="llama-math-v2",   weight=0.4)
team_b.add(code_tensors,      model_id="llama-code-v4",   weight=0.35)
team_c.add(reasoning_tensors, model_id="llama-reason-v1", weight=0.25)

team_a.merge(team_b).merge(team_c)  # in-place, returns self

assert team_a.state_hash == team_b.merge(team_c).state_hash  # identical regardless of order
merged = team_a.resolve()

Learning Path

New to crdt-merge?

  1. CRDT Fundamentals — understand OR-Sets and convergence (15 min)
  2. CRDT Primitives Reference — hands-on with every type (20 min)
  3. Merge Strategies — pick the right strategy for your data (10 min)
  4. Choose your domain:

Repository Layout

docs/
├── guides/                  ← 25 in-depth guides (all code verified by tests)
├── api-reference/           ← Complete API reference (layers 1–6, accelerators, CLI)
├── architecture/            ← System overview, layer map, data flow, design decisions
├── getting-started/         ← Installation, quickstart, core concepts
├── cookbook/                 ← Practical recipes and patterns
├── cookbooks/               ← E4 trust-delta runnable tutorials
├── e4.md                    ← E4 core modules API reference
├── e4_integration.md        ← E4 integration bridges API reference
├── e4_resilience.md         ← E4 resilience subsystem API reference
├── CRDT_ARCHITECTURE.md     ← Full mathematical proof of CRDT compliance
├── ARCHITECTURE_MAP.md      ← Annotated codebase map
└── benchmarks/              ← A100 GPU performance, stress test reports

Architecture

crdt-merge uses a strict 7-layer architecture — each layer is independently testable and composable:

LayerModuleResponsibility
1crdt_merge.coreOR-Set, G-Counter, LWW-Register, VectorClock
2crdt_mergeDataFrame/JSON merge, strategies, MergeQL
3crdt_merge.wire / .gossip / .merkleTransport, serialisation, content integrity
4crdt_merge.modelML model merging, CRDTMergeState, 26 strategies
5crdt_merge.encryption / .rbac / .metricsSecurity, access control, observability
6crdt_merge.complianceGDPR, HIPAA, SOX, EU AI Act
7crdt_merge.e4Trust-delta protocol, PCO, Byzantine resilience, adaptive verification
+crdt_merge.context / .agenticAgent memory, ContextBloom, ContextManifest
+AcceleratorsDuckDB, dbt, Polars, Airbyte, Spark

Full proof: CRDT_ARCHITECTURE.md


By Role

RoleStart here
DeveloperQuickstartPrimitives Reference
ML EngineerFederated Model MergingLoRA
Data EngineerMerge StrategiesMergeQL
ArchitectARCHITECTURE_MAP.mdapi-reference/
ComplianceCompliance GuideRight to Forget
SecuritySecurity GuidePrivacy-Preserving Merge

crdt-merge v0.9.5 · April 2026