{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/Config",
  "$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: hordecode.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://models.dev/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."
        },
        "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"
              },
              "reasoning_options": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "effort"
                          ]
                        },
                        "values": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "type",
                        "values"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "toggle"
                          ]
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "budget_tokens"
                          ]
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "description": "Reasoning controls the model accepts, used to build its variants"
              },
              "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"
                ]
              },
              "cachePromptTTL": {
                "type": "string",
                "enum": [
                  "5m",
                  "1h"
                ]
              },
              "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"
        },
        "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)."
        }
      },
      "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"
        },
        "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
    },
    "Policy.Effect": {
      "type": "string",
      "enum": [
        "allow",
        "deny"
      ]
    },
    "ConfigV2.Experimental.Policy": {
      "type": "object",
      "properties": {
        "action": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "provider.use"
                  ]
                }
              ]
            }
          ]
        },
        "effect": {
          "$ref": "#/$defs/Policy.Effect"
        },
        "resource": {
          "type": "string"
        }
      },
      "required": [
        "action",
        "effect",
        "resource"
      ],
      "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://models.dev/model-schema.json#/$defs/Model"
              },
              "variant": {
                "type": "string"
              },
              "subtask": {
                "type": "boolean"
              }
            },
            "required": [
              "template"
            ],
            "additionalProperties": false
          },
          "description": "Command configuration, see https://opencode.ai/docs/commands"
        },
        "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": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing"
        },
        "autoshare": {
          "type": "boolean",
          "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically"
        },
        "autoupdate": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string",
              "enum": [
                "notify"
              ]
            }
          ],
          "description": "Check for new versions and show an update notice. Updates are never installed automatically; confirm the notice or run `horde upgrade`. Set to false to disable update checks. true and 'notify' behave the same"
        },
        "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://models.dev/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://models.dev/model-schema.json#/$defs/Model"
        },
        "vision_model": {
          "type": "string",
          "description": "Model to use for image/vision subagent tasks in the format of provider/model. If unset, a vision-capable model is chosen automatically (in-house models preferred, then cheapest)."
        },
        "model_groups": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "default": {
                    "type": "string"
                  },
                  "models": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "default"
                ],
                "additionalProperties": false
              }
            ]
          },
          "description": "Named model groups (capability tiers, e.g. ultra/standard/lite). Each group has a default model and optional member models. A group name can be used anywhere a provider/model string is accepted."
        },
        "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 3 (main agent, coordinating supervisor, workers, helpers). Values above 8 are capped at 8. Set 1 to keep 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://opencode.ai/docs/agents"
        },
        "harness": {
          "type": "object",
          "properties": {
            "docs": {
              "type": "string",
              "description": "Directory where harness skills save specs, plans, and reports. Relative paths are passed to the agent prompt verbatim; set docs_absolute: true to anchor them to the project root. Defaults to docs/harness."
            },
            "docs_absolute": {
              "type": "boolean",
              "description": "Whether the docs directory injected into the harness prompt is an absolute path. When false (default), a relative `docs` value is passed through verbatim. When true, a relative `docs` is resolved against the active worktree root so it is unambiguous regardless of the agent's working directory. Ignored when `docs` is already absolute."
            }
          },
          "additionalProperties": false,
          "description": "Harness mode configuration"
        },
        "workflow": {
          "type": "object",
          "properties": {
            "maxConcurrentAgents": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "string",
                  "enum": [
                    "NaN"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "Infinity"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "-Infinity"
                  ]
                }
              ],
              "description": "Process-wide ceiling on subagents running concurrently across ALL workflow runs."
            },
            "scriptDeadlineMs": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "string",
                  "enum": [
                    "NaN"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "Infinity"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "-Infinity"
                  ]
                }
              ],
              "description": "Wall-clock budget for a whole workflow script, in milliseconds."
            }
          },
          "additionalProperties": false,
          "description": "Dynamic workflow runtime settings."
        },
        "supervisor": {
          "type": "object",
          "properties": {
            "max_subagents": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Subagents the supervisor tool runs at once in one session tree (the session and every session under it). Default: 8. Values above 16 are capped at 16. Workflow agents have their own limit (workflow.maxConcurrentAgents)."
            }
          },
          "additionalProperties": false,
          "description": "Supervisor tool settings."
        },
        "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"
          }
        },
        "tool": {
          "type": "object",
          "properties": {
            "invocation_style": {
              "type": "string",
              "enum": [
                "json",
                "shell"
              ],
              "description": "Default invocation style for all tools. 'json' (default) exposes the original Zod schema; 'shell' exposes a single `script` parameter and uses the tool's shell.parse mapping."
            },
            "invocation_style_by_tool": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "enum": [
                  "json",
                  "shell"
                ]
              },
              "description": "Per-tool override of invocation_style. Keys are tool IDs. A tool without a `shell` field falls back to JSON regardless of this setting."
            }
          },
          "additionalProperties": false,
          "description": "Tool invocation style configuration (JSON vs shell-style)."
        },
        "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
        },
        "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."
        },
        "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."
            },
            "max_context": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "minimum": 0,
                      "type": "integer",
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "minimum": 0,
                        "type": "integer",
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                }
              ],
              "description": "Compact earlier than the model window. A token count (300000), a shorthand string (\"300K\", \"1M\", \"50%\"), or a map keyed by \"<providerID>/<modelID>\" with wildcards (\"openai/gpt-5*\"). Always clamped to the model's real window — it can only lower the compaction trigger, never raise it. 0 means no budget."
            }
          },
          "additionalProperties": false
        },
        "checkpoint": {
          "type": "object",
          "properties": {
            "thresholds": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Context fill thresholds that trigger checkpoint writes. Strings may be percentages (\"40%\"), absolute tokens (\"100K\", \"1.5M\"), or mixed (\"100K\", \"50%\"). Each threshold must be <= window - 20K reserved. Default: [\"40%\", \"60%\", \"80%\"]."
            },
            "reserved": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Token buffer reserved for checkpoint operations. Default: 20000."
            },
            "max_writer_failures": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Deprecated: has no effect; kept so existing configs still load."
            },
            "fork": {
              "type": "boolean",
              "description": "Whether to fork the parent agent's message prefix into the writer session for prefix-cache reuse. Requires provider cache-breakpoint support. Default: false."
            },
            "push_caps": {
              "type": "object",
              "properties": {
                "tasks_ledger": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the tasks ledger section of rebuild context. Default: 2000."
                },
                "focus_task": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the focus task body in rebuild context. Default: 4000."
                },
                "supervisor_ledger": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the supervisor ledger section of rebuild context. Default: 500."
                },
                "memory_titles": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for memory titles in rebuild context. Default: 500."
                },
                "global": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the global memory section (global/MEMORY.md) of rebuild context. Default: 6000."
                },
                "checkpoint": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the session checkpoint section (checkpoint.md) of rebuild context. Default: 11000."
                },
                "memory": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the project memory section (MEMORY.md) of rebuild context. Default: 10000."
                },
                "notes": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the session notes (notes.md) of rebuild context. Default: 6000."
                },
                "design_decisions": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for §10 Design decisions section of checkpoint.md (writer-side budget validation). Default: 3000."
                },
                "open_notes": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for §11 Open notes section of checkpoint.md (writer-side budget validation). Default: 800."
                },
                "recent_user": {
                  "minimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Token cap for the recent user input section (verbatim user messages from the live DB, FIFO eviction). Default: 16000. Set 0 to disable."
                },
                "recent_user_per_msg": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Per-message cap inside recent user input section; oversized messages get head/tail truncation with messageID elision marker. Default: 2000."
                }
              },
              "additionalProperties": false,
              "description": "Per-section token caps for rebuild context (renderRebuildContext). Each section is loaded up to its cap so the rebuild stays within a predictable budget."
            },
            "task_archive_days": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Days after a task is done or abandoned before it is hidden from task lists that exclude archived tasks. Rows are kept, not deleted. Default: 7."
            },
            "task_cleanup_days": {
              "exclusiveMinimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Deprecated alias of task_archive_days."
            },
            "memory_reconcile_on_search": {
              "type": "boolean",
              "description": "Whether to reconcile memory state on search operations. Default: true."
            },
            "memory_search_score_floor": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "string",
                  "enum": [
                    "NaN"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "Infinity"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "-Infinity"
                  ]
                }
              ],
              "description": "Relative BM25 floor for memory.search (OR-joined query): keep results scoring >= this fraction of the top hit, dropping common-word-only noise. The #1 result is always kept. Default: 0.15. Set 0 to keep all matches."
            }
          },
          "additionalProperties": false
        },
        "memory": {
          "type": "object",
          "properties": {
            "disable_write": {
              "type": "boolean",
              "description": "Stop WRITING new memory. Default: false (memory is written). When true, no new memory is produced — session checkpoint.md, project MEMORY.md, notes.md and per-task progress.md are never written, the high-pressure 'save your learnings to memory' nudge is suppressed, and automatic dream/distill runs are skipped. Existing memory stays READABLE on demand: the builtin `memory` search tool keeps working and the files can still be read directly. What does stop is the AUTOMATIC injection — checkpoint rebuild is short-circuited to compaction while writing is off, and the memory dumps that a rebuild would have placed in context are only produced by that rebuild, so nothing is loaded on its own; an agent that wants memory has to search or read for it. Nothing is ever deleted — set it back to false to resume writing on top of the existing files."
            },
            "cc_index": {
              "type": "boolean",
              "description": "Index Claude Code memory (~/.claude/projects/<slug>/memory) and expose under scope='cc'. Default: false. Note: when enabled, every hordecode agent (build/explore/subagents) can search these memories via the builtin `memory` tool — including CC's `type: user` (your role/preferences) and `type: feedback` (your guidance) categories. CC originally writes them for future CC sessions; flipping this on widens the consumer set to hordecode agents on the same machine. Leave disabled (default) if you don't want personal context recallable from a prompt-injection-vulnerable agent."
            },
            "embedding": {
              "type": "boolean",
              "description": "Enable semantic (vector) memory search. Default false. When true the embedding model (about 133 MB) is downloaded once into <cache>/models on first use; search stays keyword-only until it is ready."
            }
          },
          "additionalProperties": false
        },
        "history": {
          "type": "object",
          "properties": {
            "kinds": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "user_text",
                  "assistant_text",
                  "tool_input",
                  "tool_error",
                  "reasoning",
                  "tool_output"
                ]
              },
              "description": "Which part kinds the history FTS index should cover. Defaults to text (user/assistant) + tool input + tool errors. Add 'reasoning' or 'tool_output' to grow recall at the cost of database size. Note: enabling 'tool_output' reclassifies completed tools from kind='tool_input' to kind='tool_output' (input remains searchable in the body, but kind:['tool_input'] filter will then only match pending/error tools)."
            }
          },
          "additionalProperties": false,
          "description": "Trajectory (conversation history) FTS index configuration."
        },
        "dream": {
          "type": "object",
          "properties": {
            "auto": {
              "type": "boolean",
              "description": "Auto-trigger dream memory consolidation on new session start. Default: false (no background work without opting in)."
            },
            "interval_days": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Minimum days between automatic dream runs. Set to 0 to trigger on every new session. Default: 7."
            }
          },
          "additionalProperties": false
        },
        "distill": {
          "type": "object",
          "properties": {
            "auto": {
              "type": "boolean",
              "description": "Auto-trigger distill workflow packaging on new session start. Default: false (no background work without opting in)."
            },
            "interval_days": {
              "minimum": 0,
              "type": "integer",
              "maximum": 9007199254740991,
              "description": "Minimum days between automatic distill runs. Default: 30."
            }
          },
          "additionalProperties": false
        },
        "cron": {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "description": "Default timezone (IANA, e.g. Europe/Istanbul) for cron schedule jobs. Omit = system local timezone."
            }
          },
          "additionalProperties": false,
          "description": "Cron scheduling defaults."
        },
        "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."
            },
            "switches": {
              "type": "object",
              "properties": {
                "workspaces": {
                  "type": "boolean"
                },
                "orchestrator": {
                  "type": "boolean"
                },
                "workflow_tool": {
                  "type": "boolean"
                },
                "cron": {
                  "type": "boolean"
                },
                "permission_audit": {
                  "type": "boolean"
                },
                "sandbox": {
                  "type": "boolean"
                },
                "hashline": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false,
              "description": "Turn on Hordecode experimental features. Read once at startup; restart to apply. An environment variable that is set always wins."
            },
            "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"
            },
            "predict_next_prompt": {
              "type": "boolean",
              "description": "Predict the user's likely next prompt after each turn and show it as inline ghost text (Tab to accept). Enabled by default; set to false to disable."
            },
            "policies": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ConfigV2.Experimental.Policy"
              },
              "description": "Policy statements applied to supported resources, such as provider access"
            },
            "maxMode": {
              "type": "object",
              "properties": {
                "candidates": {
                  "exclusiveMinimum": 0,
                  "type": "integer",
                  "maximum": 9007199254740991,
                  "description": "Number of parallel reasoning candidates per step in max mode (default 5)."
                }
              },
              "additionalProperties": false,
              "description": "Max mode (experimental): the 'max' agent runs N parallel reasoning candidates each step, picks the best via a judge call, and executes only the winner."
            },
            "try_best": {
              "type": "object",
              "properties": {
                "edit_window": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                "edit_similarity": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                "edit_matches": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                "action_streak": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                "bash_retries": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                }
              },
              "additionalProperties": false
            },
            "advisor": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "model": {
                  "type": "string",
                  "$ref": "https://models.dev/model-schema.json#/$defs/Model"
                },
                "triggers": {
                  "type": "object",
                  "properties": {
                    "files_touched": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "enum": [
                            "NaN"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "Infinity"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "-Infinity"
                          ]
                        }
                      ]
                    },
                    "tool_failures": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "enum": [
                            "NaN"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "Infinity"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "-Infinity"
                          ]
                        }
                      ]
                    },
                    "same_error": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "enum": [
                            "NaN"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "Infinity"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "-Infinity"
                          ]
                        }
                      ]
                    },
                    "context_percent": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "enum": [
                            "NaN"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "Infinity"
                          ]
                        },
                        {
                          "type": "string",
                          "enum": [
                            "-Infinity"
                          ]
                        }
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "sensitivity": {
                  "type": "string",
                  "enum": [
                    "low",
                    "default",
                    "high"
                  ],
                  "description": "How readily the advisor reviews: low (quiet), default, high (watchful). Explicit triggers and cooldown_steps override it."
                },
                "min_severity": {
                  "type": "string",
                  "enum": [
                    "nit",
                    "concern",
                    "blocker"
                  ]
                },
                "max_notes": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                },
                "cooldown_steps": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "enum": [
                        "NaN"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "Infinity"
                      ]
                    },
                    {
                      "type": "string",
                      "enum": [
                        "-Infinity"
                      ]
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "Advisor (experimental, off by default): a second model reviews the agent when the work looks risky (many files touched, repeated tool failures, high context use) and adds short notes for the next step. Runs only when enabled is true and model is set."
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "allowComments": true,
  "allowTrailingCommas": true
}