Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ Documentation for `oxide-code` (`ox`) is organized into three user-facing bucket

## Reference

| Document | Topic |
| ------------------------------------------- | ------------------------------------------------------------------ |
| [ACP](reference/acp.md) | `ox acp` stdio JSON-RPC 2.0 server methods and streaming updates |
| [CLI](reference/cli.md) | Shipped subcommands, flags, session storage, and TUI keybindings |
| [Configuration](reference/configuration.md) | `config.toml` schema for providers, credentials, and model entries |
| [Hooks](reference/hooks.md) | Out-of-process command hooks, lifecycle events, and error policy |
| [MCP Plugin](reference/mcp-plugin.md) | `ox-plugin-mcp` stdio and Streamable HTTP MCP bridge configuration |
| [Models](reference/models.md) | Data-driven model catalog TOML schema and tier profiles |
| [Skills](reference/skills.md) | `SKILL.md` discovery roots, frontmatter schema, and `load_skill` |
| [Statusline](reference/statusline.md) | Built-in statusline segments and external ANSI command protocol |
| [Subagents](reference/subagents.md) | Unified `Agent` + `SpawnSpec` delegation and `invoke_subagent` |
| [System Prompt](reference/system-prompt.md) | Named system prompt sections and declarative Markdown overrides |
| [Themes](reference/themes.md) | Built-in palettes and custom TOML theme file schema |
| Document | Topic |
| ----------------------------------------------- | ------------------------------------------------------------------ |
| [ACP](reference/acp.md) | `ox acp` stdio JSON-RPC 2.0 server methods and streaming updates |
| [CLI](reference/cli.md) | Shipped subcommands, flags, session storage, and TUI keybindings |
| [Configuration](reference/configuration.md) | `config.toml` schema for providers, credentials, and model entries |
| [Hooks](reference/hooks.md) | Out-of-process command hooks, lifecycle events, and error policy |
| [MCP Plugin](reference/mcp-plugin.md) | `ox-plugin-mcp` stdio and Streamable HTTP MCP bridge configuration |
| [Models](reference/models.md) | Data-driven model catalog TOML schema and tier profiles |
| [Plugin Protocol](reference/plugin-protocol.md) | Stdio NDJSON-RPC 2.0 plugin host protocol and callbacks |
| [Skills](reference/skills.md) | `SKILL.md` discovery roots, frontmatter schema, and `load_skill` |
| [Statusline](reference/statusline.md) | Built-in statusline segments and external ANSI command protocol |
| [Subagents](reference/subagents.md) | Unified `Agent` + `SpawnSpec` delegation and `invoke_subagent` |
| [System Prompt](reference/system-prompt.md) | Named system prompt sections and declarative Markdown overrides |
| [Themes](reference/themes.md) | Built-in palettes and custom TOML theme file schema |

## Architecture

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Import `oxide-code.homeManagerModules.default` (also exported as `oxide-code.hom
];
settings = {
default_model = "gemini-4-neon";
providers.google.kind = "google";
providers.google.wire = "google";
models.gemini-4-neon = {
provider = "google";
model = "gemini-4-neon";
Expand Down
68 changes: 50 additions & 18 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration Reference

`ox` loads its configuration from a TOML file passed via `-c` / `--config <path>`.
`ox` loads its configuration from a TOML file passed via `-c` / `--config <path>`, the `OX_CONFIG` environment variable, or XDG auto-discovery (`$XDG_CONFIG_HOME/ox/config.toml`, falling back to `~/.config/ox/config.toml`).

## Example

Expand All @@ -11,6 +11,9 @@ theme = "catppuccin-mocha"
[providers.google]
wire = "google"
api_key_file = "/path/to/gemini.key"
timeout_ms = 30000
max_retries = 3
retry_base_delay_ms = 500

[providers.openai]
wire = "openai"
Expand All @@ -26,9 +29,30 @@ api_key = "sk-ant-..."

[models.gemini]
provider = "google"
model = "gemini-4-hydrogen"
model = "gemini-4-neon"
max_output_tokens = 8192
reasoning_effort = "medium"

[models.gemini-fast]
provider = "google"
model = "gemini-4-hydrogen"

[profiles]
default = "gemini"
fast = "gemini-fast"

[[hooks]]
event = "PreToolUse"
matcher = "mcp__*"
command = ["/path/to/check-mcp-tool.sh"]
timeout_ms = 5000
on_error = "block"

[[plugins]]
name = "mcp"
command = ["ox-plugin-mcp", "--config", "/path/to/mcp.toml"]
timeout_ms = 30000
env = { RUST_LOG = "info" }
```

## Top-Level Fields
Expand All @@ -42,16 +66,19 @@ reasoning_effort = "medium"

Each table under `[providers.<name>]` defines connection, authentication, and TLS settings for a named provider.

| Field | Type | Required | Description |
| ---------------- | ---------------- | -------- | --------------------------------------------------------------------------- |
| `wire` | string | Yes | Wire protocol: `"google"`, `"openai"` (alias `"open-ai"`), or `"anthropic"` |
| `base_url` | string | No | Endpoint URL overriding the wire's default base URL |
| `api_key` | string | No | Inline API key (redacted in debug output) |
| `api_key_file` | path | No | Path to a file containing the API key |
| `auth_command` | array of strings | No | Command whose stdout prints a bearer token or API key |
| `extra_headers` | table of strings | No | Additional HTTP headers sent with every request (values redacted) |
| `extra_ca_certs` | array of paths | No | PEM CA certificate files used for TLS verification |
| `no_proxy` | boolean | No | Disable system and environment HTTP proxies (defaults to `false`) |
| Field | Type | Required | Description |
| --------------------- | ---------------- | -------- | --------------------------------------------------------------------------- |
| `wire` | string | Yes | Wire protocol: `"google"`, `"openai"` (alias `"open-ai"`), or `"anthropic"` |
| `base_url` | string | No | Endpoint URL overriding the wire's default base URL |
| `api_key` | string | No | Inline API key (redacted in debug output) |
| `api_key_file` | path | No | Path to a file containing the API key |
| `auth_command` | array of strings | No | Command whose stdout prints a bearer token or API key |
| `extra_headers` | table of strings | No | Additional HTTP headers sent with every request (values redacted) |
| `extra_ca_certs` | array of paths | No | PEM CA certificate files used for TLS verification |
| `no_proxy` | boolean | No | Disable system and environment HTTP proxies (defaults to `false`) |
| `timeout_ms` | integer | No | Per-request HTTP timeout in milliseconds |
| `max_retries` | integer | No | Maximum number of retry attempts for transient HTTP or transport errors |
| `retry_base_delay_ms` | integer | No | Base backoff delay in milliseconds between retry attempts |

### Credential Resolution Precedence

Expand All @@ -74,16 +101,21 @@ Each table under `[models.<name>]` binds a provider name to a wire-level model i
| `max_output_tokens` | integer | No | Default maximum output token cap |
| `reasoning_effort` | string | No | Default reasoning effort: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |

## `[profiles]`

An optional table mapping user-defined profile names to keys in `[models.<name>]`. When a requested profile is not found, `ox` falls back to `default_model`. See the [Models](models.md) reference for catalog tier profiles.

## `[[hooks]]`

Each `[[hooks]]` entry defines an out-of-process command hook that runs on an agent lifecycle event.

| Field | Type | Required | Description |
| ------------ | ---------------- | -------- | ----------------------------------------------------------------------- |
| `event` | string | Yes | Lifecycle event: `"PreToolUse"`, `"PostToolUse"`, or `"Stop"` |
| `matcher` | string | No | Optional tool name filter (`"*"` or an exact tool name) for tool events |
| `command` | array of strings | Yes | Executable and arguments invoked when the hook fires |
| `timeout_ms` | integer | No | Per-invocation timeout in milliseconds (defaults to `30000`) |
| Field | Type | Required | Description |
| ------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `event` | string | Yes | Lifecycle event: `"SessionStart"`, `"SessionEnd"`, `"UserPromptSubmit"`, `"PreToolUse"`, `"PostToolUse"`, `"TurnEnd"`, `"Stop"` |
| `matcher` | string | No | Optional tool name filter (exact name or `*` glob, such as `"mcp__*"`) for tool events |
| `command` | array of strings | Yes | Executable and arguments invoked when the hook fires |
| `timeout_ms` | integer | No | Per-invocation timeout in milliseconds (defaults to `30000`) |
| `on_error` | string | No | Error policy for blocking-capable events: `"allow"` (default, fail open) or `"block"` (fail closed) |

## `[[plugins]]`

Expand Down
37 changes: 26 additions & 11 deletions docs/reference/statusline.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,41 @@ By default, the statusline displays a clean, icon-free layout split into left an
- **Left**: Active model identifier and context usage formatted as `Ctx: <pct>% (<used>k/<window>k)` when the context window size is known, or `Ctx: <used>k` otherwise. Context usage changes color across three configurable thresholds (`context_thresholds.warn_pct` and `context_thresholds.error_pct`, defaulting to `50` and `80`).
- **Right**: `expanded` when tool details are expanded (`Ctrl+O`), plus the active agent state (`thinking`, `streaming`, or the running tool name) only while busy.

`StatusLineConfig` exposes `left` and `right` vectors of `StatusSegment` values so callers can reorder or customize the bar:

| Segment | Description |
| ----------------- | ---------------------------------------------------------- |
| `model` | Active model identifier |
| `context` | Context token usage with 3-tier color thresholds |
| `expanded` | Shown as `expanded` when tool call details are expanded |
| `status` | Active agent state (`thinking`, `streaming`, or tool name) |
| `command([args])` | First stdout line from an external command as one segment |
`StatusLineConfig` is deserialized from TOML by `ox-tui` and exposes `left` and `right` vectors of `StatusSegment` values so callers can reorder or customize the bar:

| Segment | Description |
| ----------------------- | ---------------------------------------------------------- |
| `model` | Active model identifier |
| `context` | Context token usage with 3-tier color thresholds |
| `expanded` | Shown as `expanded` when tool call details are expanded |
| `status` | Active agent state (`thinking`, `streaming`, or tool name) |
| `{ command = ["..."] }` | First stdout line from an external command as one segment |

```toml
left = ["model", "context", { command = ["git", "branch", "--show-current"] }]
right = ["expanded", "status"]

[context_thresholds]
warn_pct = 50
error_pct = 80
```

## External Command Mode

Setting `statusline.command` replaces the built-in layout with the first line of stdout from an external command. `ox` writes a JSON snapshot to the command's stdin:
Setting `command` on `StatusLineConfig` replaces the built-in layout with the first line of stdout from an external command:

```toml
command = ["my-statusline", "--compact"]
```

`ox` writes a JSON snapshot to the command's stdin:

```json
{
"cwd": "/path/to/repo",
"workspace": { "current_dir": "/path/to/repo" },
"model": { "id": "gemini-4-hydrogen" },
"context": { "used_tokens": 12000, "window_size": 200000 },
"context": { "used_tokens": 12000, "window_size": 1048576 },
"status": "idle"
}
```
Expand Down
12 changes: 12 additions & 0 deletions docs/reference/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

`ox-tui` supports built-in color palettes and custom TOML theme files loaded with `Theme::from_toml` or `Theme::load_file`. Built-in palettes dogfood the same TOML schema and live in [`crates/ox-tui/themes/`](../../crates/ox-tui/themes/catppuccin-mocha.toml).

## Selecting a Theme

Set the top-level `theme` key in `config.toml` to a built-in palette name or the path to a custom TOML theme file:

```toml
# Built-in palette
theme = "catppuccin-mocha"

# Custom theme file
# theme = "/path/to/custom-theme.toml"
```

## Built-in Palettes

| Name | Description | Source |
Expand Down
2 changes: 1 addition & 1 deletion nix/hm-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ in
example = lib.literalExpression ''
{
default_model = "gemini-4-neon";
providers.google.kind = "google";
providers.google.wire = "google";
models.gemini-4-neon = {
provider = "google";
model = "gemini-4-neon";
Expand Down
Loading