---
url: /another-agentic-system/api/config.md
---
# The orchestrator's configuration file

> **Status: built (PR S9 of plan 10, 2026-10-02; the `artifacts` section by S10; `auth.mode`, `auth.jwt` and `server.environment` by S14; `auth.roles` and `auth.defaultRole` by S15; the `models`, `tasks` and `ui` sections by S18; the `toolServers` section by slice 8, [ADR 0024](../decisions/0024-mcp-tools-attached-per-conversation.md); the `secrets` section by slice 3 of [ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md), 2026-10-14).** The decision is
> [ADR 0034](../decisions/0034-one-yaml-configuration-secrets-by-reference.md) (the file, secrets by reference,
> validation, migration), [ADR 0035](../decisions/0035-utility-model-tasks.md) (the `models` and `tasks` sections),
> [ADR 0032](../decisions/0032-files-from-agents-live-in-an-artifact-store.md) (the `artifacts` section) and
> [ADR 0033](../decisions/0033-the-orchestrator-is-an-oauth2-resource-server.md) (the `auth` section, its roles, and `server.environment`).
> The loader builds every key marked **now** (crate [`orch-config`](../../orchestrator/crates/config/README.md), the
> loader in [`orchestrator/bin/orchestrator`](../../orchestrator/bin/orchestrator/README.md#the-configuration-file));
> a key marked **reserved** belongs to the PR named beside it and is refused (exit 78, naming that PR and ADR) until it
> lands. The JSON Schema is [`config.schema.json`](config.schema.json). [`GET /api/config`](#get-apiconfig) serves the
> `ui` section.
> The environment variables of
> [`orchestrator/bin/orchestrator/README.md`](../../orchestrator/bin/orchestrator/README.md#environment) still work in
> this release, over the file.

One YAML file, named by `ORCH_CONFIG_FILE` (or `--config <path>`), read once at startup. It configures the
orchestrator only: the web has no configuration and no secrets ([architecture](../architecture.md)), and reads the
public `ui` subset of this file from [`GET /api/config`](#get-apiconfig).

## Rules

* **`version: 1`** is required. Another value, or none, is exit 78 ("this build reads version 1").
* **Unknown keys are errors** (`deny_unknown_fields` on every struct; the schema says `additionalProperties: false`).
* **A secret is a reference**, never a value: `{ env: NAME }` (the variable must be set and not empty) or
  `{ file: /run/secrets/name }` (read at startup, at most 64 KiB; one trailing `\n` or `\r\n` is cut; an `{ env }`
  value is trimmed, as a `tokenEnv` value is today). A plain string where a secret goes is exit 78: `database.url: a secret is a reference: { env: NAME }
  or { file: PATH }`. The message never carries a value.
* **A URL may be a reference too**, where a deployment keeps an address out of git: `models.endpoints.<name>.baseUrl` is
  the URL as text, as ever, or `{ env: NAME }` or `{ file: PATH }`, read at startup by the rules of a secret above. The value
  read is then checked as a written one is (`http` or `https`, a host), under the same key
  (`models.endpoints.<name>.baseUrl: expected an http:// or https:// URL, like https://api.example.com/v1`), and an
  error never carries it. A URL is **not one of the fifteen secrets** ([ADR 0034](../decisions/0034-one-yaml-configuration-secrets-by-reference.md)):
  `--print-config` shows the reference, a log line names the reference in place of the address, and nothing redacts it as a
  credential. A plain string keeps working unchanged. `ORCH_MODEL_BASE_URL` stays text.
* **Relative paths** (`agents.file`, `mcp.tokensFile`, a secret's or a prompt's `file`) are relative to the directory
  of the configuration file.
* **A prompt is read once, at startup.** `tasks.<task>.system` is `{ inline: TEXT }` or `{ file: PATH }`; a file is
  read through the same door as a secret's (UTF-8), and a change needs a restart. With the space around it cut it is 1
  to 4096 bytes: empty or longer is exit 78, naming the key and the file, never the text. A prompt is not a secret,
  and `--print-config` shows it as the reference the file has (`{ file: prompts/title.md }`), never the text.
* **No value in an error.** A message names the key path, what is wrong and what is allowed, never a value of the
  file, the environment or a secret file.
* **A key repeated in one mapping is an error**, never "the last one wins".
* **Every error at once.** A YAML syntax error is reported alone (nothing after it can be read). Otherwise each pass
  lists all of its errors, each with its key path, then the process exits 78: the shape errors (unknown or reserved key,
  wrong type, missing required key, a value out of range or not allowed, a plain string as a secret), and, when there
  are none, the rule errors (a URL, a cross-key rule such as "both or neither of `threadTools.url` and `secret`", a
  secret that cannot be read) and then the rules of the gate against the agents, the surfaces and features this build
  has, the agents file and the MCP tokens, which are checked one at a time. A pass runs only when the one before it found
  none: a rule cannot be checked on a value that is not there.
* **Anchors and aliases** are resolved by the parser and merge keys (`<<:`) are applied before validation; a YAML tag
  (`!something`) is an error.
* **A key that selects an implementation** (`artifacts.store`, `secrets.store`, `auth.mode`, a surface in `server.surfaces`) names only
  what this build compiled in; anything else is exit 78 naming the Cargo feature, as `ORCH_SURFACES` does today.
* The JSON Schema of the file is generated from the Rust types (`schemars`) and committed at
  [`docs/api/config.schema.json`](config.schema.json); a test fails when the types and the committed file differ
  (regenerate with `UPDATE_SCHEMA=1 cargo test -p orch-config --test schema`, as the goldens do with `UPDATE_GOLDEN=1`).
  Editors can validate against it. An optional key is simply optional in it: a key written with nothing after it is a
  type error.
* **The variables over the file** (this release). A flag or its variable that is set wins over the file, which wins
  over the default, and the process logs one warning per variable naming the variable and the key (never the value).
  Each is read with its own parser first (`ORCH_STEPS_RECORD_IO=yes` is `true`, `ORCH_SURFACES` a comma list), and a
  value that does not parse is an error naming the variable. `ORCH_ROLE`, `ORCH_INSTANCE_ID`, `RUST_LOG` and
  `HOSTNAME` are logged at info. A variable that says what the file says, or that the file names as `{ env: NAME }`,
  overrides nothing. The `ORCH_MODEL_*` variables are the endpoint `default` (they add it to the file's other
  endpoints, or override its keys when the file has one of that name), `ORCH_TITLE_MODEL` is `tasks.title.model`
  (with `tasks.title.endpoint: default` when the file has none). A variable of a group whose first key is not set (a registry timeout with no registry URL, the
  model key or timeout with no base URL, a webhook age with no secrets) is read, and left out, as it always was.
* **A process that serves no routes** (`server.role: worker`) is not asked for the secrets of the routes it would not
  mount (`webhooks.*`), so one file serves a control plane and its workers; the secrets every role uses
  (`database.url`, the registry's, `threadTools`, a model endpoint's, the keys of `secrets`) are read by all.

## An example

```yaml [orchestrator.yaml]
version: 1
server:
  listen: 0.0.0.0:8080
  surfaces: [agui, mcp, thread-tools, webhook-generic, webhook-github]
  publicUrl: https://chat.example.com
database:
  url: { env: DATABASE_URL }
agents:
  file: agents.yaml
  registry:
    url: https://platform.example.com/registry/v1/agents
    agentToken: { file: /run/secrets/registry-agent-token }
gate:
  require: [agent-checks, ci]
  ci: { required: [build] }
steps:
  recordToolIo: true
asks:
  maxDepth: 2
  maxPerJob: 16
  maxRunning: 4
  timeoutSecs: 1800
models:
  endpoints:
    default:
      baseUrl: https://models.example.com/v1
      apiKey: { env: ORCH_MODEL_API_KEY }
    small:
      baseUrl: https://small.example.com/v1
      timeoutSecs: 10
tasks:
  title: { endpoint: small, model: small-model }
  description:
    endpoint: default
    model: small-model
    system: { inline: "Say in one or two sentences what the person wants and where it stands." }
    maxTokens: 160
    recompute: { minNewMessages: 4 }
ui:
  showDescriptions: true
  history: { initialTurns: 12, pageTurns: 20, windowed: true }
artifacts:
  store: fs
  fs: { root: /var/lib/orchestrator/artifacts }
secrets:                      # where a person's own credentials are kept (see "secrets"); absent: none are kept
  store: pg                   # or openbao, with `openbao: { address, mount, token, caFile }` instead of `pg`
  pg:
    keys: [{ id: k1, key: { file: /run/secrets/user-secrets-key } }]
    current: k1
threadTools:
  url: http://orchestrator:8080
  secret: { file: /run/secrets/thread-tools }
sharing:                      # a thread shared by a revocable link (see "sharing"); absent: nothing is shared
  mode: internal
  secret: { file: /run/secrets/sharing }
retention:                    # how long threads are kept (see "retention"); absent: 90 days
  threads: { days: 90 }
usage:                        # the usage ledger of the people (see "usage"); absent: 24 months kept, nothing priced
  retentionMonths: 24
  prices:
    currency: EUR
    models:
      - provider: openai
        model: glm-5.3
        input: "0.40"         # per million tokens, a decimal string, never a YAML number
        cachedInput: "0.10"
        output: "1.60"
    sandbox:
      cpuCoreHour: "0.04"
      gibHour: "0.005"
mcp:
  tokensFile: mcp-tokens.yaml
  allowedHosts: [chat.example.com]
auth:
  mode: jwt
  jwt:
    issuer: https://idp.example/realms/main
    audiences: [oauth2-proxy-client-id]
    rolesClaim: realm_access.roles
  defaultRole: user           # the built-in user and admin (see "Roles and permissions")
webhooks:
  generic:
    secrets: [{ env: WEBHOOK_GENERIC_SECRET }]
  github:
    secrets: [{ env: WEBHOOK_GITHUB_SECRET }]
toolServers:                  # what a person may attach to a conversation (see "toolServers")
  - id: websearch
    name: Web search
    description: Search the web.
    url: https://search.example.com/mcp
    icon: data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnLz4=
    bearer: { env: WEBSEARCH_TOKEN }
    tools: [search]
    agents: [chat, researcher]
```

`orchestrator --print-config` prints the configuration this process would run with (the file, the environment over it,
the defaults filled in), secrets as their references, and exits 0; with errors it lists them and exits 78. It opens no
connection. It reads the secrets' variables and files, as a start does, so it checks a file where it will run (any dummy
value does for a check elsewhere); the notes about variables that override the file go to stderr, the YAML to stdout.

`orchestrator artifacts migrate --from fs --to s3 --fs-root <dir> [--dry-run] [--allow-empty]` ([ADR 0058](../decisions/0058-large-files-go-up-through-a-presigned-url-the-orchestrator-gives-the-agent.md) A5.4) is the binary's one command; with none the process is the service. It reads this file too,
but **only the `artifacts` section and its two credentials** (`store: s3` is required; `artifacts.s3.accessKeyId` and `secretAccessKey` are the only secrets resolved; the rules the service applies to that section and that need nothing outside it (the download and presign settings, the public endpoint, the limits an upload needs) are applied too; the database, the agents and every other section are neither checked nor read, and Postgres is never opened). `--config` and `--log-format` may come before the command.
Its flags, report and exit codes are in [`bin/orchestrator`](../../orchestrator/bin/orchestrator/README.md#the-command-artifacts-migrate).

`orchestrator secrets rewrap` ([ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md), slice 3) re-seals the stored secrets under the current key, after a key was made current. It reads this file too, but **only `database.url` and the `secrets` section with its keys** (the section is required, and `secrets.store` must be one this build has, else exit 78; every other section is neither checked nor read). Its report and exit codes are in [`bin/orchestrator`](../../orchestrator/bin/orchestrator/README.md#the-command-secrets-rewrap).

## Every key

**Now** is built (S9; the `artifacts` keys by S10 and S11, the `auth` keys by S14 and S15, the `models`, `tasks` and `ui` keys by S18); **reserved** names the PR and the ADR that bring it. "Replaces" is the environment variable
(and flag) of today; during the transition release it still works and wins over the file, with a warning naming the
variable and the key ([ADR 0034](../decisions/0034-one-yaml-configuration-secrets-by-reference.md#4-migration-the-environment-over-the-file-for-one-release)). A
secret variable of today stands for a reference to itself: `ORCH_MODEL_API_KEY` set means
`models.endpoints.default.apiKey: { env: ORCH_MODEL_API_KEY }`.

### `server`, `log`, `database`, `dispatcher`, `inbox`

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `server.listen` | socket address, `0.0.0.0:8080` | `LISTEN_ADDR` | now |
| `server.role` | `all` | `control-plane` | `worker`, `all` | `ORCH_ROLE` (**kept**: a process override, see below) | now |
| `server.instanceId` | string, `$HOSTNAME-<uuid>` | `ORCH_INSTANCE_ID` (**kept**: a process override) | now |
| `server.surfaces` | list of `agui`, `mcp`, `thread-tools`, `webhook-generic`, `webhook-github`; `[agui]` | `ORCH_SURFACES` (a comma list) | now |
| `server.publicUrl` | origin, none | `ORCH_PUBLIC_URL` | now |
| `server.minClientVersion` | one to four dotted decimal numbers of at most nine digits (`1.4.0`); none (no client is refused) | — | now. The lowest application version served: see [client-version.md](client-version.md). A request of the resource API whose client states a lower version in `X-Client-Version`, an unreadable one or none gets the problem `client_update_required` (426); the health, public-share and OAuth routes are not asked |
| `server.cors.allowedOrigins` | list of at least one exact origin, `scheme://host[:port]` with no path, query, fragment, credentials or trailing slash, any scheme (`tauri://localhost`, `http://tauri.localhost`), an `http(s)` one as a browser sends it (lower case, no default port, the host in ASCII: `https://xn--bcher-kva.example`, not `https://bücher.example:443`), never `*` or `null`, each once; none (no CORS header at all) | — | now; [ADR 0047](../decisions/0047-one-ui-for-web-desktop-and-mobile-each-signs-in-as-a-public-oauth-client.md). The pages of these origins may call every route (the desktop and mobile apps): a preflight is answered before identity (any origin's, but only a listed one gets `Access-Control-Allow-Origin`), the request headers `Authorization`, `DPoP`, `Content-Type`, `Accept`, `Last-Event-ID`, `X-Web-Revision` and `X-Client-Version` are allowed, `WWW-Authenticate`, `Date` and `Content-Disposition` are exposed, and **credentials never are** (no cookie crosses origins; the apps send DPoP-bound tokens). `production` refuses `http://` except for `localhost`, a loopback address and a name under `.localhost` |
| `server.shutdownGraceSecs` | ≥ 1, `15` | `SHUTDOWN_GRACE_SECS` | now |
| `server.history.maxTurns`, `.maxPageBytes` | `maxTurns` 1 to 1000, `100`: the largest `limit` of a page of a thread's history and the most a `since` read goes back; `maxPageBytes` 65 536 to 67 108 864, `4194304`: the frames of a page as JSON, the newest chain returned whole whatever its size | — | now; [ADR 0059](../decisions/0059-a-thread-opens-at-its-end-and-older-turns-load-on-scroll-up.md), [`history.md`](history.md) |
| `server.internal.listen` | socket address, `0.0.0.0:8081`; never `server.listen` on a port that is not 0 (exit 78 naming the key) | — | now; [ADR 0084](../decisions/0084-the-run-lease-the-broker-binds-a-run-and-lends-its-model-credential.md), card ANR-578. The **internal listener** of the credential broker's run routes, below. Absent: no second listener |
| `server.internal.token` | **secret**, required, at least 32 bytes | — | now. The orchestrator's own bearer on the run routes: `POST /internal/runs` and `DELETE /internal/runs/{run}` |
| `server.internal.agents` | map from an agent id (`a-z`, `0-9`, `-`, at most 63) to a **secret**, at least 32 bytes each; none | — | now. Each agent's bearer on the internal listener, so an agent is told apart and refused: binding or unbinding is `403`, and it may not read a run's lease, its own run included (ADR 0084 decision 2, amended 2026-11-24). No two callers may share a token (exit 78 naming the second key) |
| `server.internal.meter` | **secret**, at least 32 bytes, not another caller's token; none | — | now; [ADR 0108](../decisions/0108-a-run-is-charged-to-the-identity-providers-sub-and-an-ended-run-is-still-answered-to-the-meter.md), card ANR-1099. The operator's pod-minute meter's bearer on the run routes: the one caller of `GET /internal/runs/{run}/account`. **Refused (exit 78 naming this key) unless `auth.mode` is `jwt` and `auth.jwt.userClaim` is `sub`**: the meter is answered the person's `UserId` under the identity provider's `sub` (trimmed and lower-cased), never an e-mail address. Absent: nobody may ask |
| `server.environment` | `development` | `production`, `development` | — (plan 10 §3.4 called it `ORCH_ENV`; it is a key, not a variable) | now. A `production` process refuses `auth.mode: proxy_header`, and an `http://` `auth.jwt.issuer` or `jwksUrl` ([Authentication](#authentication)) |
| `log.format` | `json` | `text`, `json` | `LOG_FORMAT` | now |
| `database.url` | **secret** (required) | `DATABASE_URL` | now |
| `database.directUrl` | **secret**, none; never the same text as `database.url` (exit 78 naming the key) | `DATABASE_DIRECT_URL` | now; [Database behind a pooler](#database-behind-a-pooler). The database itself, for what cannot go through a transaction-mode pooler: the migrations at boot, the `LISTEN` connection and the commands that open the database. Absent: everything uses `database.url`, as before |
| `database.maxConnections` | ≥ 2, `10` | `DATABASE_MAX_CONNECTIONS` | now |
| `dispatcher.concurrency` | ≥ 1, `32` | `DISPATCHER_CONCURRENCY` | now |
| `dispatcher.outboxLeaseSecs` | ≥ 3, `30` | `OUTBOX_LEASE_SECS` | now |
| `dispatcher.order` | `fair` | `fifo`, `fair` | — | now; [ADR 0066](../decisions/0066-a-fair-share-of-the-dispatcher.md). Which due rows a claim takes first when more are waiting than there are free slots. `fair`: the person (the owner of the row's thread) with the fewest jobs running gets the next free slot, and among equals the oldest row; with one person it is the oldest-first order, and a `cancel` row always goes first. `fifo`: the oldest row first, whoever it is for, as before the ADR; a switch to roll back to. A job that runs is never taken back. |
| `inbox.leaseSecs` | ≥ 3, `30` | `INBOX_LEASE_SECS` | now |
| `inbox.pollSecs` | ≥ 1, `2` | `INBOX_POLL_SECS` | now |
| `inbox.parkedTtlSecs` | ≥ 1, `86400` | `INBOX_PARKED_TTL_SECS` | now |
| `inbox.maxAttempts` | ≥ 1, `10` | `INBOX_MAX_ATTEMPTS` | now |

### The internal listener (the run routes)

*Built 2026-11-24 (ADR 0084 decision 5, card ANR-578).* The credential broker's run routes are the orchestrator's binding of a run
and the injector's lease of the deployment's model key for it. They are served on **their own port** and nothing else is: no
surface, no `/healthz`, no resource API, and no Ingress or edge route names it. Only a process that serves routes (`all`,
`control-plane`) binds it; a worker that shares the file reads and checks the section and opens nothing.

```yaml [orchestrator.yaml]
server:
  listen: 0.0.0.0:8080
  internal:
    listen: 0.0.0.0:8081
    token: { file: /run/secrets/orchestrator/internal-token }
    agents:
      coder: { file: /run/secrets/orchestrator/internal-agent-coder-token }
    meter: { file: /run/secrets/orchestrator/internal-meter-token }   # only with auth.jwt.userClaim: sub
```

| Route | Caller | Answer |
|---|---|---|
| `POST /internal/runs` | the orchestrator (its `token`) | `204`; `409 run_already_bound` for a different binding of a run |
| `DELETE /internal/runs/{run}` | the orchestrator (its `token`) | `204`, idempotent |
| `GET /internal/runs/{run}/lease` | the orchestrator or the injector — never an agent, its own run included | `200 {"token","accountId","expiresAt"}`, `Cache-Control: no-store`; `422 account_not_opaque` when the person is not an account id |
| `GET /internal/runs/{run}/account` | the operator's meter identity alone | `200 {"accountId"}`, `Cache-Control: no-store`; `404 run_not_bound` for an unknown run, for a run that ended more than 24 hours ago and for any other caller; `422 account_not_opaque` when the person is not an account id |

`accountId` is the person's `UserId` under the identity provider's **`sub`** (ADR 0108; the claim **trimmed and lower-cased**, so only an identity provider whose `sub` is lower-case ASCII joins with its raw `sub`): an id of the platform's closed alphabet `[A-Za-z0-9._:/-]{1,128}` and **never an
e-mail address**, so a deployment that reads `auth.jwt.userClaim: email` is answered `422 account_not_opaque` and cannot run the meter (the configuration
refuses `server.internal.meter` there). It is the same id in the lease and in the meter's answer. The injector gets it beside the key so it can say
whose call it is (ADR 0084, amended 2026-11-24). It is in no log line, no refusal, no error and no message to an agent.

The `{run}` of every route is adam's A2A task id. A run pod carries it as the annotation `adam.vymalo.com/run-id` (its label `adam.vymalo.com/run`
is a 12-hex hash the broker does not accept): the meter reads `metadata.annotations["adam.vymalo.com/run-id"]`, asks
`GET /internal/runs/{run}/account` and is answered `{"accountId"}`. A run that **ended** is still answered for 24 hours (its binding is kept as a
tombstone that no lease reads, swept by the next end after that), because a pod lives up to 900 s idle after its job and the meter backfills up to 24 hours.

A refusal is one of the ruled slugs: `run_not_bound` (`404`, also for a caller that is not the run's agent, so the answer never
says whether a run exists), `lease_expired` (`410`), `account_not_opaque` (`422`), `unavailable` (`503`, among them a model the deployment has no key for: never
an empty header), `unauthenticated` (`401`) and `not_allowed` (`403`, an agent binding or unbinding). A configuration that would not
run is refused at startup, exit 78 naming the key: a `listen` that is not a socket address or that is `server.listen`, a token
shorter than 32 bytes, a key of `agents` that is not an agent id, and two callers sharing one token (the door compares the
orchestrator's first, so one caller would answer as another).

**What is not here:** today's caller authentication is one static token per caller (`SharedTokens`), not a TokenReview of the
service-account token or mTLS; the model keys are the deployment's configuration, not a vault; and the routes are absent from
`docs/api/chat-api.yaml` on purpose. S9 brings the injector's own identity scheme, and the deployment of the vault. The chart's
`orchestrator.internal` values are what turn the section on ([`deploy/chart/README.md`](../../deploy/chart/README.md#the-run-routes-adr-0084-cards-anr-378-and-anr-578)).

### Database behind a pooler

With many replicas, each holds a pool, and Postgres has a fixed number of connections: a connection pooler in front of it (PgBouncer, which CloudNativePG runs as a `Pooler`) lets every replica keep a small pool. Then `database.url` is **the pooler's address** and `database.directUrl` is **the database itself**. Without `directUrl` nothing changes: every connection uses `database.url`, as it always did.

| Used for | Connection | Why |
|---|---|---|
| The migrations at boot (the thread store's, the secret store's, the in-process agents' journal's) | `directUrl` | the migrator (`orch-pg-migrate` for the two stores; adam-rs's own for the agents' journal, which takes a session lock of the journal's prefix, `pg_advisory_lock(hashtext(...))`, on `tokio-postgres` since adam-rs `7ac3281`) takes a **session** advisory lock (`pg_advisory_lock`) and holds it across its statements; a transaction-mode pooler hands the server connection to someone else between two transactions |
| The `LISTEN` connection of the wakeup, and the in-process agents' notifier | `directUrl` | `LISTEN` is session state; a pooler in transaction mode cannot keep it |
| `orchestrator usage backfill` and `orchestrator secrets rewrap` | `directUrl` | a command holds a session across statements and has no use for a pooler |
| Everything else: the request pool, the dispatcher, the inbox, the purge and sweep workers, the in-process agents' journal, the `NOTIFY`s | `url` | each is a statement or a transaction |

With the feature `agent-local`, the URL the in-process agents' notifier listens on (`url`, or `directUrl` behind a pooler) names its server itself: host, port, user, password, database and `sslmode` (and `sslrootcert` when it verifies). adam-rs's listener reads the URL alone, so a URL that leaves one of them to a `PG*` variable, the password file or the operating system's user is refused at startup ([`orch-agent-adam`](../../orchestrator/crates/agent-adam/README.md)); the rest of the orchestrator reads those as sqlx did.

**What must stay direct, and why** (*verified 2026-10-28*):

* **`LISTEN`.** PgBouncer's own feature map lists `LISTEN` as never supported in transaction pooling (pgbouncer.org/features.html). Observed against PgBouncer 1.22.0: a listener taken from a pooled pool believes it is attached and hears nothing, and PgBouncer logs `got packet 'A' from server when not linked`. A `NOTIFY` is a single statement and pools fine.
* **The migration lock.** `sqlx-postgres` 0.9.0 takes `SELECT pg_advisory_lock($1)` and releases it with `pg_advisory_unlock` (`src/migrate.rs`, read at 0.9.0), and `orch-pg-migrate`, which the thread store and the secret store migrate with since sys#382 E1, takes the same lock (`crates/pg-migrate`). Observed against PgBouncer 1.22.0: eight replicas migrating through a pooled pool race, so a migration runs twice and fails (`column ... already exists`) or a lock is left held on a server connection nobody owns, which would stop the next replica's migration. Each replica's migration therefore runs on one connection of its own to `directUrl`, closed when it is done.

**What is safe through a pooler:** every other lock the orchestrator takes is transaction-scoped (`pg_advisory_xact_lock`, in the thread store, the people's server definitions, the secret store and adam-rs's journal), and every setting is `SET LOCAL lock_timeout`, `set_config(.., true)` or `SET TRANSACTION`, so none outlives its transaction. *Verified 2026-10-28* by reading every `advisory`, `SET` and `set_config` in `orchestrator/crates` and `orchestrator/bin`, and by running the whole of `orch-store-postgres`, `orch-secrets-pg` and the binary's Postgres tests through PgBouncer in transaction mode (`orchestrator.yml`, job `pooler`).

**What the pooler must be:**

* `pool_mode = transaction` (session mode needs none of this; statement mode breaks transactions).
* `max_prepared_statements` above 0, which needs **PgBouncer 1.21.0 (2023-10-16) or later** (its changelog: "Add support for protocol-level named prepared statements"; pgbouncer.org/changelog.html, *verified 2026-10-28*). The drivers cache named prepared statements per connection (`tokio-postgres` names them `s0`, `s1`, ... in each process, read in its `src/prepare.rs` at 0.7.18; sqlx `sqlx_s_1`, ...); the setting is what lets PgBouncer keep them across server connections. With `max_prepared_statements = 0` the first statements of two clients collide on a server connection (`prepared statement "sqlx_s_1" already exists`, SQLSTATE 42P05; *verified 2026-10-28* against PgBouncer 1.22.0 with sqlx; *unverified* with `tokio-postgres`' names), so the orchestrator would fail at boot or under load. CI runs 200.
* No startup option in either URL (`options=-c ...`): PgBouncer refuses the ones it does not track (`unsupported startup parameter in options`). The orchestrator does not send `extra_float_digits` either (sqlx's default, which `tokio-postgres` does not send), which PgBouncer 1.22.0 refuses (`unsupported startup parameter: extra_float_digits`), so `ignore_startup_parameters` needs no entry for it.

`database.maxConnections` stays the size of the request pool. With `directUrl` the wakeup's listener is no longer taken from it, so the pool of at least 2 is for the requests alone; the listener, the migrations and a command's session are extra connections to the database itself (one each, per process).

The chart can deploy one: a CloudNativePG `Pooler` in transaction mode with `max_prepared_statements` set, the orchestrator's `url` the pooler and its `directUrl` the cluster's `-rw` Service ([`deploy/chart/README.md`](../../deploy/chart/README.md#scaling-the-database-issue-290), off by default; its kind end-to-end had not run when this was written).

Not proven here: other poolers (Pgpool-II, Supavisor), PgBouncer versions other than 1.22.0 and 1.26.1 (the chart's `Pooler` runs the operator's default, 1.25.2 in CloudNativePG 1.30.1), and a real load: the suites run on a pooler with a few connections, and measure nothing.

### `agents`

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `agents.file` | path; required unless `agents.registry.url` is set | `AGENTS_FILE` | now. The file's format (`{id, name, aliases?, transport?, cardUrl?, tokenEnv?, agent?, gate?}`) gains `aliases`, a list of other names of the agent ([ADR 0049](../decisions/0049-the-coder-is-shown-as-adam-agents-may-have-aliases.md)); a file without it is read as before |
| `agents.localConcurrency` | ≥ 1, `4`; a build without the feature `agent-local` refuses the key (78) | `AGENT_LOCAL_CONCURRENCY` | now |
| `agents.registry.url` | `http(s)` URL without credentials; a build without `registry-platform` refuses it (78). **Who may use an agent it lists is the item's `audience`, not `agents.file` or a role's `agents` alone** ([ADR 0045](../decisions/0045-admin-dashboard-in-the-web-and-agent-access-from-the-registry.md), [who may use a platform agent](#who-may-use-a-platform-agent)): an item with none is for administrators only | `AGENT_REGISTRY_URL` | now. Chart: `orchestrator.agents.registry.url` |
| `agents.registry.token` | **secret**, none | `AGENT_REGISTRY_TOKEN` | now. Chart: `orchestrator.agents.registry.tokenProperty`, the AWS property mounted as a `{ file }` |
| `agents.registry.agentToken` | **secret**, none | `AGENT_REGISTRY_AGENT_TOKEN` | now |
| `agents.registry.timeoutSecs` | 1 to 60, `3` | `AGENT_REGISTRY_TIMEOUT_SECS` | now |
| `agents.registry.maxAgeSecs` | 1 to 3600, `60` | `AGENT_REGISTRY_MAX_AGE_SECS` | now |
| `agents.sleep.wakeTimeoutSecs` | 1 to 300, absent by default and then the deployment never wakes an agent; how long a dispatch waits for a sleeping agent before the thread fails with a readable message ([ADR 0096](../decisions/0096-a-held-stream-is-a-projection-of-the-log-so-a-sleeping-agent-is-invisible-to-it.md)) | — | proposed |

### `gate`

The deployment's layer of the verification gate ([ADR 0018](../decisions/0018-verification-gate-and-rework-loop.md)),
with the same member names as an agent entry's `gate` in the agents file, plus the keys only a deployment has.

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `gate.require` | list of `ci`, `agent-checks`, `verifier`; `[]` | `ORCH_GATE` | now |
| `gate.maxAttempts` | 1 to the cap, `3` | `ORCH_MAX_ATTEMPTS` | now |
| `gate.maxAttemptsCap` | 1 to 100, `10` | `ORCH_MAX_ATTEMPTS_CAP` | now |
| `gate.verifier` | an agent id, none | `ORCH_VERIFIER` | now |
| `gate.verifierTimeoutSecs` | ≥ 1, `1800` | `ORCH_VERIFIER_TIMEOUT_SECS` | now |
| `gate.verifierWatchSecs` | ≥ 1, `5` | `ORCH_VERIFIER_WATCH_SECS` | now |
| `gate.ci.required` | list of check names, `[]` | `ORCH_CI_REQUIRED` | now |
| `gate.ci.timeoutSecs` | ≥ 1, `3600` | `ORCH_CI_TIMEOUT_SECS` | now |

### `steps`, `asks`, `models`, `tasks`, `ui`

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `steps.recordToolIo` | boolean, `true` | `ORCH_STEPS_RECORD_IO` (which also takes `1`/`0`, `yes`/`no`, `on`/`off`; the file takes YAML's `true`/`false` only) | now. The bounds (4 KiB, 8 KiB, 2 MiB per job) stay the core's constants ([ADR 0030](../decisions/0030-a-step-carries-its-input-and-output-bounded-and-redacted.md)); they are not keys |
| `asks.maxDepth` | 1 to 4, `2`; the addressed agent's ask is depth 1, so with the default an asked agent may ask once more and that one cannot ask | `ORCH_ASK_MAX_DEPTH` | now ([`ask_agent`](thread-tools-v1.md#ask_agent), owner decision 6 of plan 11) |
| `asks.maxPerJob` | 1 to 64, `16`; the asks of one job, those that ended included | `ORCH_ASK_MAX_PER_JOB` | now |
| `asks.maxRunning` | 1 to 16, `4`; the asks of one thread that may run at once | `ORCH_ASK_MAX_RUNNING` | now |
| `asks.timeoutSecs` | 10 to 7200, `1800`; an ask that runs this long ends `timed_out` and its asked agent is told to stop. A call may ask for less (`timeout_secs`), never for more | `ORCH_ASK_TIMEOUT_SECS` | now |
| `models.endpoints.<name>.baseUrl` | `http(s)` URL up to `/chat/completions`, as text or read from `{ env: NAME }` or `{ file: PATH }` (checked after it is read); a name is a slug (`a-z`, `0-9`, `-`, 1 to 32 characters) | `ORCH_MODEL_BASE_URL` (endpoint `default`) | now: **several endpoints** |
| `models.endpoints.<name>.apiKey` | **secret**, none | `ORCH_MODEL_API_KEY` (endpoint `default`) | now |
| `models.endpoints.<name>.timeoutSecs` | ≥ 1, `20`; the longest one try of a task at this endpoint may take | `ORCH_MODEL_TIMEOUT_SECS` (endpoint `default`) | now |
| `tasks.title.endpoint` | an endpoint name (required with `tasks.title`) | — (`default` when `ORCH_TITLE_MODEL` is used) | now. A name that is not in `models.endpoints` is exit 78. The call goes through the model path the deployment configured, and when that path is the model injector it is billed to the **thread's owner** ([model-injector.md](model-injector.md), "The orchestrator's own calls") |
| `tasks.title.model` | the model's name at the endpoint (required with `tasks.title`) | `ORCH_TITLE_MODEL` | now. **No `tasks.title`, no title model: titles are off**, as with `ORCH_TITLE_MODEL` unset |
| `tasks.title.system` | `{ inline: TEXT }` or `{ file: PATH }`, 1 to 4096 bytes; default: the core's guidance ("Reply with a 3 to 6 word title for the conversation, in plain text.") | — | now. Replaces the **guidance** only: the core always adds the form of the answer, the data clause, the fence and the language line ([ADR 0035](../decisions/0035-utility-model-tasks.md#4-what-the-core-always-adds)) |
| `tasks.title.maxTokens` | 1 to 256, `32` | — | now |
| `tasks.title.language` | `conversation` (default) or `english`, `french`, `german`, `spanish`, `portuguese`, `italian`, `chinese`, `japanese`, `korean`, `cyrillic`, `arabic`, `hebrew`, `greek`, `devanagari`, `thai` | — | now. `conversation`: the language of the **person's** messages, found by the core and checked on the answer; a fixed language is named last and the answer is checked against **its** script |
| `tasks.description.endpoint`, `.model`, `.system`, `.maxTokens`, `.language` | as the title's; `maxTokens` 1 to 1024, `160`; default guidance: "Describe in one or two sentences what the conversation is about now: what the person wants and where it stands." | — | now. **No `tasks.description`, no descriptions**: no row, no model call |
| `tasks.description.maxChars` | 40 to 500, `300`; the cleaned answer is cut to it at a word | — | now |
| `tasks.description.recompute.minNewMessages` | ≥ 1, `4`; the messages (the person's, and the agent's final words) since the last description before a new one is asked for; fewer is **no model call** | — | now |
| `tasks.turnSummary`, `tasks.stepLabel` | names kept for later tasks | — | reserved, no PR yet: refused |
| `ui.showDescriptions` | boolean, `true`; whether the web shows a thread's description (the API returns it either way) | — | now, served by [`GET /api/config`](#get-apiconfig); the web reads it (PR S19) |
| `ui.history.initialTurns`, `.pageTurns`, `.windowed` | `initialTurns` 1 to 100, `12`: the turns the web asks for when it opens a thread; `pageTurns` 1 to 100, `20`: the turns of the first older page (each later one asks for more, up to `server.history.maxTurns`); `windowed` boolean, `true`: whether the web opens a thread from its history (the newest turns first, older ones as the person scrolls up); `false` replays the whole log as the web always did. Both counts may not exceed `server.history.maxTurns` (refused at startup) | — | now, served by [`GET /api/config`](#get-apiconfig) **with the build's `projection` version, and only by a process that serves the history route** (it mounts `agui` and serves routes): the presence of `ui.history` is the capability ([`history.md`](history.md)) |

### `threadTools`, `mcp`, `webhooks`, `auth`, `artifacts`

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `threadTools.url` | `http(s)` base URL; both or neither with `secret` | `THREAD_TOOLS_URL` | now |
| `threadTools.secret` | **secret**, ≥ 32 bytes | `THREAD_TOOLS_SECRET` | now |
| `threadTools.previousSecret` | **secret**, ≥ 32 bytes, not the current one | `THREAD_TOOLS_SECRET_PREVIOUS` | now |
| `threadTools.tokenTtlSecs` | 60 to 86400, `7200` | `THREAD_TOOLS_TOKEN_TTL_SECS` | now |
| `threadTools.allowedHosts` | list of `host[:port]`, the host of `url` | `THREAD_TOOLS_ALLOWED_HOSTS` | now |
| `mcp.tokensFile` | path; required when `mcp` is mounted. Its format is `{user, tokenEnv, role?}`: the optional `role` is one of `auth.roles` (the built-in `user` and `admin` without them); without one the token has the default role. **`user` is the person the jobs belong to** (ANR-1163, [ADR 0108](../decisions/0108-a-run-is-charged-to-the-identity-providers-sub-and-an-ended-run-is-still-answered-to-the-meter.md)): the id the person's token gives under `auth.jwt.userClaim`, as `UserId::new` makes it (trimmed, lower-cased), so that a job started over `/mcp` belongs to the same person as one started by their sign-in. By claim: **`email`** (and any mode that also reads an identity header, whatever the claim) an e-mail address, so it has an `@`; **`sub`** the identity provider's `sub` (1 to 128 of `[A-Za-z0-9._:/-]`, **no `@`**), so that the job can be leased and metered; **any other claim** (`preferred_username`, `oid`, `upn`, ...) whatever that claim holds, an `@` or not: not blank, no control character (the rule of the JWT path for a user claim), and at most 256 bytes after trimming and lower-casing (the JWT path has no bound; 256 holds an e-mail address, the longest value a common claim yields). A user the rule refuses is refused at load (exit 78, naming `mcp.tokensFile` and the entry's position, the first being entry 1, and not the user's value; no refusal of the file shows a user, and a `tokenEnv` that is not shaped like a variable name, `[A-Z_][A-Z0-9_]*`, is refused unshown, so a token pasted in the wrong field is never printed). A claim value that is a number (an employee id) is quoted in YAML (`user: "1042"`), or the file is not a list of strings. The file is read once at start. **Rollout:** a `sub` deployment must write subs in its tokens file (ANR-1163), or it exits 78 at start; and, since ANR-1186, so must a deployment on another claim write what that claim yields: an e-mail user stays valid there only when the claim yields an e-mail (*unverified*: `preferred_username` is an e-mail address at many providers, an `oid` is a GUID), and one that does not match is not refused but names nobody who signs in, so its jobs are not in their thread list. Check the file's users against the claim before the roll out. Also since ANR-1186, a `tokenEnv` outside `[A-Z_][A-Z0-9_]*` (a lower-case variable name, say) is exit 78 at start: rename the variable | `MCP_TOKENS_FILE` | now; `role`: S15, ADR 0033; `sub` users: ANR-1163; other claims: ANR-1186 |
| `mcp.allowedHosts` | list of `host[:port]`; required when `mcp` is mounted | `MCP_ALLOWED_HOSTS` | now |
| `mcp.allowedOrigins` | list of origins, `[]` | `MCP_ALLOWED_ORIGINS` | now |
| `mcp.waitMaxSecs` | 1 to 86400, `3600` | `MCP_WAIT_MAX_SECS` | now |
| `mcp.waitMaxConcurrent` | ≥ 1, `256` | `MCP_WAIT_MAX_CONCURRENT` | now |
| `mcp.waitMaxPerUser` | ≥ 1, `16` | `MCP_WAIT_MAX_PER_USER` | now |
| `webhooks.generic.secrets` | list of 1 or 2 **secrets**, each ≥ 32 bytes; required when `webhook-generic` is mounted | `WEBHOOK_GENERIC_SECRETS` (one variable, comma rule kept) | now |
| `webhooks.generic.maxSkewSecs` | ≥ 1, `300` | `WEBHOOK_GENERIC_MAX_SKEW_SECS` | now |
| `webhooks.github.secrets` | list of 1 or 2 **secrets**; required when `webhook-github` is mounted | `WEBHOOK_GITHUB_SECRETS` (comma rule kept) | now |
| `webhooks.github.maxAgeSecs` | ≥ 1, `86400` | `WEBHOOK_GITHUB_MAX_AGE_SECS` | now |
| `auth.devUser` | an e-mail, none; development only (warns); only with `auth.mode: proxy_header` | `AUTH_DEV_USER` | now |
| `auth.mode` | `proxy_header` | `jwt` | `jwt_or_proxy_header`, `proxy_header` (nothing changes); a mode whose Cargo feature (`auth-jwt`, `auth-header`) is not in the build is refused (78) | — | now |
| `auth.jwt.issuer` | `http(s)` URL without credentials, query or fragment; required with a mode that reads tokens. `iss` must equal it exactly, as **one text** (a list that holds it is refused). Over plain `http` (development only; `production` refuses it) the process logs one warning at startup: the keys then travel in the clear | — | now; the warning and the one-text `iss` 2026-10-16 |
| `auth.jwt.audiences` | list of at least one non-empty text; required with `issuer` | — | now |
| `auth.jwt.jwksUrl` | `http(s)` URL without credentials, none (the keys are found from `<issuer>/.well-known/openid-configuration`) | — | now |
| `auth.jwt.userClaim` | the claim whose value is the user, `email`. A deployment behind its own BFF, which presents the BFF's token, sets `sub`: the person is then the token's subject (and the token's `aud` names the orchestrator, `auth.jwt.audiences: [orchestrator]`). Its value must be text that is not blank and has no control character (Unicode Cc: U+0000–U+001F, U+007F–U+009F), or the token is refused | — | now; the control character 2026-10-16 |
| `auth.jwt.rolesClaim` | a dotted path (`realm_access.roles`, `groups`), none (no roles) | — | now; read into `Principal.roles`, which `auth.roles` maps to permissions (S15) |
| `auth.dpop.publicOrigins` | list of at least one `http(s)` origin (`https://chat.example.com`: no path, query, fragment or credentials, no trailing slash); required with `auth.dpop`, which is only for a mode that reads tokens. **A proof's `htu` must be one of them followed by the request's path** (the process sits behind a proxy and cannot rebuild the public URL). `production` refuses `http://` except for `localhost`, `127.0.0.1` and `[::1]` | — | now; [ADR 0054](../decisions/0054-the-web-holds-its-own-tokens-dpop-bound-in-indexeddb.md) |
| `auth.dpop.maxAgeSeconds` | 1 to 600, 60: how old a proof's `iat` may be; a proof's `jti` is remembered this long and `futureSkewSeconds` more | — | now; ADR 0054 |
| `auth.dpop.futureSkewSeconds` | 0 to 60, 5: how far ahead of the clock a proof's `iat` may be | — | now; ADR 0054 |
| `auth.browser.clientId` | the web's public OAuth client at `auth.jwt.issuer`, non-empty, no space; required with `auth.browser`, which needs a mode that reads tokens **and `auth.dpop`** (the web's tokens are bound to its key) | — | now; ADR 0054 |
| `auth.browser.scope` | scope tokens separated by single spaces, `openid email profile offline_access` | — | now; ADR 0054 |
| `auth.roles` | map from a role name to `{ permissions, scope?, agents?, maxTier? }` ([Roles and permissions](#roles-and-permissions)); absent: the built-in `user` and `admin`; given: it replaces both, and at least one role | — | now (S15) |
| `auth.roles.<role>.permissions` | list of `agent.read`, `agent.invoke`, `thread.read`, `thread.write`, `thread.share`, `thread.delete`, `artifact.read`, `admin`, `tools.user.add`, `prompts.share`; required, may be empty (a role that is known and grants nothing) | — | now (S15) |
| `auth.roles.<role>.scope` | `own` | `{ read: own, write: own }`, default `own`, and the only scope there is: **`any` is refused** (exit 78, [ADR 0039](../decisions/0039-nobody-reads-another-persons-thread.md)). Only with a role that holds `thread.read`, `thread.write` or `artifact.read`. The key is kept for `version: 1` files | — | now (S15); `any` refused: S-A, ADR 0039 |
| `auth.roles.<role>.agents` | list of agent ids and/or `"*"`, `["*"]`; only with a role that holds `agent.read` or `agent.invoke`; not empty | — | now (S15) |
| `auth.roles.<role>.maxTier` | `plan` | `edits` | `auto` | `bypass`; none (the default): no cap. The highest [access tier](access-tier-v1.md#8-roles-and-the-web) a person with this role may pick for a message ([ADR 0061](../decisions/0061-the-person-picks-an-access-tier-for-each-message-the-agent-keeps-to-it.md)): a **ceiling, not a permission** (it is not in `permissions`), and only with a role that holds `agent.invoke` (otherwise exit 78 naming the key: it would do nothing). A value outside the four is exit 78 naming the key. For an agent, a person with several roles has the highest cap of the roles that let them invoke **it**, and one of those roles without a cap leaves them none. A message that names no tier is sent under the highest tier of the agent not above the lower of its default and the cap | — | now (ADR 0061) |
| `auth.roles.<role>.limits` | `{ runsAtOnce?, messagesPerMinute?, webhookJobsPerMinute?, tokensPerPeriod?, modelCallsInFlight?, admissionWaitSecs? }` ([ADR 0081](../decisions/0081-limits-per-person-before-a-run-starts.md)): what one person with this role may use at a time. Absent or `{}`: the defaults below. An unknown key, a text, a fraction, zero or a negative number is exit 78 naming the key. **Only `messagesPerMinute` and `tokensPerPeriod` are read so far**: the admission checks of the other keys and the park of a run follow | defaults below | now (ADR 0081; `messagesPerMinute` and `tokensPerPeriod` enforced, the rest parsing only) |
| `auth.roles.<role>.limits.runsAtOnce` | the person's jobs that have not finished (queued, working or waiting for an ask); at least 1 | `4` | now (ADR 0081, parsing only) |
| `auth.roles.<role>.limits.messagesPerMinute` | the person's messages in the last minute; at least 1. A message over it is refused before anything is written: **429**, `Retry-After` (the seconds until the oldest message of the minute leaves it), and `code: over_limit` with `limit`, `inUse` and `max`. Counted from the thread log (the person's `user_message` events of the last minute), so every replica counts the same. A fork's first message counts; a card action does not | none | now (ADR 0081, the messages slice; every other limit is still parsing only) |
| `auth.roles.<role>.limits.webhookJobsPerMinute` | the jobs a webhook source starts in the last minute; at least 1 | none | now (ADR 0081, parsing only) |
| `auth.roles.<role>.limits.tokensPerPeriod` | the person's tokens in the period, from the usage ledger ([ADR 0065](../decisions/0065-a-usage-ledger-per-person.md)); at least 1. No allowance by default in the open source: a deployment that wants one sets it per role. The period is the UTC calendar month of the ledger. A person who has used it is refused before a message, a new thread or a fork with a new message reaches an agent: **403** with `code: allowance_spent`, naming the limit and the tokens used. With several roles the highest allowance of the roles that hold `agent.invoke` counts, and one of them without an allowance lifts it | none | now (ADR 0081) |
| `auth.roles.<role>.limits.modelCallsInFlight` | the orchestrator's own model calls in flight for the person (titles, descriptions); at least 1 | `4` | now (ADR 0081, parsing only) |
| `auth.roles.<role>.limits.admissionWaitSecs` | seconds a run waits for a slot before it parks; at least 1 | the dispatcher's short wait | now (ADR 0081, parsing only) |
| `auth.defaultRole` | a role of `auth.roles`, or `null` for none. Absent: `user` when `auth.roles` is absent (the built-ins, so a deployment that configures nothing is as it was), `null` when `auth.roles` is given. The one key where `null` is a value | — | now (S15) |
| `auth.signingClients` | the clients of the issuer (the token's `azp`, or `client_id`) whose prompts must carry `vymalo.promptSignature` ([ADR 0087](../decisions/0087-a-signing-app-signs-each-prompt-and-the-orchestrator-refuses-an-unsigned-one.md)): at most 64, each 1 to 256 printable characters with no space, none twice, none the `auth.browser.clientId`. Absent or `[]`: no signing client | — | now (ANR-719; the intake check that reads it, and the rule that production refuses an empty list, are not built yet) |
| `artifacts` | the artifact store ([ADR 0032](../decisions/0032-files-from-agents-live-in-an-artifact-store.md)). Absent: no store, and a file an agent hands over is refused with "no artifact store configured". Present: `store` is required | — | now (S10) |
| `artifacts.store` | `fs` | `s3`; required with the section. Names only what this build compiled in: `fs` needs the Cargo feature `artifacts-fs`, `s3` needs `artifacts-s3`, else exit 78 naming it. The section of the store chosen is required and the other one is an error | — | now |
| `artifacts.fs.root` | path (relative to this file's directory); required with `store: fs`. Made (mode `0700`) when missing. Every role must see the same directory (one machine, or a shared volume) | — | now |
| `artifacts.s3.bucket` | 3 to 63 characters of `a-z`, `0-9`, `-`, `.`, starting and ending with a letter or a digit; required with `store: s3`; the bucket must exist | — | now |
| `artifacts.s3.region` | slug, `us-east-1` | — | now |
| `artifacts.s3.endpoint` | `http(s)` URL with a host, no credentials, query or fragment; absent: AWS S3. The bucket is then in the path (`<endpoint>/<bucket>/<key>`). An `http` endpoint sends the files in the clear | — | now |
| `artifacts.s3.prefix` | `a-z A-Z 0-9 . _ - /`, no `..`, at most 128 characters; keys go under it, so one bucket serves several deployments | — | now |
| `artifacts.s3.accessKeyId`, `artifacts.s3.secretAccessKey` | **secrets**, required with `store: s3`. Static credentials only: this build does not read `AWS_*` variables or an instance profile | — | now |
| `artifacts.s3.timeoutSecs` | 1 to 3600, `60` (one request) | — | now |
| `artifacts.s3.publicEndpoint` | `https` URL with a host, no credentials, query or fragment (`http` only when `server.environment` is not `production`); the path style of `endpoint` applies. **The host of every presigned URL** ([ADR 0058](../decisions/0058-large-files-go-up-through-a-presigned-url-the-orchestrator-gives-the-agent.md), A2): SigV4 signs the `Host`, so a URL for the Service `endpoint` names does not work at the public name. The store builds a second signer for it and uses it to sign only; no request goes to the public host from the orchestrator. Absent: nothing is presigned and `artifacts.upload` is an error. (The name `publicEndpoint` is the ADR's.) | — | now (6a, 2026-10-14) |
| `artifacts.s3.downloads` | `stream` | `redirect`, `stream`. How a file is sent to the person who reads it ([ADR 0058](../decisions/0058-large-files-go-up-through-a-presigned-url-the-orchestrator-gives-the-agent.md), A1): `stream` sends the bytes through the orchestrator, as for the directory store; `redirect` makes the three file routes answer `302` to a presigned `GET` on `publicEndpoint` (see [`uploads-v1.md`](uploads-v1.md#downloads-a1)). **Opt-in, and a departure from A1** (which redirects whenever `publicEndpoint` is set): the web fetches a file with `fetch` and its `connect-src` does not list the files host, so a redirect switched on by `publicEndpoint` alone, which uploads need, would break every file in the stock web. Turn it on together with the files host's CORS and the web's policy: **a control plane that starts with `redirect` logs one warning saying so** (the web's `connect-src` and `img-src` must list the files host; the files host must add `nosniff`, `Content-Security-Policy: default-src 'none'; sandbox` and CORS) (the chart's `rustfs.ingress`, step 6c, adds them to the files host it renders), because nothing here can check either. `redirect` without `publicEndpoint` is exit 78 naming the key. A store that cannot presign streams whatever is set | — | now (6b, 2026-10-14) |
| `artifacts.s3.presignTtlSecs` | 30 to 3600, `300`. How long the URL of a redirected download works; the two link routes (`/api/shared`, `/api/public/shared`) use at most 60 seconds of it, so a revoked link stops serving within a minute. Used by `downloads: redirect`, and range-checked whatever `downloads` is (a value out of range is refused even when files are streamed) | — | now (6b, 2026-10-14) |
| `artifacts.maxFileBytes` | 1 to 268435456 (256 MiB), `10485760` (10 MiB). Read by the ingest (ADR 0032, S11): a larger file is not kept; the agent's artifact is logged without it, with an error "the file is too large to keep" | — | now |
| `artifacts.maxPerJobBytes` | 1 to 4294967296 (4 GiB), `104857600` (100 MiB). The bytes of files one job (one run of an agent) keeps; a job also keeps at most 50 files (not a key). A file over either is refused like one over `maxFileBytes` | — | now (S11) |
| `artifacts.fetchHosts` | list of hosts (`files.example.com`, `10.0.0.5:8080`: a host name or address with or without a port, which without one is the scheme's default, 80 or 443; no scheme, path, wildcard or credentials), default none. A `url` part of an agent's artifact on one of them is fetched by the worker and kept like a `raw` part; any other `url` stays a link. The list is the SSRF control: a host on it is trusted; the fetch is `http(s)` only, follows no redirect, sends no credential and stops at `maxFileBytes` | — | now (S11) |
| `artifacts.upload` | large files by a presigned upload ([`uploads/v1`](uploads-v1.md), [ADR 0058](../decisions/0058-large-files-go-up-through-a-presigned-url-the-orchestrator-gives-the-agent.md)). Absent: the extension is off and `raw` is the only way a file reaches a thread. Present: needs `artifacts.store: s3` **with** `artifacts.s3.publicEndpoint` (the directory store cannot presign), `threadTools.url` and `threadTools.secret` (the extension rides on `thread-tools/v1`, and its upload ids are signed with that key), and the `thread-tools` surface in `server.surfaces`; each is an error naming the key when missing. The extension is still activated only for an agent whose live card lists `uploads/v1` and `thread-tools/v1` and only while the store can presign | — | now (6a) |
| `artifacts.upload.maxBytes` | required with the section; 1 to 5368709120 (5 GiB, what one S3 `PUT` takes), and **not more than `artifacts.maxPerJobBytes`** (a file larger than a job may keep could never be kept; a deployment that wants a gigabyte raises `maxPerJobBytes`, which allows up to 4 GiB), so **the most in practice is 4 GiB**. Told to the agent in the message, checked when it asks for a slot and again when it names the upload | — | now (6a) |
| `artifacts.upload.ttlSecs` | 30 to 3600, `300`. How long a slot's URL works; told to the agent in the message | — | now (6a) |

### `secrets`

Where the credentials of the MCP servers **people add themselves** are kept ([ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md): a token, a key, the pending state of an authorization): by default (`store: pg`) sealed with AES-256-GCM in a table of the orchestrator's own Postgres (the crate [`orch-secrets-pg`](../../orchestrator/crates/secrets-pg/README.md)), under a key that lives here, **by reference**; or (`store: openbao`) in a KV v2 mount of OpenBao, which seals them (below the table). **Absent: no store.** The running service reads and checks the section (every role does) and **uses it only when [`userToolServers.enabled`](#usertoolservers) is true** (the credential broker and the sealed store are then built at startup, by the roles that serve routes, `all` and `control-plane`; with it off, or in a `worker`, nothing is opened or migrated, the section is only checked). The routes of slice 4b reach the store only through the credential broker (a token or a key a person types goes to the broker, which seals it here; nothing else reads the store). `orchestrator secrets rewrap` uses it too.

A key is 64 hexadecimal characters (32 random bytes: `openssl rand -hex 32`; 64 zeros is refused), in a secret file or a variable. **Losing every key loses every stored credential** (people authorize again), and a backup of the database does not restore them without the key. To rotate: add a key, make it `current`, restart every replica and wait until none runs the old configuration, run `orchestrator secrets rewrap` (it opens every secret, the ones under the current key too), and when it reports nothing failed or changed and a second run finds everything current, remove the old key from `keys`. **Never change the bytes behind an id** (overwrite the file or variable a key is read from, or remove a key and add a different one under its name): add a new id, because a row says only which id sealed it, and every row under the old bytes stops opening. A secret sealed under a key that is not listed cannot be read, and only that server is unavailable.

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `secrets` | the store of a person's own credentials. Absent: none. Present: `store` is required | — | now (ADR 0046, slice 3) |
| `secrets.store` | `pg` | `openbao`; required with the section. Any other name is refused at load (exit 78) naming the key. Names only what this build compiled in: `pg` needs the Cargo feature `secrets-pg`, `openbao` needs `secrets-openbao` (both on by default), else exit 78 naming it. The section of the store chosen is required, and the other store's section is refused | — | now |
| `secrets.pg.keys` | 1 to 16 keys, each `{ id, key }`. **`key` is a secret**: 64 hexadecimal characters, in either case, white space around them cut. `id` is 1 to 64 characters of `A-Z a-z 0-9 . _ -`, unique in the list; it is written beside every secret the key seals and is part of what the seal authenticates | — | now |
| `secrets.pg.current` | the `id` of one of `keys`; required. Seals every new secret and every secret `rewrap` re-seals | — | now |
| `secrets.openbao.address` | required with `store: openbao`. An `https` URL with a host and no credential, query or fragment (`https://bao.internal:8200`): the token is sent with every call and never in the clear | — | now |
| `secrets.openbao.mount` | the KV v2 mount, `secret`. 1 to 128 characters of `A-Z a-z 0-9 . _ -` with `/` between names (no leading or trailing `/`, no `.` or `..` name) | — | now |
| `secrets.openbao.token` | **secret**, required with `store: openbao`: the token the orchestrator reads and writes with, by reference. The adapter calls `data` (read, write), `metadata` (read) and `destroy` (update) under `<mount>/…/orchestrator/`, so a policy on those three paths and no other is enough | — | now |
| `secrets.openbao.caFile` | none. A file of PEM certificates the server's certificate is also checked against, besides the system's roots (a private authority); read at startup, relative to the file's directory. A file that is unreadable or holds no certificate is refused naming the key | — | now |

`store: openbao` keeps the credentials in a KV v2 mount of a self-hosted OpenBao (or Vault), one path per person and server under `<mount>/orchestrator/`, named by a hash: the crate [`orch-secrets-openbao`](../../orchestrator/crates/secrets-openbao/README.md). **OpenBao seals what it keeps, so there are no keys of ours: `orchestrator secrets rewrap` has nothing to do and exits 78 for this store.** It is used under the same conditions as the sealed store (`userToolServers.enabled`, and a role that serves routes), and the pending authorizations of an OAuth flow stay in the orchestrator's own Postgres in both. The server is not contacted at startup: a server that does not answer is an unavailable credential for the person whose server needs it, not a process that will not start. No message, log line or error holds the token, a path of OpenBao or a body it answered with. **Status: unverified against a live OpenBao** (the adapter's conformance suite needs one, [its README](../../orchestrator/crates/secrets-openbao/README.md)).

### `provisioner`

A person's own agents on the platform (the `AgentProvisioner` port). **Absent is off**: nothing changes, and
`--print-config` prints nothing of it.

**On the message path** (ANR-806): with the section, a person's message to the agent the deployment calls `coder` or
`workspace` (its id or one of its aliases, and a kind listed in `kinds`) first asks the platform for **the person's own
agent** of that kind, `<kind>-<owner>`, where `<owner>` is 24 hex digits of the SHA-256 of the person's user id. The agent
is made when there is none (a first message), resumed when it is suspended, and waited for until it is `ready`; only then is
the message written and **sent to that agent** (the registry lists it under `<kind>-<owner>`; the thread's target stays the configured agent). Two messages at once make one agent. The wait ends at `readyTimeoutSecs`: the person gets a
**503** `code: agent_not_ready`, "your coder agent is not ready after 120s", with `Retry-After`, and **nothing is written**
(they send the message again; the agent keeps getting ready meanwhile). A platform that is down is a 503 "your coder agent
could not be made ready"; one that refuses the orchestrator's token or the form is a 500 (the deployment's fault, never the
person's), logged with the cause; an agent the platform reports `Blocked` is waited for (a fresh database or a
referent not made yet passes), except for a reason that waiting cannot clear (`NameConflict`, `CNPGNotInstalled`),
which is a 500 `code: agent_blocked`, "your coder agent is blocked: NameConflict". The shared `chat` agent and any other agent never go through it. A binary built without the Cargo feature `provisioner-platform` refuses
the section (exit 78).

| Key | Meaning |
|---|---|
| `url` | The Platform API's base URL: `http` or `https`, a host, no user name or password. |
| `kinds` | The kinds made for each person: `coder`, `workspace`, each once, at least one. The shared chat agent is never provisioned. |
| `forms.<kind>` | The agent form of each kind in `kinds` (the platform's form without `name`, `owner` and `suspend`, which the orchestrator sets). One per kind, and none for a kind that is not listed. |
| `credentials` | What the orchestrator presents. One type: `dev-oidc`, the OAuth `client_credentials` grant for the local stack's `mock-oidc`: `tokenUrl`, `clientId`, `clientSecret` (a `{ env }` or `{ file }` reference), and optionally `user`, `audience`, `roles` (the token must carry `platform:agents.own`). A development adapter; use another in a deployment. |
| `requestTimeoutSecs` | One request to the platform, 1 to 60 (default 5). |
| `readyTimeoutSecs` | How long to wait for a made or resumed agent to be ready, 1 to 600 (default 120). **The bound of a person's message path**: the application gives up at it (and, as a backstop for an adapter that does not, 10 s later), with the 503 above; it is not the dispatch's timeout. It also bounds how long a routed row waits for its agent in the dispatcher. |

### `userToolServers`

*Built 2026-10-14 ([ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md), slice 4a: the section, the composition root and the store), 2026-10-15 (slice 4b: the routes, [`/api/user-tool-servers`](chat-api.yaml) and their servers in `GET /api/tool-servers`) and 2026-10-15 (slice 4c: authorizing an OAuth server, its callback and the Client ID Metadata Document). Attaching a person's server to a thread is the next slice.* People can add **MCP servers of their own** (a URL, and how to authenticate to it), and the orchestrator calls them for the person with a credential it keeps for them. The deployment's own [`toolServers`](#toolservers) stay as they are and a person's are only ever added on top. **Off unless `enabled: true`**: with it off or absent **nothing is built and nothing is opened**, the keys of `secrets` are only checked, and nothing changes. Adding a server also needs the permission [`tools.user.add`](#roles-and-permissions), which no role holds by default.

What `enabled: true` builds depends on `secrets`:

| `secrets` | The definitions of servers | Credentials (a token, a key, an OAuth grant) |
|---|---|---|
| a section | in the orchestrator's Postgres | kept sealed, by the credential broker (OAuth discovery, PKCE `S256`, refresh, short leases) |
| **absent** | in the orchestrator's Postgres | **nowhere to keep one: only servers that need no authentication (`none`) can be added**, and the broker refuses every call (fail closed). The process starts and says so in one warning; when servers already hold a credential (the section was removed after they were stored: a lost key, a response to a compromise) it says how many, they stay unavailable until the section is back with its keys, and **their owners can still delete them** |

The URL a person types is **untrusted**. By default it must be `https` and every host is allowed, but a connection is refused to a private, loopback, link-local (the cloud's metadata address among them), multicast or reserved address, judged on the **address the connection is made to** and not on the name (so a name that answers a public address to a check and a private one to the connection gets nowhere). `egress` is the deployment's say on top: `deny` always wins; a non-empty `allow` refuses every host it does not name. A host named **exactly** in `allow` (or an address) may resolve to a private address, which is an operator's choice; a `*.` entry never lifts that ban (`*.vercel.app` names every project a stranger can make) and nothing in `allow` lifts the ban on link-local, multicast and the other special ranges (a pattern like `*.internal` would otherwise name `metadata.google.internal`). The same policy is applied to every URL the broker fetches for a server (its metadata, the authorization server, the token endpoint).

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `userToolServers` | the section. Absent: off, and `--print-config` prints nothing of it | — | now (ADR 0046, slice 4a) |
| `userToolServers.enabled` | boolean, `false`. When `true`, **no `toolServers[].id` may start with `u-`** (a startup error naming the key: the ids of a person's servers do, and the two must never meet in the relayed name `<id>__<tool>`) | — | now |
| `userToolServers.egress.allow` | list of host patterns, at most 256, none (every public host). A **host name** (`mcp.example.com`), an **address** in the standard library's strict form (`203.0.113.7`, `[2001:db8::7]` or `2001:db8::7`; `010.0.0.1`, `127.1`, `0x7f.1` and `2130706433` are refused, because the URL parser would read them as other addresses than they look like) or `*.` and a **domain** (`*.example.com`: any subdomain at any depth, not the domain itself). Names are compared lower case, an internationalised name as punycode, one trailing dot ignored; an entry twice in one list is an error. A key path names a bad entry and never quotes it | — | now |
| `userToolServers.egress.deny` | list of host patterns, same form, at most 256, none. A host or a resolved address that matches is refused, whatever else | — | now |
| `userToolServers.egress.allowHttp` | boolean, `false`. Also take `http` URLs: for a development stack whose server runs on a local port. **Refused when `server.environment` is `production`** (the file is refused whether the feature is on or off, so a file copied from staging is heard of at once): a person's credential would travel in the clear. A process that has it on says so in a warning | — | now |
| `userToolServers.oauth.clientName` | 1 to 80 characters of one line, not blank; `another-agentic-system`. The name of this orchestrator as an authorization server shows it to the person on its consent page: sent when a client is registered dynamically (RFC 7591) and written in the Client ID Metadata Document. **Say what the orchestrator is** (for example `Acme Chat`), never a person, a team or a server: anybody who holds `tools.user.add` can send a person the link to authorize a server of their own, and this name is what the person reads before they consent. Nothing that names the owner or the server is sent to an authorization server ([ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md), slice 4c review) | — | now |
| `userToolServers.oauth.callbackUrl` | an `https` URL with a host, at most 2 KiB, no user name, password, query or fragment; **outside production** also an `http` URL on the loopback address `127.0.0.1` or `[::1]` (not the name `localhost`, which a name server can point elsewhere: it is what `RedirectUri` of the broker takes). The address **the person's browser comes back to** after they authorize a server at its authorization server (the `redirect_uri` of the authorization). Default: `server.publicUrl` and `/api/user-tool-servers/oauth/callback`. **Its path must be exactly `/api/user-tool-servers/oauth/callback`**, the only path the router serves the callback at (it matches exactly: no trailing slash, no case folding, no decoded `%2F`): the key moves the origin and never the path, and a file that names another path does not start (78), the error naming the path that is served. **Required while credentials are kept** (`enabled` and a `secrets` section): the file must give this key or `server.publicUrl`, and the one it gives must be an address OAuth takes (a `publicUrl` of `http://localhost:3000` is not, and the error names `server.publicUrl`); a process that has neither does not start (78). **The edge must let `GET` of its path through to the orchestrator with no sign-in** (see below) | — | now (slice 4c) |
| `userToolServers.oauth.clientMetadataUrl` | an `https` URL with a host and a path (not just `/`), at most 2 KiB, no user name, password or fragment; none. The URL of this orchestrator's **Client ID Metadata Document**: with it, an authorization server that supports such documents is given the URL as the `client_id` and registers nothing; without it that step of the registration order is skipped (a pre-registered client, and dynamic registration, remain). **The orchestrator serves the document at the path of that URL**, `GET`, outside sign-in, while credentials are kept; its `redirect_uris` is the callback and nothing else (the browser always comes back to the orchestrator, [ADR 0047](../decisions/0047-one-ui-for-web-desktop-and-mobile-each-signs-in-as-a-public-oauth-client.md)). The file is refused when the URL is **not on the origin of the callback** (the document would be served where nobody asks for it), or its path is **under `/api`, `/agui`, `/mcp`, `/thread-tools`, `/webhooks`, `/healthz`, `/readyz`, `/metrics`, `/oauth2` (the orchestrator and oauth2-proxy), `/edge-healthz`, `/.well-known` (the edge), `/config.json`, `/s`, `/auth`, `/signed-in`, `/threads`, `/usage`, `/tools`, `/prompts`, `/_next`, `/_not-found`, `/brand`, `/404.html`, `/index.html`, `/favicon.ico`, `/icon.svg`, `/apple-icon.png`, `/manifest.webmanifest` (the web)** (paths that the orchestrator, oauth2-proxy, the edge or the web serve at that origin; a test reads the charts' and the dev stack's Caddyfiles and the web's routes and fails when one is missing from the list): pick a path such as `/oauth/client-metadata.json`, and have the edge send that exact path to the orchestrator | — | now (slice 4c) |

**What a person can do with it** ([`chat-api.yaml`](chat-api.yaml), operations `createUserToolServer`, `listUserToolServers`, `updateUserToolServer`, `deleteUserToolServer`, and `listToolServers`): with `enabled: true`, a person who holds [`tools.user.add`](#roles-and-permissions) adds up to 8 servers (a name, a URL, and `none`, a bearer token, an API key in a header they name, or OAuth 2.0), edits them, re-keys them and deletes them; **listing and deleting need no permission**, so a person whose permission is taken away still sees what they added (`unavailable`, reason `not_permitted`) and can remove it. With `enabled: false` (or absent) every one of these routes is a **404** and `GET /api/tool-servers` is what it always was. A secret a person types is **write-only**: it goes to the credential broker, which seals it under `secrets`, and it is in no response, log line or event. Without a `secrets` section only `none` servers can be added (422 `credentials_not_kept` for the others). Every URL goes through the egress rules above when it is typed and again at each connection; a URL that is refused says why in the guard's public words and never which rule or which address. Adding a server does not connect to it. A person attaches a server of their own, once it is `ready`, to a thread of theirs (`putThreadTools`), and the relay calls it for the agent with a **fresh credential for every list and every call**, through a client that judges the URL and the address of every connection with these same rules ([`thread-tools-v1.md`](thread-tools-v1.md#a-persons-own-servers)); that needs the build's Cargo feature `tool-relay` (on by default) and a process that serves routes (`all` or `control-plane`). Without the feature the servers can be attached and give an agent no tools, and the process says so at startup.

**Authorizing an OAuth server** (operations `authorizeUserToolServer` and `finishUserToolAuthorization`): a person with `tools.user.add` starts the authorization of an `oauth2` server of their own, the client opens the URL it is given, and the person's **browser comes back to the orchestrator's callback**, `GET /api/user-tool-servers/oauth/callback`, which makes the server `connected`. Starting it is **limited to ten a minute per person, in each process** (a burst of ten, then one every six seconds; 429 with `Retry-After`): it makes the orchestrator fetch URLs that a stranger's metadata names. **The callback needs no sign-in, and the edge must say so**: on the desktop it is the system browser and on mobile the in-app tab that come back, with no token and no cookie. So the edge needs one more open path, `GET /api/user-tool-servers/oauth/callback` (and, if `clientMetadataUrl` is set, `GET` of that exact path), sent to the orchestrator with `Authorization` and the identity header removed, as for the public link of a shared thread; the chart's does not yet (see its README). The person is found by the `state` the orchestrator kept when the flow began, taken once; the page the browser is shown is fixed text with no script and nothing of the request in it, and the callback's query is never logged.

The section is **checked whether it is on or off** (a typo in a list is heard now, not on the day it is turned on), except the rule about `toolServers` ids, which only the feature being on makes. What the broker is allowed to be tuned to (lease and flow lifetimes, timeouts, response size) has no key: the defaults of [`orch-credential-broker`](../../orchestrator/crates/credential-broker/README.md) stand. `userToolServers.enabled` is read once at startup, so a change is a restart; **setting it back to `false` stops every lease of a person's server at once** (nothing is built to lease from).

### `sharing`

A thread can be shared by a revocable link ([ADR 0040](../decisions/0040-thread-sharing-by-revocable-link.md)). The section is the
deployment's **cap** on what any thread may be shared as; **absent, nothing is shared** (`mode: disabled`), so a file with no
`sharing` behaves as before. What is served is the narrower of a thread's own visibility and the cap, read when a link is opened:
lowering the cap narrows every link at once with no data change, and raising it again brings them back. The file is read once at
startup, so a change of the cap is a restart, which also ends every open stream. **Roll the build out everywhere before raising
`mode` above `disabled`:** an older build cannot read a log that holds a `thread_shared` event (migration `0015`).

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `sharing.mode` | `disabled` | `internal` | `public`, `disabled`. `internal`: signed-in people who have the link; `public`: anybody who has it, signed in or not | — | now (S-B2, ADR 0040) |
| `sharing.secret` | **secret**, ≥ 32 bytes, **never the same as `threadTools.secret`**; required unless `mode` is `disabled`. A link is `base64url(nonce ‖ HMAC-SHA256(secret, "share/v1" ‖ thread_id ‖ nonce)[0..16])`: a copy of the database alone cannot make one, and the owner can always copy their link again (the server recomputes it from the thread's row under the current secret). Losing it ends every link until the owners copy them again | — | now |
| `sharing.previousSecret` | **secret**, ≥ 32 bytes, not the current one, not `threadTools`'s; needs `secret`. For verifying only (a rotation): links made under either still open, and a re-copied link carries the new MAC. Drop it after the owners have had time to copy, or accept that every link made under the old secret then 404s (the nonce is intact; the owner's next copy works) | — | now |
| `sharing.public.stepIo` | boolean, `false`; a public reader sees steps' labels and states, not their input, output and detail. **Only with `mode: public`** (a key that does nothing is an error) | — | now |
| `sharing.public.files` | boolean, `false`; a public reader cannot open the thread's files. Only with `mode: public` | — | now |
| `sharing.rateLimit.perLinkPerSecond` | 1 to 1000, `10`; requests a second to one link's public routes. Only with `mode: public` | — | now |
| `sharing.rateLimit.totalPerSecond` | 1 to 10000, `100`; requests a second to all links together. An answer of 404 costs this bucket five tokens instead of one, so guessing tokens is throttled | — | now |
| `sharing.rateLimit.streamsPerLink` | 1 to 100, `5`; open public streams of one link | — | now |
| `sharing.rateLimit.streamsTotal` | 1 to 1000, `50`; open public streams in all | — | now |

The limits are per process and the numbers are the ADR's starting points, *unverified* under load. **`mode: public` has the
limiter always** (the keys above only tune it): the public routes are mounted behind it in every composition this binary makes, and
a composition of `orch-api` that builds none (`ApiConfig::public_limits: None`) serves the public routes as the one 404 and is
refused by `ApiConfig::check` when the cap is `public` (the binary maps that to exit 78): the order the owner asked for, the limit
before `public`, is enforced by the code. `sharing.secret` is one of the **fourteen** secrets of the contract (with
`sharing.previousSecret`). `server.publicUrl` is the address a link is shown under (`<publicUrl>/s/<token>`); without it a link is
the path `/s/<token>`. The cap is **not** in [`GET /api/config`](#get-apiconfig) (its body is `{ui, search}`): the web learns it per
person from `GET /api/me` (`sharing`, the cap when the person's roles hold `thread.share`, else `disabled`).

### `retention`

A thread with no active job (not `queued`, `working` or `verifying`, and no running ask) whose **last event** is older than the
retention is erased by a sweep, through the same path as the person's own delete ([ADR 0043](../decisions/0043-deleting-a-thread-erases-it.md)):
the log, the files, the search index and the notifications go, its edits and child sessions with it, and a fork is kept. Pinning,
archiving and reordering are not events, so they never keep a thread alive. A thread that works is never erased; it is looked at
again at the next pass. The section is optional and **an absent section changes nothing about a file that was valid** beyond the
default below: 90 days are kept. The file is read once at startup, so a change is a restart.

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `retention.threads.days` | 1 to 36500, `90`. Days a thread is kept after its last event. A sweep runs once at start and then every hour, in every process that runs workers (`all` and `worker`), reads 100 threads at a time oldest first and logs one line with the count when it erased any (no person, no thread). Several replicas may run it | — | now |

### `usage`

The usage ledger of the people ([ADR 0065](../decisions/0065-a-usage-ledger-per-person.md)) keeps **counts** per person, task and UTC
month, and `GET /api/me/usage` puts a price on a month **when it is read**, with the table below: changing a price re-prices every
month, and the answer names the table that priced it (`prices`, `sha256:` and 16 hex digits of the parsed table, the same whatever
the order of the entries or how a price was written). The section is optional and **an absent section changes nothing about a file
that was valid**: 24 months are kept and nothing is priced. The file is read once at startup, so a change is a restart.

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `usage.retentionMonths` | 1 to 1200, `24`. How many UTC calendar months are kept; **the current month is one of them** (24 keeps this month and the 23 before it). A sweep removes older months, 1000 tasks at a time, every hour, in every process that runs workers (`all` and `worker`). The real number is the owner's and the law's (M5) | — | now (ADR 0065, PR 2) |
| `usage.prices.currency` | exactly three upper-case ASCII letters (the shape of an ISO 4217 code; whether it names a currency is not checked); required with `usage.prices`. One currency for the deployment | — | now |
| `usage.prices.models[]` | at most 256 entries: `provider` (optional, 1 to 128 bytes), `model` (1 to 128 bytes) and three **decimal strings**, all required: `input` (per million input tokens that were not read from a cache; **tokens written to a cache are input tokens and are priced here**), `cachedInput` (per million input tokens read from a cache; a model with no discount says its `input` again) and `output` (per million output tokens; **reasoning tokens are output tokens**, priced here). A usage line matches the entry with the **same provider** (an absent `provider` matches a line that reports none, and only those) **and the same model, exactly**: no case folding, no prefix. Two entries for one provider and model are refused, naming the first | — | now |
| `usage.prices.sandbox.cpuCoreHour`, `.gibHour` | **decimal strings**, both required in the block: the price of one CPU core for one hour and of one GiB of memory for one hour, applied to what the pod *requested* for the time the commands took. Absent block: sandbox lines are **unpriced** | — | now |

**A price is a decimal string**: digits, then optionally a point and one to six more digits, at most `1000000` (1 000 000 currency
units per million tokens or per hour); no sign, exponent, space, separator or leading `+`. It is read exactly into millionths of the
currency unit with no floating point anywhere, so a price written as a YAML **number** (`input: 0.40`) is refused as a type error
("expected string"), because a float cannot hold `0.1`; quote it. More than six decimals is refused, not rounded. `"0"` is a price (a
model that costs nothing says so); a model or a sandbox with **no** entry is *unpriced*, which is not the same, and the answer says it
(`"price": null`, `"complete": false`).

The refusals name the key path (`usage.prices.models[1].cachedInput`) and say what a price looks like; none quotes the value. How a
line is priced (one division per line, rounded half up, and what makes a line unpriced) is in
[`chat-api.yaml`](chat-api.yaml) `GET /api/me/usage` and ADR 0065.

### `toolServers`

*Built 2026-10-02 ([ADR 0024](../decisions/0024-mcp-tools-attached-per-conversation.md), slice 8).* The MCP servers a person may
attach to a conversation, **the deployment's own list**: a person cannot enter a URL here (with [`userToolServers`](#usertoolservers) on, a person with `tools.user.add` adds servers of their own on top, ADR 0046). A list of at most 64 servers, in the
order the web shows them; absent or empty, nothing is attachable. The orchestrator will call a server on the agent's behalf
and holds its credentials ([the relay](thread-tools-v1.md#attached-servers-and-the-relay-slice-8), built behind the binary's feature `tool-relay`, on by default); the
application, the API and the log hold only the part that is not secret. Replaces nothing: it has no variable.

| Key | Type, default | Replaces | When |
|---|---|---|---|
| `toolServers[].id` | `a-z`, `0-9`, `-`, starting with a letter or a digit, 1 to 31 characters, **unique**; required. What a thread records and the prefix of the server's tools on the thread's endpoint (`<id>__<tool>`): no `_`, so the first `__` is the split | — | now |
| `toolServers[].name` | 1 to 80 characters of one line, not blank; required | — | now |
| `toolServers[].description` | at most 500 characters of one line, none. Shown by the picker, and told to the agent (`attached` of its message) | — | now |
| `toolServers[].url` | `http(s)` URL with a host, **no user name, password, query or fragment** (a credential goes in `bearer` or `headers`); required. An `http` URL with a credential logs a warning at startup, naming the server | — | now |
| `toolServers[].icon` | a `data:` URI, `data:image/(svg+xml\|png\|webp);base64,…`, at most 8 KiB, none. The screen draws it as it is: an icon at a URL is never fetched (open question 38), and the icons the server offers itself are dropped | — | now |
| `toolServers[].bearer` | **secret**, none; sent as `Authorization: Bearer <value>` on the orchestrator's own requests | — | now |
| `toolServers[].headers` | map from a header name to a **secret**, none. A name is letters, digits and `-`; `Authorization` (use `bearer`), `Accept`, `Content-Type`, `Host`, `Mcp-Session-Id`, `Mcp-Protocol-Version` and `Last-Event-ID` are refused, whatever their case, and a name twice that differs only by case is too. A resolved value must be one a header can hold (visible ASCII, no line break) | — | now |
| `toolServers[].tools` | list of the server's own tool names, at least one, none (every tool the relay can expose). Each is `a-z A-Z 0-9 _ -`, not starting with `_`, and `<id>__<tool>` is at most 64 characters | — | now |
| `toolServers[].agents` | list of agent ids, at least one, none (every agent). The agents the server may be attached for: a thread whose agent is not listed cannot attach it (422). With no platform registry the ids must be agents of the agents file (exit 78 otherwise); with one they cannot all be known at startup, and an id that matches no agent is a server nobody is offered | — | now |
| `toolServers[].timeoutSecs` | 1 to 600, `120`; the longest one call may take | — | now |
| `toolServers[].protocol` | `legacy` | `2026-07-28`, `legacy`. The MCP revision the server speaks, which decides how a session opens. `legacy` opens with `initialize` and `notifications/initialized`, as every server did before. `2026-07-28` opens with **`server/discover`**, offers that revision only, and **never falls back to `initialize`**: a server that is not one is an error (`Protocol`), not a different conversation than the one configured. A server that speaks only `2026-07-28` (a cratestack MCP endpoint at 0.17) refuses `initialize`, so it needs this. Any other value is refused naming the key. *Verified 2026-11-02:* `rmcp` 3.5.0 has it (`ClientLifecycleMode::Discover`, `ClientServiceExt::serve_with_lifecycle`) | — | now ([ADR 0080](../decisions/0080-requests-to-a-tool-server-are-signed-for-the-person.md)) |
| `toolServers[].signing` | none. Sign **every** request to the server instead of presenting a bearer: [`signed-tool-requests-v1.md`](signed-tool-requests-v1.md) is the contract the tool server is written against. **Refused together with `bearer`** (a signed server is sent none), and with a `headers` entry named `Tool-Request-Claims`. Each HTTP request, the handshake and the listing included, carries one header that binds it to its method, path and body, to the thread, and to the **thread's owner**. Closed: `key`, `audience`, `ttlSecs` | — | now (ADR 0080) |
| `toolServers[].signing.key` | **secret**, required with `signing`. The Ed25519 private key the requests are signed with, a PKCS#8 PEM block (`openssl genpkey -algorithm ed25519`), by reference. A value that is not one stops the process at startup (exit 78), naming `toolServers[i].signing.key` and never its text. **One key per server**: the server pins its public half (`kid`: the first 8 bytes of its RFC 9679 thumbprint) | — | now |
| `toolServers[].signing.audience` | 1 to 256 bytes of one line, required with `signing`. The name the tool server calls itself: the `aud` of every signed request, compared by exact string equality. By convention the URL of its MCP endpoint | — | now |
| `toolServers[].signing.ttlSecs` | 1 to 60, `30`. How long a signed request lives (`exp - iat`). The contract allows 60 seconds at most, and a tool server refuses an object that lives longer | — | now |

A server's `signing.key` is a secret of the contract too, by the same rules (a reference, resolved at startup, printed by `--print-config` as the
reference): **the nineteenth in the schema**, counting the ones that later changes added (the run routes'
`server.internal.token` and `server.internal.agents`, ADR 0084; `secrets.openbao.token` is the twentieth, and `server.internal.meter`, ADR 0108, the twenty-first); the list the test
`the_secrets_are_the_twenty_one_the_contract_names` keeps is the authority. A server's `bearer` and each of its `headers` are two of the **fourteen** secrets of the contract (the ten of ADR 0032, the
two here and the two of `sharing`): a reference, resolved at startup, with an error that names the key and the variable or path and never a value, and
printed by `--print-config` as the reference. The public part of each server (`id`, `name`, `description`, `icon`, `tools`,
`agents`, the timeout) is what reaches the application; `GET /api/tool-servers` shows the first four and `agents`, never the
URL, a header or a credential. A server the deployment stops listing stays attached to the threads that have it (the thread keeps
its attachments); it is no longer told to their agents, and a person can detach it.

### Authentication

```yaml [orchestrator.yaml]
server:
  environment: production
auth:
  mode: jwt
  jwt:
    issuer: https://idp.example/realms/main
    audiences: [oauth2-proxy-client-id]
    userClaim: email                    # the default: keeps the threads that exist
    rolesClaim: realm_access.roles      # optional
```

A deployment whose own BFF authenticates to the orchestrator presents the BFF's token rather than oauth2-proxy's ID token: it
sets `userClaim: sub` — the person is the token's subject — and an audience that names this API, for example
`audiences: [orchestrator]`. The claim is read exactly as above: `sub` must be text that is not blank and has no control
character. The chart's `tests/bff-only.values.yaml` is such a deployment ([`deploy/chart/README.md`](../../deploy/chart/README.md#the-bff-only-shape-the-web-and-the-edge-off)).

* **`proxy_header`** (the default) trusts `X-Auth-Request-Email` and `auth.devUser`: safe only behind a proxy that strips
  client-supplied copies. **`jwt`** validates the `Authorization: Bearer` token oauth2-proxy forwards (the ID token by
  default; its `aud` is oauth2-proxy's client id) or a client's own token, and reads no header. **`jwt_or_proxy_header`**
  takes the token when the request has one (and a refused token is never reconsidered as the header) and the header when
  it has not: one release of migration.
* **Rules** (exit 78, each naming its key): `auth.jwt` is required by `jwt` and `jwt_or_proxy_header` and refused by
  `proxy_header` (a key that does nothing is an error); `auth.devUser` only with `proxy_header`; **`proxy_header` is
  refused when `server.environment` is `production`**; a mode needs its Cargo feature. A process that serves no routes
  (`server.role: worker`) needs no authenticator.
* **The token** must be signed with RS256, RS384, ES256 or EdDSA by a key of the issuer's JWKS, and carry `iss` equal to
  `issuer` (one text, not a list), one of `audiences` in `aud`, `exp` and `iat`; 60 seconds of leeway; `email_verified`
  must not be `false`. The user is `userClaim`, trimmed and lower-cased; blank, or with a control character (Unicode Cc: U+0000–U+001F, U+007F–U+009F), it is no user.
  A token with several of these wrong is refused for the first in the order `exp`, `nbf`, `iss`, `aud`, `iat`, `email_verified`, the user. A
  key of the issuer is read as the numbers it holds (a leading zero cut or covered by a sign byte does not make it unusable),
  and every key under the token's `kid` is tried. See [ADR 0033](../decisions/0033-the-orchestrator-is-an-oauth2-resource-server.md#2-the-jwt-authenticator-orch-auth-jwt-authmode-jwt)
  for the key cache (10 minutes; an unknown `kid` at most once in 30 seconds; an hour of grace) and what is bounded.
* **Responses:** 401 with `WWW-Authenticate: Bearer` for no token or a refused one; **503** with `Retry-After` while the
  issuer's keys cannot be fetched; `/readyz` is 503 until they have been fetched.
* **DPoP (`auth.dpop`, [ADR 0054](../decisions/0054-the-web-holds-its-own-tokens-dpop-bound-in-indexeddb.md), RFC 9449)**, off
  by default, and then the `DPoP` scheme is refused and a bearer is exactly what it was. When set, a request may carry
  `Authorization: DPoP <token>` and exactly one `DPoP` proof: `typ` `dpop+jwt`, `ES256` or `EdDSA`, signed by the public `jwk`
  of its header (a key with a private member is refused), `htm` the method, `htu` (without query and fragment) one of
  `publicOrigins` and the request's path, `iat` within `maxAgeSeconds` past and `futureSkewSeconds` ahead, a `jti` not seen
  within that window, and `ath` the token's hash. The token is validated as a bearer is **and** its `cnf.jkt` must be the
  RFC 7638 thumbprint of the proof's key. **A token that carries `cnf` sent as `Bearer` is refused**, and so is a `DPoP`
  request whose token has none. The `jti`s are remembered **in the memory of the process** (at most 100 000): a deployment
  of several processes accepts a replayed proof once per process within the window (the chart runs one). A refusal is 401
  with `WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256 EdDSA"` (the proof) or `DPoP error="invalid_token",
  algs="ES256 EdDSA"` (the token, its binding, a bound token sent as a bearer); with DPoP on, a request with no credential
  is told both `Bearer realm="orchestrator"` and `DPoP algs="ES256 EdDSA"`. The edge in front must pass `Authorization` and
  `DPoP` through unchanged; the stream of a DPoP request ends with its token as a bearer's does.
* **Browser sign-in (`auth.browser`, ADR 0054):** the web is a public OAuth client of the issuer and signs in itself; the
  orchestrator says how, at the public route `GET /api/public/auth`, `{ "issuer": <auth.jwt.issuer>, "clientId", "scope" }`
  (no identity, the public routes' rate limit, `Cache-Control: no-store`), and answers **404** when it is absent, which is
  the web of before (the edge's cookie).

```yaml [orchestrator.yaml]
auth:
  mode: jwt
  jwt: { issuer: https://idp.example/realms/main, audiences: [another-agentic], rolesClaim: agentic_roles }
  dpop:
    publicOrigins: [https://chat.example.com]
    maxAgeSeconds: 60                   # the default
    futureSkewSeconds: 5                # the default
  browser:
    clientId: another-agentic-web
    scope: openid email profile offline_access   # the default
```

* **A worked example** is the dev stack (S16): [`dev/orchestrator.yaml`](../../dev/orchestrator.yaml) runs `jwt` against a mock issuer
  (`issuer: http://mock-oidc:8080`, `audiences: [dev-chat]`, `rolesClaim: roles`, `server.environment: development` because the issuer is plain http) behind a
  real oauth2-proxy, with the roles `user`, `admin` and `chat-only` ([`dev/README.md`](../../dev/README.md#sign-in-a-mock-issuer-and-oauth2-proxy)).

### Roles and permissions

([ADR 0033](../decisions/0033-the-orchestrator-is-an-oauth2-resource-server.md#4-roles-and-permissions), built by S15.)
The roles of a request are the ones its credential carries: the token's `auth.jwt.rolesClaim`, or the `role` of an
MCP token's entry. The proxy header carries none. `auth.roles` says what each role grants; a role it does not name
grants nothing (the names are compared exactly: `Admin` is not `admin`). A person none of whose roles is named gets
`auth.defaultRole`, and a person with nothing at all is refused (403) by every operation but
[`GET /api/me`](chat-api.yaml), which says why.

The first tab is what an absent `auth.roles` means (the built-in roles). The built-in `admin` is a `user` that also holds `admin`, which is
operational and gives no access to what people wrote (see below): since [ADR 0039](../decisions/0039-nobody-reads-another-persons-thread.md)
(2026-10-03) **no role reads or acts on another person's thread**. A deployment that wants Keycloak groups to decide, and
nobody else in, writes the second:

::: code-group

```yaml [built-in roles]
auth:
  defaultRole: user
  roles:
    user:  { permissions: [agent.read, agent.invoke, thread.read, thread.write, thread.share, thread.delete, artifact.read], scope: own, agents: ["*"] }
    admin: { permissions: [agent.read, agent.invoke, thread.read, thread.write, thread.share, thread.delete, artifact.read, admin], scope: own, agents: ["*"] }
```

```yaml [Keycloak groups]
auth:
  jwt: { issuer: https://idp.example/realms/main, audiences: [oauth2-proxy-client-id], rolesClaim: groups }
  roles:
    chat-users:  { permissions: [agent.read, agent.invoke, thread.read, thread.write, thread.share, thread.delete, artifact.read], agents: [chat, researcher] }
    chat-admins: { permissions: [agent.read, agent.invoke, thread.read, thread.write, thread.share, thread.delete, artifact.read, admin], agents: ["*"] }
  # no defaultRole: a token with neither group is refused (403)
```

:::

| Permission | What it lets the person do |
|---|---|
| `agent.read` | See an agent in `GET /api/agents`, read its AG-UI capabilities, see `GET /api/registry`. Limited to the role's `agents`, and for an agent the platform's registry lists, to its [audience](#who-may-use-a-platform-agent) |
| `agent.invoke` | Start a thread on an agent, send a message to a thread on it (a fork too), mention it, attach a server for it. Limited to the role's `agents`, and for an agent the platform's registry lists, to its [audience](#who-may-use-a-platform-agent) |
| `thread.read` | Read a thread: `GET /api/threads/{id}`, its export, its branches, its AG-UI stream, and list one's own (`GET /api/threads`). Over the person's own threads |
| `thread.write` | Start a thread, send, answer, cancel, rename, describe, fork. Over the person's own threads |
| `thread.share` | Share one's own thread by a link, widen or narrow it, make a new link ([`sharing`](#sharing), [ADR 0040](../decisions/0040-thread-sharing-by-revocable-link.md)). It takes no scope (the only thread a person can act on is their own). **Taking a link down is not gated by it**: the owner can always revoke, so a role that loses `thread.share` never leaves a link up that its owner cannot remove. Moot while `sharing.mode` is `disabled` |
| `thread.delete` | Delete one's own thread, which **erases** it: the thread and the threads made from it by an edit, with their log, their files and their links (`DELETE /api/threads/{id}`, [ADR 0043](../decisions/0043-deleting-a-thread-erases-it.md)); forks are kept. It takes no scope (the only thread a person can erase is their own) and **does not need `thread.write`**: a person who may only read may still erase their own data. **A deployment that lists its roles does not get it by itself**: a role written before this permission existed has no `thread.delete` until it is added (the built-in `user` and `admin` have it, so a deployment that configures no roles needs nothing), and a person whose role lacks it is refused (403 `forbidden`) whatever the id. A deployment can withhold it on purpose, for a legal hold for instance: **the people of such a role are erased by the operator**, in the database and in the artifact store, because nothing in the application will. What stays out of reach of a delete, in any role: the A2A agent's own store of the conversation, the model provider that saw it, backups until they expire, and in a build that hosts an agent in-process the agent's journal rows for the context |
| `artifact.read` | Download the files of a thread. Over the person's own threads (it is its own permission: `thread.read` alone does not give files) |
| `admin` | **Operational and content-free** ([ADR 0039](../decisions/0039-nobody-reads-another-persons-thread.md)): it gates nothing today beyond what `user` has, and is reserved for endpoints that show no thread content and no personal data beyond counts. It never reaches a person's thread, file or listing. `GET /api/me` lists it |
| `tools.user.add` | Add, edit, authorize and re-key an MCP server **of one's own** ([`userToolServers`](#usertoolservers), [ADR 0046](../decisions/0046-people-add-their-own-mcp-servers-secrets-in-a-credential-broker.md)). It takes no scope (a person's servers are the person's own). **No role holds it by default: the built-in `user` and `admin` do not, and `admin` does not imply it**; a deployment lists it for the roles it chooses (in Keycloak, a client role a composite can bundle). Listing, attaching and removing one's own servers are not gated by it, so a person whose permission is taken away can still remove what they added. Only has an effect with `userToolServers.enabled`. **To grant it**, list it in the `permissions` of the role (`auth.roles.<role>.permissions: [..., tools.user.add]`; a role that lists permissions gets none by itself, and the role keeps its `scope` and `agents` for the permissions they are about); `GET /api/me` then lists it for the people who hold it. What it gates: `POST` and `PATCH` of `/api/user-tool-servers` (slice 4b) and `POST /api/user-tool-servers/{id}/authorize` (slice 4c; **not** the OAuth callback, which the person's browser reaches with no roles at all: the permission is checked when the flow begins). *Built as a permission in slice 4a, gates the routes since slice 4b* |
| `prompts.share` | Share a prompt **of one's own** with roles ([ADR 0070](../decisions/0070-a-persons-prompt-library.md), [`prompts-v1.md`](prompts-v1.md)): any write whose result is shared (`createPrompt` or `updatePrompt` with a non-empty `audience`). It takes no scope (a person's prompts are the person's own). **No role holds it by default: the built-in `user` and `admin` do not, and `admin` does not imply it**; a deployment lists it for the roles it chooses. Saving, reading, rendering, unsharing and deleting one's own prompts are not gated by it, so a person whose permission is taken away can still withdraw what they shared (a prompt they shared before stays shared and is frozen until they do). There is no configuration switch for the library: it is always on. `GET /api/me` lists the permission for a role that holds it |

* **Own, and nothing else** ([ADR 0039](../decisions/0039-nobody-reads-another-persons-thread.md), which reverses owner decision 4 of
  [ADR 0033](../decisions/0033-the-orchestrator-is-an-oauth2-resource-server.md)). `own` is the threads the person owns (the owner is the
  e-mail, [ADR 0033](../decisions/0033-the-orchestrator-is-an-oauth2-resource-server.md#2-the-jwt-authenticator-orch-auth-jwt-authmode-jwt)).
  There is no wider scope: a `scope` of `any`, for reading or for acting, is a configuration error (exit 78), so a file
  cannot grant it by accident, and `GET /api/threads?owner=` is a `400`. A person who wants another to read a thread shares
  it ([`sharing`](#sharing): reading through a link is a second check, `thread.read` at any scope over a thread somebody shared, not a scope: **an administrator reads a shared thread only as anybody who has the link**) or sends its export. Break-glass access (a legal request, abuse) is outside the application: an
  operator with database access, under the deployment's own controls.
* **What a person gets** when a request is not theirs to make: **404** for a thread that is not theirs, whatever their roles
  (the answer for one that does not exist, so existence never leaks), **403
  `forbidden`** for a permission their roles lack (the same for every id, so it says nothing of what exists) and for an
  agent their roles do not name, **403 `no_access`** when their roles grant nothing.
* **Who may use a platform agent** ([ADR 0045](../decisions/0045-admin-dashboard-in-the-web-and-agent-access-from-the-registry.md),
  decision 1). The agents of `AGENTS_FILE` have no audience and `agents` of the roles alone decides. For an agent the platform's registry
  (`AGENT_REGISTRY_URL`, `agent-registry/v1`) lists, a person may read (`agent.read`) or invoke (`agent.invoke`) it only when **both** hold:
  a role of theirs grants the permission over the agent's id (`agents`, as above), **and** the item's `audience` holds `"*"`, or a value
  equal, byte for byte, to one of the roles in the credential's roles claim (`auth.jwt.rolesClaim`; the roles `auth.roles` defines or not),
  **or** a role of theirs holds `admin`. An item with no `audience`, an empty one or a malformed one is for people whose roles hold `admin`
  only (fail closed): an agent just made is seen by the administrators and tried by them, until it is given an audience and somebody holds
  it. So a deployment that reads a platform registry whose items carry no `audience` shows those agents to its administrators only; and
  `agents: ["*"]` for `user` no longer shows everything the registry lists. The audience is the registry's to set and the identity
  provider's to grant (by convention `agent.use:<agent-name>`, a client role of the identity provider; it need not be a key of `auth.roles`).
  An agent whose audience leaves a person out is **not there** for them: not in `GET /api/agents`, a 404 for its capabilities and a run,
  "unknown agent" for starting a thread, a fork or a mention. A thread of their own on it stays theirs, **read-only**: they read it, and a
  message, "Stop & send", a card's action or attaching a server is a 403; cancelling a running job still works. `GET /api/me` still says the patterns of `agents`.
  **A role that holds `admin` sees and may use every platform agent, hidden ones and agents with no audience included**, still over the
  ids a role of theirs names in `agents`; `auth.defaultRole` counts, so a deployment that gives the role everybody falls back to `admin`
  makes all of them administrators here, and one that wants the contract's rule (an administrator is held to the audience too) gives no
  role `admin`. **A narrowed audience reaches the orchestrator when its registry reader's copy refreshes**: at most
  [`agents.registry.maxAgeSecs`](#agents) (default 60 s), and sooner when the registry's own `max-age` is shorter. A job already running keeps the
  agents it was given by mention (`job.mentioned`), so one mentioned before the change can still be asked until that job ends. The view of
  a shared thread names its agent (the id to every reader, the display name to a signed-in one) with no audience filter: the owner chose
  to share, and the content already shows it.
* **A cap on the access tier** ([ADR 0061](../decisions/0061-the-person-picks-an-access-tier-for-each-message-the-agent-keeps-to-it.md),
  [`access-tier-v1.md`](access-tier-v1.md#8-roles-and-the-web)). A role may carry `maxTier`, one of `plan`, `edits`, `auto`, `bypass` (in
  that order of how much an agent does alone): a message from a person whose roles allow no more than `auto` that names `bypass` is
  refused with **422** before anything is written. Absent, there is no cap: the built-in `user` and `admin` may pick any tier the agent
  honours, and a deployment that wants `bypass` to be something it opts into caps its roles. It is a ceiling and not a permission,
  so it is not listed in `permissions`, and it is refused on a role that does not hold `agent.invoke`. For one agent the cap is
  that of the roles that let the person invoke **that** agent (their `agents` name it); a role that cannot invoke it lifts nothing.
  A person with a cap who names no tier is not left to the agent's default: the message is sent under the highest tier the agent
  offers that is not above the lower of its default and the cap. `GET /api/me` says the person's cap as `maxTier` (a hint for the
  screen, over the roles that hold `agent.invoke` at all, absent when there is none):

  ```yaml [orchestrator.yaml]
  auth:
    roles:
      chat-only: { permissions: [agent.read, agent.invoke, thread.read, thread.write], agents: [chat], maxTier: auto }
  ```
* **Several roles** are unioned, each judged alone: a person with a role that holds `thread.read` and another that holds
  `agent.invoke` for `coder` has both, and may invoke `coder` and no other agent (a role's `agents` limit only the agent
  permissions that role holds).
* **Rules** (exit 78, each naming its key): a `maxTier` that is not one of the four tiers, or on a role that does not hold `agent.invoke` (`auth.roles.<role>.maxTier`);
  `auth.defaultRole` is one of the roles; a role name has no space around
  it; no permission is listed twice; a `scope` or `agents` that its role would ignore is an error, `scope: any` is an error naming
  the ADR (`auth.roles.<role>.scope: any is refused: reading or acting on another person's thread is not a permission (ADR 0039); share the thread instead`;
  `.scope.read` and `.scope.write` for the split form), and so is an empty
  `agents`; `auth.roles: {}` is an error (leave the key out for the built-ins). An agent id that no agent has matches
  nothing (the roles are read before the agents are). A `role` of the MCP tokens file that `auth.roles` does not define
  is exit 78 too: a typo would otherwise hand the token the default role.
* **A stream ends at the shortest of its token, an hour and the deployment's lifetime**: an AG-UI connect or run stream is
  ended at the token's `exp` plus 60 s, at most an hour, and at most the lifetime (60 s by default, `ApiConfig::sse_lifetime`,
  the contract's own and not a key of this file: [ADR 0082](../decisions/0082-a-stream-ends-after-a-minute-and-a-message-keeps-its-id.md));
  the client reopens it with `Last-Event-ID`. A credential that does not run out (the proxy header, an MCP token) is bounded by
  the lifetime like any other: no stream is unbounded.
* **The proxy header** carries no roles, so every request of `auth.mode: proxy_header` has the default role: with the
  built-ins, everybody is a `user`, as before roles existed. To have an administrator in that mode, name `admin` the
  default role (everybody is one: for one person on a local machine, and it adds nothing to what a user reads) or use `jwt`.

### Variables that are not keys

| Variable | Why it has no key |
|---|---|
| `ORCH_CONFIG_FILE` | Names the file (also `--config`). Kept for good. Unset in the transition release: the environment alone configures the process, as today |
| `RUST_LOG` | The log filter of `tracing-subscriber` (`EnvFilter`), read before anything else; the standard way to change verbosity of one process. Unset: `info,rmcp=off`. **`rmcp=off` is added to a value that does not name `rmcp`** (`RUST_LOG=info` runs as `info,rmcp=off`): `rmcp`, the MCP library, logs what the servers it talks to say and the URL of a failed request, so an operator who wants its lines names it (`info,rmcp=warn`) ([`orch-log-filter`](../../orchestrator/crates/log-filter/README.md)). Kept for good |
| `HOSTNAME` | Set by the container runtime; only the first part of `server.instanceId`'s default. Kept |
| the `tokenEnv` names of the agents file and of the MCP tokens file (`CODER_A2A_TOKEN`, `MCP_TOKEN_<NAME>`, …) | Not the orchestrator's variables: those files name them, and already hold references, not values. Unchanged |

**Process overrides.** `ORCH_ROLE` and `ORCH_INSTANCE_ID` (and their flags `--role`, `--instance-id`) stay after the
deprecation: they describe one process, not the deployment, and a control plane and its workers share one file. They
win over the file and log at `info`, not `warn`.

**Inventory** (verified 2026-10-02 against `orchestrator/bin/orchestrator/src/config.rs` at `9dddfc1`, every
`#[arg(env = …)]`, and `logging.rs`): 52 variables are declared as flags with an environment fallback (one of them,
`HOSTNAME`, hidden), and `RUST_LOG` is read by `EnvFilter`: 53 names. 51 map to a key above; `HOSTNAME` and `RUST_LOG`
do not. No other crate of `orchestrator/` reads the environment outside tests and test helpers.

## `GET /api/config`

**Built (PR S18, 2026-10-02); the web reads it (PR S19, 2026-10-02).** The public subset of the configuration, for the web.

```http [GET /api/config]
GET /api/config
→ 200 application/json
{ "search": { "maxQueryLength": 200, "maxTerms": 8 },
  "prompts": { "limit": 100, "maxVariables": 8, "maxBodyBytes": 16384, "maxRenderedBytes": 32768 },
  "ui": { "showDescriptions": true,
          "history": { "initialTurns": 12, "pageTurns": 20, "maxTurns": 100, "projection": 2, "windowed": true } } }
```

* The body is `{ "ui": { … } }`, `search` and `prompts`: every key of the `ui` section, with its effective value (defaults filled in).
  Nothing else of the file is ever in it. The `ui` section's Rust type has no secret field, and a test asserts that its
  schema has no secret reference, so a secret cannot be added to it by mistake.
* `search` is **not configuration**: it is the capability of the build ([ADR 0068](../decisions/0068-a-person-searches-their-own-threads.md), [ADR 0067](../decisions/0067-the-plan-to-librechat-grade-and-the-client-agnostic-rule.md) rule 3). Its presence says this orchestrator serves `searchThreads`
  ([`thread-search-v1.md`](thread-search-v1.md)); an older one leaves it out and a client then offers no search box. `maxQueryLength` and `maxTerms` are what the server enforces.
* `prompts` is **not configuration either**: it is the capability of the build ([ADR 0070](../decisions/0070-a-persons-prompt-library.md)). Its presence says this orchestrator serves the prompt library
  ([`prompts-v1.md`](prompts-v1.md)); an older one leaves it out and a client then offers no library. There is no switch to turn it off. `limit` (prompts per person and per page), `maxVariables`,
  `maxBodyBytes` and `maxRenderedBytes` are what the server enforces.
* **Behind the identity layer**, like every `/api/*` route (401 without an identity, fail closed). The web asks for it
  after the edge has let the browser in, and nothing in it is needed before that.
* `ui.history` is the one key that can be **absent**: it is served only by a process that serves the history route
  ([`history.md`](history.md), [ADR 0059](../decisions/0059-a-thread-opens-at-its-end-and-older-turns-load-on-scroll-up.md)), so its
  presence is the capability and an orchestrator without it (older, or with no AG-UI surface, or a worker) leaves it out. Its
  `projection` is the version of the frames this build writes and `maxTurns` is `server.history.maxTurns`, the largest page the server accepts: neither is a key of `ui.history`.
* It changes only when the process restarts. The web treats a missing key as its default and ignores a key it does not
  know, so the section grows additively; a key is never renamed or retyped in `version: 1`.
* It is `getConfig` in [`chat-api.yaml`](chat-api.yaml), served by the resource API of every role that serves routes, and
  the contract test of the API checks it (200 with exactly `{ "search": …, "ui": … }`, 401 without an identity). A deployment with no
  `ui` section serves the defaults.
