Skip to content

Configuration

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).

Configuration loading is strictly read-only: ox follows symlinks and never creates or mutates files inside its configuration directory, so Nix, Home Manager, or dotfile-managed read-only trees work without wrapper scripts.

Alongside config.toml, a configuration root may organize definitions into drop-ins and per-kind directories:

$XDG_CONFIG_HOME/ox/
├── config.toml # Base settings and optional inline tables
├── config.d/*.toml # Preference drop-ins, merged in filename order
├── providers/<name>.toml # One ProviderConfig per file (stem = provider name)
├── models/<name>.toml # One ModelConfig per file (stem = model key)
├── profiles/<name>.toml # One profile per file (`model = "<key>"`)
├── hooks/<name>.toml # One HookConfig per file, appended in filename order
├── plugins/<name>.toml # One PluginConfig per file, appended in filename order
├── themes/<name>.toml # Custom theme files, resolvable by bare stem name
└── tui/<name>.toml # Custom TUI preset files, resolvable by bare stem name

Hidden files (leading .) and non-.toml files are ignored. Layers merge deterministically from lowest to highest precedence:

  1. Declared package_roots (in list order, deduplicated by canonical path)
  2. config.toml
  3. config.d/*.toml (lexicographical filename order)
  4. Per-kind directories (providers/, models/, profiles/, hooks/, plugins/, themes/, tui/)
  5. CLI flags (--model, --profile, --base-url, --api-key, --reasoning-effort)

Map entries (providers, models, profiles) override by key, lists (hooks, plugins) append in order, and scalars (default_model, theme) take the highest-precedence non-empty value.

package_roots lists directories that bundle reusable declarative configuration and resources using the same layout:

<package-root>/
├── package.toml # Optional manifest (`name = "..."`)
├── config.toml # Named entries and list items only
├── config.d/*.toml # Additional drop-in entries
├── providers/<name>.toml # Reusable provider definitions
├── models/<name>.toml # Reusable model definitions
├── profiles/<name>.toml # Reusable profile definitions
├── hooks/<name>.toml # Reusable hooks
├── plugins/<name>.toml # Reusable plugins
├── themes/<name>.toml # Themes selectable by bare name
├── tui/<name>.toml # TUI presets selectable by bare name
├── skills/ # Skill directories (`SKILL.md`)
├── prompts/ # Prompt section overrides
└── AGENTS.md # Package-level instructions

Relative package root paths resolve against the configuration root directory. Symlinks are followed and roots are deduplicated by canonical path. Setting default_model, theme, [memory], attachments.policy, attachments.max_bytes, or package_roots inside a package root fails with an error naming the package and file. Named entries, list items (including [attachments.converters]), and top-level defaults under [compaction], [tui], and [statusline] are allowed and can be overridden by user configuration.

default_model = "gemini"
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"
auth_command = ["op", "read", "op://vault/openai/api-key"]
base_url = "https://api.openai.com/v1"
extra_headers = { "X-Custom-Header" = "value" }
extra_ca_certs = ["/path/to/ca.pem"]
no_proxy = false
[providers.anthropic]
wire = "anthropic"
api_key = "sk-ant-..."
[models.gemini]
provider = "google"
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" }
Field Type Default Description
default_model string None Key in [models.<name>] used when --model is not passed on the CLI
theme string None Built-in or custom theme name (default "catppuccin-mocha"), bare themes/<name>.toml stem, or path to a TOML file. See Themes.
package_roots path[] [] Declarative package root directories loaded in list order before user configuration

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

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

Provider credentials are resolved in the following order, trimming surrounding whitespace:

  1. api_key
  2. api_key_file
  3. auth_command

If none of these fields are set in the provider entry, --api-key from the CLI is used when supplied.

Each table under [models.<name>] binds a provider name to a wire-level model identifier.

Field Type Default Description
provider string Required Key into [providers.<name>]
model string Required Wire-level model identifier
max_output_tokens integer None Default maximum output token cap
reasoning_effort string None Default reasoning effort: off, minimal, low, medium, high, xhigh, or max

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 reference for catalog and profile details.

Optional per-project memory directory settings. See Project Memory for the field schema, storage layout, and prompt injection behavior.

Optional multimodal attachment resolution settings controlling how non-text attachments are validated, passed through natively, or converted by plugins.

Field Type Default Description
policy string "auto" Resolution policy: "auto", "native_only", "plugin_first", or "error"
max_bytes integer 20971520 Maximum payload size in bytes for native pass-through (default 20 MiB). Oversized inputs may convert.
converters map<string, string> {} Optional MIME media type or wildcard pattern ("video/*") mapped to a configured plugin name override
  • auto: passes through natively when the model supports the media type and the payload fits within max_bytes, otherwise routes to a matching converter plugin or errors if none is available.
  • native_only: passes through natively when supported and within max_bytes, never invoking converter plugins.
  • plugin_first: tries a matching converter plugin first, falling back to native pass-through when supported and within max_bytes.
  • error: rejects all non-text attachments with an error.

Optional conversation compaction settings controlling automatic context window compaction and summarization prompts. See Compaction for trigger thresholds, cut-point rules, deterministic preservation, and plugin overrides.

Field Type Default Description
enabled boolean true Enable automatic compaction when latest-turn context fill reaches the effective threshold
auto_compact_pct integer 85 Percentage of the model context window (0..=100) that triggers automatic compaction
reserve_tokens integer 16384 Minimum token headroom reserved below the model context window
keep_recent_tokens integer 20000 Approximate token budget of recent messages preserved verbatim during compaction
prompt string None Optional inline summarization prompt overriding the built-in compaction template
prompt_file path None Optional path to a summarization prompt file overriding both prompt and the built-in default template

Each [[hooks]] entry defines an out-of-process command hook that runs on an agent lifecycle event. See Command Hooks for the full field schema, supported events, matcher rules, and error policies.

Each [[plugins]] entry defines a long-lived stdio JSON-RPC 2.0 plugin process whose advertised tools are registered into the agent tool registry and shut down cleanly on exit. See Plugin Protocol for the full field schema and wire protocol.

Optional declarative TUI settings and preset selection. See TUI for the field schema, built-in presets, and precedence order.

Optional TUI statusline layout style, segment configuration, context usage thresholds, or external command replacement. See Statusline for the full field schema and JSON payload format.

Optional table mapping kebab-case TUI action names to one or more key chord or key sequence strings, or [] to unbind an action. Each configured action replaces all default bindings for that action. See Customizing Keybindings for action names and chord syntax.