{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://chenxs.me/works/agent-directory/agent.schema.json",
  "title": "chenxs.me Agent Directory Entry",
  "description": "A single audited agent entry for the chenxs.me Agent 黄页 registry. Submitted strings must be NFC-normalized and must not contain control, bidi, invisible Unicode, or raw HTML angle brackets; the CI validator enforces those security rules beyond this schema.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "code",
    "name",
    "initials",
    "tone",
    "category",
    "status",
    "summary",
    "description",
    "links",
    "skills",
    "emailSubject"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
      "minLength": 3,
      "maxLength": 64
    },
    "code": {
      "type": "string",
      "pattern": "^(R|I|L|W|D|A|S|M|C)-[0-9]{3}$|^OPEN$",
      "maxLength": 12
    },
    "name": {
      "type": "string",
      "minLength": 2,
      "maxLength": 64
    },
    "initials": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4
    },
    "tone": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$"
    },
    "category": {
      "type": "string",
      "enum": ["research", "investing", "life", "writing", "design", "automation", "social", "media", "code", "wanted"]
    },
    "status": {
      "type": "string",
      "enum": ["tested", "installed", "watching", "wanted"]
    },
    "summary": {
      "type": "string",
      "minLength": 8,
      "maxLength": 96
    },
    "description": {
      "type": "string",
      "minLength": 24,
      "maxLength": 360
    },
    "links": {
      "type": "array",
      "minItems": 1,
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["label", "url"],
        "properties": {
          "label": { "type": "string", "minLength": 2, "maxLength": 40 },
          "url": {
            "type": "string",
            "pattern": "^(https://|mailto:[^?@\\s]+@[^?@\\s]+\\.[^?@\\s]+$|/(?!/).*)",
            "maxLength": 240
          }
        }
      }
    },
    "skills": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "detail"],
        "properties": {
          "name": { "type": "string", "minLength": 2, "maxLength": 64 },
          "detail": { "type": "string", "minLength": 8, "maxLength": 180 }
        }
      }
    },
    "emailSubject": {
      "type": "string",
      "minLength": 3,
      "maxLength": 80
    }
  }
}
