{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dnncha.github.io/dotmatch/agent-capabilities.schema.json",
  "title": "DotMatch agent capability manifest",
  "description": "Machine-readable task routing for DotMatch known-target sequencing workflows.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema_version",
    "generated_for_version",
    "project",
    "scope",
    "install",
    "outcomes",
    "intents",
    "error_recovery",
    "interfaces"
  ],
  "properties": {
    "$schema": {"type": "string", "format": "uri"},
    "schema_version": {"type": "string", "const": "1.1"},
    "generated_for_version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+"},
    "project": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "package", "repository", "documentation", "homepage", "license"],
      "properties": {
        "name": {"const": "DotMatch"},
        "package": {"const": "dotmatch"},
        "repository": {"type": "string", "format": "uri"},
        "documentation": {"type": "string", "format": "uri"},
        "homepage": {"type": "string", "format": "uri"},
        "license": {"const": "Apache-2.0"}
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": ["summary", "requires", "does_not_do"],
      "properties": {
        "summary": {"type": "string", "minLength": 20},
        "requires": {"type": "array", "minItems": 2, "items": {"type": "string", "minLength": 3}},
        "does_not_do": {"type": "array", "minItems": 5, "items": {"type": "string", "minLength": 3}}
      }
    },
    "install": {
      "type": "object",
      "additionalProperties": false,
      "required": ["recommended", "verify", "platforms", "limitations"],
      "properties": {
        "recommended": {"type": "string", "pattern": "^python3 -m pip install dotmatch"},
        "verify": {"const": "dotmatch --version"},
        "platforms": {"type": "array", "minItems": 2, "items": {"type": "string"}},
        "limitations": {"type": "array", "minItems": 1, "items": {"type": "string"}}
      }
    },
    "outcomes": {
      "type": "object",
      "additionalProperties": false,
      "required": ["unique", "ambiguous", "none", "invalid"],
      "properties": {
        "unique": {"type": "string"},
        "ambiguous": {"type": "string"},
        "none": {"type": "string"},
        "invalid": {"type": "string"}
      }
    },
    "intents": {
      "type": "array",
      "minItems": 5,
      "items": {"$ref": "#/$defs/intent"}
    },
    "error_recovery": {
      "type": "array",
      "minItems": 3,
      "items": {"$ref": "#/$defs/recovery"}
    },
    "interfaces": {
      "type": "object",
      "additionalProperties": false,
      "required": ["human_help", "machine_help", "manifest", "schema", "llms", "llms_full"],
      "properties": {
        "human_help": {"const": "dotmatch --help"},
        "machine_help": {"const": "dotmatch capabilities --json"},
        "manifest": {"type": "string", "format": "uri"},
        "schema": {"type": "string", "format": "uri"},
        "llms": {"type": "string", "format": "uri"},
        "llms_full": {"type": "string", "format": "uri"},
        "agent_tools": {"type": "string", "format": "uri"},
        "agent_tools_schema": {"type": "string", "format": "uri"},
        "codex_skill": {"type": "string", "format": "uri"}
      }
    }
  },
  "$defs": {
    "intent": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "task", "queries", "entrypoint", "command", "inputs", "outputs", "limitations", "documentation", "evidence"],
      "properties": {
        "id": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"},
        "task": {"type": "string", "minLength": 5},
        "queries": {"type": "array", "minItems": 2, "items": {"type": "string", "minLength": 3}},
        "entrypoint": {"type": "string", "pattern": "^dotmatch(?: [a-z0-9-]+)+$"},
        "command": {"type": "string", "pattern": "^dotmatch ", "minLength": 20},
        "inputs": {"type": "array", "minItems": 1, "items": {"type": "string"}},
        "outputs": {"type": "array", "minItems": 1, "items": {"type": "string"}},
        "limitations": {"type": "array", "minItems": 1, "items": {"type": "string"}},
        "documentation": {"type": "string", "format": "uri"},
        "evidence": {"type": "array", "minItems": 1, "items": {"type": "string"}}
      }
    },
    "recovery": {
      "type": "object",
      "additionalProperties": false,
      "required": ["symptom", "next_command", "reason"],
      "properties": {
        "symptom": {"type": "string", "minLength": 5},
        "next_command": {"type": "string", "pattern": "^dotmatch ", "minLength": 10},
        "reason": {"type": "string", "minLength": 10}
      }
    }
  }
}
