{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "agent-v3-schema",
  "title": "AIOX Agent V3 Schema",
  "description": "Schema for AIOX agent definitions with Auto-Claude patterns",
  "type": "object",
  "required": ["agent", "persona", "commands", "dependencies", "autoClaude"],
  "properties": {
    "IDE-FILE-RESOLUTION": {
      "type": "array",
      "description": "Instructions for resolving file paths in IDE environments"
    },
    "REQUEST-RESOLUTION": {
      "type": "string",
      "description": "How to match user requests to commands"
    },
    "activation-instructions": {
      "type": "array",
      "description": "Steps to execute when agent is activated"
    },
    "agent": {
      "type": "object",
      "required": ["name", "id", "title", "icon"],
      "properties": {
        "name": { "type": "string", "description": "Agent persona name (e.g., Dex, Quinn)" },
        "id": { "type": "string", "description": "Agent identifier (e.g., dev, qa)" },
        "title": { "type": "string", "description": "Agent role title" },
        "icon": { "type": "string", "description": "Emoji icon for agent" },
        "whenToUse": { "type": "string", "description": "When to use this agent" },
        "customization": { "type": ["object", "null"], "description": "Custom overrides" }
      }
    },
    "persona_profile": {
      "type": "object",
      "properties": {
        "archetype": { "type": "string" },
        "zodiac": { "type": "string" },
        "communication": {
          "type": "object",
          "properties": {
            "tone": { "type": "string" },
            "emoji_frequency": { "type": "string", "enum": ["minimal", "low", "medium", "high"] },
            "vocabulary": { "type": "array", "items": { "type": "string" } },
            "greeting_levels": { "type": "object" },
            "signature_closing": { "type": "string" }
          }
        }
      }
    },
    "persona": {
      "type": "object",
      "properties": {
        "role": { "type": "string" },
        "style": { "type": "string" },
        "identity": { "type": "string" },
        "focus": { "type": "string" },
        "core_principles": { "type": "array", "items": { "type": "string" } }
      }
    },
    "commands": {
      "type": "array",
      "description": "Available commands for this agent",
      "items": {
        "oneOf": [
          { "type": "object" },
          { "type": "string" }
        ]
      }
    },
    "dependencies": {
      "type": "object",
      "properties": {
        "tasks": { "type": "array", "items": { "type": "string" } },
        "templates": { "type": "array", "items": { "type": "string" } },
        "checklists": { "type": "array", "items": { "type": "string" } },
        "workflows": { "type": "array", "items": { "type": "string" } },
        "scripts": { "type": "array", "items": { "type": "string" } },
        "data": { "type": "array", "items": { "type": "string" } },
        "tools": { "type": "array", "items": { "type": "string" } },
        "utils": { "type": "array", "items": { "type": "string" } }
      }
    },
    "autoClaude": {
      "type": "object",
      "required": ["version"],
      "description": "Auto-Claude V3 configuration",
      "properties": {
        "version": { "type": "string", "const": "3.0" },
        "migratedAt": { "type": "string", "format": "date-time" },
        "specPipeline": {
          "type": "object",
          "description": "Spec Pipeline capabilities (Epic 3)",
          "properties": {
            "canGather": { "type": "boolean", "description": "@pm - gather requirements" },
            "canAssess": { "type": "boolean", "description": "@architect - assess complexity" },
            "canResearch": { "type": "boolean", "description": "@analyst - research dependencies" },
            "canWrite": { "type": "boolean", "description": "@pm - write spec" },
            "canCritique": { "type": "boolean", "description": "@qa - critique spec" }
          }
        },
        "execution": {
          "type": "object",
          "description": "Execution Engine capabilities (Epic 4)",
          "properties": {
            "canCreatePlan": { "type": "boolean", "description": "@architect - create implementation plan" },
            "canCreateContext": { "type": "boolean", "description": "@architect - create project context" },
            "canExecute": { "type": "boolean", "description": "@dev - execute subtasks" },
            "canVerify": { "type": "boolean", "description": "@dev, @qa - verify subtasks" },
            "selfCritique": {
              "type": "object",
              "properties": {
                "enabled": { "type": "boolean" },
                "checklistRef": { "type": "string" }
              }
            }
          }
        },
        "recovery": {
          "type": "object",
          "description": "Recovery System capabilities (Epic 5)",
          "properties": {
            "canTrack": { "type": "boolean", "description": "@dev - track attempts" },
            "canRollback": { "type": "boolean", "description": "@dev - rollback changes" },
            "maxAttempts": { "type": "integer", "default": 3 },
            "stuckDetection": { "type": "boolean" }
          }
        },
        "qa": {
          "type": "object",
          "description": "QA capabilities (Epic 6)",
          "properties": {
            "canReview": { "type": "boolean" },
            "canFixRequest": { "type": "boolean" },
            "reviewPhases": { "type": "integer" },
            "maxIterations": { "type": "integer" }
          }
        },
        "worktree": {
          "type": "object",
          "description": "Worktree capabilities (Epic 1)",
          "properties": {
            "canCreate": { "type": "boolean" },
            "canMerge": { "type": "boolean" },
            "canCleanup": { "type": "boolean" }
          }
        },
        "memory": {
          "type": "object",
          "description": "Memory/Learning capabilities",
          "properties": {
            "canCaptureInsights": { "type": "boolean" },
            "canExtractPatterns": { "type": "boolean" },
            "canDocumentGotchas": { "type": "boolean" }
          }
        }
      }
    }
  }
}
