{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kinra.ai/docs/truth-machine/schemas/projection.schema.json",
  "title": "Truth Machine typed current projection",
  "description": "The Kit's current.toml shape: one declared current selection with records, sealed scopes, and exact artifacts. Validated after parsing TOML to an equivalent object.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "declared_at", "workspace", "repository"],
  "properties": {
    "schema_version": {"const": 1},
    "declared_at": {"type": "string", "format": "date-time"},
    "workspace": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "purpose"],
      "properties": {
        "id": {"type": "string", "minLength": 1},
        "purpose": {"type": "string", "minLength": 1},
        "operator_count": {"type": "integer", "minimum": 1},
        "operators": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {"type": "string", "minLength": 1}
        }
      }
    },
    "repository": {
      "type": "object",
      "additionalProperties": false,
      "required": ["canonical_branch", "human_index"],
      "properties": {
        "remote": {"type": "string", "minLength": 1},
        "canonical_branch": {"type": "string", "minLength": 1},
        "remote_ref": {"type": "string", "minLength": 1},
        "human_index": {"type": "string", "minLength": 1}
      }
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "path", "status_marker", "meaning"],
        "properties": {
          "id": {"type": "string", "minLength": 1},
          "path": {"type": "string", "minLength": 1},
          "status_marker": {"type": "string", "pattern": "^\\*\\*Status: "},
          "meaning": {"type": "string", "minLength": 1}
        }
      }
    },
    "sealed": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["scope", "revision", "reason"],
        "properties": {
          "scope": {"type": "string", "minLength": 1},
          "revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
          "reason": {"type": "string", "minLength": 1}
        }
      }
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "path", "sha256", "meaning"],
        "properties": {
          "id": {"type": "string", "minLength": 1},
          "path": {"type": "string", "minLength": 1},
          "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
          "meaning": {"type": "string", "minLength": 1}
        }
      }
    }
  }
}
