{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Subagent frontmatter",
  "type": "object",
  "properties": {
    "name": {
      "description": "Display name of the subagent.",
      "type": "string"
    },
    "description": {
      "description": "Short summary of what the subagent does.",
      "type": [
        "string",
        "null"
      ]
    },
    "polytoken": {
      "anyOf": [
        {
          "const": true
        },
        {
          "$ref": "#/$defs/SubagentPolytokenFrontMatter"
        }
      ]
    }
  },
  "required": [
    "name"
  ],
  "$defs": {
    "SubagentPolytokenFrontMatter": {
      "description": "Polytoken-specific subagent controls.",
      "type": "object",
      "properties": {
        "model": {
          "description": "Model this subagent uses, overriding the session default.",
          "type": [
            "string",
            "null"
          ]
        },
        "autonomous_hint": {
          "description": "Hint text Polytoken shows when suggesting this subagent.",
          "type": [
            "string",
            "null"
          ]
        },
        "auto_facet_hint": {
          "description": "Backwards-compatible alias of `autonomous_hint`.",
          "type": [
            "string",
            "null"
          ]
        },
        "fallback_models": {
          "description": "Models Polytoken tries, in order, if the primary model is unavailable.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "tools": {
          "description": "Tools this subagent can use, as tool names or `tag!` groups.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "tools_deny": {
          "description": "Tools to exclude after `tools` expands.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "undeferred_tools": {
          "description": "Tools to always send in full, even under native-deferred tool loading.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "allow_subagent_spawn": {
          "description": "Whether this subagent may spawn its own subagents.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "exit_tool_schema": {
          "description": "Custom schema for the subagent's exit tool, replacing the default."
        },
        "skills_allow": {
          "description": "Skills this subagent can invoke, as skill names or `tag!` groups.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "skills_deny": {
          "description": "Skills to exclude from `skills_allow`.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "inherit_tools": {
          "description": "Whether this subagent inherits the caller's tools instead of using\n`tools`.",
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    }
  }
}
