{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oshun.dev/schemas/audit/eve-sota-gap-task-evidence-exit.v1.json",
  "title": "Eve SOTA gap to task to evidence to exit matrix",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "initiativeId",
    "generatedOn",
    "source",
    "gaps",
    "proofScopes",
    "matrixRows",
    "limitations"
  ],
  "properties": {
    "schemaVersion": {
      "const": "eve-sota-gap-task-evidence-exit.v2"
    },
    "initiativeId": {
      "const": "eve-sota-gap-closure-2026-09-01"
    },
    "generatedOn": {
      "const": "2026-09-01"
    },
    "source": {
      "$ref": "#/$defs/source"
    },
    "gaps": {
      "type": "array",
      "minItems": 18,
      "maxItems": 18,
      "items": {
        "$ref": "#/$defs/gap"
      }
    },
    "proofScopes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/proofScope"
      }
    },
    "matrixRows": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/matrixRow"
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    }
  },
  "$defs": {
    "taskId": {
      "type": "string",
      "pattern": "^(?:0|[1-9][0-9]*)\\.[1-9][0-9]*$"
    },
    "gapId": {
      "type": "string",
      "pattern": "^G(?:[1-9]|1[0-8])$"
    },
    "proofScopeId": {
      "enum": [
        "source-inspection",
        "static-contract",
        "automated-behavior",
        "service-integration",
        "persistence-recovery",
        "authorization-isolation",
        "real-model-provider",
        "real-agent-runtime",
        "real-database",
        "real-vector-store",
        "real-browser-ui",
        "native-desktop-runtime",
        "mobile-runtime",
        "real-dcc-runtime",
        "real-engine-runtime",
        "external-channel-runtime",
        "real-multimodal-runtime",
        "protocol-interop",
        "host-capability-observation",
        "operational-load-soak",
        "fault-recovery",
        "security-adversarial",
        "privacy-data-rights",
        "performance-quality",
        "governance-decision",
        "human-outcomes",
        "manual-assistive-tech",
        "independent-verification",
        "docs-render-integrity"
      ]
    },
    "evidenceClassId": {
      "enum": [
        "source-review",
        "automated-static",
        "automated-test",
        "service-integration",
        "live-runtime",
        "operational-exercise",
        "security-exercise",
        "measurement",
        "governance-review",
        "human-review",
        "independent-verification"
      ]
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "ledger", "taskRequirementsSha256"],
      "properties": {
        "repository": {
          "const": "GreyChimp/oshun"
        },
        "ledger": {
          "const": "EVE_SOTA_GAP_CLOSURE_TODOS_2026-09-01.md"
        },
        "taskRequirementsSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "title": "The ledger this matrix was derived from, bound by requirement"
    },
    "gap": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "statement"],
      "properties": {
        "id": {
          "$ref": "#/$defs/gapId"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "proofScope": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "boundary", "requiredEvidenceClassRefs", "description"],
      "properties": {
        "id": {
          "$ref": "#/$defs/proofScopeId"
        },
        "boundary": {
          "type": "string",
          "minLength": 1
        },
        "requiredEvidenceClassRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/evidenceClassId"
          }
        },
        "description": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "matrixRow": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ownerTaskId",
        "phaseId",
        "closureState",
        "requirement",
        "gapRefs",
        "dependencyTaskIds",
        "requiredProofScopeRefs",
        "evidencePlan",
        "exitCriterion",
        "dependencyRationales"
      ],
      "properties": {
        "ownerTaskId": {
          "$ref": "#/$defs/taskId"
        },
        "phaseId": {
          "type": "string",
          "pattern": "^(?:0|[1-9][0-9]*)$"
        },
        "closureState": {
          "enum": ["open", "completed"]
        },
        "requirement": {
          "type": "string",
          "minLength": 1
        },
        "gapRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/gapId"
          }
        },
        "dependencyTaskIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/taskId"
          }
        },
        "requiredProofScopeRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/proofScopeId"
          }
        },
        "evidencePlan": {
          "$ref": "#/$defs/evidencePlan"
        },
        "exitCriterion": {
          "type": "string",
          "minLength": 1
        },
        "dependencyRationales": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 40
          }
        }
      }
    },
    "evidencePlan": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "state",
        "proofScopeRefs",
        "evidenceClassRefs",
        "artifactLocators",
        "requiredManifestPattern",
        "limitation"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^evidence-[0-9]+-[0-9]+$"
        },
        "state": {
          "enum": ["planned", "available-direct"]
        },
        "proofScopeRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/proofScopeId"
          }
        },
        "evidenceClassRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/evidenceClassId"
          }
        },
        "artifactLocators": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "requiredManifestPattern": {
          "type": "string",
          "pattern": "^docs/audits/eve-sota-evidence/phase-[0-9]+/task-[0-9]+-[0-9]+\\.json$"
        },
        "limitation": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
