{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentknowledge.dev/schemas/compile-run.schema.json",
  "title": "Agent Knowledge Compile Run",
  "type": "object",
  "additionalProperties": false,
  "required": ["run_id", "trigger", "status", "inputs", "outputs"],
  "properties": {
    "run_id": { "type": "string", "minLength": 1 },
    "trigger": { "type": "string", "enum": ["ingest", "source-change", "manual", "scheduled", "migration"] },
    "status": { "type": "string", "enum": ["passed", "needs-review", "stale", "disputed", "failed"] },
    "compiler": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "tool": { "type": "string" },
        "version": { "type": "string" },
        "model": { "type": "string" }
      }
    },
    "inputs": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path"],
        "properties": {
          "path": { "type": "string" },
          "sha256": { "type": "string" }
        }
      }
    },
    "outputs": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "operation"],
        "properties": {
          "path": { "type": "string" },
          "operation": { "type": "string", "enum": ["created", "updated", "deleted", "unchanged"] }
        }
      }
    },
    "diagnostics": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["severity", "path", "message"],
        "properties": {
          "severity": { "type": "string", "enum": ["info", "warning", "error"] },
          "path": { "type": "string" },
          "message": { "type": "string" }
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "required": { "type": "boolean" },
        "reason": { "type": "string" }
      }
    }
  }
}
