{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://local.pi/extensions/pi-subagent/overrides.schema.json",
  "title": "Pi subagent replacement overrides",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "$schema": { "type": "string" },
    "defaults": {
      "$ref": "#/$defs/agentOverride",
      "description": "Extension-owned default child runtime policy. model/thinking/fallbackModels are ignored here so this cannot become Pi model settings v2. Missing per-agent model/thinking inherits the parent Pi session."
    },
    "agentOverrides": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/agentOverride"
      }
    }
  },
  "$defs": {
    "turnBudget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "maxTurns": { "type": "integer", "minimum": 1 },
        "graceTurns": { "type": "integer", "minimum": 0 }
      },
      "required": ["maxTurns"]
    },
    "agentOverride": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "model": { "type": "string", "minLength": 1, "description": "Per-agent model pin. Omit to inherit the parent Pi session model." },
        "fallbackModels": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "thinking": { "type": "string", "minLength": 1, "description": "Per-agent thinking pin. Omit to inherit the parent Pi session thinking level." },
        "tools": {
          "type": "array",
          "description": "Pi child tool allowlist. This replaces/ignores Claude-agent markdown tools; use Pi registered tool names only.",
          "items": { "type": "string", "minLength": 1 }
        },
        "defaultContext": { "enum": ["fresh", "fork"] },
        "timeoutMs": { "type": "integer", "minimum": 1 },
        "turnBudget": { "$ref": "#/$defs/turnBudget" },
        "maxSubagentDepth": { "type": "integer", "minimum": 1 },
        "systemPrompt": { "type": "string" },
        "systemPromptMode": { "enum": ["append", "replace"] },
        "description": { "type": "string" },
        "extensions": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "subagentOnlyExtensions": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "skills": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "inheritProjectContext": { "type": "boolean" },
        "inheritSkills": { "type": "boolean" },
        "acceptance": {
          "oneOf": [
            { "type": "string" },
            {
              "type": "array",
              "items": { "type": "string", "minLength": 1 }
            }
          ]
        },
        "acceptanceRole": { "type": "string" },
        "completionGuard": { "type": "boolean" },
        "interactive": { "type": "boolean" },
        "memory": { "type": "string" },
        "output": { "type": "string" },
        "defaultReads": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "defaultProgress": { "type": "string" },
        "toolBudget": { "type": "integer", "minimum": 1 },
        "async": { "type": "boolean" },
        "disabled": { "type": "boolean" },
        "unset": {
          "type": "array",
          "description": "Remove inherited properties from lower-precedence policy layers.",
          "uniqueItems": true,
          "items": {
            "enum": [
              "model", "fallbackModels", "thinking", "tools", "defaultContext", "timeoutMs", "turnBudget", "maxSubagentDepth",
              "systemPrompt", "systemPromptMode", "description", "extensions", "subagentOnlyExtensions", "skills", "inheritProjectContext",
              "inheritSkills", "acceptance", "acceptanceRole", "completionGuard", "interactive", "memory", "output", "defaultReads",
              "defaultProgress", "toolBudget", "async", "disabled"
            ]
          }
        }
      }
    }
  }
}
