{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Loop Engineering Handbook - prompt-library catalog",
  "type": "object",
  "required": ["version", "count", "categories", "primitives", "cards"],
  "additionalProperties": false,
  "properties": {
    "version": { "type": "integer", "minimum": 1 },
    "generated_from": { "type": "string" },
    "count": { "type": "integer", "minimum": 1 },
    "categories": { "type": "array", "items": { "type": "string" } },
    "primitives": { "type": "array", "items": { "type": "string" } },
    "cards": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "title", "category", "primitive", "use_when", "verify", "tags", "path"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "title": { "type": "string", "minLength": 1 },
          "category": { "enum": ["engineering", "operations", "content", "research", "data"] },
          "primitive": { "enum": ["/goal", "/loop", "routine"] },
          "use_when": { "type": "string", "minLength": 1 },
          "verify": { "type": "string", "minLength": 1 },
          "tags": { "type": "array", "minItems": 1, "items": { "type": "string" } },
          "path": { "type": "string", "pattern": "^library/loops/" },
          "example": { "type": "string" }
        }
      }
    }
  }
}
