Policy

Policy is a versioned document, not a setting.

Every decision records the exact policy version it was evaluated against. Change a limit and the record still tells you which rule was in force at the time.

A complete policy

Rules are evaluated in ascending priority; the first match wins. If nothing matches, the policy's default effect applies, and that default should be deny.

policy.json
{
  "name": "Agency refunds",
  "default_effect": "deny",
  "fail_mode": "closed",
  "rules": [
    {
      "id": "spend-under-500",
      "name": "Refunds under 500 USD",
      "priority": 10,
      "when": {
        "tools": ["refund.create"],
        "amount_usd_lte": 500,
        "data_classes_not_in": ["health", "credentials"]
      },
      "effect": "allow",
      "explanation": "Refunds under the automated ceiling are approved by policy."
    },
    {
      "id": "large-refund",
      "name": "Refunds above 500 USD",
      "priority": 20,
      "when": { "tools": ["refund.create"], "amount_usd_gt": 500 },
      "effect": "deny",
      "explanation": "Above the ceiling the action is denied. Nothing waits on a person."
    }
  ]
}

Condition keys

FieldTypeMeaning
toolsstring[]Tool names, exact or globbed with *.
amount_usd_lte / _gtnumberSpend ceilings and floors.
data_classes_any / _not_instring[]Data class fences.
hour_outside {from,to}objectUTC business hours, 0-23.
velocity {max,window_seconds}objectPer-agent call cap inside a window.
risk_score_gtenumberThreshold against a caller-supplied score.
agent_idsstring[]Restrict a rule to specific agents.
Conditions within one rule are ANDed. Use separate rules for alternatives, ordered by priority. First match wins, so order is the design.

Example library

Velocity cap

Stop a loop before it becomes an incident.

rule
{
  "id": "velocity-cap",
  "priority": 5,
  "when": { "tools": ["*.write"], "velocity": { "max": 60, "window_seconds": 600 } },
  "effect": "deny",
  "explanation": "More than 60 writes in ten minutes from one agent is denied."
}

Business hours only

Time windows for actions that should not happen at 3am.

rule
{
  "id": "business-hours",
  "priority": 30,
  "when": { "tools": ["invoice.send"], "hour_outside": { "from": 8, "to": 18 } },
  "effect": "deny",
  "explanation": "Invoices are only sent during business hours (UTC)."
}

Data class fence

Keep an agent away from the data it was never cleared for.

rule
{
  "id": "no-credentials",
  "priority": 1,
  "when": { "data_classes_any": ["credentials", "health"] },
  "effect": "deny",
  "explanation": "This agent is not cleared for credential or health data."
}

Changing policy is itself an action

Publishing a policy version writes an audit event with the previous and new version, the actor, and the diff. Policies are authorized like anything else: a compromised admin session leaves a trail, and a version can be rolled back without erasing what happened under the old one.

A decision you can verify right now
permanent demo decisionALLOW
action
refund.create · $180
rule
Refunds up to 250 USD
record
seq 1
sha-256
078506dc86…8a5948
statement
anchored
receipt
moment-j5xx23u1
dec_demo_permanent

Cite: Aprve decision dec_demo_permanent, seq 1, sha-256 078506dc868d5413af74db8267801c4bf602dea47d0446ef97ca517d5e8a5948