libertaria-stack/membrane-agent
Markus Maiwald a4645865b3 Phase 6B Week 3 COMPLETE: L2 Membrane Agent Integration
- Implemented L2 Pipeline Integration Test (tests/integration_test.rs)
  - Connects L0 events -> PolicyEnforcer -> QVL FFI
  - Validates full stack behavior
- Fixed build.rs linkage (linking libqvl_ffi.a correctly)
- Added README.md for membrane-agent
- Updated tasks and walkthroughs

Phase 6B Delivery:
- Rust L2 Agent Daemon (Functional)
- QVL FFI Bridge (Verified)
- Core Enforcement Logic (Policy/Alerts)
- RFC-0121 Slash Protocol Spec (Drafted)

Ready for next phase: Slash Protocol Implementation.
2026-01-31 03:33:13 +01:00
..
src Phase 6B Week 2 COMPLETE: Rust L2 Membrane Agent Daemon 2026-01-31 03:30:07 +01:00
tests Phase 6B Week 3 COMPLETE: L2 Membrane Agent Integration 2026-01-31 03:33:13 +01:00
Cargo.lock Phase 6B Week 2 COMPLETE: Rust L2 Membrane Agent Daemon 2026-01-31 03:30:07 +01:00
Cargo.toml Phase 6B Week 1: Rust membrane-agent FFI bindings (partial) 2026-01-31 03:21:35 +01:00
README.md Phase 6B Week 3 COMPLETE: L2 Membrane Agent Integration 2026-01-31 03:33:13 +01:00
build.rs Phase 6B Week 3 COMPLETE: L2 Membrane Agent Integration 2026-01-31 03:33:13 +01:00

README.md

Membrane Agent

L2 Trust-Based Policy Enforcement Daemon for Libertaria

The Membrane Agent is a Rust-based daemon that acts as the immune system for a Libertaria node. It sits between the L0 Transport Layer (UTCP) and the Application Layer, enforcing policies based on the L1 QVL Trust Graph.

🏗️ Architecture

  • L0 Hooks: Listens for packet events (receipt, connection).
  • QVL FFI: Queries the Zig-based QVL via C ABI for trust scores and betrayal detection.
  • Policy Enforcer: Decides to Accept, Deprioritize, or Drop packets based on sender trust.
  • Anomaly Alerts: Emits P0/P1 alerts when Betrayal (negative cycles) is detected.

🚀 Running

Prerequisites

  • Zig 0.15.2+ (to build liblibertaria_sdk)
  • Rust 1.80+

Build

First, build the Zig SDK static library:

cd libertaria-sdk
zig build

Then build the Rust daemon:

cd membrane-agent
cargo build --release

Run

cargo run --release

🧪 Testing

# Run unit tests + FFI integration tests
cargo test

🔌 API Integration (Draft)

The agent exposes a control socket (TODO) and consumes L0 events via IPC (TODO). Currently operates in STUB MODE for L0 integration.