Configuration
Ulmi is configured through YAML files, environment variables, and command-line flags. This document is the canonical reference for merge order and every supported YAML key. MCP transports and qualified tool names live in MCP; TUI chords live in the TUI Guide.
Source precedence
Configuration is merged from low to high priority. Each source is allowed to override only the fields it explicitly defines.
| Priority | Source |
|---|---|
| 1 (lowest) | Built-in defaults compiled into the binary |
| 2 | Global config: ~/.config/ulmi/config.yaml (or $XDG_CONFIG_HOME/ulmi/config.yaml) |
| 3 | Project config: ulmi.yaml in the current working directory, or the file named by ULMI_CONFIG |
| 4 (highest) | CLI flags such as --model, --agent, … |
This is the canonical merge order (internal/config/loader.go). There is
no separate ULMI_* overlay layer. If the home directory is unavailable,
set XDG_CONFIG_HOME; global config operations otherwise fail instead of
using a path relative to the project.
ULMI_CONFIG replaces project-file discovery. When it is set,
ulmi.yaml in the cwd is not also merged. To layer a project file on
top of the global config, leave ULMI_CONFIG unset and keep
ulmi.yaml in the working directory.
Commands refuse to load project configuration without --trust-project.
This also applies to the file selected by ULMI_CONFIG, project agents, and
project custom commands (including discovered ancestor command directories).
Inspect these files before opting in: they can change permissions, provider
endpoints, or execute MCP processes and shell snippets. Consent lasts only
for that invocation; global configuration remains trusted. For example:
ulmi --trust-project or ulmi --trust-project run "Run the tests".
--help remains available without trusting the project.
A handful of environment variables are copied into fields after YAML
merge ($EXA_API_KEY → web.search.api_key, $SHELL → shell,
$EDITOR / $VISUAL → tui.file_opener.editor). They are listed under
Environment variables; they are not a fifth
precedence source for arbitrary keys.
Unknown top-level keys produce a warning on stderr but do not fail the load — this keeps your config forward-compatible.
Generating a starter config
On first launch, if ~/.config/ulmi/config.yaml is missing, ulmi writes a
starter file there automatically (never overwrites an existing one).
ulmi config init # writes ./ulmi.yaml in the current directory
ulmi config init --output ~/.config/ulmi/config.yaml
ulmi config validate # check for errors / unknown fieldsThe Full reference below is the annotated example of every supported field.
Environment variable interpolation
Inside any YAML value you can write ${VAR_NAME} and it will be replaced with
the value of that environment variable at load time. Missing variables expand
to an empty string. Typical usage:
providers:
anthropic:
api_key: ${ANTHROPIC_API_KEY}Full reference
The example below shows every supported field with its default value.
# ── Active model ────────────────────────────────────────────────────────────
# Format: <provider>/<model-name>
model: ollama/qwen3-coder
# ── Providers ──────────────────────────────────────────────────────────────
providers:
ollama:
base_url: http://localhost:11434
openai:
api_key: ${OPENAI_API_KEY}
base_url: https://api.openai.com/v1
anthropic:
api_key: ${ANTHROPIC_API_KEY}
base_url: https://api.anthropic.com/v1
gemini:
api_key: ${GOOGLE_API_KEY}
base_url: https://generativelanguage.googleapis.com/v1beta
# OpenAI-compatible — any custom key works; base_url required, api_key optional locally.
openrouter:
api_key: ${OPENROUTER_API_KEY}
base_url: https://openrouter.ai/api/v1
groq:
api_key: ${GROQ_API_KEY}
base_url: https://api.groq.com/openai/v1
local:
base_url: http://127.0.0.1:8080/v1
api_key: ""
# ── Selectable models ──────────────────────────────────────────────────────
# Keys appear in the TUI model picker. Values may override parameters.
models:
ollama/qwen3-coder:
max_tokens: 8192
context_window: 40000
anthropic/claude-sonnet-4-5:
max_tokens: 16384
temperature: 0
# Optional USD-per-1M-token overrides (defaults come from the catalog):
# input_price: 3.0
# output_price: 15.0
# cache_read_price: 0.30
# cache_write_price: 3.75
# ── Model groups ───────────────────────────────────────────────────────────
# Named ordered lists; ulmi uses the first available model in the list.
model_groups:
fast:
description: "Low-latency models for quick tasks."
models:
- ollama/qwen3-coder
- openai/gpt-4.1-mini
- anthropic/claude-haiku-3-5
smart:
description: "High-quality models for complex reasoning."
models:
- openai/o3
- anthropic/claude-sonnet-4-5
# ── Prompt cache ───────────────────────────────────────────────────────────
# On by default. Anthropic uses cache_control breakpoints; OpenAI sends
# prompt_cache_key; Gemini matches the implicit prefix (optional resource).
llm:
cache:
enabled: true # default true
ttl: 1h # 5m or 1h (Anthropic extended TTL); default 1h
# min_tokens: 0
# key: "" # optional OpenAI prompt_cache_key
# resource: "" # optional Gemini cachedContent name
# ── Agents ─────────────────────────────────────────────────────────────────
# Override built-in agents or add new ones (the agents themselves are usually
# defined in markdown files; see docs/agents.md).
agents:
cheap_model: openai/gpt-4.1-mini # explore / verifier / bash-runner / lsp-explore
build:
model: anthropic/claude-sonnet-4-5 # pin a model
# model_group: smart # or use a group
system_prompt_file: "" # custom system prompt file
tools:
bash: ask # ask | allow | deny
# ── Permissions ────────────────────────────────────────────────────────────
permissions:
edit: ask # category fallback for write/edit/delete/patch
bash: ask # category fallback for bash
tools: # per-tool levels (win over categories)
read: allow
glob: allow
grep: allow
list: allow
write: ask
edit: ask
delete: ask
patch: ask
bash: ask
task: allow
rules:
- pattern: "**/*.go"
edit: allow
- pattern: "*.env"
tools:
read: deny
edit: deny
- pattern: "/etc/**"
edit: deny
bash: deny
- pattern: "rm -rf"
bash: deny
# ── Sub-agent task permissions ─────────────────────────────────────────────
# Control which named sub-agents the task tool may invoke.
task_permissions:
rules:
- pattern: "explore"
allow: true
- pattern: "implementer"
allow: true
- pattern: "*"
allow: false
# ── MCP servers ────────────────────────────────────────────────────────────
# Transports, qualified tool names, and CLI: docs/mcp.md (canonical).
mcp:
filesystem:
type: local # local|stdio, remote|http, sse, streamable-http|streamable
enabled: false
command: ["npx", "-y", "@modelcontextprotocol/server-filesystem", "."]
github:
type: local
enabled: false
command: ["npx", "-y", "@modelcontextprotocol/server-github"]
environment:
GITHUB_PERSONAL_ACCESS_TOKEN: ${GITHUB_TOKEN}
# allow_tools: [list_issues] # whitelist; wins over block_tools
# block_tools: [delete_issue]
permissions: # short tool names → allow|ask|deny
"*": ask # default for all tools from this server
list_issues: allow
create_issue: ask
remote-tools:
type: remote # HTTP POST JSON (not SSE)
enabled: false
url: https://mcp.example.com
headers:
Authorization: Bearer ${MCP_TOKEN}
# sse-tools:
# type: sse
# enabled: false
# url: https://mcp.example.com/sse
# streamable-tools:
# type: streamable-http
# enabled: false
# url: https://mcp.example.com/mcp
# ── TUI ────────────────────────────────────────────────────────────────────
tui:
theme: catppuccin-mocha
leader_key: ctrl+x
show_thinking: true # show reasoning/thinking blocks (Claude etc.)
tool_output: compact # compact | full — tool result bodies (default: compact)
print_history_on_exit: true # dump in-TUI chat to scrollback on quit (resume hint always printed)
status_dir_depth: 4 # trailing path segments shown in the status bar
keybinds:
new_session: "<leader>n"
models: "<leader>m"
sessions: "<leader>l"
quit: "<leader>q"
file_opener:
# command: "cd {cwd} && cursor --goto {file}:{line}"
editor: "" # empty → $EDITOR, then $VISUAL, then vi
prompt_history:
enabled: true
storage: sqlite # pluggable Store; sqlite default
path: ~/.local/share/ulmi/prompt-history.db
max_entries: 1000 # oldest trimmed when exceeded
shell_mode:
enabled: true # default: true
respond_to_output: false # set true to auto-trigger an LLM reply
max_output_lines: 150 # truncate output stored in LLM history
# ── @-mentions ─────────────────────────────────────────────────────────────
mentions:
max_file_size: 102400 # 100 KiB when resolving @file
# refresh_interval: 30 # parsed; periodic rebuild is not wired yet
# ── Logging ────────────────────────────────────────────────────────────────
logging:
level: info # debug | info | warn | error
dir: ~/.local/state/ulmi/log # JSON files; empty → XDG state default
max_size_mb: 50
max_age_days: 7
# ── Sessions ───────────────────────────────────────────────────────────────
sessions:
storage: sqlite # sqlite | json
path: ~/.local/share/ulmi/sessions.db
auto_compact_tokens: 100000 # 0 disables auto-compact
# ── Snapshots (undo/redo) ──────────────────────────────────────────────────
snapshots:
backend: cas # cas | shadowgit
path: "" # default: ~/.cache/ulmi/snapshots
max_file_size: 10485760 # 10 MiB
allow_outside_workspace: false
retention_days: 30
# ── Sharing (placeholder for future hosted feature) ────────────────────────
sharing:
enabled: false
# ── Login shell (TUI bash-card labels). Empty → $SHELL, then "sh". ────────
# shell: /bin/zsh
# ── Web tools ──────────────────────────────────────────────────────────────
# web:
# search:
# enabled: true
# api_key: ${EXA_API_KEY} # or set EXA_API_KEY; Load copies it here
# fetch:
# max_bytes: 5242880
# timeout_seconds: 30Field-by-field notes
model
Default model when no --model flag is provided. Format is
<provider>/<model>. If the value is the name of a model_groups entry, it
is resolved to the first concrete model in the group at startup, with
automatic fallback on stream errors.
providers
Each provider key matches a registered provider in
internal/cli/registry.go.
Native providers (ollama, openai, anthropic, gemini) have dedicated
API clients. ollama does not require an API key. The other native providers
require api_key.
OpenAI-compatible providers — any other key in providers: with a
base_url is registered automatically using the OpenAI Chat Completions
client. The config key becomes the provider ID and model prefix
(openrouter/..., groq/..., local/...). base_url is required;
api_key is optional for local servers (llama.cpp, vLLM, LM Studio).
models
Declares which models appear in the TUI picker (/models / <leader>m).
Each key is a provider/model ID. Optional values override max_tokens,
temperature, context_window, thinking_budget, and optional pricing
overrides (input_price, output_price, cache_read_price,
cache_write_price — USD per 1M tokens).
Extended thinking / reasoning is off unless thinking_budget is a
positive integer. Enabling it also busts Anthropic prompt-cache hits for
that request.
For Ollama, context_window is sent as num_ctx on each chat request.
Without it, Ollama keeps its model default (often 2048 or 4096), so the
status bar can show 4.1K/40.0K while the model is actually truncating
at ~4k.
The picker also includes the active model: (when it is not a group name)
and every ID listed under model_groups. There is no separate built-in
catalog in the picker — only models from configuration are shown.
Known IDs may still inherit pricing/context metadata from an internal
reference table.
model_groups
A model_groups entry is a named ordered list of models. Inside the TUI
the model picker shows groups alongside individual models; selecting a group
pins the active model to its first entry and enables stream-error fallback
through the rest of the list.
llm.cache
Prompt caching is on by default. Anthropic requests get explicit
cache_control breakpoints on the last tool schema, the stable system
prefix, and a rolling history point. OpenAI sends prompt_cache_key.
Gemini relies on implicit prefix matching (set resource to pin a
cachedContent name). Ollama reuses its KV cache when the byte prefix is
unchanged.
ttl is 1h (default) or 5m (Anthropic extended-cache-ttl). The 1h
default keeps long interactive sessions on cache reads instead of paying a
cache write when a turn idles longer than five minutes. Override
per provider (providers.<id>.cache) or agent (agents.<name>.cache).
Set enabled: false to disable.
agents.cheap_model
When set, built-in grunt sub-agents (explore, verifier, bash-runner,
lsp-explore) use this model unless the task request, the agent markdown,
or agents.<name>.model pins another one. implementer keeps the parent
model.
agents.<name>
Override settings for built-in or user-defined agents. See
Agents for the markdown-based authoring workflow. The fields
here let you pin a model / model_group, point at an external
system_prompt_file, or override the per-tool permission level.
permissions
Top-level settings define default levels for two categories: bash and
edit (used for any file-mutating tool). The rules list adds
pattern-based overrides; rules are evaluated in declaration order and the
first match wins. See Permissions for the full priority
chain.
task_permissions
Controls which named sub-agents the task tool may invoke. Rules use glob
patterns (with * prefix/suffix support) evaluated in declaration order; the
first match wins. When no rules are configured, all sub-agents are
allowed. See Agents → Sub-agents.
mcp
Each MCP server has a type, an enabled flag, and a transport-specific
payload. Model-visible tools are registered as
mcp__<server-name>__<tool-name>. Canonical transport table, aliases,
allow_tools / block_tools, resources/prompts, and CLI:
MCP.
tui
leader_key is the prefix key for chord shortcuts (defaults to ctrl+x).
Inside keybinds, the literal <leader> token is replaced with the leader
key string. See TUI Guide for every action name.
show_thinking controls whether reasoning / thinking token blocks (e.g. from
Claude extended-thinking) are rendered in the chat. Defaults to true.
tool_output controls how tool result bodies appear in the chat:
compact (default) shows a short preview with expand-on-demand; full shows
complete output. Errors are always expanded. Toggle at runtime with
/tool-output, or expand the topmost truncated card with the leader+v
chord (expand_tool keybind).
print_history_on_exit controls whether the in-TUI chat transcript is printed
to the terminal after leaving the alternate screen. Defaults to true. A
resume hint (ulmi --session <id> or ulmi --continue) is always printed
on exit, even when this flag is false or the chat is empty.
status_dir_depth sets how many trailing directory segments are shown in the
working-directory indicator on the left side of the status bar. When the full
path has more segments than this value, the leading portion is replaced with
…. Defaults to 4. Example — set to 3 for a more compact display:
tui:
status_dir_depth: 3prompt_history controls composer ↑/↓ / Ctrl+R recall. Defaults to enabled
SQLite at ~/.local/share/ulmi/prompt-history.db with a 1000-entry cap.
Up/search are filtered by the current working directory. This store is
separate from sessions (LLM transcripts). Set enabled: false to disable.
file_opener.command is an optional template ({file}, {cwd}, {line})
for opening file cards. When empty, file_opener.editor is used (YAML, then
$EDITOR, then $VISUAL, then vi).
tui.shell_mode
Controls the ! prefix in the composer. Defaults: enabled, no auto-LLM
reply, 150 history lines. Behaviour: TUI Guide → Shell mode.
mentions
max_file_size caps how many bytes are inlined when resolving an @file
mention (default 100 KiB). refresh_interval is accepted in YAML but the
file index currently builds once at startup.
logging
Structured slog JSON files under dir (default
$XDG_STATE_HOME/ulmi/log, or ~/.local/state/ulmi/log). If that
directory does not exist yet and the previous default ~/.config/ulmi/log
(or $XDG_CONFIG_HOME/ulmi/log) does, the old path is used until you move
the files or set dir explicitly. level is
debug | info | warn | error. Rotation uses max_size_mb (default
50) and max_age_days (default 7). If the directory cannot be created,
Ulmi logs to stderr and still starts.
At info, JSON msg values below reconstruct a TUI turn or a headless
Engine.Send without prompt text, tool parameters, or API keys.
Correlation attributes (session_id, model, turn_id, job_id,
call_id) are mixed in from context when known. Names are frozen in
internal/logger (EventTurnStart, …).
msg | When | Fields beyond correlation |
|---|---|---|
turn_start | User send / Engine.Send | agent (when set) |
llm_round | Each completed Send/Stream (success or error) | provider, duration_ms, attempts, stop_reason, input_tokens, output_tokens, cache_read, cache_write, err (on failure) |
llm_retry | Each retryable error before the last attempt (WARN) | provider, attempt, max_attempts, backoff_ms, err |
tool_done | Registry.Execute | name, call_id, duration_ms, is_error, denied |
compact | Auto-compact after a tool round | removed, tokens_before, tokens_after, breaker_tripped |
turn_end | Turn finished | duration_ms, tokens, cost, n_tools, stop (ok | error | cancel | loop_cap), err (on failure) |
mcp_connect | MCP server connect (success or failure) | server, duration_ms, tools; err on failure |
session_saved | Session persist succeeded | (correlation only) |
The table is the INFO contract. DEBUG still logs request shape (message
counts, tool names) but not prompt text unless log_prompts: true. Use
level: debug only when a bug is in prompt shape (see
FAQ).
shell
Login-shell path used only for TUI labels on bash cards and the ! terminal
header. When omitted, Load copies $SHELL. The bash tool still runs
commands via /bin/sh -c.
web
web.search.api_key is the Exa key for websearch. When omitted, Load
copies $EXA_API_KEY. Tools read the resolved config field, not the
environment. Set web.search.enabled: false to leave the tool unregistered.
sessions
storage chooses between SQLite (default, single file) and a directory of
JSON files (one per session). Auto-compact fires at 80% of the model’s
context window when that window is known. auto_compact_tokens is the
fallback threshold when the window is unknown; 0 disables that fallback.
snapshots
backend: cas uses an internal content-addressable store; no extra
dependencies. backend: shadowgit writes a hidden git repository per
workspace, using go-git. See Snapshots.
Environment variables
A handful of variables are read directly:
| Variable | Effect |
|---|---|
ULMI_CONFIG | Replace the project-config path (ulmi.yaml in cwd is not also loaded). |
XDG_CONFIG_HOME | Move the global config root from ~/.config to $XDG_CONFIG_HOME. |
XDG_STATE_HOME | Move the default log directory from ~/.local/state/ulmi/log to $XDG_STATE_HOME/ulmi/log. |
ULMI_EXPERIMENTAL_LSP | Set to 1 or true to enable the LSP integration. See LSP. |
EDITOR | External editor fallback when tui.file_opener.editor is empty (AGENTS.md exception). |
VISUAL | Copied into tui.file_opener.editor by Load when EDITOR is also empty. |
SHELL | Copied into shell by Load for TUI bash-card labels. |
EXA_API_KEY | Copied into web.search.api_key by Load when the YAML field is empty. |
ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, OPENROUTER_API_KEY, GROQ_API_KEY, TOGETHER_API_KEY, MCP_TOKEN, GITHUB_TOKEN, … | Referenced from the example config via ${VAR} interpolation. |
Validating a config
ulmi config validate # validates the merged config
ulmi config validate --file ./ulmi.yamlValidation checks that required provider fields are set (for example
api_key on every cloud provider, base_url on Ollama). Unknown fields are
reported as warnings rather than errors so older binaries remain compatible
with newer YAML.