{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON schema reference for configuration validation"
    },
    "shell": {
      "type": "string",
      "description": "Default shell to use for terminal and shell tool execution"
    },
    "logLevel": {
      "$ref": "#/$defs/LogLevel",
      "description": "Log level"
    },
    "server": {
      "$ref": "#/$defs/ServerConfig",
      "description": "Server configuration for opencode serve and web commands"
    },
    "command": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "model": {
            "type": "string",
            "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
          },
          "variant": {
            "type": "string"
          },
          "subtask": {
            "type": "boolean"
          }
        },
        "required": [
          "template"
        ],
        "additionalProperties": false
      },
      "description": "Command configuration, see https://github.com/mttydev/miao/blob/main/packages/web/src/content/docs/commands.mdx"
    },
    "skills": {
      "description": "Additional paths or URLs to discover skills from",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "paths": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Additional paths to skill folders"
            },
            "urls": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)"
            }
          },
          "additionalProperties": false,
          "description": "Additional skill folder paths"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Additional paths or URLs to discover skills from"
        }
      ]
    },
    "references": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/ConfigV2.Reference.Git"
          },
          {
            "$ref": "#/$defs/ConfigV2.Reference.Local"
          }
        ]
      },
      "description": "Named local directories or Git repositories available as external context"
    },
    "reference": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/ConfigV2.Reference.Git"
          },
          {
            "$ref": "#/$defs/ConfigV2.Reference.Local"
          }
        ]
      },
      "description": "@deprecated Use 'references' field instead. Named git or local directory references"
    },
    "watcher": {
      "description": "Filesystem watcher configuration",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "ignore": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        },
        {
          "$ref": "#/$defs/ConfigV2.Watcher",
          "description": "Filesystem watcher configuration"
        }
      ]
    },
    "snapshot": {
      "type": "boolean",
      "description": "Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true."
    },
    "plugin": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "prefixItems": [
              {
                "type": "string"
              },
              {
                "type": "object"
              }
            ],
            "maxItems": 2,
            "minItems": 2
          }
        ]
      }
    },
    "share": {
      "type": "string",
      "enum": [
        "manual",
        "auto",
        "disabled"
      ],
      "description": "@deprecated Ignored: session sharing was removed"
    },
    "autoshare": {
      "type": "boolean",
      "description": "@deprecated Ignored: session sharing was removed"
    },
    "autoupdate": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string",
          "enum": [
            "notify"
          ]
        }
      ],
      "description": "Automatically update or notify when a new version is available"
    },
    "disabled_providers": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Disable providers that are loaded automatically"
    },
    "enabled_providers": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "When set, ONLY these providers will be enabled. All other providers will be ignored"
    },
    "model": {
      "type": "string",
      "description": "Default model to use when no session or agent model is selected",
      "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
    },
    "small_model": {
      "type": "string",
      "description": "Small model to use for tasks like title generation in the format of provider/model",
      "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
    },
    "default_agent": {
      "type": "string",
      "description": "Default primary agent to use when no session agent is selected"
    },
    "subagent_depth": {
      "minimum": 0,
      "type": "integer",
      "maximum": 9007199254740991,
      "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents."
    },
    "username": {
      "type": "string",
      "description": "Username displayed in conversations and used for telemetry identity"
    },
    "mode": {
      "type": "object",
      "properties": {
        "build": {
          "$ref": "#/$defs/AgentConfig"
        },
        "plan": {
          "$ref": "#/$defs/AgentConfig"
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/AgentConfig"
      },
      "description": "@deprecated Use `agent` field instead."
    },
    "agent": {
      "type": "object",
      "properties": {
        "plan": {
          "$ref": "#/$defs/AgentConfig"
        },
        "build": {
          "$ref": "#/$defs/AgentConfig"
        },
        "general": {
          "$ref": "#/$defs/AgentConfig"
        },
        "explore": {
          "$ref": "#/$defs/AgentConfig"
        },
        "title": {
          "$ref": "#/$defs/AgentConfig"
        },
        "summary": {
          "$ref": "#/$defs/AgentConfig"
        },
        "compaction": {
          "$ref": "#/$defs/AgentConfig"
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/AgentConfig"
      },
      "description": "Agent configuration, see https://github.com/mttydev/miao/blob/main/packages/web/src/content/docs/agents.mdx"
    },
    "provider": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ProviderConfig"
      },
      "description": "Custom provider configurations and model overrides"
    },
    "mcp": {
      "description": "MCP server configuration",
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "$ref": "#/$defs/McpLocalConfig"
                  },
                  {
                    "$ref": "#/$defs/McpRemoteConfig"
                  }
                ]
              },
              {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ],
                "additionalProperties": false
              }
            ]
          },
          "description": "MCP (Model Context Protocol) server configurations"
        },
        {
          "$ref": "#/$defs/ConfigV2.MCP",
          "description": "MCP server configuration"
        }
      ]
    },
    "formatter": {
      "description": "Enable built-in formatters or configure formatter overrides",
      "anyOf": [
        {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "disabled": {
                    "type": "boolean"
                  },
                  "command": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "environment": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "extensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          ],
          "description": "Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides."
        },
        {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ConfigV2.Formatter.Entry"
              }
            }
          ],
          "description": "Enable built-in formatters or configure formatter overrides"
        }
      ]
    },
    "lsp": {
      "description": "Enable built-in language servers or configure server overrides",
      "anyOf": [
        {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "type": "boolean",
                        "enum": [
                          true
                        ]
                      }
                    },
                    "required": [
                      "disabled"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "command": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "extensions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "disabled": {
                        "type": "boolean"
                      },
                      "env": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "initialization": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "command"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          ],
          "description": "Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides."
        },
        {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "type": "boolean",
                        "enum": [
                          true
                        ]
                      }
                    },
                    "required": [
                      "disabled"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.LSP.Server"
                  }
                ]
              }
            }
          ],
          "description": "Enable built-in language servers or configure server overrides"
        }
      ]
    },
    "instructions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Additional paths or URLs supplying ambient instructions"
    },
    "layout": {
      "$ref": "#/$defs/LayoutConfig",
      "description": "@deprecated Always uses stretch layout."
    },
    "permission": {
      "$ref": "#/$defs/PermissionConfig"
    },
    "tools": {
      "description": "Tool advertising: defer remote catalogs behind tool_search and pin always-loaded tools",
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          }
        },
        {
          "$ref": "#/$defs/ConfigV2.Tools",
          "description": "Tool advertising: defer remote catalogs behind tool_search and pin always-loaded tools"
        }
      ]
    },
    "attachment": {
      "$ref": "#/$defs/AttachmentConfig",
      "description": "Attachment processing configuration, including image size limits and resizing behavior"
    },
    "enterprise": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "description": "@deprecated Ignored: session sharing was removed"
    },
    "tool_output": {
      "description": "Tool output truncation thresholds",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "max_lines": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)"
            },
            "max_bytes": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)"
            }
          },
          "additionalProperties": false,
          "description": "Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned."
        },
        {
          "$ref": "#/$defs/ConfigV2.ToolOutput",
          "description": "Tool output truncation thresholds"
        }
      ]
    },
    "sandbox": {
      "$ref": "#/$defs/ConfigV2.Sandbox",
      "description": "OS sandbox for bash commands"
    },
    "compaction": {
      "description": "Conversation compaction behavior",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "auto": {
              "type": "boolean",
              "description": "Enable automatic compaction when context is full (default: true)"
            },
            "prune": {
              "type": "boolean",
              "description": "Enable pruning of old tool outputs (default: false)"
            },
            "tail_turns": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction. By default retention is limited only by the preserved token budget."
            },
            "preserve_recent_tokens": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction"
            },
            "reserved": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction."
            }
          },
          "additionalProperties": false
        },
        {
          "$ref": "#/$defs/ConfigV2.Compaction",
          "description": "Conversation compaction behavior"
        }
      ]
    },
    "experimental": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "disable_paste_summary": {
              "type": "boolean"
            },
            "batch_tool": {
              "type": "boolean",
              "description": "Enable the batch tool"
            },
            "openTelemetry": {
              "type": "boolean",
              "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)"
            },
            "primary_tools": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Tools that should only be available to primary agents."
            },
            "continue_loop_on_deny": {
              "type": "boolean",
              "description": "Continue the agent loop when a tool call is denied"
            },
            "mcp_timeout": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Timeout in milliseconds for model context protocol (MCP) requests"
            },
            "policies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ConfigV2.Experimental.Policy"
              },
              "description": "Policy statements applied to supported resources, such as provider access"
            }
          },
          "additionalProperties": false
        },
        {
          "$ref": "#/$defs/ConfigV2.Experimental"
        }
      ]
    },
    "engine": {
      "$ref": "#/$defs/Config.Engine",
      "description": "Engine process settings (global config file only; environment overrides)"
    },
    "permissions": {
      "$ref": "#/$defs/PermissionV2.Ruleset",
      "description": "Ordered tool permission rules applied to agent tool use"
    },
    "disabled_tools": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tool names hidden from the model for every agent in this Location"
    },
    "accounts": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Account a provider should use, keyed by provider id and valued by credential label or id"
    },
    "agents": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ConfigV2.Agent"
      },
      "description": "Named built-in agent overrides and custom agent definitions"
    },
    "snapshots": {
      "type": "boolean",
      "description": "Enable snapshots used for undo and revert behavior"
    },
    "linter": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ConfigV2.Linter.Entry"
          }
        }
      ],
      "description": "File-scoped lint commands that run after edits and feed failures back to the model"
    },
    "attachments": {
      "$ref": "#/$defs/ConfigV2.Attachments",
      "description": "Attachment processing configuration"
    },
    "hooks": {
      "$ref": "#/$defs/ConfigV2.Hooks",
      "description": "Lifecycle hooks the native engine executes under its sandbox"
    },
    "cache": {
      "$ref": "#/$defs/ConfigV2.Cache",
      "description": "Prompt cache behavior"
    },
    "loop": {
      "$ref": "#/$defs/ConfigV2.Loop",
      "description": "Goal/todo-driven autonomous loop that continues the session until todos complete"
    },
    "cost": {
      "$ref": "#/$defs/ConfigV2.Cost",
      "description": "Cost guardrails"
    },
    "commands": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ConfigV2.Command"
      },
      "description": "Named slash command definitions"
    },
    "plugins": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/ConfigV2.Plugin.Entry"
          }
        ]
      },
      "description": "Ordered external plugin packages to load"
    },
    "providers": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ConfigV2.Provider"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "LogLevel": {
      "type": "string",
      "enum": [
        "DEBUG",
        "INFO",
        "WARN",
        "ERROR"
      ],
      "description": "Log level"
    },
    "ServerConfig": {
      "type": "object",
      "properties": {
        "port": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Port to listen on"
        },
        "hostname": {
          "type": "string",
          "description": "Hostname to listen on"
        },
        "mdns": {
          "type": "boolean",
          "description": "Enable mDNS service discovery"
        },
        "mdnsDomain": {
          "type": "string",
          "description": "Custom domain name for mDNS service (default: opencode.local)"
        },
        "cors": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Additional domains to allow for CORS"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Reference.Git": {
      "type": "object",
      "properties": {
        "repository": {
          "type": "string"
        },
        "branch": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "hidden": {
          "type": "boolean"
        }
      },
      "required": [
        "repository"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Reference.Local": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "hidden": {
          "type": "boolean"
        }
      },
      "required": [
        "path"
      ],
      "additionalProperties": false
    },
    "PermissionActionConfig": {
      "type": "string",
      "enum": [
        "ask",
        "allow",
        "deny"
      ]
    },
    "PermissionObjectConfig": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/PermissionActionConfig"
      }
    },
    "PermissionRuleConfig": {
      "anyOf": [
        {
          "$ref": "#/$defs/PermissionActionConfig"
        },
        {
          "$ref": "#/$defs/PermissionObjectConfig"
        }
      ]
    },
    "PermissionConfig": {
      "anyOf": [
        {
          "$ref": "#/$defs/PermissionActionConfig"
        },
        {
          "type": "object",
          "properties": {
            "read": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "edit": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "glob": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "grep": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "list": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "bash": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "task": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "external_directory": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "todowrite": {
              "$ref": "#/$defs/PermissionActionConfig"
            },
            "question": {
              "$ref": "#/$defs/PermissionActionConfig"
            },
            "webfetch": {
              "$ref": "#/$defs/PermissionActionConfig"
            },
            "websearch": {
              "$ref": "#/$defs/PermissionActionConfig"
            },
            "lsp": {
              "$ref": "#/$defs/PermissionRuleConfig"
            },
            "doom_loop": {
              "$ref": "#/$defs/PermissionActionConfig"
            },
            "skill": {
              "$ref": "#/$defs/PermissionRuleConfig"
            }
          },
          "additionalProperties": {
            "$ref": "#/$defs/PermissionRuleConfig"
          }
        }
      ]
    },
    "AgentConfig": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "variant": {
          "type": "string",
          "description": "Default model variant for this agent (applies only when using the agent's configured model)."
        },
        "temperature": {
          "type": "number"
        },
        "top_p": {
          "type": "number"
        },
        "prompt": {
          "type": "string"
        },
        "tools": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          },
          "description": "@deprecated Use 'permission' field instead"
        },
        "disable": {
          "type": "boolean"
        },
        "description": {
          "type": "string",
          "description": "Description of when to use the agent"
        },
        "mode": {
          "type": "string",
          "enum": [
            "subagent",
            "primary",
            "all"
          ]
        },
        "hidden": {
          "type": "boolean",
          "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)"
        },
        "options": {
          "type": "object"
        },
        "color": {
          "anyOf": [
            {
              "pattern": "^#[0-9a-fA-F]{6}$",
              "type": "string"
            },
            {
              "type": "string",
              "enum": [
                "primary",
                "secondary",
                "accent",
                "success",
                "warning",
                "error",
                "info"
              ]
            }
          ],
          "description": "Hex color code (e.g., #FF5733) or theme color (e.g., primary)"
        },
        "steps": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum number of agentic iterations before forcing text-only response"
        },
        "maxSteps": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "@deprecated Use 'steps' field instead."
        },
        "budget": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Soft per-prompt token budget: crossing 80% asks the model to wrap up; exhausting it ends the turn with a text-only summary and a resumable pause notice"
        },
        "permission": {
          "$ref": "#/$defs/PermissionConfig"
        }
      }
    },
    "ProviderConfig": {
      "type": "object",
      "properties": {
        "api": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "env": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "id": {
          "type": "string"
        },
        "npm": {
          "type": "string"
        },
        "whitelist": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "blacklist": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "options": {
          "type": "object",
          "properties": {
            "apiKey": {
              "type": "string"
            },
            "baseURL": {
              "type": "string"
            },
            "enterpriseUrl": {
              "type": "string",
              "description": "GitHub Enterprise URL for copilot authentication"
            },
            "setCacheKey": {
              "type": "boolean",
              "description": "Enable promptCacheKey for this provider (default false)"
            },
            "timeout": {
              "anyOf": [
                {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991
                },
                {
                  "type": "boolean",
                  "enum": [
                    false
                  ]
                }
              ],
              "description": "Timeout in milliseconds for full requests to this provider. Set to false to disable timeout."
            },
            "headerTimeout": {
              "anyOf": [
                {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991
                },
                {
                  "type": "boolean",
                  "enum": [
                    false
                  ]
                }
              ],
              "description": "Timeout in milliseconds to wait for response headers (default: 300000). Set to false to disable timeout."
            },
            "chunkTimeout": {
              "anyOf": [
                {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991
                },
                {
                  "type": "boolean",
                  "enum": [
                    false
                  ]
                }
              ],
              "description": "Timeout in milliseconds between streamed SSE chunks for this provider (default: 300000). If no chunk arrives within this window, the request is aborted. Set to false to disable timeout."
            }
          }
        },
        "models": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "family": {
                "type": "string"
              },
              "release_date": {
                "type": "string"
              },
              "attachment": {
                "type": "boolean"
              },
              "reasoning": {
                "type": "boolean"
              },
              "temperature": {
                "type": "boolean"
              },
              "tool_call": {
                "type": "boolean"
              },
              "interleaved": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "reasoning",
                          "reasoning_content",
                          "reasoning_text"
                        ]
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "field": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "reasoning",
                              "reasoning_content",
                              "reasoning_text"
                            ]
                          },
                          {
                            "type": "string"
                          }
                        ]
                      }
                    },
                    "required": [
                      "field"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "cost": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "number"
                  },
                  "output": {
                    "type": "number"
                  },
                  "cache_read": {
                    "type": "number"
                  },
                  "cache_write": {
                    "type": "number"
                  },
                  "context_over_200k": {
                    "type": "object",
                    "properties": {
                      "input": {
                        "type": "number"
                      },
                      "output": {
                        "type": "number"
                      },
                      "cache_read": {
                        "type": "number"
                      },
                      "cache_write": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "input",
                      "output"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "input",
                  "output"
                ],
                "additionalProperties": false
              },
              "limit": {
                "type": "object",
                "properties": {
                  "context": {
                    "type": "number"
                  },
                  "input": {
                    "type": "number"
                  },
                  "output": {
                    "type": "number"
                  }
                },
                "required": [
                  "context",
                  "output"
                ],
                "additionalProperties": false
              },
              "modalities": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "text",
                        "audio",
                        "image",
                        "video",
                        "pdf"
                      ]
                    }
                  },
                  "output": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "text",
                        "audio",
                        "image",
                        "video",
                        "pdf"
                      ]
                    }
                  }
                },
                "additionalProperties": false
              },
              "experimental": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "enum": [
                  "alpha",
                  "beta",
                  "deprecated",
                  "active"
                ]
              },
              "provider": {
                "type": "object",
                "properties": {
                  "npm": {
                    "type": "string"
                  },
                  "api": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              },
              "options": {
                "type": "object"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "variants": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "disabled": {
                      "type": "boolean",
                      "description": "Disable this variant for the model"
                    }
                  }
                },
                "description": "Variant-specific configuration"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "McpLocalConfig": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "local"
          ],
          "description": "Type of MCP server connection"
        },
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Command and arguments to run the MCP server"
        },
        "cwd": {
          "type": "string",
          "description": "Working directory for the MCP server process. Relative paths resolve from the workspace directory."
        },
        "environment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Environment variables to set when running the MCP server"
        },
        "call_meta": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Identity stamped into `_meta` on every tools/call. `{env:VAR}` values are re-read per call, so credential rotation is picked up without reconnecting."
        },
        "enabled": {
          "type": "boolean",
          "description": "Enable or disable the MCP server on startup"
        },
        "timeout": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."
        }
      },
      "required": [
        "type",
        "command"
      ],
      "additionalProperties": false
    },
    "McpOAuthConfig": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string",
          "description": "OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted."
        },
        "clientSecret": {
          "type": "string",
          "description": "OAuth client secret (if required by the authorization server)"
        },
        "scope": {
          "type": "string",
          "description": "OAuth scopes to request during authorization"
        },
        "callbackPort": {
          "minimum": 1,
          "maximum": 65535,
          "type": "integer",
          "description": "Port for the local OAuth callback server (default: 19876). Shorthand for redirectUri when only the port needs changing. Ignored if redirectUri is set."
        },
        "redirectUri": {
          "type": "string",
          "description": "OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback)."
        },
        "clientMetadataUrl": {
          "type": "string",
          "description": "HTTPS URL of this client's OAuth client metadata document (CIMD). An authorization server advertising `client_id_metadata_document_supported` uses it as the client_id instead of dynamic registration. Must be hosted and reachable by the server."
        }
      },
      "additionalProperties": false
    },
    "McpRemoteConfig": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "remote"
          ],
          "description": "Type of MCP server connection"
        },
        "url": {
          "type": "string",
          "description": "URL of the remote MCP server"
        },
        "enabled": {
          "type": "boolean",
          "description": "Enable or disable the MCP server on startup"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Headers to send with the request"
        },
        "call_meta": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Identity stamped into `_meta` on every tools/call. `{env:VAR}` values are re-read per call, so credential rotation is picked up without reconnecting."
        },
        "oauth": {
          "anyOf": [
            {
              "$ref": "#/$defs/McpOAuthConfig"
            },
            {
              "type": "boolean",
              "enum": [
                false
              ]
            }
          ],
          "description": "OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection."
        },
        "timeout": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."
        }
      },
      "required": [
        "type",
        "url"
      ],
      "additionalProperties": false
    },
    "LayoutConfig": {
      "type": "string",
      "enum": [
        "auto",
        "stretch"
      ]
    },
    "ImageAttachmentConfig": {
      "type": "object",
      "properties": {
        "auto_resize": {
          "type": "boolean",
          "description": "Resize images before sending them to the model when they exceed configured limits (default: true)"
        },
        "max_width": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum image width before resizing or rejecting the attachment (default: 2000)"
        },
        "max_height": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum image height before resizing or rejecting the attachment (default: 2000)"
        },
        "max_base64_bytes": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum base64 payload bytes for an image attachment (default: 5242880)"
        }
      },
      "additionalProperties": false
    },
    "AttachmentConfig": {
      "type": "object",
      "properties": {
        "image": {
          "$ref": "#/$defs/ImageAttachmentConfig",
          "description": "Image attachment configuration"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Sandbox": {
      "type": "object",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "off",
            "workspace-write"
          ],
          "description": "Run bash commands inside the OS sandbox. workspace-write limits writes to the Location, the command's working directory, temp directories, and approved paths. Defaults to off; MIAO_SANDBOX=1 or 0 overrides it."
        },
        "network": {
          "type": "boolean",
          "description": "Allow network access inside the sandbox (default: true). MIAO_SANDBOX_DENY_NETWORK=1 overrides it to deny."
        },
        "writable_roots": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Extra directories the sandbox may write to. Relative paths resolve from the Location; ~ expands to the home directory."
        },
        "on_unavailable": {
          "type": "string",
          "enum": [
            "warn",
            "fail"
          ],
          "description": "What to do when the sandbox is enabled but no sandbox runner is available: warn and run unsandboxed (default), or fail the command."
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Experimental.Policy": {
      "type": "object",
      "properties": {
        "effect": {
          "type": "string",
          "enum": [
            "allow",
            "deny"
          ]
        },
        "resource": {
          "type": "string"
        },
        "action": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "provider.use"
              ]
            }
          ]
        }
      },
      "required": [
        "effect",
        "resource",
        "action"
      ],
      "additionalProperties": false
    },
    "Config": {
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "description": "JSON schema reference for configuration validation"
        },
        "shell": {
          "type": "string",
          "description": "Default shell to use for terminal and bash tool"
        },
        "logLevel": {
          "$ref": "#/$defs/LogLevel",
          "description": "Log level"
        },
        "server": {
          "$ref": "#/$defs/ServerConfig",
          "description": "Server configuration for opencode serve and web commands"
        },
        "command": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "template": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "agent": {
                "type": "string"
              },
              "model": {
                "type": "string",
                "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
              },
              "variant": {
                "type": "string"
              },
              "subtask": {
                "type": "boolean"
              }
            },
            "required": [
              "template"
            ],
            "additionalProperties": false
          },
          "description": "Command configuration, see https://github.com/mttydev/miao/blob/main/packages/web/src/content/docs/commands.mdx"
        },
        "skills": {
          "type": "object",
          "properties": {
            "paths": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Additional paths to skill folders"
            },
            "urls": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)"
            }
          },
          "additionalProperties": false,
          "description": "Additional skill folder paths"
        },
        "references": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Git"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Local"
              }
            ]
          },
          "description": "Named git or local directory references"
        },
        "reference": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Git"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Local"
              }
            ]
          },
          "description": "@deprecated Use 'references' field instead. Named git or local directory references"
        },
        "watcher": {
          "type": "object",
          "properties": {
            "ignore": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": false
        },
        "snapshot": {
          "type": "boolean",
          "description": "Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true."
        },
        "plugin": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "prefixItems": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object"
                  }
                ],
                "maxItems": 2,
                "minItems": 2
              }
            ]
          }
        },
        "share": {
          "type": "string",
          "enum": [
            "manual",
            "auto",
            "disabled"
          ],
          "description": "@deprecated Ignored: session sharing was removed"
        },
        "autoshare": {
          "type": "boolean",
          "description": "@deprecated Ignored: session sharing was removed"
        },
        "autoupdate": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string",
              "enum": [
                "notify"
              ]
            }
          ],
          "description": "Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications"
        },
        "disabled_providers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Disable providers that are loaded automatically"
        },
        "enabled_providers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "When set, ONLY these providers will be enabled. All other providers will be ignored"
        },
        "model": {
          "type": "string",
          "description": "Model to use in the format of provider/model, eg anthropic/claude-2",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "small_model": {
          "type": "string",
          "description": "Small model to use for tasks like title generation in the format of provider/model",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "default_agent": {
          "type": "string",
          "description": "Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid."
        },
        "subagent_depth": {
          "minimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum subagent nesting depth. Defaults to 1, which prevents subagents from launching subagents."
        },
        "username": {
          "type": "string",
          "description": "Custom username to display in conversations instead of system username"
        },
        "mode": {
          "type": "object",
          "properties": {
            "build": {
              "$ref": "#/$defs/AgentConfig"
            },
            "plan": {
              "$ref": "#/$defs/AgentConfig"
            }
          },
          "additionalProperties": {
            "$ref": "#/$defs/AgentConfig"
          },
          "description": "@deprecated Use `agent` field instead."
        },
        "agent": {
          "type": "object",
          "properties": {
            "plan": {
              "$ref": "#/$defs/AgentConfig"
            },
            "build": {
              "$ref": "#/$defs/AgentConfig"
            },
            "general": {
              "$ref": "#/$defs/AgentConfig"
            },
            "explore": {
              "$ref": "#/$defs/AgentConfig"
            },
            "title": {
              "$ref": "#/$defs/AgentConfig"
            },
            "summary": {
              "$ref": "#/$defs/AgentConfig"
            },
            "compaction": {
              "$ref": "#/$defs/AgentConfig"
            }
          },
          "additionalProperties": {
            "$ref": "#/$defs/AgentConfig"
          },
          "description": "Agent configuration, see https://github.com/mttydev/miao/blob/main/packages/web/src/content/docs/agents.mdx"
        },
        "provider": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ProviderConfig"
          },
          "description": "Custom provider configurations and model overrides"
        },
        "mcp": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "$ref": "#/$defs/McpLocalConfig"
                  },
                  {
                    "$ref": "#/$defs/McpRemoteConfig"
                  }
                ]
              },
              {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ],
                "additionalProperties": false
              }
            ]
          },
          "description": "MCP (Model Context Protocol) server configurations"
        },
        "formatter": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "disabled": {
                    "type": "boolean"
                  },
                  "command": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "environment": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "extensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          ],
          "description": "Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides."
        },
        "lsp": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "type": "boolean",
                        "enum": [
                          true
                        ]
                      }
                    },
                    "required": [
                      "disabled"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "command": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "extensions": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "disabled": {
                        "type": "boolean"
                      },
                      "env": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "initialization": {
                        "type": "object"
                      }
                    },
                    "required": [
                      "command"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          ],
          "description": "Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides."
        },
        "instructions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Additional instruction files or patterns to include"
        },
        "layout": {
          "$ref": "#/$defs/LayoutConfig",
          "description": "@deprecated Always uses stretch layout."
        },
        "permission": {
          "$ref": "#/$defs/PermissionConfig"
        },
        "tools": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          }
        },
        "attachment": {
          "$ref": "#/$defs/AttachmentConfig",
          "description": "Attachment processing configuration, including image size limits and resizing behavior"
        },
        "enterprise": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "Enterprise URL"
            }
          },
          "additionalProperties": false,
          "description": "@deprecated Ignored: session sharing was removed"
        },
        "tool_output": {
          "type": "object",
          "properties": {
            "max_lines": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum lines of tool output before it is truncated and saved to disk (default: 2000)"
            },
            "max_bytes": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)"
            }
          },
          "additionalProperties": false,
          "description": "Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned."
        },
        "sandbox": {
          "$ref": "#/$defs/ConfigV2.Sandbox",
          "description": "OS sandbox for bash commands"
        },
        "compaction": {
          "type": "object",
          "properties": {
            "auto": {
              "type": "boolean",
              "description": "Enable automatic compaction when context is full (default: true)"
            },
            "prune": {
              "type": "boolean",
              "description": "Enable pruning of old tool outputs (default: false)"
            },
            "tail_turns": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction. By default retention is limited only by the preserved token budget."
            },
            "preserve_recent_tokens": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Maximum number of tokens from recent turns to preserve verbatim after compaction"
            },
            "reserved": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Token buffer for compaction. Leaves enough window to avoid overflow during compaction."
            }
          },
          "additionalProperties": false
        },
        "experimental": {
          "type": "object",
          "properties": {
            "disable_paste_summary": {
              "type": "boolean"
            },
            "batch_tool": {
              "type": "boolean",
              "description": "Enable the batch tool"
            },
            "openTelemetry": {
              "type": "boolean",
              "description": "Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)"
            },
            "primary_tools": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Tools that should only be available to primary agents."
            },
            "continue_loop_on_deny": {
              "type": "boolean",
              "description": "Continue the agent loop when a tool call is denied"
            },
            "mcp_timeout": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Timeout in milliseconds for model context protocol (MCP) requests"
            },
            "policies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ConfigV2.Experimental.Policy"
              },
              "description": "Policy statements applied to supported resources, such as provider access"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "Config.Engine": {
      "type": "object",
      "properties": {
        "responses_websocket_contract": {
          "type": "object",
          "properties": {
            "model": {
              "type": "string",
              "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
            },
            "endpoint": {
              "type": "string"
            },
            "authentication": {
              "type": "string",
              "enum": [
                "api",
                "subscription"
              ]
            },
            "mode": {
              "type": "string",
              "enum": [
                "full",
                "delta"
              ]
            },
            "beta": {
              "type": "boolean"
            }
          },
          "required": [
            "model",
            "endpoint",
            "authentication",
            "mode"
          ],
          "additionalProperties": false
        },
        "tool_disclosure": {
          "type": "string",
          "enum": [
            "full",
            "compact"
          ]
        },
        "provider": {
          "type": "string",
          "description": "Provider id the engine's primary model resolves against"
        },
        "model": {
          "type": "string",
          "description": "The engine's primary model id",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "endpoint": {
          "type": "string",
          "description": "Provider endpoint override for the engine's route"
        },
        "fallback_model": {
          "type": "string",
          "description": "Model id retried once when the primary route fails at the transport level"
        },
        "roles": {
          "type": "object",
          "properties": {
            "summarize": {
              "type": "string"
            },
            "retrieve": {
              "type": "string"
            },
            "verify": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "description": "Purpose-role model bindings (ADR-14), resolved on the engine's own route"
        },
        "prompt_cache": {
          "type": "boolean",
          "description": "Prompt-cache policy for providers that support it (default provider-dependent)"
        },
        "responses_cache_contract": {
          "type": "object",
          "properties": {
            "model": {
              "type": "string",
              "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
            },
            "endpoint": {
              "type": "string"
            },
            "authentication": {
              "type": "string",
              "enum": [
                "api",
                "subscription"
              ]
            },
            "profile": {
              "type": "string",
              "enum": [
                "legacy",
                "breakpoints"
              ]
            },
            "mode": {
              "type": "string",
              "enum": [
                "implicit",
                "explicit",
                "disabled"
              ]
            },
            "ttl": {
              "type": "string",
              "enum": [
                "30m"
              ]
            },
            "retention": {
              "type": "string",
              "enum": [
                "in_memory",
                "24h"
              ]
            },
            "system": {
              "type": "boolean"
            },
            "prewarm": {
              "type": "boolean",
              "enum": [
                false
              ]
            }
          },
          "required": [
            "model",
            "endpoint",
            "authentication",
            "profile"
          ],
          "additionalProperties": false
        },
        "verify_command": {
          "type": "string",
          "description": "Completion check the engine runs before ending an edit turn"
        },
        "mcp_config": {
          "type": "string"
        },
        "lsp_config": {
          "type": "string",
          "description": "Native engine LSP host configuration file; relative paths resolve against the global config directory"
        },
        "storage": {
          "type": "string",
          "description": "Directory for the native engine's per-location databases; relative paths resolve against the global config directory. Setting it places new Sessions on the native engine"
        },
        "context_limits": {
          "type": "object",
          "properties": {
            "window": {
              "type": "number"
            },
            "ratio": {
              "type": "number"
            },
            "headroom": {
              "type": "number"
            },
            "perPass": {
              "type": "number"
            }
          },
          "required": [
            "window",
            "ratio",
            "headroom",
            "perPass"
          ],
          "additionalProperties": false,
          "description": "Automatic compaction trigger (roadmap §2.13); absent keeps it off"
        }
      },
      "additionalProperties": false
    },
    "PermissionV2.Effect": {
      "type": "string",
      "enum": [
        "allow",
        "deny",
        "ask"
      ]
    },
    "PermissionV2.Rule": {
      "type": "object",
      "properties": {
        "action": {
          "type": "string"
        },
        "resource": {
          "type": "string"
        },
        "effect": {
          "$ref": "#/$defs/PermissionV2.Effect"
        }
      },
      "required": [
        "action",
        "resource",
        "effect"
      ],
      "additionalProperties": false
    },
    "PermissionV2.Ruleset": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PermissionV2.Rule"
      }
    },
    "ConfigV2.Provider.Request": {
      "type": "object",
      "properties": {
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "body": {
          "type": "object"
        }
      },
      "additionalProperties": false
    },
    "PermissionV2.Mode": {
      "type": "string",
      "enum": [
        "default",
        "auto"
      ]
    },
    "ConfigV2.Agent": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "variant": {
          "type": "string"
        },
        "accounts": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Account this agent should use per provider, valued by credential label or id"
        },
        "request": {
          "$ref": "#/$defs/ConfigV2.Provider.Request"
        },
        "system": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "subagent",
            "primary",
            "all"
          ]
        },
        "hidden": {
          "type": "boolean"
        },
        "color": {
          "anyOf": [
            {
              "pattern": "^#[0-9a-fA-F]{6}$",
              "type": "string"
            },
            {
              "type": "string",
              "enum": [
                "primary",
                "secondary",
                "accent",
                "success",
                "warning",
                "error",
                "info"
              ]
            }
          ]
        },
        "steps": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "budget": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "disabled": {
          "type": "boolean"
        },
        "permissions": {
          "$ref": "#/$defs/PermissionV2.Ruleset"
        },
        "permission_mode": {
          "$ref": "#/$defs/PermissionV2.Mode",
          "description": "Auto mode classifies safe asks (workspace edits, read-only commands) as allowed"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Watcher": {
      "type": "object",
      "properties": {
        "ignore": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Formatter.Entry": {
      "type": "object",
      "properties": {
        "disabled": {
          "type": "boolean"
        },
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "environment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Linter.Entry": {
      "type": "object",
      "properties": {
        "disabled": {
          "type": "boolean"
        },
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "environment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Tools": {
      "type": "object",
      "properties": {
        "disclosure": {
          "type": "boolean",
          "description": "Defer external tool schemas above the budget behind a stable tool_search tool"
        },
        "always_load": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "External tool names that stay resident instead of deferring behind tool_search"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.LSP.Server": {
      "type": "object",
      "properties": {
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "disabled": {
          "type": "boolean"
        },
        "env": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "initialization": {
          "type": "object"
        }
      },
      "required": [
        "command"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Attachments.Image": {
      "type": "object",
      "properties": {
        "auto_resize": {
          "type": "boolean"
        },
        "max_width": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "max_height": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "max_base64_bytes": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "target_raw_bytes": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Attachments": {
      "type": "object",
      "properties": {
        "image": {
          "$ref": "#/$defs/ConfigV2.Attachments.Image"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.ToolOutput": {
      "type": "object",
      "properties": {
        "max_lines": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "max_bytes": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Hooks.Entry": {
      "type": "object",
      "properties": {
        "event": {
          "type": "string",
          "enum": [
            "session_start",
            "user_prompt_submit",
            "pre_tool_use",
            "post_tool_use",
            "permission_request",
            "permission_denied",
            "subagent_start",
            "subagent_stop",
            "pre_compact",
            "post_compact",
            "stop",
            "stop_failure",
            "instructions_loaded"
          ],
          "description": "Lifecycle event that triggers the hook."
        },
        "tool": {
          "type": "string",
          "description": "Tool name selector for tool-scoped events; defaults to all tools."
        },
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Argv executed under the same sandbox as bash. Never a shell string."
        },
        "timeout_ms": {
          "minimum": 1000,
          "maximum": 60000,
          "type": "integer",
          "description": "Hook time budget in milliseconds (default 10000)."
        }
      },
      "required": [
        "event",
        "command"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Hooks": {
      "type": "object",
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConfigV2.Hooks.Entry"
          },
          "description": "Lifecycle hooks the native engine executes as observation guards."
        }
      },
      "required": [
        "entries"
      ],
      "additionalProperties": false
    },
    "ConfigV2.MCP.Timeout": {
      "type": "object",
      "properties": {
        "startup": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum time in milliseconds to establish and initialize the MCP server."
        },
        "request": {
          "exclusiveMinimum": 0,
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Maximum time in milliseconds to wait for each MCP request after initialization."
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.MCP.Local": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "local"
          ]
        },
        "command": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "cwd": {
          "type": "string",
          "description": "Working directory for the MCP server process. Relative paths resolve from the workspace directory."
        },
        "environment": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "call_meta": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Identity stamped into `_meta` on every tools/call. `{env:VAR}` values are re-read per call, so credential rotation is picked up without reconnecting."
        },
        "disabled": {
          "type": "boolean"
        },
        "timeout": {
          "$ref": "#/$defs/ConfigV2.MCP.Timeout"
        }
      },
      "required": [
        "type",
        "command"
      ],
      "additionalProperties": false
    },
    "ConfigV2.MCP.OAuth": {
      "type": "object",
      "properties": {
        "client_id": {
          "type": "string"
        },
        "client_secret": {
          "type": "string"
        },
        "scope": {
          "type": "string"
        },
        "callback_port": {
          "minimum": 1,
          "maximum": 65535,
          "type": "integer"
        },
        "redirect_uri": {
          "type": "string"
        },
        "client_metadata_url": {
          "type": "string",
          "description": "HTTPS URL of this client's OAuth client metadata document (CIMD). An authorization server advertising `client_id_metadata_document_supported` uses it as the client_id instead of dynamic registration. Must be hosted and reachable by the server."
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.MCP.Remote": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "remote"
          ]
        },
        "url": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "call_meta": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Identity stamped into `_meta` on every tools/call. `{env:VAR}` values are re-read per call, so credential rotation is picked up without reconnecting."
        },
        "oauth": {
          "anyOf": [
            {
              "$ref": "#/$defs/ConfigV2.MCP.OAuth"
            },
            {
              "type": "boolean",
              "enum": [
                false
              ]
            }
          ]
        },
        "disabled": {
          "type": "boolean"
        },
        "timeout": {
          "$ref": "#/$defs/ConfigV2.MCP.Timeout"
        }
      },
      "required": [
        "type",
        "url"
      ],
      "additionalProperties": false
    },
    "ConfigV2.MCP": {
      "type": "object",
      "properties": {
        "timeout": {
          "$ref": "#/$defs/ConfigV2.MCP.Timeout"
        },
        "servers": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/$defs/ConfigV2.MCP.Local"
              },
              {
                "$ref": "#/$defs/ConfigV2.MCP.Remote"
              }
            ]
          }
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Compaction.Keep": {
      "type": "object",
      "properties": {
        "tokens": {
          "minimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Compaction": {
      "type": "object",
      "properties": {
        "auto": {
          "type": "boolean"
        },
        "prune": {
          "type": "boolean"
        },
        "hot_prefix": {
          "type": "boolean"
        },
        "precise_tokens": {
          "type": "boolean"
        },
        "summarize_small": {
          "type": "boolean"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "enum": [
                "NaN"
              ]
            },
            {
              "type": "string",
              "enum": [
                "Infinity"
              ]
            },
            {
              "type": "string",
              "enum": [
                "-Infinity"
              ]
            }
          ]
        },
        "keep": {
          "$ref": "#/$defs/ConfigV2.Compaction.Keep"
        },
        "buffer": {
          "minimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        },
        "max_context": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                {
                  "type": "string"
                }
              ]
            },
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "NaN"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          "Infinity"
                        ]
                      },
                      {
                        "type": "string",
                        "enum": [
                          "-Infinity"
                        ]
                      }
                    ]
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Cache": {
      "type": "object",
      "properties": {
        "ttl_seconds": {
          "minimum": 0,
          "type": "integer",
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Loop": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "max_iterations": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "enum": [
                "NaN"
              ]
            },
            {
              "type": "string",
              "enum": [
                "Infinity"
              ]
            },
            {
              "type": "string",
              "enum": [
                "-Infinity"
              ]
            }
          ]
        },
        "continue_prompt": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Cost": {
      "type": "object",
      "properties": {
        "budget_usd": {
          "type": "number"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Command": {
      "type": "object",
      "properties": {
        "template": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "agent": {
          "type": "string"
        },
        "model": {
          "type": "string",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "variant": {
          "type": "string"
        },
        "subtask": {
          "type": "boolean"
        }
      },
      "required": [
        "template"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Plugin.Entry": {
      "type": "object",
      "properties": {
        "package": {
          "type": "string"
        },
        "options": {
          "type": "object"
        }
      },
      "required": [
        "package"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Experimental": {
      "type": "object",
      "properties": {
        "policies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConfigV2.Experimental.Policy"
          }
        },
        "disable_paste_summary": {
          "type": "boolean",
          "description": "Disable the TUI paste summary"
        }
      },
      "additionalProperties": false
    },
    "Provider.AISDK": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "aisdk"
          ]
        },
        "package": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "settings": {
          "type": "object"
        }
      },
      "required": [
        "type",
        "package"
      ],
      "additionalProperties": false
    },
    "Provider.Native": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "native"
          ]
        },
        "url": {
          "type": "string"
        },
        "settings": {
          "type": "object"
        }
      },
      "required": [
        "type",
        "settings"
      ],
      "additionalProperties": false
    },
    "Provider.Api": {
      "anyOf": [
        {
          "$ref": "#/$defs/Provider.AISDK"
        },
        {
          "$ref": "#/$defs/Provider.Native"
        }
      ]
    },
    "Model.Capabilities": {
      "type": "object",
      "properties": {
        "tools": {
          "type": "boolean"
        },
        "input": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "output": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "tools",
        "input",
        "output"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Model.Cost.Cache": {
      "type": "object",
      "properties": {
        "read": {
          "type": "number"
        },
        "write": {
          "type": "number"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Model.Cost": {
      "type": "object",
      "properties": {
        "tier": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "context"
              ]
            },
            "size": {
              "type": "integer",
              "maximum": 9007199254740991
            }
          },
          "required": [
            "type",
            "size"
          ],
          "additionalProperties": false
        },
        "input": {
          "type": "number"
        },
        "output": {
          "type": "number"
        },
        "cache": {
          "$ref": "#/$defs/ConfigV2.Model.Cost.Cache"
        }
      },
      "required": [
        "input",
        "output"
      ],
      "additionalProperties": false
    },
    "ConfigV2.Model.Limit": {
      "type": "object",
      "properties": {
        "context": {
          "type": "integer",
          "maximum": 9007199254740991
        },
        "input": {
          "type": "integer",
          "maximum": 9007199254740991
        },
        "output": {
          "type": "integer",
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Model": {
      "type": "object",
      "properties": {
        "family": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "api": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "aisdk"
                  ]
                },
                "package": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "settings": {
                  "type": "object"
                }
              },
              "required": [
                "type",
                "package"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "native"
                  ]
                },
                "url": {
                  "type": "string"
                },
                "settings": {
                  "type": "object"
                }
              },
              "required": [
                "type",
                "settings"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "required": [
                "id"
              ],
              "additionalProperties": false
            }
          ]
        },
        "capabilities": {
          "$ref": "#/$defs/Model.Capabilities"
        },
        "request": {
          "type": "object",
          "properties": {
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "body": {
              "type": "object"
            },
            "variant": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "variants": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "body": {
                "type": "object"
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false
          }
        },
        "cost": {
          "anyOf": [
            {
              "$ref": "#/$defs/ConfigV2.Model.Cost"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ConfigV2.Model.Cost"
              }
            }
          ]
        },
        "currency": {
          "type": "string"
        },
        "disabled": {
          "type": "boolean"
        },
        "limit": {
          "$ref": "#/$defs/ConfigV2.Model.Limit"
        }
      },
      "additionalProperties": false
    },
    "ConfigV2.Provider": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "disabled": {
          "type": "boolean",
          "description": "Hide this provider and its models, even when credentials for it exist"
        },
        "env": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "api": {
          "$ref": "#/$defs/Provider.Api"
        },
        "request": {
          "$ref": "#/$defs/ConfigV2.Provider.Request"
        },
        "currency": {
          "type": "string"
        },
        "models": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ConfigV2.Model"
          }
        }
      },
      "additionalProperties": false
    },
    "Config.Info": {
      "type": "object",
      "properties": {
        "$schema": {
          "type": "string",
          "description": "JSON schema reference for configuration validation"
        },
        "shell": {
          "type": "string",
          "description": "Default shell to use for terminal and shell tool execution"
        },
        "model": {
          "type": "string",
          "description": "Default model to use when no session or agent model is selected",
          "$ref": "https://mtty.dev/miao/model-schema.json#/$defs/Model"
        },
        "engine": {
          "$ref": "#/$defs/Config.Engine",
          "description": "Engine process settings (global config file only; environment overrides)"
        },
        "default_agent": {
          "type": "string",
          "description": "Default primary agent to use when no session agent is selected"
        },
        "autoupdate": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string",
              "enum": [
                "notify"
              ]
            }
          ],
          "description": "Automatically update or notify when a new version is available"
        },
        "share": {
          "type": "string",
          "enum": [
            "manual",
            "auto",
            "disabled"
          ],
          "description": "@deprecated Ignored: session sharing was removed"
        },
        "enterprise": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "description": "@deprecated Ignored: session sharing was removed"
        },
        "username": {
          "type": "string",
          "description": "Username displayed in conversations and used for telemetry identity"
        },
        "permissions": {
          "$ref": "#/$defs/PermissionV2.Ruleset",
          "description": "Ordered tool permission rules applied to agent tool use"
        },
        "disabled_tools": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Tool names hidden from the model for every agent in this Location"
        },
        "accounts": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Account a provider should use, keyed by provider id and valued by credential label or id"
        },
        "agents": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ConfigV2.Agent"
          },
          "description": "Named built-in agent overrides and custom agent definitions"
        },
        "snapshots": {
          "type": "boolean",
          "description": "Enable snapshots used for undo and revert behavior"
        },
        "watcher": {
          "$ref": "#/$defs/ConfigV2.Watcher",
          "description": "Filesystem watcher configuration"
        },
        "formatter": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ConfigV2.Formatter.Entry"
              }
            }
          ],
          "description": "Enable built-in formatters or configure formatter overrides"
        },
        "linter": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/$defs/ConfigV2.Linter.Entry"
              }
            }
          ],
          "description": "File-scoped lint commands that run after edits and feed failures back to the model"
        },
        "tools": {
          "$ref": "#/$defs/ConfigV2.Tools",
          "description": "Tool advertising: defer remote catalogs behind tool_search and pin always-loaded tools"
        },
        "lsp": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "disabled": {
                        "type": "boolean",
                        "enum": [
                          true
                        ]
                      }
                    },
                    "required": [
                      "disabled"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "$ref": "#/$defs/ConfigV2.LSP.Server"
                  }
                ]
              }
            }
          ],
          "description": "Enable built-in language servers or configure server overrides"
        },
        "attachments": {
          "$ref": "#/$defs/ConfigV2.Attachments",
          "description": "Attachment processing configuration"
        },
        "tool_output": {
          "$ref": "#/$defs/ConfigV2.ToolOutput",
          "description": "Tool output truncation thresholds"
        },
        "hooks": {
          "$ref": "#/$defs/ConfigV2.Hooks",
          "description": "Lifecycle hooks the native engine executes under its sandbox"
        },
        "mcp": {
          "$ref": "#/$defs/ConfigV2.MCP",
          "description": "MCP server configuration"
        },
        "compaction": {
          "$ref": "#/$defs/ConfigV2.Compaction",
          "description": "Conversation compaction behavior"
        },
        "cache": {
          "$ref": "#/$defs/ConfigV2.Cache",
          "description": "Prompt cache behavior"
        },
        "loop": {
          "$ref": "#/$defs/ConfigV2.Loop",
          "description": "Goal/todo-driven autonomous loop that continues the session until todos complete"
        },
        "cost": {
          "$ref": "#/$defs/ConfigV2.Cost",
          "description": "Cost guardrails"
        },
        "sandbox": {
          "$ref": "#/$defs/ConfigV2.Sandbox",
          "description": "OS sandbox for bash commands"
        },
        "skills": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Additional paths or URLs to discover skills from"
        },
        "commands": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ConfigV2.Command"
          },
          "description": "Named slash command definitions"
        },
        "instructions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Additional paths or URLs supplying ambient instructions"
        },
        "references": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Git"
              },
              {
                "$ref": "#/$defs/ConfigV2.Reference.Local"
              }
            ]
          },
          "description": "Named local directories or Git repositories available as external context"
        },
        "plugins": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/ConfigV2.Plugin.Entry"
              }
            ]
          },
          "description": "Ordered external plugin packages to load"
        },
        "experimental": {
          "$ref": "#/$defs/ConfigV2.Experimental"
        },
        "providers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ConfigV2.Provider"
          }
        }
      },
      "additionalProperties": false
    }
  },
  "allowComments": true,
  "allowTrailingCommas": true
}