NAME
hax-config - hax configuration file and settings
DESCRIPTION
Configuration is optional: the interactive pickers work without a file and remember provider/model choices. Add config.json for stable defaults, custom providers, presets, or behavior changes.
FILES AND RESOLUTION
hax follows the XDG Base Directory specification. The table shows the paths used when the corresponding XDG_CONFIG_HOME, XDG_STATE_HOME, or XDG_CACHE_HOME variable is unset.
- User configuration
- ~/.config/hax/config.json
- Remembered interactive selections
- ~/.local/state/hax/state.json
- Logins made with /login
- ~/.local/state/hax/auth.json
- Sessions and prompt history
- ~/.local/state/hax/sessions/<encoded-cwd>/
- Model metadata cache
- ~/.cache/hax/catalog.json
config.json expresses durable, user-owned intent. It is suitable for a dotfiles repository or a symlink from one, provided secrets remain in environment variables. state.json is machine-local convenience state written by hax when you use the interactive selectors; do not edit or version it. Keeping them separate lets interactive /provider and /model choices persist without rewriting your portable configuration.
For an ordinary setting, the first defined value wins:
current-process override → resumed conversation → environment
→ state.json → config.json → default
The resumed-conversation tier applies to provider, model, effort, and preset. This ensures hax -c continues on the backend that previously handled the session even when your current default changed. Explicit CLI selection flags still override it.
Sources behave as follows:
- --provider, --model, --effort, and --preset apply only to this process and do not persist. A preset is applied first, then explicit selection flags are layered over it.
- /provider, /model, /effort, and /preset affect the current process and save the selection in state.json for later runs.
- HAX_* environment variables are useful for per-shell and automated runs. They override saved interactive choices.
- config.json should hold durable defaults, provider definitions, and presets. Do not edit state.json by hand.
In the REPL, /config shows each registered setting's resolved value, source, and description. It also identifies settings that can be changed for the running process:
/config # pick a setting /config theme light # set a process override /config compact.threshold 75 /config theme default # clear the process override
Provider, model, effort, and preset use their dedicated commands. API keys are displayed only as set or unset. /config tracks only hax's own settings, so a first-party credential variable such as OPENAI_API_KEY authenticates without appearing there. Provider blocks (providers.<id>.*) are not listed either: select a provider with /provider, and define its settings through environment variables or config.json. A specific registered key can still be queried by name, for example /config providers.openai-compatible.base_url.
CONFIG FILE FORMAT
config.json is plain JSON without comments or trailing commas. Dotted keys are normally represented as nested objects:
{
"provider": "openrouter",
"model": "anthropic/claude-sonnet-5",
"theme": "dark",
"compact": {
"threshold": 80
}
}
Flat dotted keys such as "compact.threshold": 80 are also accepted for scalar settings. Keep structured values such as providers, presets, and catalog.models nested for clarity.
Scalar strings, numbers, and booleans are accepted. Booleans recognize 1/0, true/false, yes/no, and on/off, case-insensitively. Durations accept seconds or ms, s, m, and h suffixes. Byte sizes accept plain bytes or k and m suffixes using 1024-base units; token counts (context_limit, catalog limit fields) use decimal k and m, so "272k" means 272000 tokens. Invalid typed values use the setting's default; /config rejects invalid runtime values with an error.
Keep secrets in environment variables where possible:
export OPENAI_API_KEY=... export ANTHROPIC_API_KEY=... export OPENROUTER_API_KEY=...
For a custom provider, use api_key_env to name its credential variable rather than putting the credential itself in JSON.
COMMON CONFIGURATIONS
Local OpenAI-compatible server
{
"provider": "vllm",
"model": "Qwen3-30B",
"providers": {
"vllm": {
"display_name": "vLLM",
"base_url": "http://127.0.0.1:8000/v1"
}
}
}
Ollama on a different port
{
"provider": "ollama",
"model": "qwen3:8b",
"providers": {
"ollama": {
"base_url": "http://127.0.0.1:11500/v1"
}
}
}
Light terminal theme with restrained notifications
{
"theme": "light",
"notify": "off",
"display_width": 100
}
PRESETS
A preset is first of all a name for a favorite provider/model/effort selection — useful when you regularly switch between a daily model, a cheaper alternative, and a stronger model for difficult work. A preset can also become a role by adding a description, system-prompt instructions, and a visual tint. Only presets with a description are advertised to the model for subagent delegation; a favorite that is just a name stays yours alone.
The easiest way to save a favorite is to select it with /provider, /model, and /effort, then run /preset-save <name>. Edit config.json when you want to add role-specific fields:
{
"presets": {
"daily": {
"description": "favorite everyday model",
"provider": "openrouter",
"model": "deepseek/deepseek-v4-flash-0731",
"tint": "teal"
},
"review": {
"description": "thorough code review",
"provider": "codex",
"model": "gpt-5.6-sol",
"effort": "high",
"system_prompt_append": "@prompts/review.md",
"tint": "rose"
}
}
}
Model availability, pricing, and data policies change; treat these IDs as examples and prefer choices shown by your /model picker. Apply a preset with hax daily, --preset daily, HAX_PRESET=review, /preset review, or /new review. The bare form must come right after hax and only works for a defined preset name. /preset offers a picker when no name is given. The active preset appears in the banner and /session.
Preset fields:
- provider
- Required provider id.
- model
- Optional model id; omitted means the provider's own default/discovery.
- effort
- Optional provider-specific reasoning effort.
- system_prompt
- Replace the built-in base prompt. Prefer appending unless replacement is required.
- system_prompt_append
- Add role-specific instructions after the base prompt.
- tint
- teal, violet, rose, or sage.
- description
- Human-readable purpose. Required for the preset to be offered to the model as a delegation target.
system_prompt and system_prompt_append accept @path; relative paths resolve from the hax config directory, while absolute paths and @~/... work directly. Prefer system_prompt_append so updates to hax's built-in safety and workflow guidance are retained.
A preset is a complete stance rather than a bag of partial defaults: it replaces the previous preset as a whole, and an explicit provider, model, or effort from a higher-priority source leaves or suppresses it instead of mixing with it. Endpoint and credential settings are not preset fields; define those on a custom provider and point the preset to it.
/preset-save <name> [tint] writes the current selection to config.json as a preset and activates it. The command preserves other loaded keys but normalizes JSON formatting. Because it rewrites the configuration loaded at startup, do not edit the file concurrently in another window. Existing preset names require confirmation before replacement; their description is retained.
SETTING REFERENCE
The tables below cover persistent and environment configuration. /config is the best source for the current binary's resolved values and whether a setting is runtime-tunable. — means unset or provider-dependent.
Selection and context
- preset
- Startup preset; an empty environment value disables a config default.
Environment: HAX_PRESET. Default: —. - provider
- Provider id.
Environment: HAX_PROVIDER. Default: auto. - model
- Provider-specific model id.
Environment: HAX_MODEL. Default: —. - effort
- Provider-specific reasoning effort; empty omits it.
Environment: HAX_EFFORT. Default: —. - system_prompt
- Replace the base prompt; @path reads a file; (none) removes the entire system message.
Environment: HAX_SYSTEM_PROMPT. Default: built in. - system_prompt_append
- Append text or an @path file to the base prompt.
Environment: HAX_SYSTEM_PROMPT_APPEND. Default: —. - no_env
- Omit the Environment section.
Environment: HAX_NO_ENV. Default: off. - no_agents_md
- Omit discovered AGENTS.md files.
Environment: HAX_NO_AGENTS_MD. Default: off. - no_skills
- Omit skill descriptions.
Environment: HAX_NO_SKILLS. Default: off. - no_subagents
- Omit delegation guidance.
Environment: HAX_NO_SUBAGENTS. Default: off. - no_tasks
- Disable managed background tasks.
Environment: HAX_NO_TASKS. Default: off.
(none) for system_prompt is stronger than an empty string: it sends no system message at all. --raw is usually clearer when the goal is a prompt-only chat with no tools or context.
Display and behavior
- markdown
- Render Markdown on terminal output; piped output remains raw.
Environment: HAX_MARKDOWN. Default: on. - show_reasoning
- Display reasoning emitted by the provider; does not enable reasoning.
Environment: HAX_SHOW_REASONING. Default: off. - sort_models
- Sort model picker newest-first (on), keep server order (off), or use provider default (sorted unless the provider opts out).
Environment: HAX_SORT_MODELS. Default: auto. - context_limit
- Override the model context-window size used for display and compaction.
Environment: HAX_CONTEXT_LIMIT. Default: auto. - display_width
- auto, terminal, or an exact width of at least 20 columns.
Environment: HAX_DISPLAY_WIDTH. Default: auto. - notify
- Completion notification: auto, bel, osc9, or off.
Environment: HAX_NOTIFY. Default: auto. - theme
- auto, dark, light, ansi, or off.
Environment: HAX_THEME. Default: auto. - tint
- Model-output tint: teal, violet, rose, or sage.
Environment: HAX_TINT. Default: teal. - keep_awake
- Best-effort idle-sleep inhibition while a turn runs.
Environment: HAX_KEEP_AWAKE. Default: on. - compact.auto
- Automatically summarize the conversation near the context limit.
Environment: HAX_COMPACT_AUTO. Default: on. - compact.threshold
- Context percentage that triggers automatic compaction. It triggers sooner when needed to keep 16k tokens, or a quarter of a small window, free.
Environment: HAX_COMPACT_THRESHOLD. Default: 85. - max_turns
- Model round-trips per user turn before hax pauses (interactive) or aborts (one-shot). 0 is unlimited.
Environment: HAX_MAX_TURNS. Default: 0.
theme=auto respects NO_COLOR, terminal color support, and COLORFGBG when available. Terminals rarely report a light background reliably, so set light explicitly if auto detection is wrong. theme=ansi uses the terminal's own 16-color palette; identity tints apply only to dark/light themes.
Recording
- no_session
- Skip new sessions and prompt-history writes; auto skips the mock provider.
Environment: HAX_NO_SESSION. Default: auto. - session_retention_days
- Remove inactive sessions after N days; 0 keeps them.
Environment: HAX_SESSION_RETENTION_DAYS. Default: 30. - transcript
- Mirror the Ctrl-T transcript to a file.
Environment: HAX_TRANSCRIPT. Default: —. - trace
- Write an HTTP/SSE diagnostic trace.
Environment: HAX_TRACE. Default: —.
Model metadata
- catalog.url
- Metadata catalog URL; empty disables fetching.
Environment: HAX_CATALOG_URL. Default: models.dev. - catalog.refresh
- Refresh age; 0 disables fetching.
Environment: HAX_CATALOG_REFRESH. Default: 24h.
hax uses model metadata for context limits, image capability, and estimated spend. It caches models.dev <https://models.dev/api.json> data and refreshes it in the background only when needed: a refresh starts only when a provider with a catalog identity is about to use the data (its first request, or a /model or /effort picker), and only when the cache is older than catalog.refresh. Local providers and custom providers without a catalog_id never cause a fetch. A stale cache remains usable. Set catalog.url empty or catalog.refresh to 0 to prevent network refreshes; an existing cache may still be read.
Per-model overrides can be placed under catalog.models, with costs in USD per million tokens:
{
"catalog": {
"models": {
"openai": {
"example-model": {
"cost": {"input": 1.25, "output": 10, "cache_read": 0.125},
"limit": {"context": 400000, "output": 128000}
}
}
}
}
}
Blocks are keyed by the runtime provider id (the providers.<id> name) or by the models.dev provider key when the two differ; the runtime-id block wins field by field. Configured fields override both the cached snapshot and metadata the provider reports live; the Codex section of hax-providers(7) has a worked context-window override, and its Custom providers section covers model API overrides for mixed gateways. A ~ on displayed spend means the result is estimated from token counts and this metadata; check provider billing for authoritative costs.
Tools and transport
- image_input
- Auto-detect image support, or force it on/off.
Environment: HAX_IMAGE_INPUT. Default: auto. - tool_output_cap
- Maximum tool-output bytes retained for the model.
Environment: HAX_TOOL_OUTPUT_CAP. Default: 50k. - bash.timeout
- Default command timeout before detaching; 0 disables.
Environment: HAX_BASH_TIMEOUT. Default: 2m. - bash.timeout_max
- Maximum timeout a model may request; 0 removes the cap.
Environment: HAX_BASH_TIMEOUT_MAX. Default: 30m. - bash.timeout_grace
- SIGTERM-to-SIGKILL grace period.
Environment: HAX_BASH_TIMEOUT_GRACE. Default: 2s. - bash.background_yield
- Initial output window before explicit backgrounding detaches.
Environment: HAX_BASH_BACKGROUND_YIELD. Default: 5s. - bash.shell
- Shell executable used by the bash tool.
Environment: HAX_BASH_SHELL. Default: bash/sh. - task.wait_timeout
- Default wait for a background task.
Environment: HAX_TASK_WAIT_TIMEOUT. Default: 10m. - task.max_running
- Maximum concurrent background tasks, up to 64.
Environment: HAX_TASK_MAX_RUNNING. Default: 32. - http.max_retries
- Additional retries for transient HTTP failures.
Environment: HAX_HTTP_MAX_RETRIES. Default: 4. - http.retry_base
- Initial retry backoff.
Environment: HAX_HTTP_RETRY_BASE. Default: 1s. - http.idle_timeout
- Streaming silence before failure; 0 disables.
Environment: HAX_HTTP_IDLE_TIMEOUT. Default: 10m.
When no_tasks is on, reaching bash.timeout kills the command instead of detaching it. Standard CURL_CA_BUNDLE, SSL_CERT_FILE, and SSL_CERT_DIR variables can override TLS certificate lookup.
Provider settings
Every provider reads settings only from its own providers.<id> block; nothing bleeds between providers. Most shipped hosted providers, such as openai and deepseek, pin their endpoint, protocol, and credential variable: base_url and api in their blocks warn and are ignored, so no setting can redirect their key or change what it speaks. Their other advanced fields (the same ones custom providers accept) are honored but rarely needed; a different endpoint is a custom provider, not a tweak. Codex is pinned the same way, and its credentials come from the ChatGPT login made with /login rather than a key, so api_key and api_key_env in its block warn and are ignored.
The shipped openai-compatible and anthropic-compatible providers are configured the same way — through their own providers.<name> blocks — and additionally bind environment variables to those keys so a one-off endpoint needs no config file.
Keys in the providers.openai-compatible block:
- base_url
- Endpoint; required.
Environment: HAX_OPENAI_BASE_URL. Default: —. - api_key
- Bearer token. Does not inherit OPENAI_API_KEY.
Environment: HAX_OPENAI_API_KEY. Default: —. - display_name
- Banner and picker name.
Environment: HAX_OPENAI_DISPLAY_NAME. Default: —. - api
- chat (Chat Completions) or responses.
Environment: HAX_OPENAI_API. Default: chat. - reasoning_format
- Effort request shape: flat or nested.
Environment: HAX_OPENAI_REASONING_FORMAT. Default: flat. - reasoning_roundtrip
- Replay reasoning text: auto, off, or a field name.
Environment: HAX_OPENAI_REASONING_ROUNDTRIP. Default: auto. - reasoning_required
- Send the reasoning field on every assistant message, even empty; auto follows the catalog per model.
Environment: HAX_OPENAI_REASONING_REQUIRED. Default: auto. - send_cache_key
- Send a stable prompt-cache key.
Environment: HAX_OPENAI_SEND_CACHE_KEY. Default: auto. - request_cost
- Request provider-specific per-response cost data.
Environment: HAX_OPENAI_REQUEST_COST. Default: auto. - cache
- Send explicit prompt-cache breakpoints.
Environment: HAX_OPENAI_CACHE. Default: auto. - cache_ttl
- Cache TTL: 5m or 1h.
Environment: HAX_OPENAI_CACHE_TTL. Default: 1h.
Leave cache and cost controls on auto unless the endpoint documents support — the correct behavior varies by provider and model.
Keys in the providers.anthropic-compatible block:
- base_url
- Endpoint; required.
Environment: HAX_ANTHROPIC_BASE_URL. Default: —. - api_key
- x-api-key token. Does not inherit ANTHROPIC_API_KEY.
Environment: HAX_ANTHROPIC_API_KEY. Default: —. - display_name
- Banner and picker name.
Environment: HAX_ANTHROPIC_DISPLAY_NAME. Default: —. - max_tokens
- Maximum output including thinking; clamped to known model limits.
Environment: HAX_ANTHROPIC_MAX_TOKENS. Default: model cap. - thinking_mode
- auto follows model metadata; prefer-adaptive also assumes adaptive for models the catalog lacks; adaptive, budget, and off pin. Selecting an effort makes an unpinned mode adaptive.
Environment: HAX_ANTHROPIC_THINKING_MODE. Default: auto. - thinking_budget
- Budget-mode thinking tokens.
Environment: HAX_ANTHROPIC_THINKING_BUDGET. Default: max minus 1. - cache
- Send prompt-cache breakpoints; off for endpoints that reject them.
Environment: HAX_ANTHROPIC_CACHE. Default: auto. - cache_ttl
- Cache TTL: 5m or 1h.
Environment: HAX_ANTHROPIC_CACHE_TTL. Default: 1h. - version
- API version header.
Environment: HAX_ANTHROPIC_VERSION. Default: 2023-06-01.
When model metadata has no output limit, max_tokens falls back internally to 32000.
Provider-specific and development settings
- providers.llamacpp.base_url
- Full llama-server URL; overrides the port.
Environment: HAX_LLAMACPP_BASE_URL. Default: —. - providers.llamacpp.api_key
- Bearer token when llama-server uses --api-key.
Environment: HAX_LLAMACPP_API_KEY. Default: —. - providers.llamacpp.port
- llama-server port when no base URL is set.
Environment: HAX_LLAMACPP_PORT. Default: 9931. - providers.mock.script
- Mock-provider script path.
Environment: HAX_MOCK_SCRIPT. Default: —.
Custom provider blocks are documented in hax-providers(7).