Policy Engine
The Policy Engine is a deterministic rule evaluator. It takes the operation type, risk assessment, scope, context, and content flags as input, and evaluates a list of YAML-defined rules in priority order. The first matching rule wins, producing aPolicyDecision with an action and reason codes.
Deterministic means the same input combined with the same policy version always produces the same decision. There is no randomness, no ML model, and no external calls.
Policy File Structure
Policies are defined in a YAML file with four top-level sections:Rule Anatomy
Each rule has these fields:Match Modes
Available Fields
These fields are available in rule conditions:Condition Operators
The engine supports 10 operators:Actions
Each rule produces one of four actions:allow
The operation proceeds to the adapter and is committed to the memory backend.
deny
The operation is blocked immediately. A
PolicyDeniedError is raised with the matched rule ID.require_approval
The operation is paused and sent to the Approval Broker. It proceeds only if approved.
quarantine
The operation payload is stored in the quarantine store for later review. A
QuarantinedError is raised.The on_policy_miss Fallback
When no rule matches an operation, the defaults.on_policy_miss action is used. The decision will have reason_codes: ["DEFAULT_POLICY"] and an empty matched_rule_ids list.
Policy Schema Validation
Policies are validated against a JSON Schema at load time. If amemproof-policy.schema.json file is found in the schemas/ directory, it is used automatically:
Example: Multi-Rule Policy
block-secrets (priority 10) before reaching approve-deletes (priority 30), because rules are evaluated in ascending priority order.