{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oshun.dev/schemas/audit/eve-sota-evidence-manifest.v2.json",
  "title": "Eve SOTA gap-closure evidence manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "initiativeId",
    "manifestId",
    "recordedAt",
    "source",
    "phase",
    "claims",
    "executions",
    "negativeControls",
    "artifacts",
    "runtimeProvenance",
    "modelProvenance",
    "gaps",
    "limitations"
  ],
  "properties": {
    "schemaVersion": { "const": "eve-sota-evidence-manifest.v2" },
    "initiativeId": { "const": "eve-sota-gap-closure-2026-09-01" },
    "manifestId": { "$ref": "#/$defs/id" },
    "recordedAt": { "$ref": "#/$defs/dateTime" },
    "source": { "$ref": "#/$defs/source" },
    "phase": { "$ref": "#/$defs/phase" },
    "claims": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/claim" }
    },
    "executions": {
      "type": "array",
      "minItems": 2,
      "items": { "$ref": "#/$defs/execution" }
    },
    "negativeControls": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/negativeControl" }
    },
    "artifacts": {
      "type": "array",
      "items": { "$ref": "#/$defs/artifact" }
    },
    "runtimeProvenance": {
      "type": "array",
      "items": { "$ref": "#/$defs/runtimeProvenance" }
    },
    "modelProvenance": {
      "type": "array",
      "items": { "$ref": "#/$defs/modelProvenance" }
    },
    "gaps": {
      "type": "array",
      "items": { "$ref": "#/$defs/gap" }
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 }
    }
  },
  "$defs": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]*$",
      "minLength": 1
    },
    "nullableId": {
      "type": ["string", "null"],
      "pattern": "^[a-z0-9][a-z0-9.-]*$"
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "dateTime": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$"
    },
    "taskId": {
      "type": "string",
      "pattern": "^(?:0|[1-9][0-9]*)\\.[1-9][0-9]*$"
    },
    "nullableTaskId": {
      "type": ["string", "null"],
      "pattern": "^(?:0|[1-9][0-9]*)\\.[1-9][0-9]*$"
    },
    "stringRefs": {
      "type": "array",
      "items": { "$ref": "#/$defs/id" }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "commit", "ledger"],
      "properties": {
        "repository": { "const": "GreyChimp/oshun" },
        "commit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "implementationCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "evidenceSnapshotCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "ledger": { "const": "EVE_SOTA_GAP_CLOSURE_TODOS_2026-09-01.md" }
      }
    },
    "phase": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "status", "taskIds", "decisionOwner", "closedAt", "closureClaimRefs"],
      "properties": {
        "id": { "type": "string", "pattern": "^(?:0|[1-9][0-9]*)$" },
        "status": { "enum": ["open", "closed"] },
        "taskIds": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/taskId" }
        },
        "decisionOwner": { "type": ["string", "null"] },
        "closedAt": { "type": ["string", "null"], "pattern": "^\\d{4}-\\d{2}-\\d{2}T" },
        "closureClaimRefs": { "$ref": "#/$defs/stringRefs" }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "statement",
        "proofClass",
        "boundary",
        "supportsPhaseClosure",
        "executionRefs",
        "artifactRefs",
        "runtimeProvenanceRefs",
        "modelProvenanceRefs",
        "limitation"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "statement": { "type": "string", "minLength": 1 },
        "proofClass": {
          "enum": [
            "source",
            "unit",
            "integration",
            "contract",
            "e2e",
            "real-provider",
            "engine",
            "live"
          ]
        },
        "boundary": {
          "enum": [
            "repository",
            "logic",
            "service",
            "persistence",
            "authorization",
            "database",
            "browser",
            "desktop",
            "dcc",
            "engine",
            "channel",
            "remote-service",
            "model-provider"
          ]
        },
        "supportsPhaseClosure": { "type": "boolean" },
        "executionRefs": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/id" }
        },
        "artifactRefs": { "$ref": "#/$defs/stringRefs" },
        "runtimeProvenanceRefs": { "$ref": "#/$defs/stringRefs" },
        "modelProvenanceRefs": { "$ref": "#/$defs/stringRefs" },
        "limitation": { "type": "string", "minLength": 1 }
      }
    },
    "command": {
      "type": "object",
      "additionalProperties": false,
      "required": ["executable", "arguments", "workingDirectory", "environmentVariableNames"],
      "properties": {
        "executable": { "type": "string", "minLength": 1 },
        "arguments": {
          "type": "array",
          "items": { "type": "string" }
        },
        "workingDirectory": { "type": "string", "minLength": 1 },
        "environmentVariableNames": {
          "type": "array",
          "items": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" }
        }
      }
    },
    "execution": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "mode",
        "command",
        "startedAt",
        "completedAt",
        "exitCode",
        "expected",
        "observed",
        "artifactRefs",
        "runtimeProvenanceRefs",
        "modelProvenanceRefs"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "kind": {
          "enum": [
            "schema-validation",
            "verification",
            "negative-control",
            "live-probe",
            "measurement"
          ]
        },
        "mode": { "enum": ["static", "controlled", "live"] },
        "command": { "$ref": "#/$defs/command" },
        "startedAt": { "$ref": "#/$defs/dateTime" },
        "completedAt": { "$ref": "#/$defs/dateTime" },
        "exitCode": { "type": "integer" },
        "expected": { "enum": ["pass", "fail"] },
        "observed": { "enum": ["pass", "fail"] },
        "artifactRefs": { "$ref": "#/$defs/stringRefs" },
        "runtimeProvenanceRefs": { "$ref": "#/$defs/stringRefs" },
        "modelProvenanceRefs": { "$ref": "#/$defs/stringRefs" }
      }
    },
    "negativeControl": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "claimRefs",
        "failureExecutionRef",
        "regressionExecutionRef",
        "faultIntroduced",
        "expectedFailure",
        "observedFailure"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "claimRefs": {
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/id" }
        },
        "failureExecutionRef": { "$ref": "#/$defs/id" },
        "regressionExecutionRef": { "$ref": "#/$defs/id" },
        "faultIntroduced": { "type": "string", "minLength": 1 },
        "expectedFailure": { "type": "string", "minLength": 1 },
        "observedFailure": { "type": "string", "minLength": 1 }
      }
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "locator",
        "mediaType",
        "sha256",
        "bytes",
        "retention",
        "generatedByExecutionRef"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "locator": { "type": "string", "minLength": 1 },
        "mediaType": { "type": "string", "minLength": 1 },
        "sha256": { "$ref": "#/$defs/sha256" },
        "bytes": { "type": "integer", "minimum": 0 },
        "retention": { "enum": ["committed", "retained-external", "ephemeral"] },
        "generatedByExecutionRef": { "$ref": "#/$defs/nullableId" }
      }
    },
    "runtimeProvenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "name",
        "version",
        "executionMode",
        "locator",
        "observedAt",
        "verificationExecutionRef",
        "receiptArtifactRef"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "kind": {
          "enum": [
            "host",
            "container",
            "database",
            "browser",
            "desktop",
            "dcc",
            "engine",
            "channel",
            "provider",
            "remote-service"
          ]
        },
        "name": { "type": "string", "minLength": 1 },
        "version": { "type": "string", "minLength": 1 },
        "executionMode": { "enum": ["local", "ci", "staging", "production", "external"] },
        "locator": { "type": "string", "minLength": 1 },
        "observedAt": { "$ref": "#/$defs/dateTime" },
        "verificationExecutionRef": { "$ref": "#/$defs/id" },
        "receiptArtifactRef": { "$ref": "#/$defs/id" }
      }
    },
    "priceSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currency",
        "observedAt",
        "inputUsdPerMillionTokens",
        "outputUsdPerMillionTokens"
      ],
      "properties": {
        "currency": { "const": "USD" },
        "observedAt": { "$ref": "#/$defs/dateTime" },
        "inputUsdPerMillionTokens": { "type": "number", "minimum": 0 },
        "outputUsdPerMillionTokens": { "type": "number", "minimum": 0 }
      }
    },
    "modelProvenance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "provider",
        "modelId",
        "endpoint",
        "quantization",
        "promptSha256",
        "registryDecisionLocator",
        "priceSnapshot",
        "runtimeProvenanceRef",
        "receiptArtifactRef"
      ],
      "properties": {
        "id": { "$ref": "#/$defs/id" },
        "provider": { "type": "string", "minLength": 1 },
        "modelId": { "type": "string", "minLength": 1 },
        "endpoint": { "type": "string", "minLength": 1 },
        "quantization": { "type": "string", "minLength": 1 },
        "promptSha256": { "$ref": "#/$defs/sha256" },
        "registryDecisionLocator": { "type": "string", "minLength": 1 },
        "priceSnapshot": { "$ref": "#/$defs/priceSnapshot" },
        "runtimeProvenanceRef": { "$ref": "#/$defs/id" },
        "receiptArtifactRef": { "$ref": "#/$defs/id" }
      }
    },
    "gap": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "statement",
        "status",
        "external",
        "ownerTaskId",
        "decisionOwner",
        "exactUnblockCondition",
        "evidenceClaimRefs"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^G(?:[1-9]|1[0-8])(?:-[a-z0-9][a-z0-9-]*)?$"
        },
        "statement": { "type": "string", "minLength": 1 },
        "status": { "enum": ["open", "blocked", "accepted", "closed"] },
        "external": { "type": "boolean" },
        "ownerTaskId": { "$ref": "#/$defs/nullableTaskId" },
        "decisionOwner": { "type": ["string", "null"] },
        "exactUnblockCondition": { "type": ["string", "null"] },
        "evidenceClaimRefs": { "$ref": "#/$defs/stringRefs" }
      }
    }
  }
}
