Skip to main content
Memproof policies are declarative YAML files that define how the system handles every memory operation. The policy engine evaluates rules in priority order — the first matching rule wins.

Policy File Structure

Every policy file has five top-level keys:

Rule Anatomy

Each rule is a dictionary with the following fields:
Rules are sorted by priority at load time. A rule with priority 50 is evaluated before priority 200. The first match short-circuits evaluation.

Available Fields

Conditions can reference these fields from the evaluation context:

Condition Operators

The policy engine supports 10 operators:

Match Modes

  • all (default) — Every condition must be true (logical AND).
  • any — At least one condition must be true (logical OR).

Default Behaviors

Setting on_policy_miss: allow means any operation not explicitly matched by a rule will be permitted. In production, deny is the safer default.

Common Patterns

Allow Trusted Reads

Block Cross-Tenant Operations

Require Approval for High Risk

Quarantine PII from Untrusted Sources

Start with the example policy at examples/memproof.yaml and customize it for your threat model. Keep cross-tenant denial at the lowest priority number so it fires before anything else.