English
Configuration
Configuration is one validated pydantic model, AgentConfig, shared by every entrypoint. An agent keeps its own clone of it, so agent.config can be mutated without affecting other agents or the file on disk.
Sources and precedence
$XUN_HOME/config.json—XUN_HOMEdefaults to./.xun. The file may contain a full config or only the fields you want to change: it is deep-merged over the built-in template, and unknown keys are rejected.${XUN_*}placeholders inside the file are substituted from the environment (a.envfile in the working directory is loaded automatically). Only names starting withXUN_are allowed; a missing one is an error rather than an empty string. Secrets therefore stay out of the file..envand plain environment variables also fill the built-in template itself, which already referencesXUN_OPENAI_BASE_URL,XUN_OPENAI_API_KEY,XUN_OPENAI_MODEL,XUN_AUTO_CONFIRMandXUN_ENABLE_EXTENSIONS— so a fresh checkout needs no config file at all.- Per-agent overrides in code or by an extension win last.
jsonc
// .xun/config.json — only what differs from the defaults
{
"model": { "name": "my-model", "reasoning_effort": "high" },
"auto_compact": { "token_threshold": 128000 },
"extension_settings": { "mcp": { "servers": { } } }
}load_config() caches per process; call load_config(force_reload=True) after rewriting the file. /config in a session prints the resolved config, and /config model.name=other sets a single dotted field (validated on assignment).
Fields
| Field | Default | Meaning |
|---|---|---|
provider.openai_base_url | ${XUN_OPENAI_BASE_URL} | OpenAI-compatible endpoint. |
provider.openai_api_key | ${XUN_OPENAI_API_KEY} | API key. |
model.name | ${XUN_OPENAI_MODEL} (empty) | Model id. Empty means "take the first model the provider lists". |
model.capabilities | ["vision"] | Model capabilities; a tool is offered only when its required_capabilities are a subset. Currently only vision exists. |
model.temperature | null | Omitted from the request when null. |
model.reasoning_field | null (auto) | Provider key for reasoning text, e.g. reasoning_content. Auto-detected from the first response that carries one. |
model.reasoning_effort | null | none … max; not all values are valid for every model. |
auto_confirm | false (${XUN_AUTO_CONFIRM}) | Answer every confirmation with its default without asking. A warning is printed once per process. |
auto_compact.enabled | true | Compact the conversation automatically. |
auto_compact.token_threshold | 192000 | Start compacting when the last model call reported more tokens than this. |
enable_extensions | true (${XUN_ENABLE_EXTENSIONS}) | Load $XUN_HOME/extensions/. Internal helper agents set this to false. |
load_project_instructions | true | Inject AGENTS.md from the working directory into the system prompt. |
extension_settings | {} | Per-extension bags, keyed by extension name; read through ExtensionContext.settings. |
Set by the runtime rather than by users: _XUN_USERNAME (the xunx user of a container) and a few internal _XUN_* switches such as _XUN_DEFAULT_MAX_ITER and _XUN_INFO_TOOL_OVERRIDE. They are undocumented and may change without notice.
AGENTS.md
With load_project_instructions enabled, the agent re-reads AGENTS.md (Agents.md / agents.md also match) from its workdir before and after every execute(), and stores it as a named persistent section of the system prompt. Sub-agents inherit the same behavior because they share the workspace.
python
from xun import Agent
agent = Agent()
agent.config.model.temperature = 0.2
agent.config.auto_confirm = True # validated on assignment
agent = agent.initialize()Inside a container
xunc / xunx serve copy config.json, extensions/ and skills/ from the host home into /.xun, and set XUN_HOME=/.xun there. Environment variables reach the container through --env (NAME=VALUE, or wildcard patterns forwarded from the host; XUN_* and _XUN_* are always forwarded), and are then picked up by the same placeholder mechanism.