{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opencradle.ai/schemas/policy.v1.json",
  "title": "Cradle policy v1",
  "description": "A named, versioned preset of agent constraints. SPEC-57 D10.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "id",
    "version"
  ],
  "properties": {
    "schema": {
      "const": "cradle.policy/v1"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9-]{1,64}$"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "description": {
      "type": "string",
      "maxLength": 2000
    },
    "grounding": {
      "type": "string",
      "enum": [
        "off",
        "soft",
        "strict"
      ],
      "description": "Overrides the agent grounding mode."
    },
    "tools": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "allow": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true,
          "description": "The agent tools are intersected with this list."
        }
      }
    },
    "risk": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "holdOn": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "green",
              "yellow",
              "red"
            ]
          },
          "uniqueItems": true,
          "description": "Validated and stored; not enforced in v1."
        }
      }
    }
  }
}
