causal-dag
Lock-free append-only causal DAG (G-Set CRDT) for AI agent memory.
Part of the Aevum physics kernel.
What It Is
A lock-free, append-only DAG for storing [PacrRecord] nodes linked by causal edges (Π). Backed by DashMap for O(1) lookup and O(|Π|) append. No Mutex, no RwLock in any hot path.
This is the memory substrate for Aevum: every aevum_remember call appends a node; every aevum_recall traverses the Π edges.
Properties
| Property | Value |
|---|---|
| Append | O( |
| Lookup | O(1) — DashMap shard |
| Concurrency | Lock-free (sharded CAS) |
| CRDT | G-Set: monotone grow-only, merge = union |
| Ordering | Causal (Π edges), never timestamps |
Usage
use CausalDag;
use ;
let dag = new;
// Append a genesis record (no predecessors)
let id = dag.append?;
// Append a causally dependent record
let id2 = dag.append?;
// O(1) lookup
let node = dag.get.expect;
Causal Distance Tax
causal_dag::distance_tax enforces a light-cone analog: records whose causal predecessor is far away (many hops) pay a higher Λ surcharge. This prevents star-graph topologies (hub-and-spoke bottlenecks) from forming — Pillar I requires O(n) routing.
License
Apache-2.0 — see LICENSE.