> For AI agents: the complete documentation index is available at https://enclo.nstlopez.com/llms.txt, the full documentation bundle is available at https://enclo.nstlopez.com/llms-full.txt.

# Configuration

`enclo config` reads and updates persistent defaults stored in
`$ENCLO_HOME/config.json`.

```sh
enclo config                                    # lists every key, its value and where it comes from
enclo config get sandbox.defaults.memory
enclo config set sandbox.defaults.memory 1024MiB
enclo config unset sandbox.defaults.memory
```

## Keys

| Key                             | Value                                                                        | Default                       |
| ------------------------------- | ---------------------------------------------------------------------------- | ----------------------------- |
| `sandbox.defaults.cpus`         | Number of vCPUs                                                              | 2                             |
| `sandbox.defaults.memory`       | `2048MiB`, `2GiB`, or a bare number of MiB                                   | 2048 MiB                      |
| `sandbox.defaults.idle_timeout` | `90s`, `15m`, `2h`, `1d`, or a bare number of seconds (`0` disables timeout) | 15 minutes                    |
| `session.base`                  | Name or ID of an existing sandbox to clone for every new session             | None, so sessions start empty |
| `prune.older_than`              | `14d`, or a bare number of days                                              | 14 days                       |

Example configuration file:

```json
{
  "sandbox": { "defaults": { "cpus": 2, "memory": "2048MiB", "idle_timeout": "15m" } },
  "session": { "base": "dev" },
  "prune": { "older_than": "14d" }
}
```

Unknown keys inside any of these sections cause an error naming the file and
key, since they are usually typos. `enclo config unset` operates on the raw
file, so you can use it to remove a bad key from a file that fails to load.

## Environment

| Variable                  | What it sets                                                   |
| ------------------------- | -------------------------------------------------------------- |
| `ENCLO_HOME`              | Directory for sandboxes and configuration (default `~/.enclo`) |
| `ENCLO_CPUS`              | `sandbox.defaults.cpus`                                        |
| `ENCLO_MEMORY_MIB`        | `sandbox.defaults.memory`, in MiB                              |
| `ENCLO_IDLE_TIMEOUT_SECS` | `sandbox.defaults.idle_timeout`, in seconds                    |
| `ENCLO_KRUN_LOG`          | Set to `debug` to show the VMM's own log                       |

## Precedence

Command-line flags override environment variables, and environment variables
override `config.json`. For example, `enclo new --memory 4096` allocates
4096 MiB regardless of `ENCLO_MEMORY_MIB` or `config.json`.

Regardless of configuration, a single sandbox is capped at your host's core
count for vCPUs and half of host memory.
