Agent Control as Code: Declarative Cross-Plane Governance

Agent Control as Code (ACaC, arXiv:2612.03493) is a formal declarative specification that unifies agent governance across reasoning harnesses, authorization gateways, coordination planes, and execution targets. Modeling rules over four primitives N = (H, M, T, O)—hard policies, mandates, defeasible tenets, and post-action obligations—ACaC compiles to Cedar and KedgeSpec with zero invariant violations across 11,114 TLC states and 0/25 unnecessary escalations vs. 19/25 for prose rules.
Agent Control as Code: Declarative Cross-Plane Governance: Agent Control as Code (ACaC, arXiv:2612.03493) is a formal declarative specification that unifies agent governance across reasoning harnesses, authorization gateways, coordination planes, and execution targets. Modeling rules over four primitives N = (H, M, T, O)—hard policies, mandates, defeasible tenets, and post-action obligations—ACaC compiles to Cedar and KedgeSpec with zero invariant violations across 11,114 TLC states and 0/25 unnecessary escalations vs. 19/25 for prose rules. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Zero Authority Drift & Discretion Loss: Separates hard boundaries (H) from mandates (M), defeasible preferences (T), and post-commit duties (O) across every plane.
- Mathematically Verified Compilation: Matches native Cedar across 6,144 bounded states (Z3-corroborated) and passes 11,114 TLA+/TLC model-checked states with 0 violations.
- Eliminates False Escalations: Replaces prose-only markdown rules (19/25 false escalations on GPT-5.6, 6/25 on claude-fable-5) with structured preflight envelopes (0/25).
- Sub-Millisecond Revalidation: Typed support-set caching delivers 238.6 us median KedgeSpec revalidation and 3.105 ms warm reserve latency.
import { createAgent } from '@smoke-monkey/harness';// Bind Smoke Monkey Harness permission gates to compiled ACaC (H, M, T, O) policy envelopesconst agent = createAgent({agentId: 'acac-governed-operator',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'Qwen/Qwen3-8B',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'ask', // Hard policy H: protected config paths require explicit approvalrun_command: 'ask', // Mandate M + Obligation O: emit HMAC audit receipt post-commit},});async function main() {const result = await agent.run('Validate deployment manifest against ACaC policy.yaml, run preflight capacity reservation, and log post-action obligation receipt.');console.log('ACaC governed execution:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Guardrails with LangChain: A Complete Crash Course for Building Safe AI Agents
Security & AI Governance: Reducing Risks in AI Systems
What Is Agent Control as Code (ACaC)?
Agent Control as Code (ACaC) treats operational agent safety rules the way Infrastructure as Code treats cloud topology: one declarative source of truth compiled deterministically to every execution plane. When rules are scattered across system prompts, gateway configs, and tool wrappers, teams suffer normative modality confusion—causing either authority drift (admitting forbidden writes) or discretion loss (blocking valid delegated actions).
| Verification / Study Benchmark | Prose / Uncoordinated Baseline | Compiled ACaC + KedgeSpec |
|---|---|---|
| Cedar bounded-state oracle match | — | 6,144 / 6,144 states (5/5 defects caught) |
| Concurrent burst invariant violations (30 trials) | 100 / 150 rounds (12/5 oversubscribed) | 0 / 150 rounds (peak 5 <= cap 5) |
| Unnecessary escalations (BAL, GPT-5.6 / fable-5) | 19 / 25 & 6 / 25 | 0 / 25 (with structured preflight) |
| Hard-frontier authorized completions | 11 / 60 (10 / 59 protocol) | 60 / 60 (55 / 55 filtered) |
The Four ACaC Primitives: H, M, T, and O
ACaC models every rule as a four-tuple N = (H, M, T, O) so compilers preserve exact modality semantics across planes:
- Hard Policies (`H`): Non-overridable invariants enforced at the authorization gateway and preflight layer (for example, production DB drop blocks or capacity caps).
- Mandates (`M`): Affirmative requirements that restrict candidate plan admissibility until satisfied.
- Defeasible Tenets (`T`): Preference graphs composed with strongly connected component (SCC) cycle semantics—guidance that yields safely when overridden by higher-priority constraints.
- Post-Action Obligations (`O`): Event-time duties triggered upon commit (such as audit HMAC persistence, lock release, and ack-drop recovery).
Prose Instructions Are Not Cross-Plane Firewalls
In ACaC's replay study, prose-only system instructions triggered 19/25 unnecessary escalations on GPT-5.6 and 11/60 authorized resolutions on hard-frontier tasks, whereas deterministic preflight envelopes hit 60/60.
Reproducible Declarative ACaC Policy & Cedar Projection
Structure cross-plane rules declaratively so your Smoke Monkey Harness preflight check and Cedar gateway enforce the exact same contract:
# acac-policy.yaml — Unified N = (H, M, T, O) governance contract
version: "1.0"
hard_policies:
- id: H1_no_unbounded_capacity
resource: "gpu_slot_pool"
constraint: "active_reservations <= max_capacity(5)"
- id: H2_protect_prod_env
action: "write_file"
deny_path_glob: "**/.env.production"
mandates:
- id: M1_preflight_required
require_before: ["deploy_service", "migrate_db"]
check: "cedar_allow && capacity_reserved"
tenets:
- id: T1_prefer_read_only_triage
priority: 10
defeasible: true
obligations:
- id: O1_hmac_audit_receipt
on_commit: ["deploy_service", "migrate_db"]
deadline_ms: 5000# Compile declarative policy and verify Cedar/Z3 bounds
cedar validate --policies acac-compiled.cedar --schema kedge-schema.cedarschemaFrequently Asked Questions
Q:What is the difference between authority drift and discretion loss in ACaC?
Authority drift occurs when an agent plane admits an action forbidden by global policy N; discretion loss occurs when an overly conservative plane blocks an action that N actually permits.
Q:Why does ACaC split rules into H, M, T, and O instead of one allow/deny list?
Confusing hard boundaries (H) with defeasible preferences (T) or post-commit obligations (O) causes planes to miscompile guidance into hard blocks or drop required audit/cleanup duties.
Q:What is the runtime latency overhead of ACaC governance checks?
In warm-cache E3 and E4 benchmarks, KedgeSpec typed revalidation runs in 238.6 microseconds (median) and full SHA-256 cached capacity reservation runs in 3.105 ms median.
Q:How does ACaC relate to Smoke Monkey Harness permissions?
Smoke Monkey Harness enforces deterministic pre-execution permission gates (allow/ask/deny) in code outside the LLM prompt, directly implementing ACaC hard-policy enforcement at the tool boundary.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.