{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/BourbonDog/amicus/main/schemas/error.schema.json",
  "title": "amicus error document",
  "description": "Structured failure envelope: every pre-flight/validation/route failure under --json (stdout) and every MCP error tool-text.",
  "type": "object",
  "required": ["schemaVersion", "type", "ok", "error"],
  "properties": {
    "schemaVersion": { "const": 2 },
    "type": { "const": "error" },
    "ok": { "const": false },
    "error": {
      "type": "object",
      "required": ["code", "message"],
      "properties": {
        "code": { "enum": ["BAD_ARGS", "MISSING_PROMPT", "BAD_MODEL", "MISSING_KEY", "BAD_SESSION", "BUDGET_EXCEEDED", "INTERNAL", "COUNCIL_QUORUM", "COST_EXCEEDED", "COUNCIL_CLAUDE_REVIEW_INVALID", "TEMPLATE_NOT_FOUND", "TEMPLATE_RENDER", "PACK_NOT_FOUND", "PACK_INVALID", "PACK_KIND_MISMATCH"] },
        "message": { "type": "string" },
        "hint": { "type": ["string", "null"] },
        "command": { "type": ["string", "null"] }
      }
    }
  }
}
