Layer 1 — Constitution
File:core/governance.py
Enforces declarative rules defined in dof.constitution.yml.
HARD Rules (block immediately)
SOFT Rules (warn, don’t block)
PII Patterns
Override Detection
The Constitution detects 6 direct override patterns and 11 indirect escalation patterns — attempts to convince an agent to bypass governance.Layer 2 — AST Validator
File:core/ast_verifier.py
Extracts all code blocks from agent output and runs static analysis before any code can execute.
Layer 3 — Tool Hook Gate PRE
File:core/tool_hooks.py
Intercepts tool calls before they execute — not after. The hook receives tool name + parameters, runs them through Constitution and AST, and either approves or blocks. Blocked calls return a REJECTED verdict with reason.
Layer 4 — Supervisor Engine
File:core/supervisor.py
Monitors agent behavior across turns and computes a composite quality score every cycle:
Thresholds: ≥ 7.0 →
ACCEPT · 5.0–6.9 → RETRY · < 5.0 → ESCALATE
Layer 5 — Adversarial Guard
File:core/adversarial.py
Red/blue pipeline against prompt injection, jailbreaks, and indirect injection attacks.
RedTeamAgent probes → GuardianAgent evaluates → DeterministicArbiter decides (no LLM arbitration).
DLP hook: adversarial_dlp_hook(text) scans for API keys, private keys, PII, and JWT tokens before any output is accepted.
Layer 6 — Memory Layer
File:core/memory_governance.py
Governed session state — every write to memory passes through the Constitution.
- ConstitutionalDecay — memories expire by policy
- ConflictError — contradictory memories flagged, not overwritten
- TemporalGraph — causal chain of memory updates preserved for audit
Layer 7 — Z3 SMT Verifier
File:core/z3_verifier.py
Four mathematical invariants formally proven every cycle.
In addition, core/transitions.py verifies state transitions across all 9 transition types. Results saved to logs/z3_proofs.json.
Result: 4/4 PROVEN.
DOFProofRegistry deployed on 9 chains (4 mainnet + 5 testnet).
Primary (Avalanche C-Chain, 43114): 0x154a3F49a9d28FeCC1f6Db7573303F4D809A26F6
Formal Verification
Z3 proofs and state invariants in depth
Security Configuration
Tuning rules and DLP for your use case