{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.runlocalai.co/schemas/runlocalai-model-intelligence-snapshot-v1.json",
  "title": "RunLocalAI Model Intelligence Snapshot v1",
  "type": "object",
  "required": [
    "schema_version",
    "schema_url",
    "output_hash_sha256",
    "generated_at",
    "generated_by",
    "scope",
    "license",
    "attribution",
    "not_local_measurement",
    "framework_note",
    "sources",
    "normalization",
    "models",
    "meta"
  ],
  "properties": {
    "schema_version": {
      "const": "runlocalai-model-intelligence-snapshot-v1"
    },
    "schema_url": {
      "type": "string"
    },
    "output_hash_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "generated_by": {
      "type": "string"
    },
    "scope": {
      "const": "model-intelligence-priors"
    },
    "license": {
      "type": "string"
    },
    "attribution": {
      "type": "string"
    },
    "not_local_measurement": {
      "const": true
    },
    "framework_note": {
      "type": "string"
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source"
      }
    },
    "normalization": {
      "type": "object",
      "required": ["model_matching", "composite", "local_execution_claim"],
      "properties": {
        "model_matching": { "type": "string" },
        "composite": { "type": "string" },
        "local_execution_claim": { "type": "string" }
      }
    },
    "models": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/model"
      }
    },
    "meta": {
      "type": "object",
      "required": [
        "model_count",
        "score_count",
        "source_count",
        "confidence_counts",
        "generated_from"
      ],
      "properties": {
        "model_count": { "type": "integer", "minimum": 0 },
        "score_count": { "type": "integer", "minimum": 0 },
        "source_count": { "type": "integer", "minimum": 0 },
        "confidence_counts": {
          "type": "object",
          "required": ["high", "moderate", "low"],
          "properties": {
            "high": { "type": "integer", "minimum": 0 },
            "moderate": { "type": "integer", "minimum": 0 },
            "low": { "type": "integer", "minimum": 0 }
          }
        },
        "generated_from": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "sourceId": {
      "type": "string",
      "enum": ["openevals", "lmarena", "livebench"]
    },
    "source": {
      "type": "object",
      "required": [
        "source_id",
        "label",
        "source_url",
        "dataset",
        "config",
        "split",
        "license_note",
        "fetched_rows",
        "total_rows_reported",
        "captured_at"
      ],
      "properties": {
        "source_id": { "$ref": "#/$defs/sourceId" },
        "label": { "type": "string" },
        "source_url": { "type": "string" },
        "dataset": { "type": "string" },
        "config": { "type": "string" },
        "split": { "type": "string" },
        "license_note": { "type": "string" },
        "fetched_rows": { "type": "integer", "minimum": 0 },
        "total_rows_reported": { "type": "integer", "minimum": 0 },
        "sampling_note": { "type": "string" },
        "captured_at": { "type": "string", "format": "date-time" }
      }
    },
    "model": {
      "type": "object",
      "required": [
        "model_key",
        "display_name",
        "provider",
        "aliases",
        "openness",
        "license",
        "parameter_billions",
        "context_window",
        "modalities",
        "source_ids",
        "composite",
        "scores"
      ],
      "properties": {
        "model_key": { "type": "string" },
        "display_name": { "type": "string" },
        "provider": { "type": ["string", "null"] },
        "aliases": { "type": "array", "items": { "type": "string" } },
        "openness": { "type": ["string", "null"] },
        "license": { "type": ["string", "null"] },
        "parameter_billions": { "type": ["number", "null"] },
        "context_window": { "type": ["number", "null"] },
        "modalities": { "type": "array", "items": { "type": "string" } },
        "source_ids": { "type": "array", "items": { "$ref": "#/$defs/sourceId" } },
        "composite": { "$ref": "#/$defs/composite" },
        "scores": { "type": "array", "items": { "$ref": "#/$defs/score" } }
      }
    },
    "composite": {
      "type": "object",
      "required": [
        "score_0_100",
        "confidence",
        "components",
        "derived_from",
        "limitations"
      ],
      "properties": {
        "score_0_100": { "type": ["number", "null"], "minimum": 0, "maximum": 100 },
        "confidence": { "type": "string", "enum": ["high", "moderate", "low"] },
        "components": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["source_id", "metric", "normalized_0_100", "weight"],
            "properties": {
              "source_id": { "$ref": "#/$defs/sourceId" },
              "metric": { "type": "string" },
              "normalized_0_100": { "type": "number", "minimum": 0, "maximum": 100 },
              "weight": { "type": "number", "minimum": 0 }
            }
          }
        },
        "derived_from": { "type": "array", "items": { "type": "string" } },
        "limitations": { "type": "array", "items": { "type": "string" } }
      }
    },
    "score": {
      "type": "object",
      "required": [
        "source_id",
        "metric",
        "value",
        "normalized_0_100",
        "scale",
        "confidence",
        "source_url",
        "source_dataset",
        "source_config",
        "source_split",
        "source_row_count",
        "captured_at",
        "evidence_note"
      ],
      "properties": {
        "source_id": { "$ref": "#/$defs/sourceId" },
        "metric": { "type": "string" },
        "value": { "type": "number" },
        "normalized_0_100": { "type": ["number", "null"], "minimum": 0, "maximum": 100 },
        "scale": { "type": "string" },
        "confidence": { "const": "sourced" },
        "source_url": { "type": "string" },
        "source_dataset": { "type": "string" },
        "source_config": { "type": "string" },
        "source_split": { "type": "string" },
        "source_row_count": { "type": "integer", "minimum": 0 },
        "rank": { "type": ["number", "null"] },
        "lower": { "type": ["number", "null"] },
        "upper": { "type": ["number", "null"] },
        "category": { "type": ["string", "null"] },
        "task": { "type": ["string", "null"] },
        "captured_at": { "type": "string", "format": "date-time" },
        "evidence_note": { "type": "string" }
      }
    }
  }
}
