{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/policy-decision.schema.json",
  "title": "PolicyDecision (policy-decision-v1)",
  "description": "Record of one policy evaluation by the policy engine (BC-18) or approval policy (BC-20): who asked, against which revision, what was decided and why. Attached to model receipts, tool receipts and approval requests.",
  "type": "object",
  "required": ["decisionId", "policyRevision", "subject", "action", "outcome", "evaluatedAt"],
  "additionalProperties": false,
  "properties": {
    "decisionId": { "type": "string", "format": "uuid" },
    "policyRevision": { "type": "string" },
    "subject": { "type": "object", "required": ["callerId", "tenantId"], "properties": { "callerId": { "type": "string" }, "callerKind": { "enum": ["user", "workload", "partner-agent", "system"] }, "tenantId": { "type": "string" }, "projectId": { "type": "string" }, "agentId": { "type": "string" }, "roles": { "type": "array", "items": { "type": "string" } } } },
    "action": { "type": "object", "required": ["kind"], "properties": { "kind": { "enum": ["model-invocation", "tool-invocation", "retrieval", "approval-eligibility", "publication", "memory-promotion", "spend", "export", "deletion"] }, "target": { "type": "string" }, "sideEffectClass": { "type": "string" }, "classification": { "type": "string" }, "environment": { "type": "string" } } },
    "outcome": { "enum": ["allow", "allow-with-approval", "deny", "allow-with-constraints"] },
    "constraints": { "type": "array", "items": { "type": "string" }, "description": "e.g. profile restricted to pii-local; egress allow-list applied" },
    "matchedRules": { "type": "array", "items": { "type": "string" } },
    "reason": { "type": "string" },
    "evaluatedAt": { "type": "string", "format": "date-time" },
    "evaluator": { "type": "string", "description": "Service and version that evaluated." }
  }
}
