{
  "$id": "https://context-guard.local/schemas/receipt-capability-record-v1.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "artifact_type": {
      "enum": [
        "raw_evidence_bytes",
        "blueprint_whole_bytes",
        "blueprint_item_bytes",
        "tool_schema_set_bytes",
        "tool_schema_bytes",
        "command_capture_bytes"
      ],
      "type": "string"
    },
    "byte_length": {"maximum": 1048576, "minimum": 0, "type": "integer"},
    "capability_lookup_sha256": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "evidence_boundary": {
      "additionalProperties": false,
      "properties": {
        "evidence_class": {"const": "companion_local_receipt_only"},
        "host_request_owned": {"const": false},
        "provider_claim_authority": {"const": false},
        "provider_join_status": {"const": "missing"},
        "runtime_observer_present": {"const": false},
        "schema_version": {"const": "contextguard-receipt-evidence-boundary/v1"},
        "selected_branch": {"const": "S2-UNSUPPORTED"},
        "selected_transport": {"const": "NONE"},
        "stage1_evidence": {"const": false},
        "stage2_evidence": {"const": false}
      },
      "required": [
        "evidence_class",
        "host_request_owned",
        "provider_claim_authority",
        "provider_join_status",
        "runtime_observer_present",
        "schema_version",
        "selected_branch",
        "selected_transport",
        "stage1_evidence",
        "stage2_evidence"
      ],
      "type": "object"
    },
    "integrity_hmac_sha256": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "namespace_id": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "payload_sha256": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "root_identity_sha256": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "schema_version": {"const": "contextguard-receipt-capability-record/v1"},
    "subject_identity_sha256": {
      "maxLength": 64,
      "minLength": 64,
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    }
  },
  "required": [
    "artifact_type",
    "byte_length",
    "capability_lookup_sha256",
    "evidence_boundary",
    "integrity_hmac_sha256",
    "namespace_id",
    "payload_sha256",
    "root_identity_sha256",
    "schema_version",
    "subject_identity_sha256"
  ],
  "title": "Context Guard Receipt capability record",
  "type": "object"
}
