Skip to content

6-layer architecture

Agentic SpendGuard organizes its concerns into 6 primitive layers, executed in this strict order on every decision:

T (Trace) → L (Ledger) → C (Contract) → D (Decision) → E (Evidence) → P (Proof)
LayerResponsibilityKey invariant
T TraceCapture event identity (run_id, step_id, llm_call_id)Every event has a globally-unique id
L LedgerAtomic budget reservation + commitPer-unit balance preserved every tx
C ContractHot-path policy evaluationDecision in <5ms
D Decision8-stage transaction state machineStages 1-4 always atomic
E EvidenceAudit chain durabilityNo effect without audit row (§6.1)
P ProofPer-event signing + verificationCosign-signed bundles + Ed25519 events

See docs/contract-dsl-spec-v1alpha1.md and docs/stage2-poc-topology-spec-v1alpha1.md in the source repo for the full specifications.