# Configuration

micromux is configured by a single `micromux.yaml` (or `.micromux.yaml` / `.yml`) in your project directory. Its shape is deliberately close to Docker Compose, so `services`, `depends_on`, `healthcheck`, `restart`, `ports`, `environment`, and `env_file` mean what you'd expect.

```yaml
# yaml-language-server: $schema=https://github.com/romnn/micromux/raw/main/micromux.schema.json
version: "1"
name: my-project        # optional; surfaced to agents, defaults to the directory name
restart: unless-stopped # default policy, inherited by services
services:
  api:
    command: ["sh", "-c", "./run-api"]
    # …
```

Add the `$schema` comment at the top and an editor with the YAML language server gives you completion and validation against [`micromux.schema.json`](https://romnn.github.io/micromux/docs/configuration/reference/).

## Top-level keys

| Key | Purpose |
|---|---|
| `version` | Config format version. Use `"1"`. |
| `name` | Session name shown to agents via the control plane. Defaults to the working-directory name. |
| `strict` | Treat config warnings as errors. Also `--strict` / `MICROMUX_STRICT`. |
| `services` | The map of service definitions. See [Services](https://romnn.github.io/micromux/docs/configuration/services/). |
| `restart` | Default [restart policy](https://romnn.github.io/micromux/docs/configuration/restart-policies/) inherited by services. |
| `healthcheck` | Default [healthcheck timing](https://romnn.github.io/micromux/docs/configuration/healthchecks/) inherited by services (timing only — it never creates a probe). |
| `logs` | Default [log retention](https://romnn.github.io/micromux/docs/configuration/logs/) inherited by services. |
| `ui` | Terminal-UI options — see below. |
| `control` | The [agent control plane](https://romnn.github.io/micromux/docs/agent-control/) and runtime-service policy. |
| `session`, `allocate_ports`, `routes`, `proxy` | The session's name, its [allocated ports](https://romnn.github.io/micromux/docs/configuration/sessions/), and its hostnames on the shared proxy. |

## In this section

- **[Services](https://romnn.github.io/micromux/docs/configuration/services/)** — `command`, working directory, environment, and ports.
- **[Dependencies & startup order](https://romnn.github.io/micromux/docs/configuration/dependencies/)** — `depends_on` and its conditions.
- **[Healthchecks](https://romnn.github.io/micromux/docs/configuration/healthchecks/)** — probes, timing, retries, and inherited defaults.
- **[Restart policies](https://romnn.github.io/micromux/docs/configuration/restart-policies/)** — `always`, `unless-stopped`, `on-failure[:N]`, `no`.
- **[Logs](https://romnn.github.io/micromux/docs/configuration/logs/)** — in-memory tail versus retained disk runs, and structured JSON.
- **[Sessions, ports, and hostnames](https://romnn.github.io/micromux/docs/configuration/sessions/)** — session names, allocated ports, the shared proxy, and the variables micromux injects.
- **[Configuration reference](https://romnn.github.io/micromux/docs/configuration/reference/)** — every key, and the JSON schema.

## Inheritance

`restart`, `healthcheck` timing, and `logs` can be set once at the top level and overridden per service. A service that omits a field inherits the global default; a service that sets it wins for the fields it sets. This keeps common policy in one place while letting individual services differ.

## UI options

```yaml
ui:
  width: 40              # initial sidebar width, in columns
  pretty_json_logs: true # render structured JSON logs as compact colored lines (default)
  mouse: true            # what the TUI's mouse may do: true, false or { select, navigate, scroll }
  copy_on_select: false  # copy a mouse selection when the drag ends, not on y (default off)
```

`ui.mouse` and `ui.copy_on_select` can also be set for every project in your [user config](https://romnn.github.io/micromux/docs/tui/#user-config), and per run with `--mouse on|off` and `--copy-on-select on|off`.

Services that emit JSON logs are, by default, rendered in the TUI as compact colored log lines. Opt out per run with `--no-pretty-json-logs`, or for everyone with `ui: { pretty_json_logs: false }`. The raw JSON is always preserved for the control plane and MCP tools.
