{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kolm.ai/docs/manifest-v0.1.json",
  "title": "kolm manifest",
  "description": "Identity card for a .kolm artifact. Part of RS-1 (https://kolm.ai/docs/rs-1.md).",
  "type": "object",
  "required": ["spec", "schema", "task", "compiled_at", "base_model", "recipe_registry", "k_score", "compiler"],
  "additionalProperties": false,
  "properties": {
    "spec": {
      "const": "rs-1",
      "description": "Artifact contract. Immutable. A breaking change creates rs-2."
    },
    "schema": {
      "const": "manifest-v0.1",
      "description": "Manifest document version. Bumps independently of spec."
    },
    "task": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Free-text task description, e.g. \"classify support tickets\"."
    },
    "compiled_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 UTC timestamp. Compilers SHOULD round to the second."
    },
    "base_model": {
      "type": "object",
      "required": ["name", "sha256"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "description": "Resolvable model name (e.g. a Hugging Face id or a registry-pinned alias)."
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "description": "SHA-256 of the canonical base-model bytes the compiler used."
        }
      }
    },
    "recipe_registry": {
      "type": "object",
      "required": ["version", "url"],
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "string",
          "description": "Pinned snapshot id, e.g. \"2026-05-01\"."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Where to re-fetch the registry snapshot."
        }
      }
    },
    "lora": {
      "type": ["object", "null"],
      "required": ["sha256", "rank"],
      "additionalProperties": false,
      "properties": {
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "rank": { "type": "integer", "minimum": 1, "maximum": 256 },
        "size_bytes": { "type": "integer", "minimum": 0 }
      },
      "description": "Present iff lora.bin is present in the archive."
    },
    "recall": {
      "type": ["object", "null"],
      "required": ["embedder", "vectors"],
      "additionalProperties": false,
      "properties": {
        "embedder": { "type": "string" },
        "vectors": { "type": "integer", "minimum": 0 },
        "namespace": { "type": "string" }
      }
    },
    "k_score": {
      "type": "object",
      "required": ["spec", "composite", "accuracy", "coverage", "size_bytes", "p50_latency_us"],
      "additionalProperties": false,
      "properties": {
        "spec": { "const": "k-score-1" },
        "composite": { "type": "number", "minimum": 0, "maximum": 1 },
        "accuracy": { "type": "number", "minimum": 0, "maximum": 1 },
        "coverage": { "type": "number", "minimum": 0, "maximum": 1 },
        "size_bytes": { "type": "integer", "minimum": 0 },
        "p50_latency_us": { "type": "integer", "minimum": 0 },
        "p95_latency_us": { "type": "integer", "minimum": 0 },
        "cost_usd_per_call": { "type": "number", "minimum": 0 }
      }
    },
    "compiler": {
      "type": "object",
      "required": ["name", "version"],
      "additionalProperties": false,
      "properties": {
        "name": { "const": "kolm" },
        "version": { "type": "string" }
      }
    }
  }
}
