{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://governed.run/artifacts/schema/csg-artifact.schema.json",
  "title": "Continuous Software Generation Artifact",
  "type": "object",
  "required": [
    "kind",
    "name",
    "version",
    "intent",
    "riskLevel",
    "allowedScope",
    "blockedScope",
    "evidence",
    "escalation"
  ],
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "csg.hook",
        "csg.skill",
        "csg.system-prompt",
        "csg.policy",
        "csg.validator",
        "csg.loop-pattern",
        "csg.observability-adapter"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 2
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "intent": {
      "type": "string",
      "minLength": 20
    },
    "riskLevel": {
      "type": "string",
      "enum": ["low", "medium", "high"]
    },
    "allowedScope": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" }
    },
    "blockedScope": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" }
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" }
    },
    "escalation": {
      "type": "object",
      "required": ["when", "to"],
      "properties": {
        "when": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string" }
        },
        "to": {
          "type": "string",
          "minLength": 2
        }
      },
      "additionalProperties": false
    },
    "portableAcross": {
      "type": "array",
      "items": { "type": "string" }
    },
    "dependencies": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "additionalProperties": true
}
