{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://adriandunkley.net/ai-agents/mandate.schema.json",
  "title": "Example agent mandate",
  "description": "Project-specific record format. Validation checks structure only; it cannot establish identity, authority, legality or constitutional conformity.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "mandateId",
    "constitutionVersion",
    "principal",
    "operator",
    "purpose",
    "permittedActions",
    "allowedTools",
    "allowedResources",
    "prohibitedActions",
    "budget",
    "expiresAt",
    "approvalRequiredFor",
    "stop",
    "incidentContact"
  ],
  "properties": {
    "mandateId": {
      "type": "string",
      "minLength": 1
    },
    "principal": {
      "type": "string",
      "minLength": 1
    },
    "operator": {
      "type": "string",
      "minLength": 1
    },
    "purpose": {
      "type": "string",
      "minLength": 1
    },
    "incidentContact": {
      "type": "string",
      "minLength": 1
    },
    "constitutionVersion": {
      "const": "1.1"
    },
    "permittedActions": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true,
      "minItems": 1
    },
    "allowedTools": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true,
      "minItems": 1
    },
    "allowedResources": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true,
      "minItems": 1
    },
    "prohibitedActions": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "approvalRequiredFor": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "budget": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currency",
        "spendingCap",
        "maxToolCalls"
      ],
      "properties": {
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "spendingCap": {
          "type": "number",
          "minimum": 0
        },
        "maxToolCalls": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "stop": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "revocationOwner",
        "channel"
      ],
      "properties": {
        "revocationOwner": {
          "type": "string",
          "minLength": 1
        },
        "channel": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
