Policy Circuits
Policy circuits are PCD programs that act as deterministic guardrails for AI systems. Unlike traditional rule engines or RLHF alignment, a policy circuit is formally verified (Φ_c = 1) and cannot be bypassed, updated, or overridden at runtime.A policy circuit is a regular PCD circuit that takes an action as input and emits
ALLOW or BLOCK as output. Because PCD is deterministic, the same action always produces the same verdict.Why Policy Circuits?
| Traditional Guards | Policy Circuits |
|---|---|
| Code that can be patched | Immutable verified circuit |
| Runtime exceptions | Compile-time rejection |
| Probabilistic (RLHF) | Deterministic (Φ_c = 1) |
| Trust the developer | Trust the math |
Quick Start
Create a Policy
.pcd file from a built-in template. Five templates are available:
| Template | Description |
|---|---|
no_network | Blocks all network I/O operations |
no_filesystem | Blocks all filesystem access |
memory_bound | Enforces memory allocation limits |
sandbox | Combines no_network + no_filesystem + memory_bound |
allow_all | Permits all actions (useful as a starting point) |
Verify a Policy
Verification checks that Φ_c = 1 for the policy circuit. If the circuit has dead branches, unreachable paths, or ambiguous verdicts, verification fails and the policy cannot be deployed.
Pre-Built Policies
no_network
memory_bound
Example: Robot Arm Force Limiter
A policy circuit that prevents a robotic arm from exceeding safe force thresholds:Example: LLM Output Filter
A policy circuit that blocks LLM responses containing prohibited content patterns:Writing Custom Policies
Identify which action categories your system emits. Each action has a
category string and a params record.Use
domain declarations for numeric constraints. This gives the TCE engine the information it needs to verify completeness.Pattern-match on
action.category and return ALLOW or BLOCK for every path. The circuit must be total — every possible input must reach a verdict.
