{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/sigr-mir-v1.json",
  "title": "SiGR MiR v1, model identity and relineage receipt",
  "description": "Canonical schema for the Hive MiR (Model Identity and Relineage) receipt, canonical type sigr.mir. Binds an ordered sequence of model manifest steps (each a model_id, weights_sha3, config_hash, endpoint) into one Ed25519 signature over a recomputable payload_sha256 and a recomputable lineage_root, and, when expected_model is present, a service computed identity match. MiR asserts identity and lineage continuity only: whether the served model at each step matches what was expected, and whether consecutive steps share continuous lineage. It never asserts that the model's outputs are correct, safe, or fit for any purpose.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_sigr\\.mir_[0-9]{10,}_[0-9a-f]{12}$"
    },
    "payload_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$" },
    "key_id": { "type": "string", "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$" },
    "algorithm": { "type": "string", "const": "Ed25519" },
    "ts": { "type": "integer", "minimum": 1000000000 },
    "signed_body": {
      "type": "object",
      "required": [
        "receipt_type",
        "schema",
        "subject_id",
        "tenant_id",
        "steps",
        "lineage_root",
        "identity_flicker",
        "assertion",
        "checked_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": { "type": "string", "const": "sigr.mir" },
        "schema": { "type": "string", "const": "r1.0.0" },
        "subject_id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "tenant_id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "expected_model": {
          "type": "string",
          "maxLength": 256,
          "description": "Optional. When present, every steps[].model_id must equal this value for identity_flicker to be false."
        },
        "steps": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "object",
            "required": ["seq", "model_id", "weights_sha3", "config_hash", "endpoint"],
            "additionalProperties": false,
            "properties": {
              "seq": { "type": "integer", "minimum": 0, "maximum": 63 },
              "model_id": { "type": "string", "minLength": 1, "maxLength": 256 },
              "weights_sha3": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
              "config_hash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
              "endpoint": { "type": "string", "minLength": 1, "maxLength": 500 }
            }
          }
        },
        "lineage_root": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "sha256 fold of steps in seq order. Recomputed by the verifier; a caller supplied lineage_root that does not match fails LINEAGE_ROOT."
        },
        "identity_flicker": {
          "type": "boolean",
          "description": "Recomputed by the verifier: true when expected_model is present and any step's model_id differs from it, or when any two consecutive steps report different model_id values without an explicit substitution being the point of the receipt. Never accepted as a caller supplied verdict."
        },
        "assertion": {
          "type": "string",
          "const": "served_model_identity_and_lineage"
        },
        "checked_at": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
        },
        "boundary": {
          "type": "string",
          "const": "This receipt attests that lineage_root recomputes exactly from the recorded steps array, and that identity_flicker recomputes exactly from steps and expected_model. It asserts served_model_identity_and_lineage only. It does not assert that any step's outputs are correct, safe, or fit for any purpose, and does not assert that weights_sha3 or config_hash describe a vulnerability free model."
        }
      }
    }
  }
}
