{
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema URL used by editors for validation and autocomplete."
    },
    "ignoreContextFiles": {
      "type": "boolean",
      "description": "Disable AGENTS.md / CLAUDE.md discovery for sessions started in this project, equivalent to pi --no-context-files."
    },
    "maxProjectSessions": {
      "type": "number",
      "description": "Maximum number of pi session JSONL files to retain per project. Set to 0 to disable automatic session deletion.",
      "minimum": 0
    },
    "defaultModel": {
      "type": "object",
      "properties": {
        "modelRef": {
          "type": "string",
          "description": "Provider/model identifier, e.g. 'openai-codex/gpt-5.4'."
        },
        "fallbackModels": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Fallback provider/model identifier."
          },
          "description": "Ordered default-model fallbacks tried after modelRef."
        },
        "thinking": {
          "anyOf": [
            {
              "type": "string",
              "const": "off"
            },
            {
              "type": "string",
              "const": "minimal"
            },
            {
              "type": "string",
              "const": "low"
            },
            {
              "type": "string",
              "const": "medium"
            },
            {
              "type": "string",
              "const": "high"
            },
            {
              "type": "string",
              "const": "xhigh"
            },
            {
              "type": "string",
              "const": "max"
            }
          ],
          "description": "Default model thinking budget level."
        }
      },
      "description": "Default model selection for new sessions."
    },
    "visibleModels": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Provider/model identifier shown in Pix model pickers."
      },
      "description": "User-level whitelist shared by Pix TUI and Desktop model pickers. Omit to show every available model."
    },
    "thinkingByModel": {
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "anyOf": [
            {
              "type": "string",
              "const": "off"
            },
            {
              "type": "string",
              "const": "minimal"
            },
            {
              "type": "string",
              "const": "low"
            },
            {
              "type": "string",
              "const": "medium"
            },
            {
              "type": "string",
              "const": "high"
            },
            {
              "type": "string",
              "const": "xhigh"
            },
            {
              "type": "string",
              "const": "max"
            }
          ]
        }
      },
      "description": "User-level last-applied thinking level per provider/model, shared by Pix TUI and Desktop model pickers."
    },
    "toolRenderer": {
      "type": "object",
      "properties": {
        "default": {
          "type": "object",
          "properties": {
            "previewLines": {
              "type": "number",
              "description": "Lines to show in the tool preview.",
              "minimum": 0
            },
            "direction": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "head"
                },
                {
                  "type": "string",
                  "const": "tail"
                }
              ],
              "description": "Show preview from head or tail of output."
            },
            "color": {
              "type": "string",
              "description": "Theme color name (e.g. 'warning', 'success', 'muted') or hex color."
            },
            "defaultExpanded": {
              "type": "boolean",
              "description": "Whether the tool output is expanded by default."
            },
            "compactHidden": {
              "type": "boolean",
              "description": "Hide tool output but keep a compact one-line placeholder."
            },
            "hidden": {
              "type": "boolean",
              "description": "Completely hide the tool output."
            }
          },
          "description": "Rendering rule for a specific tool or glob pattern."
        },
        "tools": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "object",
              "properties": {
                "previewLines": {
                  "type": "number",
                  "description": "Lines to show in the tool preview.",
                  "minimum": 0
                },
                "direction": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": "head"
                    },
                    {
                      "type": "string",
                      "const": "tail"
                    }
                  ],
                  "description": "Show preview from head or tail of output."
                },
                "color": {
                  "type": "string",
                  "description": "Theme color name (e.g. 'warning', 'success', 'muted') or hex color."
                },
                "defaultExpanded": {
                  "type": "boolean",
                  "description": "Whether the tool output is expanded by default."
                },
                "compactHidden": {
                  "type": "boolean",
                  "description": "Hide tool output but keep a compact one-line placeholder."
                },
                "hidden": {
                  "type": "boolean",
                  "description": "Completely hide the tool output."
                }
              },
              "description": "Rendering rule for a specific tool or glob pattern."
            }
          },
          "description": "Tool-specific rendering rules keyed by tool name or glob pattern, e.g. 'bash' or 'repo_*'."
        }
      },
      "description": "Per-tool rendering configuration. Keys in 'tools' support glob patterns like 'repo_*'."
    },
    "outputFilters": {
      "type": "object",
      "properties": {
        "patterns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Glob or /regex/ patterns to strip from tool output."
        }
      },
      "description": "Output filter patterns."
    },
    "promptEnhancer": {
      "type": "object",
      "properties": {
        "modelRef": {
          "type": "string",
          "description": "Model used for prompt enhancement."
        },
        "fallbackModels": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Fallback provider/model identifier."
          },
          "description": "Ordered prompt-enhancer fallbacks tried after modelRef."
        }
      },
      "description": "Prompt enhancer configuration."
    },
    "autocomplete": {
      "type": "object",
      "properties": {
        "modelRef": {
          "type": "string",
          "description": "Model for inline autocomplete. Empty string disables LLM autocomplete."
        },
        "fallbackModels": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Fallback provider/model identifier."
          },
          "description": "Ordered autocomplete fallbacks tried after modelRef."
        },
        "debounceMs": {
          "type": "number",
          "description": "Delay after typing before requesting completion.",
          "minimum": 100,
          "maximum": 2000
        },
        "timeoutMs": {
          "type": "number",
          "description": "Hard timeout for completion request.",
          "minimum": 250,
          "maximum": 10000
        },
        "maxTokens": {
          "type": "number",
          "description": "Maximum output tokens.",
          "minimum": 8,
          "maximum": 256
        },
        "maxPromptTokens": {
          "type": "number",
          "description": "Maximum input prompt tokens.",
          "minimum": 256,
          "maximum": 16000
        },
        "includeRecentMessages": {
          "type": "number",
          "description": "Recent messages to include as context.",
          "minimum": 0,
          "maximum": 20
        }
      },
      "description": "Inline autocomplete configuration."
    },
    "sessionTitle": {
      "type": "object",
      "properties": {
        "modelRef": {
          "type": "string",
          "description": "Model used to generate compact session titles."
        },
        "fallbackModels": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "Fallback provider/model identifiers to try after the primary title model exhausts its retries."
          }
        }
      },
      "description": "Automatic session title generation configuration."
    },
    "modelColors": {
      "anyOf": [
        {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "description": "Theme color name for matching model references, e.g. 'success', 'warning', or 'modelOpenAI'."
            }
          },
          "description": "Model reference glob pattern → theme color name mapping, e.g. 'zai/*': 'success'."
        },
        {
          "type": "object",
          "properties": {
            "rules": {
              "type": "object",
              "patternProperties": {
                "^.*$": {
                  "type": "string",
                  "description": "Theme color name for matching model references, e.g. 'success', 'warning', or 'modelOpenAI'."
                }
              },
              "description": "Model reference glob pattern → theme color name mapping, e.g. 'zai/*': 'success'."
            }
          },
          "description": "Alternative nested form for model color rules."
        }
      ],
      "description": "Model color rules. Keys are glob patterns matching model refs; values are pix theme color names."
    },
    "iconTheme": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Icon theme name, e.g. 'nerdFont' or 'fallback'."
        }
      },
      "description": "Icon theme configuration."
    },
    "dictation": {
      "type": "object",
      "properties": {
        "apiKey": {
          "type": "string",
          "description": "Deepgram API key used by terminal and desktop voice input. Store it in the user config (~/.config/pi/pix.jsonc); project-level .pi/pix.jsonc does not override this secret."
        },
        "language": {
          "type": "string",
          "description": "Selected language code, e.g. 'en' or 'ru'."
        },
        "model": {
          "type": "string",
          "description": "Deepgram speech-to-text model. Defaults to 'nova-3'."
        },
        "languages": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "object",
              "required": [
                "label"
              ],
              "properties": {
                "label": {
                  "type": "string",
                  "description": "Human-readable language label."
                },
                "deepgramLanguage": {
                  "type": "string",
                  "description": "Deepgram language code. Defaults to the language map key."
                },
                "dirName": {
                  "type": "string",
                  "description": "Deprecated legacy Vosk model directory name; ignored by Deepgram dictation."
                },
                "url": {
                  "type": "string",
                  "description": "Deprecated legacy Vosk model URL; ignored by Deepgram dictation."
                }
              },
              "description": "Deepgram voice dictation language definition."
            }
          },
          "description": "Available dictation languages keyed by local language code."
        }
      },
      "description": "Voice dictation (Deepgram) configuration. Uses dictation.apiKey from the user pix config, with DEEPGRAM_API_KEY as a compatibility fallback."
    },
    "desktop": {
      "type": "object",
      "properties": {
        "externalEditor": {
          "type": "string",
          "description": "External editor used by Pix Desktop project explorer. Known aliases include zed, code/vscode, cursor, subl/sublime, idea/intellij, and webstorm; an executable path/name is also accepted."
        },
        "git": {
          "type": "object",
          "properties": {
            "reviewModelRef": {
              "type": "string",
              "description": "Model reference used by Pix Desktop and TUI for LLM review of Git diffs, optionally with a :thinking suffix."
            },
            "reviewFallbackModels": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Ordered fallback model references used for Git diff review."
            },
            "commitMessageModelRef": {
              "type": "string",
              "description": "Model reference used by Pix Desktop and TUI to generate Git commit messages, optionally with a :thinking suffix."
            },
            "commitMessageFallbackModels": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Ordered fallback model references used for Git commit-message generation."
            }
          },
          "description": "Pix Git/Source Control LLM preferences shared by Desktop and TUI."
        }
      },
      "description": "Pix Desktop preferences; the nested git model settings are also consumed by TUI Git helpers for compatibility."
    }
  },
  "$id": "https://unpkg.com/pi-ui-extend/schemas/pix.json",
  "$schema": "https://json-schema.org/draft-07/schema#",
  "title": "Pix Configuration",
  "description": "Configuration for the pix terminal renderer (~/.config/pi/pix.jsonc, with project overrides in <cwd>/.pi/pix.jsonc).",
  "additionalProperties": true
}
