System 9 · The Stack

Spectral

Privacy-preserving, formally verified compositional safety for multi-agent systems.

Lean 4 + Elixir · ZK Proofs · Hypergraph Closure · Eduardo Aguilar Peláez

27 tests
Theorem 9.2 — Spera (2026)

Safety is non-compositional: two individually safe agents can compose into an unsafe coalition via emergent conjunctive dependencies.

Per-agent safety checks are structurally insufficient. Spectral closes this gap.

The Problem

Every system in the stack proves properties locally: CSC verifies each handoff edge, TokenGov proves each allocation round conserves budget, CCAP attests each agent's capabilities individually, Elan supervises each process in isolation.

None of them answers the critical question: is the composed system — all agents, all pipelines, all accounts, running simultaneously — safe?

This is not a gap that can be closed by making individual proofs stronger. It is a structural impossibility.

CSC
Per-edge HandoffProofs
No global DAG safety
TokenGov
Per-round invariants
No cross-account safety
CCAP
Per-agent attestation
No coalition attestation
Elan
Per-process supervision
No topology-level safety

The Solution

Hypergraph Closure

Formalises the full capability space as a directed hypergraph. Computes closure under conjunctive dependencies. Proves the closure does not intersect the forbidden set.

ZK Coalition Attestation

Agents prove their coalition is safe without revealing individual capability sets. Uses EconLib4's Crypto.ZeroKnowledge primitives — special_soundness and fiat_shamir.

Incremental Maintenance

When agents join, leave, or capabilities change, Spectral re-verifies safety via πdelta proofs without recomputing the full closure from scratch.

Safe Audit Surface

Polynomial-time partition of every capability into Safe (acquirable), Frontier (one step away), or Never (permanently forbidden). The speculum — the full snapshot.

Architecture

The Formal Model

The capability space is a directed hypergraph H = (V, E) where V is the universe of capabilities (including forbidden set F ⊆ V) and E is a set of directed hyperedges: each e = (S, t) means "possessing all capabilities in S enables acquiring capability t".

The closure Cl(A) of an initial capability set A ⊆ V is the smallest superset closed under all hyperedges. An agent or coalition with capabilities A is safe iff Cl(A) ∩ F = ∅.

ResultRole
Non-compositionality (Thm 9.2)Proves per-agent checks are insufficient
Lattice structure (Thm 9.3)Offline preprocessing for online checking
coNP-completeness (Thm 9.4)Complexity bounds for safety audit
Safe Audit Surface (Thm 10.2)Core Spectral output: Safe / Frontier / Never
Submodularity (Thm 8.4)Greedy (1-1/e) capability acquisition
Coalition SafetyLinear-time set-cover against precomputed antichain

Zero-Knowledge Proofs

πsafe

Coalition Safety Proof

Proves Cl(A1 ∪ ... ∪ An) ∩ F = ∅ without revealing any individual Ai. Each agent commits to its capabilities; the proof verifies against public commitments and the public forbidden set.

πdelta

Incremental Update Proof

When one agent's capabilities change, proves the new composition remains safe given the previous πsafe. Avoids full recomputation — only the delta is verified.

πaudit

Audit Surface Proof

Produces the Safe/Frontier/Never partition for any deployment state. The partition is public; the individual capability sets remain private. This is the speculum.

The Speculum

structure Speculum where
  hypergraph     : CapabilityHypergraph
  forbidden      : Finset Capability
  commitments    : Array (Agent × Commitment)
  closure        : Finset Capability
  safe_region    : LowerSet (Finset Capability)
  antichain      : Finset (Finset Capability)  -- B(F), minimal unsafe boundary
  audit_surface  : AuditSurface
  proof          : SafetyProof                 -- π_safe
  timestamp      : Nat

The speculum is recomputed incrementally whenever the capability state changes. Elan's supervisor consults it before any new agent composition. CCAP includes it in multi-agent execution traces.

Stack Integration

Spectral consumes outputs from every system and provides guarantees back to all of them.

EconLib4

Consumes Crypto.ZeroKnowledge, Crypto.Commitment, Trust.Reputation
Provides New module: Safety.Compositional

CSC

Consumes SkillDAG capability envelopes, HandoffProofs
Provides Coalition safety certificate per compiled pipeline

TokenGov

Consumes Cross-account capability sets, budget allocations
Provides Cross-account composition safety proof

Elan

Consumes Process topology, supervision tree, capability registry
Provides Real-time safety status; circuit breaker triggers

CCAP

Consumes Per-agent attestations, execution traces
Provides ZK coalition attestation for multi-agent collaboration

OpenCompliance

Consumes Regulatory forbidden sets (SOC 2, ISO 27001, GDPR)
Provides Compliance-as-safety-proof: regs as F, formal non-intersection

LegalLean

Consumes Formalised legal rules as capability constraints
Provides Legal safety surface: provably legal-safe envelope

LegalEngine

Consumes Production runtime state from Elan
Provides Auditable ZK proof for regulators: "composed system is safe"

Lean 4 Formalisation

Key theorems to prove in EconLib4's new Safety.Compositional module.

safety_non_compositional

Impossibility

∃ H F A B, safe H F A ∧ safe H F B ∧ ¬ safe H F (A ∪ B)

Constructive counterexample formalising Spera Thm 9.2

safe_region_is_lower_set

Structure

IsLowerSet (safe_region H F)

The safe region forms a lower set in the power-set lattice

audit_surface_polynomial

Complexity

∃ alg, alg.output = audit_surface ∧ alg.complexity ≤ poly(|H| + |F|)

Safe Audit Surface is polynomial-time computable

closure_gain_submodular

Optimisation

Submodular (closure_gain H)

Greedy (1-1/e)-optimal capability acquisition guarantee

coalition_safety_proof_sound

Soundness

verify π = true → ∃ As, all commit ∧ safe(⋃ As)

ZK coalition proof is sound: verification implies real safety

coalition_safety_proof_zk

Privacy

safe As₁ ∧ safe As₂ → indistinguishable (prove As₁) (prove As₂)

ZK coalition proof reveals nothing about individual capability sets

New Lexicon

speculum
Complete compositional safety state snapshot. Hypergraph + closure + ZK proof + audit surface. Already coined; now operationalised.
conjunctive emergence
The phenomenon where individually safe agents compose into an unsafe coalition via AND-dependencies. What Spera Thm 9.2 proves.
safe antichain
The minimal unsafe boundary B(F) — a finite antichain of capability sets. If any element is covered by a coalition's joint capabilities, the coalition is unsafe.
spectral gain
The submodular function measuring marginal safety value of acquiring a new capability. Guides greedy-optimal capability acquisition.

Speculum Freshness

Wave 4 adds coalition-hash-based staleness detection to the speculum lifecycle. Spectral now self-monitors whether its compositional safety snapshot is current, changed, or stale — and signals accordingly via MetaBus.

Staleness Detection

SpeculumFreshness

SHA-256 coalition fingerprinting computes a deterministic hash of the current coalition state. When compared against the stored coalition hash, Spectral auto-detects whether the speculum is still valid, has grown stale via TTL expiry, or the underlying coalition has changed.

Detection states:

:fresh :stale :changed

TTL is configurable per deployment. On staleness detection, Spectral triggers incremental re-verification via πdelta rather than full recomputation.

Integration Tests

Cross-System Verification

Wave 4 introduces integration test suites covering the Spectral↔Elan and Elan↔TokenGov integration surfaces.

Spectral↔Elan 5 tests passing
Elan↔TokenGov 5 tests passing

Tests cover freshness propagation, staleness escalation, TTL boundary conditions, and coalition-hash collision resistance.

MetaBus Integration

Staleness Signalling

When SpeculumFreshness detects a staleness or change condition, Spectral emits a structured event on MetaBus — the cross-system event bus — enabling downstream systems to pause coalition operations or trigger re-attestation flows.

{:speculum_stale, coalition_id, reason}

The coalition_id identifies the affected coalition; reason carries :ttl_expired, :hash_changed, or :forced_invalidation. Elan subscribes to this event to gate new agent compositions until the speculum is refreshed.

Position in The Stack

Spectral sits between orchestration (Layer 1) and protocol (Layer 3) as a cross-cutting verification layer — the system that answers the one question no other system can.

Provably impossible to close from within

Spera's theorem is an impossibility result. No amount of per-agent verification can guarantee compositional safety. You need a dedicated system-level verifier.

Connects every system

Consumes from CSC, TokenGov, Elan, CCAP, OpenCompliance, LegalLean. Provides guarantees back to all of them. The missing cross-cutting layer.

Operationalises existing ZK primitives

EconLib4 has special_soundness and fiat_shamir. CSC and CCAP reference ZK. But no system builds ZK proofs about composed state. Until now.

Makes the safety story auditable

LegalEngine can tell regulators: "We have a zero-knowledge proof that the composed system remains within the safe operating envelope — without revealing proprietary details."

Related Documentation

Stack Integration — Phase 1–5 Connections

Phases 1–5 of the trustworthiness roadmap operationalise Spectral’s formal constructs inside the running stack. Each new module maps directly onto a core Spectral concept — forbidden-capability regions, safe closure sets, incremental forbidden-set updates, and compositional coalition safety.

Phase 3 — CSC

CompetenceSignal ↔ Forbidden Capability Region

CSC.CompetenceSignal creates a semantic analogue of Spectral’s forbidden-capability zone. When a SubTask’s confidence score falls below the uncertain threshold (0.40), synthesis is blocked — just as Cl(A) ∩ F ≠ ∅ blocks execution.

The capability being “forbidden” is: generating confident-sounding output with low epistemic grounding. CompetenceSignal enforces this at the vocabulary level via CertaintyVocabulary gating.

confidence < 0.40 → halt              Cl(A) ∩ F ≠ ∅ → ¬execute
Phase 5 — CSC

FiduciaryScope.authorised_action_set ↔ Safe Region Cl(A)

CSC.FiduciaryScope requires every deployment to declare an explicit authorised_action_set — the set of actions the stack may perform autonomously. This is the compliance analogue of Spectral’s safe region.

The pipeline cannot proceed outside this declared set, mirroring Spectral’s Cl(A) ∩ F = ∅ safety certificate. FiduciaryScope also requires licensed_entity and a liability_acceptance_hash (SHA-256), making the certificate operator-signed.

action ∉ authorised_action_set → halt    Cl(A) ∩ F = ∅ → safe
Phase 5 — TokenGov

NormfallAlert ↔ Temporal Update to Forbidden Set F

When TokenGov.NormfallAlert detects a struck norm (e.g. DOL fiduciary rule, 2026-03-18), the effective legal forbidden set F shifts — actions that were safe yesterday become unsafe today.

This is the semantic equivalent of Spectral’s incremental update proof (πdelta): the forbidden set changes, and the system must re-verify safety without recomputing from scratch. NormfallAlert tracks three norms: DOL_FIDUCIARY_RULE_2024 (struck, critical), SEC_AI_GOVERNANCE_2026 (active, high), FINRA_AGENTIC_AI_2026 (active, high).

DOL struck 2026-03-18 πdelta re-verify triggered
Phase 3 — CSC

PathwayAudit ↔ Coalition Safety at the Deontic Level

CSC.PathwayAudit checks each SubTask against deontic obligations (FINRA 2026 + SEC 2026), proving pathway_compliance_compositional in Lean 4: if every SubTask is individually compliant, the full pathway is compliant.

This mirrors Spectral’s coalition safety question: if Cl(A1) ∩ F = ∅ and Cl(A2) ∩ F = ∅, is Cl(A1 ∪ A2) ∩ F = ∅? PathwayAudit answers the deontic analogue with a formal compositional proof — each SubTask is an “agent”, each deontic obligation is a forbidden-set element.

pathway_compliance_compositional : ∀ t ∈ pathway, compliant(t) → compliant(pathway)