{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/waterr-ai/json-schema/waterr-ai-guardrail-schema.json",
  "title": "Guardrail",
  "description": "A named prompt fragment. Every guardrail attached to a scenario is appended to that scenario's system prompt as a bullet under a `## Guardrails` heading, so the persona treats it as a non-negotiable rule for the whole conversation.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/waterr-ai-api-openapi.yml#/components/schemas/Guardrail",
  "type": "object",
  "required": [
    "id",
    "guardrail_name",
    "guardrail_prompt",
    "active"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "membership_id": {
      "type": "string",
      "format": "uuid"
    },
    "guardrail_name": {
      "type": "string",
      "maxLength": 64,
      "pattern": "^[a-zA-Z0-9_-]{1,64}$",
      "description": "Handle for the rule. Unique per account. Used in the API and in your logs — it is never shown to the persona or the participant."
    },
    "guardrail_prompt": {
      "type": "string",
      "maxLength": 10000,
      "description": "The rule itself, appended verbatim to the system prompt. Write it as a direct instruction. Encrypted at rest."
    },
    "active": {
      "type": "boolean",
      "default": true,
      "description": "Account-level kill-switch. `false` removes the rule from every scenario at once."
    },
    "scenarios": {
      "type": "array",
      "description": "Scenarios this guardrail is attached to. Returned only on the single-guardrail read.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "position": {
            "type": "integer"
          }
        }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}