Runtime Architecture (L0–L9)
Strict 10-layer hierarchy, downward dependencies, and hybrid persistence.
The M31A runtime is structured into 10 downward-dependency layers (L0 to L9). Lower layers are strictly forbidden from importing or depending on higher layers.
The 10-Layer Hierarchy (L0–L9)
L9
CLI & TUI Cockpit
Command parsing (clap 4), Ratatui interactive cockpit, telemetry inspection, JSON export, eval runner.
L8
Autonomy Controller
12-stage mission execution loop, 10-dimensional budget tracker, sliding-window loop detector, completion gates.
L7
Verification & Recovery
Multi-tier test validation, 15 failure classifications, differential DAG replanner, two-phase atomic checkpoints.
L6
Execution Engine
Job manager, process tree supervisor, streaming output spools, immutable content-addressed artifact store.
L5
Planning & DAG Engine
TaskGraph reconciler, topological scheduler, candidate plan validator, petgraph dependency resolution.
L4
Agent Coordination
8 canonical agent roles, role state machines, context window compilers, token allocators.
L3
Intelligence Boundary
NVIDIA NIM integration, SSE parser, multi-tier SecretRedactor, XML prompt trust envelopes with attribute escaping.
L2
Capabilities & Tools
28 core tools, 15 capability families, cgroups v2 & rlimits process confinement, deny-by-default environment builder.
L1
Security & Policy Gate
11-stage policy gate, NetworkDestinationPolicy (SSRF defense), fail-closed worktree isolation, approval coordinator.
L0
Kernel Foundation
Domain-typed kernel IDs (MissionId, TaskId, etc.), SQLite migrations, shared error model, broadcast event bus.
Downward Dependency Rule
The TUI (L9) and CLI (L9) are pure projections of authoritative SQLite state (L0). If the TUI crashes or is closed, the underlying mission execution loop (L8) and sandboxed tools (L2) continue running safely in the background without state loss.
Hybrid Persistence Architecture
.m31a/
├── db.sqlite # Compact relational state (WAL mode, foreign keys ON)
├── telemetry/ # Append-only NDJSON execution streams with secret redaction
│ └── <mission_id>.ndjson
├── artifacts/ # Content-addressed SHA-256 immutable blob storage
│ └── ab/abcd1234...bin
└── staging/ # Two-phase staging buffers for uncommitted checkpoints