# Configuration reference

```
openprogram config list              # value, group, apply mode
openprogram config get ui.web_port
openprogram config set ui.web_port 8101
```

One registry, `openprogram/state/settings.py`, drives the setup wizard, TUI and Web settings. Every setting, generated from it: [Settings keys](https://fzkuji.github.io/OpenProgram/docs/reference/config-keys.html). Everyday use: [Configuration and data directory](https://fzkuji.github.io/OpenProgram/docs/server/configuration.html).

## Common settings

### Ports

| Key | Meaning | Default | Applies |
| --- | --- | --- | --- |
| `ui.web_port` | Single worker port for API, WebSocket and Web UI | 18100 | next start |
| `ui.open_browser` | `openprogram web` opens the browser | true | next start |

### Search, memory, tools, agent

| Key | Meaning | Default | Applies |
| --- | --- | --- | --- |
| `search.default_provider` | `auto` picks the highest-priority configured one | auto | live |
| `search.google_pse_cx` | Google Programmable Search engine id. `GOOGLE_PSE_CX` is read when it is empty. | empty | live |
| `memory.backend` | `local`, or `none`: no prompt memory, recall, automatic writes, organizer or memory threads | local | next start |
| `memory.writer.model` | Optional `provider/model` for background writing; empty uses the default chat agent's | empty | live |
| `tools.disabled.<name>` | Per-tool switch; members of the `tools.disabled` list | all enabled | live |
| `agent.output_style` | How replies are written; appends to the system prompt. [Output styles](https://fzkuji.github.io/OpenProgram/docs/reference/output-styles.html) | default | live |
| `providers.<name>` | Read-only status row. Configure with `openprogram providers login` or the Web UI. | — | — |

### Sandbox

| `sandbox.mode` | Local model-driven commands |
| --- | --- |
| `off` | Default. No sandbox unless a conversation turns it on in its composer menu. |
| `auto` | Sandboxed in every conversation when the backend is available; otherwise runs without one |
| `workspace-write` | Writes limited to the working directory and configured roots, deny-read paths blocked, network disabled |
| `danger-full-access` | Full user authority |

| Key | Meaning | Default | Applies |
| --- | --- | --- | --- |
| `sandbox.writable_roots` | Extra writable directories, JSON list | [] | live |
| `sandbox.deny_read` | Unreadable globs; defaults include credential paths. Linux cannot enforce middle wildcards such as `**/.env`: use an exact path or a directory deny such as `/absolute/path/to/secrets/**`. | `openprogram config get sandbox.deny_read` | live |
| `sandbox.deny_write` | Unwritable globs, on top of the function-watcher directory and protected startup files | [] | live |
| `sandbox.network` | Network access | false | live |
| `sandbox.pass_env` | Env names passed beyond the built-in allowlist | [] | live |
| `sandbox.unavailable_policy` | `refuse` fails the command when the backend is missing or cannot isolate; `warn` runs it unsandboxed | refuse; warn on Windows | live |

Backends: Seatbelt on macOS, bubblewrap on Linux, bubblewrap through the default WSL2 distribution on Windows. Docker is not an automatic fallback.

## Top-level keys in config.json

Do not edit by hand: use `openprogram config set`, the setup wizard or the Web UI.

| Key | Holds | Code |
| --- | --- | --- |
| `ui` | `{web_port, open_browser}` | `openprogram/state/settings.py` |
| `search` | `{default_provider}` | `openprogram/state/preferences.py` |
| `memory` | `{backend, writer: {model}}` | `openprogram/state/settings.py`, `openprogram/state/memory/` |
| `tools` | `{disabled: [tool name, ...]}` | `openprogram/operations/setup.py`, `openprogram/state/settings.py` |
| `sandbox` | `{mode, writable_roots, deny_read, deny_write, network, pass_env, unavailable_policy}` | `openprogram/host/sandbox/__init__.py`, `openprogram/state/settings.py` |
| `last_used_model` | `{provider, model}` a new conversation starts on. Empty on a fresh install. | `openprogram/models/providers/catalog/last_used.py` |
| `provider_companies` | Catalogue entry id → company id: which company's card and keys an entry the built-in table does not list belongs to. Its own id makes it stand alone. | `openprogram/models/auth/login/login_method_registry.py` |
| `default_workdir` | Default agent working directory | `openprogram/state/paths.py` |
| `providers` | Per-provider subtree (enabled and custom models), managed by the Web UI model listing | `openprogram/models/providers/settings/config_read.py`, `storage.py` |
| `api_keys` | No longer written. Keys found here move into the credential store at start, and the name leaves the file; a name no service reads stays. | `openprogram/models/auth/key_move.py` |
| `spec_migration_version` | One-time marker for the model-spec migration | `openprogram/models/providers/settings/storage.py` |

## Environment variables

Set them in the shell that launches `openprogram` or the worker.

### Paths and instances

| Variable | Purpose | Code |
| --- | --- | --- |
| `OPENPROGRAM_PROFILE` | Same as `--profile`; `~/.openprogram-<name>/` | `openprogram/state/paths.py` |
| `OPENPROGRAM_WORKDIR` | Default agent working directory, above `default_workdir` | `openprogram/state/paths.py` |

### Ports and web

| Variable | Purpose | Code |
| --- | --- | --- |
| `OPENPROGRAM_WEB_PORT` | Single worker port (default 18100); below flags, above the stored preference | `openprogram/operations/worker/lifecycle.py` |
| `OPENPROGRAM_NO_WEB` | `1`: worker skips the frontend build gate and serves no web UI | `openprogram/operations/worker/runner.py` |
| `OPENPROGRAM_DOCS_BASE` | Docs mount path (default `/docs/`; must start and end with `/`). The publishing workflow sets it to the path of the site address | `scripts/docs_site/build.py` |

### Behaviour switches

| Variable | Purpose | Code |
| --- | --- | --- |
| `OPENPROGRAM_NO_AUTO_WORKER` | `1`: TUI connects only to an existing worker | `openprogram/interfaces/cli/ink.py` |
| `OPENPROGRAM_NO_SLEEP` | `1`: no memory sleep-consolidation scheduler | `openprogram/state/memory/scheduler.py` |
| `OPENPROGRAM_NO_PROGRAMS_WATCH` | `1`: no file watcher on the programs directory | `openprogram/programs/_host/watcher.py` |
| `OPENPROGRAM_PROJECT_AUTOCOMMIT` | `0`: no project auto-commit | `openprogram/state/store/project/project_commit.py` |
| `OPENPROGRAM_WEBSEARCH_DISABLE` | Disables a search provider by name, e.g. `ollama` | `openprogram/programs/tools/web/web_search/providers/ollama.py` |

### LLM calls

| Variable | Purpose | Code |
| --- | --- | --- |
| `AGENTIC_PROVIDER`, `AGENTIC_MODEL` | Picked first by `detect_provider()` | `openprogram/models/providers/catalog/registry.py` |
| `OPENPROGRAM_MAX_RETRIES` | Retries for transient failures (default 6) | `openprogram/runtime/agent/runtime/shared.py` |
| `OPENPROGRAM_RETRY_BACKOFF_BASE` | Backoff base seconds (default 1.5) | `openprogram/runtime/agent/runtime/shared.py` |
| `OPENPROGRAM_EXEC_TIMEOUT_S` | Default wall-clock budget for `runtime.exec` (unset or `0`: unbounded) | `openprogram/runtime/agent/runtime/shared.py` |
| `OPENPROGRAM_FALLBACK_MODELS` | Overrides the `model_fallback` setting. Unset: that setting (default off). `same-provider`: up to two other enabled models of that provider. `off` or `none`: disabled. Comma-separated `provider/model` list: in order, may cross providers. | `openprogram/models/providers/utils/failures/failover.py` |
| `OPENPROGRAM_PROVIDER_STREAM_RETRIES` | Attempts per streaming request, including the first (default 5). Connection retries have their own allowance of this minus one. | `openprogram/models/providers/utils/streams/stream_retry.py` |
| `OPENPROGRAM_NETWORK_WAIT_MAX_S` | Wait for an unreachable endpoint after retries are spent, checking every 5 to 30 s (default 1800; `0` fails at once). Cancelling ends it. | `openprogram/models/providers/utils/streams/stream_retry.py` |
| `OPENPROGRAM_RETRY_AFTER_CAP_S` | Longest `Retry-After` a retry sits through (default 300). Longer fails at once so a fallback model, another account or the user can take over. `0` lifts the cap. | `openprogram/models/providers/utils/streams/stream_retry.py` |
| `OPENPROGRAM_CODEX_WEBSOCKET` | `0`: ChatGPT-sign-in Codex turns use HTTP instead of the WebSocket, which is on by default and sends a continuing turn as its new input only | `openprogram/models/providers/adapters/openai_codex/websocket_transport.py` |
| `OPENPROGRAM_CODEX_ZSTD` | `0`: uncompressed Codex HTTP turns (zstd by default) | `openprogram/models/providers/adapters/openai_codex/request_compression.py` |
| `OPENPROGRAM_STRICT_TOOLS` | `0`: strict tool schemas off (on by default) | `openprogram/models/providers/schema/__init__.py` |
| `OPENPROGRAM_FORCE_IPV4` | `1`: forces an IPv4 source address | `openprogram/models/providers/utils/http_transport/http_client.py` |

### Debugging

| Variable | Purpose | Code |
| --- | --- | --- |
| `OPENPROGRAM_LOG_LEVEL` | `DEBUG`, `INFO`, `WARNING`, `ERROR`, any case. Default `INFO` for worker, scheduler and foreground Server, `WARNING` for the CLI. Invalid values are ignored. | `openprogram/host/process_logging.py` |
| `OPENPROGRAM_DEBUG_RUNTIME` | `1`: mirrors runtime logs to stderr | `openprogram/interfaces/server/runtime_management.py` |
| `OPENPROGRAM_DEBUG_REGISTRY` | `1`: traceback on function-registry import failures | `openprogram/programs/_host/registry.py` |
| `OPENPROGRAM_DEBUG_DISPATCHER` | `1`: dispatcher logs at `INFO`, in the worker log | `openprogram/runtime/conversation/turn_runtime/runtime_attach.py` |
| `OPENPROGRAM_DEBUG_PROVIDER` | `1`: provider-layer logs at `INFO`, in the worker log | `openprogram/models/providers/adapters/openai_codex/openai_codex.py` |

**Internal variables**

HTTP and SSE timeouts `OPENPROGRAM_HTTPX_*`, `OPENPROGRAM_SSE_*`; TCP keepalive `OPENPROGRAM_TCP_*`; per-provider retries `OPENPROGRAM_<PROVIDER>_MAX_RETRIES`; `OPENPROGRAM_JOB_WORKERS`; `OPENPROGRAM_IMAGE_DIR`. Full list: `grep -rn "OPENPROGRAM_" openprogram/`.
