# thalamus serve

Source: https://usecns.dev/thalamus-cli-serve/

[Start here](https://usecns.dev/manual-thalamus/)
[CLI commands](https://usecns.dev/commands-thalamus/)
[Configuration & integration](https://usecns.dev/thalamus-topics/)

Usage: `thalamus serve --bind <ADDRESS:PORT> [OPTIONS]`. Starts the HTTP router, performs an initial synchronous probe, then runs the concurrent reconciler. This is a foreground, long-lived server, not a daemonization command.

| Option | Environment | Default and semantics |
| --- | --- | --- |
| `--bind <VALUE>` | `THALAMUS_BIND` | Required; socket bind address and port. Invalid or unavailable sockets fail startup. |
| `--policy <VALUE>` | `THALAMUS_POLICY` | `sticky-least-loaded`; intelligence-plane selection policy. See accepted spellings below. |
| `--pin-ttl-secs <U64>` | `THALAMUS_PIN_TTL_SECS` | `7200`; idle session-pin lifetime, seconds. |
| `--soft-inflight-cap <U64>` | `THALAMUS_SOFT_INFLIGHT_CAP` | `3`; soft work-stealing threshold. `0` disables the soft-threshold branch, not hard-cap stealing. |
| `--max-inflight-per-node <U64>` | `THALAMUS_MAX_INFLIGHT_PER_NODE` | `3`; intelligence admission threshold. `0` disables central admission limiting. |
| `--probe-interval-ms <U64>` | `THALAMUS_PROBE_INTERVAL_MS` | `1000`; reconciler interval; implementation clamps it to at least 100 ms. |
| `--probe-timeout-ms <U64>` | `THALAMUS_PROBE_TIMEOUT_MS` | `1200`; per-endpoint probe timeout, milliseconds. |
| `--single-node <NAME>` | `THALAMUS_SINGLE_NODE` | Unset; preferred candidate for single-node policy. If not an eligible candidate, selects the first eligible member by name. |
| `--config <PATH>` | `THALAMUS_CONFIG` | Unset; JSON member schema version 1. Unreadable, invalid or unsupported config is fatal (`refusing to start`), never silently empty. |
| `--state-file <PATH>` | `THALAMUS_STATE_FILE` | Unset; persistent runtime registration state, distinct from config and telemetry. |
| `--state-dir <PATH>` | `THALAMUS_STATE_DIR` | Unset; directory for `telemetry.db`. Missing/unwritable storage disables telemetry but does not stop routing. |
| `--telemetry-retention-days <U32>` | `THALAMUS_TELEMETRY_RETENTION_DAYS` | `30`; prune older telemetry at startup and hourly. |
| `--no-default-seeds` | `THALAMUS_NO_DEFAULT_SEEDS` | False; deprecated no-op with a warning. There are no built-in members regardless of this flag. |

Policy parsing trims and ignores case. Accepted aliases: `sticky-least-loaded`, `sticky_least_loaded`, `sticky_least_loaded_3node`, `sticky`; `round-robin`, `round_robin`, `round_robin_3node`, `rr`; `single-node`, `single_node`, `single`. Other policies fail. The legacy `3node` spellings do not impose a three-member topology.

SIGINT and Unix SIGTERM enter graceful HTTP shutdown and flush telemetry. Do not replace this with an immediate process kill when preserving completion history matters.

See [CLI conventions](https://usecns.dev/thalamus-cli-usage/) for shared configuration and exit behavior, or [browse all commands](https://usecns.dev/commands-thalamus/).