Safe Event Bus & Fabric
Relevant source files
The following files were used as context for generating this wiki page:
The Safe Event Bus & Fabric is the core orchestration layer within the TAMV MD-X4 Kernel. It is designed to manage high-integrity telemetry ingestion, protocol execution, and event-driven communication across the heptafederated architecture. Its primary purpose is to ensure that all system events—ranging from civic reports to critical security alerts—are processed through a series of deterministic protocols that prioritize system integrity and the "preservation of life" over other operational objectives.
This system acts as a "sovereign digital infrastructure" that integrates frontend stores, backend Supabase Edge Functions, and an immutable ledger. It provides the technical foundation for "Mode Isla" (Island Mode) operations and ensures a verifiable chain of custody for all telemetry data through the BookPI™ Multi-State Record (MSR).
Sources: README.md:144-152, src/components/rdm/kernel.tsx:37-45, src/components/rdm/evidence.tsx:7-11
1. Architectural Components
The Event Fabric is composed of three primary layers: the Ingestion Layer (Edge Functions), the Logic Layer (Kernel Protocols), and the Persistence Layer (Immutable Ledger).
1.1 Ingestion Layer (Edge Functions)
The system utilizes Supabase Edge Functions to ingest events and telemetry. Every event is validated and serialized before being committed to the analytics engine. If a payload exceeds 10,000 characters, it is rejected to prevent denial-of-service attacks.
Sources: supabase/functions/protocols-execute/index.ts:63-68
1.2 Logic Layer: The Protocol Cascade
The Kernel MD-X4 implements four primary protocols that govern how the event bus responds to internal and external signals. These protocols react in milliseconds to ensure system stability.
| Protocol ID | Name | Focus | Mechanism |
|---|---|---|---|
| PROTO-01 | Autopoiesis | Integrity | Monitors CPU, latency, and PQC error rates to trigger self-regeneration. |
| PROTO-02 | Modo Isla | Resilience | Enables P2P local mesh networking with store-and-forward synchronization. |
| PROTO-03 | Defensa Extrema | Security | Deploys containment layers (Anubis, Horus) to block exfiltration during attacks. |
| PROTO-04 | Fénix | Recovery | Performs strong key encryption and service restoration from clean snapshots. |
Sources: src/components/rdm/kernel.tsx:6-33
1.3 Persistence Layer: BookPI™ and MSR
The "Safe" aspect of the bus is enforced through BookPI™, a Multi-State Record (MSR) ledger. Every critical event is signed using Post-Quantum Cryptography (PQC) schemes and anchored in Merkle trees.
- PQC Schemes: Utilizes FIPS 204 (ML-DSA) for signatures and FIPS 203 (ML-KEM) for key exchange.
- Audit Trail: Maintains an immutable log of resource hashes and signatures in the
audit_signaturestable.
Sources: src/components/rdm/evidence.tsx:55-70, supabase/migrations/20260512080845_110fe96e-4027-403f-98c8-f6d495c1bf4c.sql:101-110
2. Event Processing Flow
The flow of information through the Safe Event Bus follows a strict validation and auditing sequence to maintain the "Sovereign Fortress" integrity.
The diagram above shows the path of a telemetry event from ingestion through protocol routing to the immutable ledger.
2.1 Decision Logic for Patterns
When an "event out of pattern" occurs, the kernel follows a bifurcated decision tree:
- Risk to Life: If a vital risk is detected, the system triggers the "Protocol of Maximum Security," isolating identities and escalating to human-in-the-loop (HITL) with a structured incident summary.
- Infrastructure Attack: If fraud or a digital attack is detected without vital risk, it triggers "Defensa Extrema," focusing on mass containment and forensic recording.
Sources: src/components/rdm/kernel.tsx:54-85
3. Data Schema & Structures
The underlying database schema supports the Event Fabric through dedicated auditing and federation state tables.
3.1 Audit Signatures Table
This table stores the cryptographic proof of every significant event processed by the bus.
| Field | Type | Description |
|---|---|---|
id | uuid | Primary key for the signature record. |
resource_type | text | The type of entity (e.g., federation, protocol). |
sha256 | text | The SHA256 hash of the payload/state. |
signed_at | timestamptz | Timestamp of the signing event (Default: now). |
metadata | jsonb | Additional context or PQC parameters. |
Sources: supabase/migrations/20260512080845_110fe96e-4027-403f-98c8-f6d495c1bf4c.sql:102-110
3.2 Protocol Execution Implementation
The following snippet demonstrates how the Edge Function handles different event types and enforces payload size limits.
// supabase/functions/protocols-execute/index.ts:63-71
// Validate analytics payload before insert
const safeBody = typeof body === "object" && body !== null ? body : {}
const serialized = JSON.stringify(safeBody)
if (serialized.length > 10000) return json({ error: "payload too large" }, 413)
await supabase.from("analytics").insert({ event_type: functionName, data: safeBody })
return json({ ok: true, function: functionName })
Sources: supabase/functions/protocols-execute/index.ts:63-71
4. Operational Modes
4.1 Modo Isla (Island Mode)
A critical feature of the Event Fabric is its ability to operate in a completely disconnected state.
- P2P Mesh: The local network sustains economic and emergency signals.
- Store-and-Forward: Events are cached locally with robust timestamps and reconciled with the global state once connectivity is restored.
Sources: src/components/rdm/kernel.tsx:20-25, src/components/rdm/evidence.tsx:75-77
4.2 Human-in-the-loop (HITL)
The system maintains a 95% HITL threshold. While the bus re-acts in milliseconds for containment, final decisions affecting civic rights or resource redistribution require human supervision.
Sources: src/components/rdm/kernel.tsx:112, src/components/rdm/kernel.tsx:42-45
Summary
The Safe Event Bus & Fabric represents a shift from reactive monitoring to proactive sovereignty. By combining PQC-ready cryptographic signatures with a tiered protocol cascade (Autopoiesis, Modo Isla, etc.), the RDM Digital system ensures that every event within its territory is auditable, resilient to external failure, and governed by a constitutional algorithmic model.