{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ser6buzz.tail3ab3aa.ts.net/machine/capability-ontology.schema.json",
  "title": "AncientOS Governed Capability Ontology",
  "type": "object",
  "required": [
    "schema_version",
    "ontology_id",
    "doctrine",
    "classes",
    "capabilities"
  ],
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "ontology_id": {
      "type": "string"
    },
    "doctrine": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "classes": {
      "type": "object",
      "required": [
        "capability",
        "governance",
        "execution",
        "safety",
        "replayability"
      ],
      "properties": {
        "capability": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "governance": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "execution": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "safety": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "replayability": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "capabilities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/capability"
      }
    }
  },
  "$defs": {
    "provider_binding": {
      "type": "object",
      "required": [
        "provider_id",
        "binding_class",
        "required",
        "transport_specific"
      ],
      "properties": {
        "provider_id": {
          "type": "string"
        },
        "binding_class": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "transport_specific": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "constitutional_risk": {
      "type": "object",
      "required": [
        "risk_id",
        "severity",
        "description",
        "zeus_hook"
      ],
      "properties": {
        "risk_id": {
          "type": "string"
        },
        "severity": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "zeus_hook": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "capability": {
      "type": "object",
      "required": [
        "capability_id",
        "name",
        "description",
        "capability_class",
        "governance_class",
        "execution_class",
        "safety_class",
        "replayability_class",
        "transport_neutral",
        "provider_bindings",
        "artifact_requirements",
        "approval_required",
        "approval_requirements",
        "escalation_requirements",
        "degradation_semantics",
        "simulation_eligible",
        "constitutional_risks",
        "dependencies",
        "alternative_ids",
        "forbidden"
      ],
      "properties": {
        "capability_id": {
          "type": "string",
          "pattern": "^capability\\.[a-z0-9_.-]+$"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "capability_class": {
          "type": "string"
        },
        "governance_class": {
          "type": "string"
        },
        "execution_class": {
          "type": "string"
        },
        "safety_class": {
          "type": "string"
        },
        "replayability_class": {
          "type": "string"
        },
        "transport_neutral": {
          "type": "boolean"
        },
        "provider_bindings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/provider_binding"
          }
        },
        "artifact_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "approval_required": {
          "type": "boolean"
        },
        "approval_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "escalation_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "degradation_semantics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "simulation_eligible": {
          "type": "boolean"
        },
        "constitutional_risks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/constitutional_risk"
          }
        },
        "dependencies": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "alternative_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "forbidden": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
