{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aiwg.io/schemas/models/model-config-compatibility.v1.schema.json",
  "title": "AIWG model configuration compatibility input",
  "description": "Accepted project/user inputs during migration from legacy model aliases and max-quality.",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "defaults": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "workerSelection": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "roleGuidance": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/workerRole"
              },
              "propertyNames": {
                "pattern": "^[a-z][a-z0-9-]{0,62}$"
              }
            },
            "guards": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "deniedEfforts": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "minItems": 0,
                  "uniqueItems": true,
                  "default": [
                    "ultra"
                  ]
                },
                "deniedModels": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "minItems": 0,
                  "uniqueItems": true,
                  "default": []
                },
                "denySelfDelegation": {
                  "type": "boolean",
                  "default": true
                },
                "denyConductorWorkerExecution": {
                  "type": "boolean",
                  "default": false
                },
                "requireExactModel": {
                  "type": "boolean",
                  "default": true
                },
                "allowedVisibility": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "enum": [
                      "listed",
                      "hidden"
                    ]
                  },
                  "default": [
                    "listed"
                  ]
                },
                "allowedLifecycle": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "enum": [
                      "active",
                      "deprecated"
                    ]
                  },
                  "default": [
                    "active"
                  ]
                },
                "minimumIdentityEvidence": {
                  "enum": [
                    "runtime-configured",
                    "backend-attested"
                  ],
                  "default": "runtime-configured"
                }
              }
            },
            "dataPolicy": {
              "$ref": "#/$defs/workerDataPolicy"
            },
            "freshness": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "warnHours": {
                  "type": "integer",
                  "minimum": 1,
                  "default": 24
                },
                "blockHours": {
                  "type": "integer",
                  "minimum": 1,
                  "default": 168
                },
                "policyDays": {
                  "type": "integer",
                  "minimum": 1,
                  "default": 30
                }
              }
            },
            "taskClasses": {
              "type": "object",
              "propertyNames": {
                "pattern": "^[a-z][a-z0-9-]{0,62}$"
              },
              "additionalProperties": {
                "type": "string",
                "minLength": 1
              }
            },
            "dataClasses": {
              "type": "object",
              "propertyNames": {
                "pattern": "^[a-z][a-z0-9-]{0,62}$"
              },
              "additionalProperties": {
                "$ref": "#/$defs/workerDataPolicy"
              }
            }
          }
        },
        "tier": { "enum": ["economy", "standard", "premium", "flagship", "max-quality"] },
        "provider": {
          "enum": ["claude", "codex", "copilot", "cursor", "factory", "grokbot", "hermes", "muse", "opencode", "openclaw", "openhuman", "warp", "windsurf"]
        }
      }
    },
    "agentOverrides": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model-tier": { "enum": ["economy", "standard", "premium", "flagship", "max-quality"] },
          "model-override": { "type": "string", "minLength": 1 },
          "rationale": { "type": "string", "minLength": 1 }
        }
      }
    },
    "customTiers": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["description", "costMultiplier", "roleMapping"],
        "properties": {
          "description": { "type": "string", "minLength": 1 },
          "costMultiplier": { "type": "number", "minimum": 0 },
          "roleMapping": {
            "type": "object",
            "additionalProperties": false,
            "required": ["reasoning", "coding", "efficiency"],
            "properties": {
              "reasoning": { "enum": ["reasoning", "coding", "efficiency"] },
              "coding": { "enum": ["reasoning", "coding", "efficiency"] },
              "efficiency": { "enum": ["reasoning", "coding", "efficiency"] }
            }
          }
        }
      }
    },
    "rationale": { "type": "string" }
  },
  "$defs": {
    "workerRole": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "baseRole": {
          "enum": [
            "efficiency",
            "coding",
            "reasoning"
          ]
        },
        "groups": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "tier": {
          "enum": [
            "economy",
            "standard",
            "premium",
            "flagship",
            "max-quality"
          ]
        },
        "initialEffort": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "effortLadder": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "escalateAfter": {
          "type": "integer",
          "minimum": 1,
          "default": 2
        },
        "maxEscalations": {
          "type": "integer",
          "minimum": 0,
          "default": 2
        },
        "deescalateAfter": {
          "type": "integer",
          "minimum": 1,
          "default": 2
        },
        "allowNotApplicableEffort": {
          "type": "boolean",
          "default": false
        }
      },
      "required": [
        "groups",
        "tier",
        "initialEffort",
        "effortLadder"
      ]
    },
    "workerDataPolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "localOnlyPaths": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9_.@+,-]+(?:/[A-Za-z0-9_.@+,-]+)*$(?![\\s\\S])"
          },
          "description": "Literal project-relative local-only files or directory subtrees; deployed conductor guards have limited shell coverage."
        },
        "allowedProcessing": {
          "type": "array",
          "items": {
            "enum": [
              "local",
              "remote"
            ]
          },
          "minItems": 0,
          "uniqueItems": true,
          "default": [
            "local",
            "remote"
          ]
        },
        "allowProductImprovement": {
          "type": "boolean",
          "default": false
        },
        "allowUnknown": {
          "type": "boolean",
          "default": false
        },
        "maxRetentionDays": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
