{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "Agent": {
      "properties": {
        "id": {
          "type": "string",
          "enum": [
            "coder",
            "task",
            "coder",
            "task"
          ],
          "title": "Agent ID",
          "description": "Unique identifier for the agent"
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Display name of the agent"
        },
        "description": {
          "type": "string",
          "title": "Description",
          "description": "Description of what the agent does"
        },
        "disabled": {
          "type": "boolean",
          "title": "Disabled",
          "description": "Whether this agent is disabled",
          "default": false
        },
        "model": {
          "type": "string",
          "enum": [
            "large",
            "small",
            "large",
            "small"
          ],
          "title": "Model Type",
          "description": "Type of model to use (large or small)"
        },
        "allowed_tools": {
          "items": {
            "type": "string",
            "enum": [
              "bash",
              "edit",
              "fetch",
              "glob",
              "grep",
              "ls",
              "sourcegraph",
              "view",
              "write",
              "agent"
            ]
          },
          "type": "array",
          "title": "Allowed Tools",
          "description": "List of tools this agent is allowed to use (if nil all tools are allowed)"
        },
        "allowed_mcp": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object",
          "title": "Allowed MCP",
          "description": "Map of MCP servers this agent can use and their allowed tools"
        },
        "allowed_lsp": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Allowed LSP",
          "description": "List of LSP servers this agent can use (if nil all LSPs are allowed)"
        },
        "context_paths": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Context Paths",
          "description": "Custom context paths for this agent (additive to global context paths)"
        }
      },
      "type": "object",
      "required": [
        "model"
      ]
    },
    "LSPConfig": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "description": "Whether this LSP server is enabled",
          "default": true
        },
        "command": {
          "type": "string",
          "title": "Command",
          "description": "Command to execute for the LSP server"
        },
        "args": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Arguments",
          "description": "Command line arguments for the LSP server"
        },
        "options": {
          "title": "Options",
          "description": "LSP server specific options"
        }
      },
      "type": "object",
      "required": [
        "command"
      ]
    },
    "MCP": {
      "properties": {
        "command": {
          "type": "string",
          "title": "Command",
          "description": "Command to execute for stdio MCP servers"
        },
        "env": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Environment",
          "description": "Environment variables for the MCP server"
        },
        "args": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Arguments",
          "description": "Command line arguments for the MCP server"
        },
        "type": {
          "type": "string",
          "enum": [
            "stdio",
            "sse",
            "stdio",
            "sse"
          ],
          "title": "Type",
          "description": "Type of MCP connection",
          "default": "stdio"
        },
        "url": {
          "type": "string",
          "title": "URL",
          "description": "URL for SSE MCP servers"
        },
        "headers": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Headers",
          "description": "HTTP headers for SSE MCP servers"
        }
      },
      "type": "object",
      "required": [
        "command",
        "type"
      ]
    },
    "Model": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Model ID",
          "description": "Unique identifier for the model"
        },
        "name": {
          "type": "string",
          "title": "Model Name",
          "description": "Display name of the model"
        },
        "cost_per_1m_in": {
          "type": "number",
          "minimum": 0,
          "title": "Input Cost",
          "description": "Cost per 1 million input tokens"
        },
        "cost_per_1m_out": {
          "type": "number",
          "minimum": 0,
          "title": "Output Cost",
          "description": "Cost per 1 million output tokens"
        },
        "cost_per_1m_in_cached": {
          "type": "number",
          "minimum": 0,
          "title": "Cached Input Cost",
          "description": "Cost per 1 million cached input tokens"
        },
        "cost_per_1m_out_cached": {
          "type": "number",
          "minimum": 0,
          "title": "Cached Output Cost",
          "description": "Cost per 1 million cached output tokens"
        },
        "context_window": {
          "type": "integer",
          "minimum": 1,
          "title": "Context Window",
          "description": "Maximum context window size in tokens"
        },
        "default_max_tokens": {
          "type": "integer",
          "minimum": 1,
          "title": "Default Max Tokens",
          "description": "Default maximum tokens for responses"
        },
        "can_reason": {
          "type": "boolean",
          "title": "Can Reason",
          "description": "Whether the model supports reasoning capabilities"
        },
        "reasoning_effort": {
          "type": "string",
          "title": "Reasoning Effort",
          "description": "Default reasoning effort level for reasoning models"
        },
        "has_reasoning_effort": {
          "type": "boolean",
          "title": "Has Reasoning Effort",
          "description": "Whether the model supports reasoning effort configuration"
        },
        "supports_attachments": {
          "type": "boolean",
          "title": "Supports Images",
          "description": "Whether the model supports image attachments"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "cost_per_1m_out_cached",
        "context_window",
        "default_max_tokens",
        "can_reason",
        "reasoning_effort",
        "has_reasoning_effort",
        "supports_attachments"
      ]
    },
    "Options": {
      "properties": {
        "context_paths": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Context Paths",
          "description": "List of paths to search for context files",
          "default": [
            ".github/copilot-instructions.md",
            ".cursorrules",
            ".cursor/rules/",
            "CLAUDE.md",
            "CLAUDE.local.md",
            "GEMINI.md",
            "gemini.md",
            "crush.md",
            "crush.local.md",
            "Crush.md",
            "Crush.local.md",
            "CRUSH.md",
            "CRUSH.local.md"
          ]
        },
        "tui": {
          "$ref": "#/$defs/TUIOptions",
          "title": "TUI Options",
          "description": "Terminal UI configuration options"
        },
        "debug": {
          "type": "boolean",
          "title": "Debug",
          "description": "Enable debug logging",
          "default": false
        },
        "debug_lsp": {
          "type": "boolean",
          "title": "Debug LSP",
          "description": "Enable LSP debug logging",
          "default": false
        },
        "disable_auto_summarize": {
          "type": "boolean",
          "title": "Disable Auto Summarize",
          "description": "Disable automatic conversation summarization",
          "default": false
        },
        "data_directory": {
          "type": "string",
          "title": "Data Directory",
          "description": "Directory for storing application data",
          "default": ".crush"
        }
      },
      "type": "object"
    },
    "PreferredModel": {
      "properties": {
        "model_id": {
          "type": "string",
          "enum": [
            "claude-opus-4-20250514",
            "claude-sonnet-4-20250514",
            "claude-3-7-sonnet-20250219",
            "claude-3-5-haiku-20241022",
            "claude-3-5-sonnet-20240620",
            "claude-3-5-sonnet-20241022",
            "codex-mini-latest",
            "o4-mini",
            "o3",
            "o3-pro",
            "gpt-4.1",
            "gpt-4.1-mini",
            "gpt-4.1-nano",
            "gpt-4.5-preview",
            "o3-mini",
            "gpt-4o",
            "gpt-4o-mini",
            "gemini-2.5-pro",
            "gemini-2.5-flash",
            "codex-mini-latest",
            "o4-mini",
            "o3",
            "o3-pro",
            "gpt-4.1",
            "gpt-4.1-mini",
            "gpt-4.1-nano",
            "gpt-4.5-preview",
            "o3-mini",
            "gpt-4o",
            "gpt-4o-mini",
            "anthropic.claude-opus-4-20250514-v1:0",
            "anthropic.claude-sonnet-4-20250514-v1:0",
            "anthropic.claude-3-7-sonnet-20250219-v1:0",
            "anthropic.claude-3-5-haiku-20241022-v1:0",
            "gemini-2.5-pro",
            "gemini-2.5-flash",
            "grok-3-mini",
            "grok-3",
            "mistralai/mistral-small-3.2-24b-instruct:free",
            "mistralai/mistral-small-3.2-24b-instruct",
            "minimax/minimax-m1:extended",
            "minimax/minimax-m1",
            "google/gemini-2.5-flash-lite-preview-06-17",
            "google/gemini-2.5-flash",
            "google/gemini-2.5-pro",
            "openai/o3-pro",
            "x-ai/grok-3-mini",
            "x-ai/grok-3",
            "mistralai/magistral-small-2506",
            "mistralai/magistral-medium-2506",
            "mistralai/magistral-medium-2506:thinking",
            "google/gemini-2.5-pro-preview",
            "deepseek/deepseek-r1-0528",
            "anthropic/claude-opus-4",
            "anthropic/claude-sonnet-4",
            "mistralai/devstral-small:free",
            "mistralai/devstral-small",
            "google/gemini-2.5-flash-preview-05-20",
            "google/gemini-2.5-flash-preview-05-20:thinking",
            "openai/codex-mini",
            "mistralai/mistral-medium-3",
            "google/gemini-2.5-pro-preview-05-06",
            "arcee-ai/caller-large",
            "arcee-ai/virtuoso-large",
            "arcee-ai/virtuoso-medium-v2",
            "qwen/qwen3-30b-a3b",
            "qwen/qwen3-14b",
            "qwen/qwen3-32b",
            "qwen/qwen3-235b-a22b",
            "google/gemini-2.5-flash-preview",
            "google/gemini-2.5-flash-preview:thinking",
            "openai/o4-mini-high",
            "openai/o3",
            "openai/o4-mini",
            "openai/gpt-4.1",
            "openai/gpt-4.1-mini",
            "openai/gpt-4.1-nano",
            "x-ai/grok-3-mini-beta",
            "x-ai/grok-3-beta",
            "meta-llama/llama-4-maverick",
            "meta-llama/llama-4-scout",
            "all-hands/openhands-lm-32b-v0.1",
            "google/gemini-2.5-pro-exp-03-25",
            "deepseek/deepseek-chat-v3-0324:free",
            "deepseek/deepseek-chat-v3-0324",
            "mistralai/mistral-small-3.1-24b-instruct:free",
            "mistralai/mistral-small-3.1-24b-instruct",
            "ai21/jamba-1.6-large",
            "ai21/jamba-1.6-mini",
            "openai/gpt-4.5-preview",
            "google/gemini-2.0-flash-lite-001",
            "anthropic/claude-3.7-sonnet",
            "anthropic/claude-3.7-sonnet:beta",
            "anthropic/claude-3.7-sonnet:thinking",
            "mistralai/mistral-saba",
            "openai/o3-mini-high",
            "google/gemini-2.0-flash-001",
            "qwen/qwen-turbo",
            "qwen/qwen-plus",
            "qwen/qwen-max",
            "openai/o3-mini",
            "mistralai/mistral-small-24b-instruct-2501",
            "deepseek/deepseek-r1-distill-llama-70b",
            "deepseek/deepseek-r1",
            "mistralai/codestral-2501",
            "deepseek/deepseek-chat",
            "openai/o1",
            "x-ai/grok-2-1212",
            "meta-llama/llama-3.3-70b-instruct",
            "amazon/nova-lite-v1",
            "amazon/nova-micro-v1",
            "amazon/nova-pro-v1",
            "openai/gpt-4o-2024-11-20",
            "mistralai/mistral-large-2411",
            "mistralai/mistral-large-2407",
            "mistralai/pixtral-large-2411",
            "thedrummer/unslopnemo-12b",
            "anthropic/claude-3.5-haiku:beta",
            "anthropic/claude-3.5-haiku",
            "anthropic/claude-3.5-haiku-20241022:beta",
            "anthropic/claude-3.5-haiku-20241022",
            "anthropic/claude-3.5-sonnet:beta",
            "anthropic/claude-3.5-sonnet",
            "x-ai/grok-beta",
            "mistralai/ministral-8b",
            "mistralai/ministral-3b",
            "nvidia/llama-3.1-nemotron-70b-instruct",
            "google/gemini-flash-1.5-8b",
            "meta-llama/llama-3.2-11b-vision-instruct",
            "meta-llama/llama-3.2-3b-instruct",
            "qwen/qwen-2.5-72b-instruct",
            "mistralai/pixtral-12b",
            "cohere/command-r-plus-08-2024",
            "cohere/command-r-08-2024",
            "microsoft/phi-3.5-mini-128k-instruct",
            "nousresearch/hermes-3-llama-3.1-70b",
            "openai/gpt-4o-2024-08-06",
            "meta-llama/llama-3.1-405b-instruct",
            "meta-llama/llama-3.1-70b-instruct",
            "meta-llama/llama-3.1-8b-instruct",
            "mistralai/mistral-nemo",
            "openai/gpt-4o-mini",
            "openai/gpt-4o-mini-2024-07-18",
            "anthropic/claude-3.5-sonnet-20240620:beta",
            "anthropic/claude-3.5-sonnet-20240620",
            "mistralai/mistral-7b-instruct-v0.3",
            "mistralai/mistral-7b-instruct:free",
            "mistralai/mistral-7b-instruct",
            "microsoft/phi-3-mini-128k-instruct",
            "microsoft/phi-3-medium-128k-instruct",
            "google/gemini-flash-1.5",
            "openai/gpt-4o-2024-05-13",
            "openai/gpt-4o",
            "openai/gpt-4o:extended",
            "meta-llama/llama-3-8b-instruct",
            "meta-llama/llama-3-70b-instruct",
            "mistralai/mixtral-8x22b-instruct",
            "openai/gpt-4-turbo",
            "google/gemini-pro-1.5",
            "cohere/command-r-plus",
            "cohere/command-r-plus-04-2024",
            "cohere/command-r",
            "anthropic/claude-3-haiku:beta",
            "anthropic/claude-3-haiku",
            "anthropic/claude-3-opus:beta",
            "anthropic/claude-3-opus",
            "anthropic/claude-3-sonnet:beta",
            "anthropic/claude-3-sonnet",
            "cohere/command-r-03-2024",
            "mistralai/mistral-large",
            "openai/gpt-3.5-turbo-0613",
            "openai/gpt-4-turbo-preview",
            "mistralai/mistral-small",
            "mistralai/mistral-tiny",
            "mistralai/mixtral-8x7b-instruct",
            "openai/gpt-4-1106-preview",
            "mistralai/mistral-7b-instruct-v0.1",
            "openai/gpt-3.5-turbo-16k",
            "openai/gpt-4",
            "openai/gpt-4-0314"
          ],
          "title": "Model ID",
          "description": "ID of the preferred model"
        },
        "provider": {
          "type": "string",
          "enum": [
            "anthropic",
            "openai",
            "gemini",
            "azure",
            "bedrock",
            "vertex",
            "xai",
            "openrouter"
          ],
          "title": "Provider",
          "description": "Provider for the preferred model"
        },
        "reasoning_effort": {
          "type": "string",
          "title": "Reasoning Effort",
          "description": "Override reasoning effort for this model"
        },
        "max_tokens": {
          "type": "integer",
          "minimum": 1,
          "title": "Max Tokens",
          "description": "Override max tokens for this model"
        },
        "think": {
          "type": "boolean",
          "title": "Think",
          "description": "Enable thinking for reasoning models",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "model_id",
        "provider"
      ]
    },
    "PreferredModels": {
      "properties": {
        "large": {
          "$ref": "#/$defs/PreferredModel",
          "title": "Large Model",
          "description": "Preferred model configuration for large model type"
        },
        "small": {
          "$ref": "#/$defs/PreferredModel",
          "title": "Small Model",
          "description": "Preferred model configuration for small model type"
        }
      },
      "type": "object"
    },
    "ProviderConfig": {
      "properties": {
        "id": {
          "type": "string",
          "enum": [
            "anthropic",
            "openai",
            "gemini",
            "azure",
            "bedrock",
            "vertex",
            "xai",
            "openrouter"
          ],
          "title": "Provider ID",
          "description": "Unique identifier for the provider"
        },
        "base_url": {
          "type": "string",
          "title": "Base URL",
          "description": "Base URL for the provider API (required for custom providers)"
        },
        "provider_type": {
          "type": "string",
          "title": "Provider Type",
          "description": "Type of the provider (openai"
        },
        "api_key": {
          "type": "string",
          "title": "API Key",
          "description": "API key for authenticating with the provider"
        },
        "disabled": {
          "type": "boolean",
          "title": "Disabled",
          "description": "Whether this provider is disabled",
          "default": false
        },
        "extra_headers": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Extra Headers",
          "description": "Additional HTTP headers to send with requests"
        },
        "extra_params": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Extra Parameters",
          "description": "Additional provider-specific parameters"
        },
        "default_large_model": {
          "type": "string",
          "title": "Default Large Model",
          "description": "Default model ID for large model type"
        },
        "default_small_model": {
          "type": "string",
          "title": "Default Small Model",
          "description": "Default model ID for small model type"
        },
        "models": {
          "items": {
            "$ref": "#/$defs/Model"
          },
          "type": "array",
          "title": "Models",
          "description": "List of available models for this provider"
        }
      },
      "type": "object",
      "required": [
        "provider_type"
      ]
    },
    "TUIOptions": {
      "properties": {
        "compact_mode": {
          "type": "boolean",
          "title": "Compact Mode",
          "description": "Enable compact mode for the TUI",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "compact_mode"
      ]
    }
  },
  "properties": {
    "models": {
      "$ref": "#/$defs/PreferredModels",
      "title": "Models",
      "description": "Preferred model configurations for large and small model types"
    },
    "providers": {
      "additionalProperties": {
        "$ref": "#/$defs/ProviderConfig"
      },
      "type": "object",
      "title": "Providers",
      "description": "LLM provider configurations"
    },
    "agents": {
      "additionalProperties": {
        "$ref": "#/$defs/Agent"
      },
      "type": "object",
      "title": "Agents",
      "description": "Agent configurations for different tasks"
    },
    "mcp": {
      "additionalProperties": {
        "$ref": "#/$defs/MCP"
      },
      "type": "object",
      "title": "MCP",
      "description": "Model Control Protocol server configurations"
    },
    "lsp": {
      "additionalProperties": {
        "$ref": "#/$defs/LSPConfig"
      },
      "type": "object",
      "title": "LSP",
      "description": "Language Server Protocol configurations"
    },
    "options": {
      "$ref": "#/$defs/Options",
      "title": "Options",
      "description": "General application options and settings"
    }
  },
  "type": "object",
  "title": "Crush Configuration",
  "description": "Configuration schema for the Crush application"
}
