AIMP — AI Mesh Protocol

An experimental, serverless networking protocol for resilient state synchronization between autonomous agents in fragmented, low-bandwidth networks. Built on Merkle-CRDTs and cryptographic identity — no central authority, no global DNS, always writeable.
Papers
Author profiles: ResearchGate · ResearchHub
Protocol Stack
What's New
v0.4.0 — Deterministic Semantic Topologies
L3 v0.3.0 required applications to manually construct the knowledge graph (Supports/Contradicts edges). v0.4.0 eliminates this bottleneck with autonomous edge generation:
- Claims carry an optional
QuantizedEmbedding([u64; 4]) — a 256-bit SimHash computed application-side from a canonical embedding model.
- At each epoch boundary, the protocol computes pairwise Hamming distances (XOR + popcount, ~1 ns per pair) and emits Supports edges for close pairs (d <= 30 bits) and Contradicts edges for distant pairs (d >= 200 bits).
- Edge strength scales linearly with distance in basis points (d=0 → 10000 bps, d=30 → 1000 bps).
- A
max_k_nearest cap bounds edge density to O(N), preventing trust propagation explosion.
embedding_version: u32 isolates disjoint latent spaces for protocol-level model upgrades.
- Auto-edges are materialized via L2 gossip, surviving GC via Holographic Routing.
- Dead zone (31-199 bits) orphans ambiguous claims — epistemologically correct isolation.
// Autonomous truth discovery: 10,000 claims → 50 ms scan, O(N) edges
// No floats. No coordination. No central authority.
let edges = auto_edge_generator.generate_edges(&epoch_claims);
v0.3.0 — Correlation-Aware Belief Aggregation
L3 v0.2.0 assumes all evidence sources are statistically independent (Naive Bayes). This produces pathological hyper-confidence when physically correlated sensors (e.g., 100 IoT devices on the same rooftop) or semantically correlated agents (e.g., LLMs fine-tuned on the same dataset) report concordant observations.
v0.3.0 introduces Grid-Cell Correlation Discounting:
- Each claim carries an optional
CorrelationCell(u64) — a discrete coordinate for spatial, semantic, or temporal proximity.
- Within each cell, evidence is ranked by strength and geometrically discounted: the strongest source retains 100% weight; each subsequent source receives
discount_bps^rank / 10000^rank (default 30%).
- With 30% discount, N correlated sensors converge to ~1.42x the evidence of a single sensor — regardless of N. The naive approach would produce Nx amplification.
- The CRDT associativity challenge (geometric decay is non-associative across partial merges) is solved architecturally: epoch reduction buckets by
(temporal_grid, fingerprint, correlation_cell), guaranteeing atomic computation on the complete set.
- Claims with
correlation_cell: None behave identically to v0.2.0 (zero regression).
- All arithmetic is integer-only (i32/i64, basis points). No floats. ZK-ready.
// 100 co-located sensors, 70% confidence each:
// v0.2.0 (naive): 100 × 847 = 84,700 milli-log-odds → ~100% (hyper-confident)
// v0.3.0 (30%): 847 × Σ(0.3^i) ≈ 1,207 milli-log-odds → ~77% (realistic)
Architecture
aimp_node/ Rust reference implementation (Cargo workspace member)
src/
crdt/ Merkle-DAG engine, actor model, arena allocator, quorum consensus
crypto/ Ed25519 identity, BLAKE3 hashing, zero-trust firewall
network/ UDP gossip, Noise Protocol XX sessions, per-peer rate limiting
protocol/ Wire format (MessagePack), typed payload enum
epistemic.rs L3 Epistemic Layer (v0.3.0): log-odds, trust propagation, correlation discounting
semantic_topology.rs L3 Semantic Topology (v0.4.0): SimHash embeddings, auto-edge generation
decision_engine.rs Pluggable deterministic decision engine (trait + rule engine + hot-reload)
error.rs Unified AimpError type hierarchy
dashboard/ Ratatui TUI
config.rs Dynamic configuration with validation
event/ Structured logging + Prometheus metrics (counters + histograms)
tests/ Integration tests
benches/ Criterion benchmarks
aimp_testbed/ Python SDK (aimp-client) + CLI tool + chaos testing
deploy/ Systemd service, Firecracker microVM, install script
formal/ TLA+ convergence + quorum safety + belief convergence specification
docs/ Paper 1 (Typst source + PDF)
v0.2.0/ Paper 2: Epistemic Layer (Typst source + PDF)
v0.3.0/ Paper 3: Correlation-Aware Aggregation (Typst source + PDF)
Strategic Advantages
Key Features
Core Engine (v0.1.0)
- Actor Model with zero-shared-state CRDT via
tokio::mpsc
- Slab/Arena allocation with O(1) insertion and SoA layout
- Durable persistence via redb with ChaCha20Poly1305 encryption at rest
- HKDF-SHA256 key derivation with domain separation
- Cached merkle root with invalidation-on-write
- Real mark-and-sweep GC with slab memory reclamation
- Epoch-based GC tracking integrated into the CRDT actor
Epistemic Layer (v0.2.0 — v0.4.0)
- Integer log-odds arithmetic (i32, milli-log-odds) — no floats, 100% deterministic
- Two-pass Markovian trust propagation (Supports → Contradictions, no oscillation)
- Sybil-resistant reputation: new nodes start at 0, delegation required, reputation spending
- Grid-aligned epoch reduction with materialized compaction (Summaries survive GC)
- Cycle detection (sorted DFS) prevents confidence inflation loops
- v0.3.0: Correlation-aware aggregation — geometric discounting for co-located sensors / LLMs
- v0.3.0: Atomic cell reduction — bucketing by (epoch, fingerprint, cell) for CRDT safety
- v0.4.0: Deterministic semantic topologies — SimHash embeddings, autonomous edge generation
- 98-142x faster than Subjective Logic / Dempster-Shafer (bit-identical across architectures)
Networking & Security
- Noise Protocol XX encrypted sessions (default on)
- Per-peer token bucket rate limiting (integer arithmetic)
- O(1) gossip deduplication via HashSet + VecDeque
- TTL replay attack detection with circuit breaker
- Session LRU eviction (TTL + max count)
- Protocol version range negotiation for rolling upgrades
Decision Engine & Consensus
- Pluggable
DecisionEngine trait with RuleEngine implementation
- Hot-reload rules from
aimp_rules.json (no restart needed)
- BFT quorum voting with persistent verified decisions
- Typed
Payload enum per opcode (compile-time safety)
Observability
- Prometheus counters, gauges, and latency histograms
- Composite
/health endpoint with sub-checks and HTTP status codes
- Structured
SystemEvent logging with TUI dashboard
Operations
- Unified
AimpError type hierarchy (no more Box<dyn Error>)
- Config validation (rejects invalid parameter combinations)
- Graceful shutdown with 5-second timeout
- Systemd hardened service file
- CI/CD: lint, test, security audit, docs, cross-compiled releases
Benchmarks
Measured with Criterion on Apple Silicon (M-series), single-threaded, fast-crypto mode:
System-Level
Simulated 5-node cluster with anti-entropy sync (in-process, Apple Silicon):
Network Impairment (netem simulation)
Convergence under simulated packet loss, latency, and partitions (5 nodes, 50 mutations/node):
AIMP converges up to ~80% packet loss within a few anti-entropy rounds, degrading gracefully.
Docker ARM64 Linux with RPi-class resource limits:
Even on RPi Zero class hardware, throughput is 3 orders of magnitude above the rate limit.
Comparison with Automerge v0.7
Same hardware, same operations, single-threaded, target-cpu=native:
AIMP with ring outperforms Automerge by 1.37x on mutations (with Ed25519 per write) and 2.4x on merge. Yrs is fastest on mutation (no crypto) but AIMP merge is within 26% of Yrs.
# Enable ring backend for maximum throughput
RUSTFLAGS="-C target-cpu=native" cargo run --release --features fast-crypto,fast-alloc
Run benchmarks locally:
cargo bench --manifest-path aimp_node/Cargo.toml # Micro-benchmarks
cargo run --release -p aimp_node --example bench_convergence # System benchmarks
cargo run --release -p aimp_node --example bench_netem # Network impairment
docker build -f Dockerfile.bench -t aimp-bench . && \
docker run --rm --memory=1g --cpus=1 aimp-bench # ARM64 constrained
L2 — CRDT Convergence
| Property | Description | Status |
|---|
TLC explored 46,063 states (9,558 distinct) to depth 16 in <1 second with 10 parallel workers and zero violations. Bugs found: 2 correctness bugs (out-of-order heads, quorum double-voting). Both fixed.
L3 — Belief Convergence
| Property | Description | Status |
|---|
Exhaustive bounded verification: 199,902 configurations (5 properties, up to N=6 nodes). Bugs found: 1 trust propagation formula bug (t_{k+1} = t_k + At_k vs correct t_{k+1} = t_0 + At_k). Fixed.
Quick Start
1. Run the Node
cargo run -- --port 1337 --name node1
2. Python CLI
cd aimp_testbed
pip install -e .
aimp-cli health --target 127.0.0.1 --metrics-port 9090
aimp-cli infer "Check valve pressure in sector north"
3. Run Tests & Benchmarks
make test # Property-based + integration tests
make bench # Criterion benchmarks
make lint # Format + clippy
make docs # Generate rustdoc
Edge Deployment
AIMP is designed to run as a single static binary with zero runtime dependencies. No Docker, no container runtime, no JVM.
# Download the binary for your architecture
curl -LO https://github.com/fabriziosalmi/aimp/releases/latest/download/aimp_node-aarch64-linux
chmod +x aimp_node-aarch64-linux
# Install as systemd service
sudo deploy/install.sh ./aimp_node-aarch64-linux
# Start
sudo systemctl start aimp-node
curl localhost:9090/health
Cross-Compile from Source
make install-cross-targets # One-time: install musl targets
make edge-arm64 # ARM64 (RPi 4/5, Jetson, Graviton)
make edge-armv7 # ARMv7 (RPi 2/3, industrial PLCs)
make edge-x86 # x86_64 (edge gateways)
make edge-all # All three
Firecracker MicroVM (multi-tenant isolation)
For edge gateways running multiple untrusted workloads:
sudo make microvm-rootfs # Builds ~15MB Alpine rootfs with AIMP
firecracker --no-api --config-file deploy/firecracker/vm-config.json
Boot time: ~125ms. Memory: 64MB. vCPU: 1.
Systemd Service
The included service file (deploy/systemd/aimp-node.service) provides:
Configuration
Configuration is loaded from (highest priority first):
- CLI arguments (
--port, --name)
- Environment variables (
AIMP_PORT, AIMP_NOISE_REQUIRED, AIMP_PEER_RATE_LIMIT, ...)
aimp.toml file (optional)
- Hardcoded defaults
Data Flow
graph TD
UDP[UDP Socket] -->|Envelope| RL[Rate Limiter]
RL -->|Allowed| NP[Noise Protocol]
NP -->|Decrypt| FW[Security Firewall]
FW -->|Valid| BP[Backpressure Semaphore]
BP -->|Permit| Parser[Protocol Parser]
Parser -->|AimpData| CRDT[CRDT Actor]
CRDT -->|Mutation| DAG[Merkle-DAG + redb]
DAG -->|Prune| GC[Epoch GC]
CRDT -->|Evaluation Req| DE[Decision Engine]
DE -->|Decision + Evidence| CRDT
CRDT -->|Quorum Vote| QM[QuorumManager]
AIMP builds on concepts from the following areas of distributed systems research:
- CRDTs — Shapiro et al., "A Comprehensive Study of Convergent and Commutative Replicated Data Types" (INRIA, 2011)
- Merkle-CRDTs — Kleppmann & Howard, "Byzantine Eventual Consistency and the Fundamental Limits of Peer-to-Peer Databases" (2022)
- BFT Consensus — Castro & Liskov, "Practical Byzantine Fault Tolerance" (OSDI, 1999)
- Bayesian Aggregation — Jaynes, "Probability Theory: The Logic of Science" (2003); log-odds arithmetic for belief fusion
- Trust Networks — Kamvar et al., "The EigenTrust Algorithm for Reputation Management in P2P Networks" (WWW, 2003)
- Subjective Logic — Jøsang, "Subjective Logic: A Formalism for Reasoning Under Uncertainty" (Springer, 2016)
- Copulas — Nelsen, "An Introduction to Copulas" (Springer, 2006); correlation modeling for dependent evidence
- Noise Protocol — Perrin, "The Noise Protocol Framework" (2018); used via the
snow crate for XX handshake pattern
- Gossip Protocols — Demers et al., "Epidemic Algorithms for Replicated Database Maintenance" (1987)
- Merkle Trees — Merkle, "A Digital Signature Based on a Conventional Encryption Function" (CRYPTO, 1987)
- Vector Clocks — Mattern, "Virtual Time and Global States of Distributed Systems" (1988)
License
MIT — Fabrizio Salmi, 2026.