{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://humbleteam.local/humbleagents/knowledge-catalog.schema.json",
  "title": "humbleagents knowledge catalog",
  "type": "object",
  "required": ["schemaVersion", "entries"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "const": "1.0.0" },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "type", "tags", "estimatedTokens", "source", "version", "authority", "recommendedAgents", "discoveryOnly"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^reference\\.[a-z0-9][a-z0-9._-]*$" },
          "type": { "type": "string", "minLength": 1 },
          "tags": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" } },
          "estimatedTokens": { "type": "integer", "minimum": 1 },
          "source": {
            "type": "object",
            "required": ["path", "sha256", "origin", "derivation", "provenanceIds"],
            "additionalProperties": false,
            "properties": {
              "path": { "type": "string", "pattern": "^knowledgebase/knowledge/references/" },
              "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "origin": { "enum": ["humbleagents", "third-party", "mixed"] },
              "derivation": { "enum": ["native", "adapted", "copied"] },
              "provenanceIds": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" }
              }
            }
          },
          "version": { "type": "string", "minLength": 1 },
          "authority": { "enum": ["trusted-reference", "quality-gate", "implementation-reference"] },
          "recommendedAgents": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
          "discoveryOnly": { "type": "boolean" }
        }
      }
    }
  }
}
