{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://claude-context.dev/schemas/agent.schema.json",
  "title": "Claude Context Agent",
  "description": "Schema for agent manifest files",
  "type": "object",
  "required": ["name", "version", "description"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema reference"
    },
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$",
      "minLength": 1,
      "maxLength": 50,
      "description": "Agent identifier (lowercase, hyphens allowed)"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Agent version (semver)"
    },
    "displayName": {
      "type": "string",
      "maxLength": 100,
      "description": "Human-readable agent name"
    },
    "description": {
      "type": "string",
      "maxLength": 500,
      "description": "Brief description of agent capabilities"
    },
    "author": {
      "type": "string",
      "description": "Agent author"
    },
    "license": {
      "type": "string",
      "description": "SPDX license identifier"
    },
    "keywords": {
      "type": "array",
      "items": { "type": "string" },
      "maxItems": 10,
      "description": "Keywords for agent discovery"
    },
    "category": {
      "type": "string",
      "enum": [
        "initialization",
        "architecture",
        "database",
        "api",
        "integration",
        "deployment",
        "testing",
        "documentation",
        "custom"
      ],
      "description": "Agent category"
    },
    "complexity": {
      "type": "string",
      "enum": ["low", "medium", "high", "very-high"],
      "description": "Task complexity this agent handles"
    },
    "capabilities": {
      "type": "array",
      "items": { "type": "string" },
      "description": "List of capabilities (e.g., diagram-generation, dependency-analysis)"
    },
    "workflows": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Workflows this agent specializes in"
    },
    "commands": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Commands this agent can invoke"
    },
    "dependencies": {
      "type": "object",
      "properties": {
        "agents": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Required agents"
        },
        "commands": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Required commands"
        }
      }
    },
    "config": {
      "type": "object",
      "properties": {
        "context_budget": {
          "type": "string",
          "description": "Typical context usage (e.g., '~50k tokens')"
        },
        "timeout_minutes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 120,
          "description": "Execution timeout in minutes"
        }
      }
    },
    "hooks": {
      "type": "object",
      "properties": {
        "pre_invoke": {
          "type": ["string", "null"],
          "description": "Command to run before agent invocation"
        },
        "post_invoke": {
          "type": ["string", "null"],
          "description": "Command to run after agent completion"
        }
      }
    },
    "examples": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "invocation": { "type": "string" },
          "description": { "type": "string" }
        },
        "required": ["invocation", "description"]
      },
      "description": "Example invocations"
    }
  },
  "additionalProperties": false
}
