{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aiwg.io/schemas/metalanguage/rule.schema.json",
  "title": "AIWG Rule Definition",
  "description": "Declarative YAML schema for enforcement rules",
  "type": "object",
  "required": ["rule"],
  "properties": {
    "rule": {
      "type": "object",
      "required": ["id", "severity"],
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
        "name": { "type": "string" },
        "description": { "type": "string" },
        "severity": { "type": "string", "enum": ["CRITICAL", "HIGH", "MEDIUM", "LOW"] },
        "tier": { "type": "string", "enum": ["core", "sdlc", "research", "addon"] },
        "when_to_apply": { "type": "string" },
        "prohibitions": { "type": "array", "items": { "type": "string" } },
        "requirements": { "type": "array", "items": { "type": "string" } },
        "recovery_protocol": { "type": "array", "items": { "type": "string" } },
        "max_retries": { "type": "integer" },
        "exceptions": { "type": "array", "items": { "type": "string" } }
      }
    }
  }
}
