{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mnemom-ai/json-schema/mnemom-ai-integrity-certificate-schema.json",
  "title": "IntegrityCertificate",
  "description": "Machine-readable cryptographic certificate for an integrity checkpoint. Modeled on C2PA content credentials and W3C Verifiable Credentials.",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mnemom-ai-openapi.json#/components/schemas/IntegrityCertificate",
  "type": "object",
  "properties": {
    "redacted": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Present only when the caller is outside the agent's org: the listed fields (session_id, card_id, concerns, confidence, reasoning_summary, analysis_model, analysis_duration_ms, model_version) are blanked, emptied or omitted. No verifier reads them, so the certificate still verifies."
    },
    "@context": {
      "type": "string",
      "description": "Namespace identifier",
      "enum": [
        "https://mnemom.ai/aip/v1"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "IntegrityCertificate"
      ]
    },
    "version": {
      "type": "string",
      "description": "Certificate format version"
    },
    "certificate_id": {
      "type": "string",
      "description": "Unique certificate identifier (cert-{8 random chars})"
    },
    "issued_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of certificate issuance"
    },
    "subject": {
      "type": "object",
      "description": "Identifies the checkpoint this certificate attests to",
      "properties": {
        "checkpoint_id": {
          "type": "string",
          "description": "Integrity checkpoint ID (ic-{uuid})"
        },
        "agent_id": {
          "type": "string"
        },
        "session_id": {
          "type": "string"
        },
        "card_id": {
          "type": "string"
        }
      },
      "required": [
        "checkpoint_id",
        "agent_id",
        "session_id",
        "card_id"
      ]
    },
    "claims": {
      "type": "object",
      "description": "Analysis verdict and supporting evidence",
      "properties": {
        "verdict": {
          "type": "string",
          "enum": [
            "clear",
            "review_needed",
            "boundary_violation",
            "unverified",
            "unanalyzed"
          ]
        },
        "concerns": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "category": {
                "type": "string"
              },
              "severity": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            }
          }
        },
        "confidence": {
          "type": "number",
          "description": "Extraction confidence (0.0-1.0)"
        },
        "reasoning_summary": {
          "type": "string"
        },
        "analysis_model": {
          "type": "string"
        },
        "analysis_duration_ms": {
          "type": "number"
        }
      }
    },
    "input_commitments": {
      "type": "object",
      "description": "Cryptographic commitments to analysis inputs",
      "properties": {
        "thinking_block_hash": {
          "type": "string",
          "description": "SHA-256 hash of the thinking block"
        },
        "card_hash": {
          "type": "string",
          "description": "SHA-256 hash of the Alignment Card"
        },
        "values_hash": {
          "type": "string",
          "description": "SHA-256 hash of conscience values"
        },
        "context_hash": {
          "type": "string",
          "description": "SHA-256 hash of window context"
        },
        "model_version": {
          "type": "string"
        },
        "combined_commitment": {
          "type": "string",
          "description": "SHA-256 of all input fields concatenated"
        }
      }
    },
    "proofs": {
      "type": "object",
      "description": "Cryptographic evidence supporting the claims",
      "properties": {
        "signature": {
          "type": "object",
          "properties": {
            "algorithm": {
              "type": "string",
              "enum": [
                "Ed25519"
              ]
            },
            "key_id": {
              "type": "string"
            },
            "value": {
              "type": "string",
              "description": "Base64-encoded Ed25519 signature"
            },
            "signed_payload": {
              "type": "string",
              "description": "Deterministic JSON string that was signed"
            }
          }
        },
        "chain": {
          "type": "object",
          "properties": {
            "chain_hash": {
              "type": "string"
            },
            "prev_chain_hash": {
              "type": [
                "string",
                "null"
              ]
            },
            "position": {
              "type": "integer"
            }
          }
        },
        "merkle": {
          "type": [
            "object",
            "null"
          ],
          "description": "Merkle inclusion proof. Null if not yet added to tree.",
          "properties": {
            "leaf_hash": {
              "type": "string"
            },
            "leaf_index": {
              "type": "integer"
            },
            "root": {
              "type": "string"
            },
            "tree_size": {
              "type": "integer"
            },
            "inclusion_proof": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "hash": {
                    "type": "string"
                  },
                  "position": {
                    "type": "string",
                    "enum": [
                      "left",
                      "right"
                    ]
                  }
                }
              }
            }
          }
        },
        "verdict_derivation": {
          "type": [
            "object",
            "null"
          ],
          "description": "SP1 STARK proof. Null if not yet proven.",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "SP1-STARK"
              ]
            },
            "image_id": {
              "type": "string",
              "description": "SP1 verifying-key hash of the guest program: 64 lowercase hex characters, no `0x` prefix. `GET /v1/checkpoints/{checkpoint_id}/certificate` returns this form. `POST /v1/verify` also accepts the legacy 132-character form (hex of `0x` plus the 64-character hash, beginning `3078`) found in certificates saved before MNE-8833. To convert it, hex-decode once and drop the leading `0x`."
            },
            "receipt": {
              "type": "string",
              "description": "Base64-encoded STARK proof receipt"
            },
            "journal": {
              "type": "string",
              "description": "Base64-encoded public journal"
            },
            "verified_at": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "description": "URLs for independent verification",
      "properties": {
        "keys_url": {
          "type": "string",
          "format": "uri"
        },
        "certificate_url": {
          "type": "string",
          "format": "uri"
        },
        "verify_url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  },
  "required": [
    "@context",
    "type",
    "version",
    "certificate_id",
    "issued_at",
    "subject",
    "claims",
    "input_commitments",
    "proofs",
    "verification"
  ]
}