boxer

boxer.toml

Every boxer.toml key with its type, default and an example, where boxer reads configuration, and how devcontainer.json maps onto it.

# boxer.toml at the repository root
image       = "node:24-bookworm-slim"
setup       = ["npm ci"]
start       = ["npm run dev"]
ready       = "curl -sf http://127.0.0.1:3000/"

[network]
mode        = "allowlist"
allow_hosts = ["registry.npmjs.org"]
ports       = ["auto:3000"]

[tasks]
test = "npm test"

Every key is optional. boxer doctor prints each resolved value and the file or variable it came from.

Some keys are fixed when the sandbox is created: image, build, smolfile, network.mode, network.allow_hosts, network.dns, network.ports, mounts, volumes, mount_at, cpus and memory. Changing one does not change a sandbox that already exists. up, run and status print a boxer: warning: naming each one that changed, and boxer up --recreate applies them. An edit to build's Dockerfile is named as build, since the sandbox still runs the image built before. Another spelling of the same value is not a change: a port forward with or without /tcp or the 127.0.0.1: it binds anyway, a mount path with a trailing /, a .. or ~ for your home directory, and a host name in another case. network.dns counts only on smolvm, the one backend that uses it.

Files and precedence

boxer merges these in order, each overriding the one before.

  1. Built-in defaults, as listed on this page.
  2. .devcontainer/devcontainer.json, else .devcontainer.json, from the worktree root, else the repository root, so a branch that changes its devcontainer gets its own. See the mapping.
  3. $XDG_CONFIG_HOME/boxer/boxer.toml, else ~/.config/boxer/boxer.toml.
  4. boxer.toml at the repository root (the main checkout).
  5. boxer.toml at the worktree root, when it differs from the repository root.
  6. BOXER_* environment variables.
  7. The [harness.<name>] table for the harness making the call.

A later file replaces a list and merges into a table key by key. An unknown key is an error, so a typo cannot weaken enforcement. An unknown top-level table is a warning, so a repository written for a newer boxer still loads. A value outside its allowed set is an error that names the allowed values.

Scope

A scope is what one sandbox belongs to.

isolation

string, default "worktree". One of repo, worktree, session, subagent. Env BOXER_ISOLATION.

What a sandbox is keyed to. session and subagent need an id from the harness or the identity flags. Session and subagent sandboxes in one worktree all mount that same worktree, so two dev servers or installs there still write to the same node_modules and build directories. For dev servers, give each session its own worktree.

isolation = "session"

on_missing_id

string, default "degrade". One of degrade, fail. Env BOXER_ON_MISSING_ID.

What session or subagent isolation does with no id. degrade falls back from subagent to session to worktree and warns. fail refuses with SCOPE_UNRESOLVED.

on_missing_id = "fail"

require_worktree

string, default "warn". One of off, warn, require. Env BOXER_REQUIRE_WORKTREE.

What happens in the main checkout instead of a linked worktree. warn runs and warns, require refuses with WORKTREE_REQUIRED, off says nothing.

require_worktree = "require"

worktree.manage

string, default "off". One of off, detect. Env BOXER_WORKTREE_MANAGE.

detect makes a session in the main checkout share the repository's sandbox, with a warning, until it moves into a linked worktree. It applies only when isolation = "worktree".

[worktree]
manage = "detect"

Integration

integration

string, default "outside". One of outside, inside. Env BOXER_INTEGRATION.

outside runs the harness on the host and its commands in the sandbox. inside runs the harness in the guest. boxer shell and boxer acp set it. See running the harness inside.

integration = "inside"

mode

string, default "rewrite". One of rewrite, tool, off. Env BOXER_MODE.

What a hook does with an intercepted command. rewrite turns it into boxer run -c '<command>'. tool denies it and names boxer_run and boxer run. off lets everything through.

mode = "tool"

enforcement

string, default "both". One of hook, shim, both, audit. Env BOXER_ENFORCEMENT.

Which mechanisms keep commands in the sandbox. With shim or both, a hook on a harness that cannot rewrite (Kimi, DSH) lets the bare command reach the shim, but only when boxer's shims are on the harness's PATH and the command names the program bare. Without shims, or for a program named by path (/opt/homebrew/bin/npm), the hook denies it with the boxer run line to use. With hook, the hook always denies it. audit makes hooks print boxer: audit: would <action> on stderr and allow everything. Shims follow the same setting: under mode = "off", enforcement = "hook" or "audit", a shim runs its program on the host, so a repository file that sets either when your own setting is stricter is held back until boxer trust. shim and both route commands the same way and are not held.

enforcement = "hook"

on_sandbox_unavailable

string, default "fail". One of fail, passthrough. Env BOXER_ON_SANDBOX_UNAVAILABLE.

What boxer run does when the sandbox cannot be provisioned. fail refuses. passthrough runs the command on the host, unsandboxed.

on_sandbox_unavailable = "passthrough"

What gets sandboxed

intercept

[]string, default below.

Programs whose commands run in the sandbox. The sandbox's PATH is the image's own, without node_modules/.bin, so run project tools as npx vite or npm run dev rather than adding bare vite or tsc here. A program matches by name, after skipping leading VAR=value assignments and any path, so bin/rails and ./node_modules/.bin/next match rails and next. A name also matches the program it stands for: a version suffix is dropped (pip3 and pip3.12 match pip, node22 matches node, go1.22 matches go), and nodejs, uvx, pnpx, yarnpkg, gmake, pipx, py.test and cargo-* match node, uv, pnpm, yarn, make, pip, pytest and cargo. corepack matches npm. passthrough matches exact names only. List names, not paths: letters, digits, ., _, + and -, the same rule for intercept_also and passthrough.

boxer reads the whole line the way a shell would, and wraps it whole when any program in it matches. That includes:

  • every command joined by &&, ||, ;, |, & or a newline
  • commands inside $(...), backticks and <(...), even in double quotes
  • the line given to sh -c, bash -lc and the others, and to eval
  • the program behind env, sudo, nohup, nice, time, timeout, xargs, command, exec, taskset, chrt, busybox, toybox, xcrun, chroot, sandbox-exec, entr, xvfb-run, dbus-run-session, ccache, distcc, perf record and similar wrappers, and the line env -S splits, however the option is spelled and under genv
  • the command line held by GIT_SSH_COMMAND, GIT_EDITOR, GIT_PAGER, EDITOR, VISUAL, PAGER, RSYNC_RSH and similar variables when the line sets them, and by rsync -e
  • the commands inside if, while, until, for, case, { ... } and a function body, and the line a trap will run
  • a $(...) in an array index, quoted or not, which arithmetic runs

Text in quotes is text: git commit -m "fix npm test" stays on the host. A line boxer cannot read goes to the sandbox: an unclosed quote, a wrapper option boxer does not know (it may take a value boxer would misread as the program), an alias or hash -p, whose new name boxer cannot follow, and a shell that reads its commands from stdin (bare sudo -s, sudo -i, su, doas -s). The same goes for a passthrough program told to run another one in a way boxer cannot read:

  • git -c or git config with a key boxer does not know, which may run something its value does not show (core.hooksPath, include.path, remote.*.uploadpack); --config-env, --exec-path= and a git global option boxer does not know
  • git options that run a command: rebase -x, bisect run, submodule foreach, filter-branch, --upload-pack, --receive-pack, clone -u, and --template on init and clone
  • a GIT_ variable that is neither harmless (GIT_TERMINAL_PROMPT, GIT_AUTHOR_*, GIT_TRACE*, GIT_SSL_NO_VERIFY, GIT_DIR and similar) nor a command line, such as GIT_CONFIG_PARAMETERS and GIT_EXEC_PATH
  • ssh -o with ProxyCommand, LocalCommand, KnownHostsCommand, Match and similar options (a jump host is ssh -J, which stays on the host), in any letter case, and ssh -F with a file other than /dev/null
  • pwsh, powershell, nu, xonsh and elvish, whose languages are not POSIX shell, with arguments or without (bare, each reads its commands from stdin), and an interactive environment shell such as bare nix develop or poetry shell, which reads its commands from stdin
  • a shell or source whose script is its stdin (sh /dev/stdin <<< '...', source /dev/fd/0), and a prompt variable holding a substitution (PS4='$(...)' bash -x), which runs when shown

Where the program is a command line boxer can read, it is read instead, and the line goes to the sandbox only when that program is intercepted: git keys and variables that name a command (an editor, pager, ssh command, fsmonitor, credential helper, filter, diff or merge driver, or ! alias: core.pager=cat log stays on the host, alias.x='!npm i' does not), and runners given a program (poetry run, bundle exec, mise exec, aws-vault exec, watchexec, parallel, hyperfine, gdb, lldb and others). poetry run black . runs on the host; poetry run python runs in the sandbox. On a harness without a rewrite hook, an intercepted program a runner starts is refused, since a PATH shim never sees it.

boxer does not read git's own configuration files or hooks. A repository's .git/config and .git/hooks run on the host with git. A script run by path (bash build.sh, ./build.sh) is one program, its own name, and boxer does not read inside it: add the script's name, or intercept the tools it calls through PATH shims (enforcement = "both", the default, once boxer shim install has written them and they are on the harness's PATH). Task runners that run lines the repository defines are the same: just, task, mage, turbo, nx, npm-run-all, rake, tox, nox and ninja are not read, and the intercepted programs they start run on the host unless the PATH shims are installed or the runner is in intercept_also. nodemon, ts-node and tsx start node and are not intercepted by default. ["*"] intercepts every program not in passthrough. It writes no PATH shims, since there is no program to name, so enforcement rests on the hook. Not settable from the environment.

intercept = ["npm", "npx", "pnpm", "yarn", "bun", "bunx", "node", "deno",
             "python", "python3", "pip", "uv", "pytest", "cargo", "rustc",
             "go", "make", "cmake"]

Under enforcement = "shim" or "both", boxer shim install writes a file for every entry. A node or python shim shadows the interpreter of a harness written in that language, and the harness fails at startup. Narrow the list to build tools first.

intercept_also

[]string, default [].

Programs added to intercept, so you keep the default list and name only what your project needs on top. A program already in intercept is not added twice. boxer doctor suggests it for a Ruby or JVM project whose tools the default list leaves on the host. Not settable from the environment. A repository whose intercept and intercept_also together leave out a program yours intercept is held back until boxer trust approves it, so a repository's intercept_also = [] does not undo yours.

intercept_also = ["bundle", "rake", "rails", "rspec"]

passthrough

[]string, default ["git", "gh", "ssh", "boxer", "smolvm"].

Programs that never send a line to the sandbox by themselves. A line made only of passthrough and unlisted programs runs on the host. A line that also runs an intercepted program is wrapped whole, so git pull && npm ci runs both in the sandbox. boxer is always treated as passthrough. Not settable from the environment.

passthrough = ["git", "gh", "ssh", "boxer", "smolvm", "terraform"]

Backend

backend

string, default "smolvm". One of smolvm, container, docker, podman. Env BOXER_BACKEND.

The runtime that hosts sandboxes. A backend that lacks a capability refuses the setting that needs it with cause UNSUPPORTED. Only smolvm supports network.mode = "allowlist", the default, so set network.mode with any other backend. See backends.

backend      = "docker"
network.mode = "on"

Guest

image

string, default "". Env BOXER_IMAGE.

The guest image: an OCI reference, or a local docker save archive or rootfs directory given as a path starting ./, ../, / or ~/, with no whitespace. A value ending in .tar, .tar.gz or .tgz (in any case) is a local archive too, wherever it points, because smolvm reads it as one. A local image is not pulled. A repository's local-path image is a host path smolvm boots, so it is held back until boxer trust approves it. - (stdin) is refused: boxer's commands use stdin themselves. When empty, boxer picks the image from the first lockfile found in the worktree.

LockfileImage
Gemfile.lockruby:3-slim-bookworm
pom.xmlmaven:3-eclipse-temurin-21
build.gradle, build.gradle.ktsgradle:8-jdk21
bun.lock, bun.lockboven/bun:1-slim
pnpm-lock.yaml, package-lock.json, yarn.locknode:24-bookworm-slim
uv.lock, requirements.txt, pyproject.tomlpython:3.12-slim-bookworm
Cargo.lockrust:1-slim-bookworm
go.sum, go.modgolang:1-alpine
nonedebian:bookworm-slim

With integration = "inside" and no image, the default is mirror.gcr.io/library/node:24-bookworm-slim. The Node, Python and Ruby images carry no compiler. Add one in image_setup. See choosing an image.

image = "node:24-alpine"

smolfile

string, default "". Env BOXER_SMOLFILE.

A smolvm Smolfile to build the guest from. Takes precedence over image. Other backends refuse it.

smolfile = "./Smolfile"

build

string, default "".

A Dockerfile, relative to the worktree, that boxer builds and boots instead of image. An absolute path is used as written; a repository's build, absolute or not, is held back until boxer trust approves it. The build runs on the host every time a sandbox is created. The builder's layer cache makes an unchanged build take a second, and a file the Dockerfile copies can change without the Dockerfile changing.

BackendBuilt byBoots
docker, podmandocker build, podman buildthe tag boxer-<hash>-<key>
containercontainer buildthe tag boxer-<hash>-<key>
smolvmthe host's docker build, then docker savethe archive, under boxer's state directory

On smolvm, docker must be installed on the host even though the sandbox is a microVM. The last two archives per Dockerfile are kept. The tag is the Dockerfile's content hash and the scope key without its sb- prefix, so two worktrees building at once never re-point each other's tag, and they share layers through the builder's cache. The tag is removed when its sandbox is, by down, --recreate and --rebuild. Build arguments are not passed. Cannot be set with smolfile. Fails with cause BUILD_FAILED when the build does.

build = "Dockerfile"

build_context

string, default "".

The directory the build sees, relative to the worktree, or an absolute path used as written (even /, which sends the builder the whole host filesystem). Empty means the directory holding the Dockerfile. A repository's value is held back with build until approved.

build         = ".devcontainer/Dockerfile"
build_context = "."

cpus

int, default 4. Env BOXER_CPUS.

Virtual CPUs for the guest, from 1 to 1024. The cap is fixed rather than this host's count, because one file is read on hosts of every size; a value above what the host has is the backend's to refuse.

cpus = 2

memory

string, default "4G". Env BOXER_MEMORY.

Guest memory: 4G, 4096M, or a bare number of MiB. G and M may also be written GB, GiB, MB or MiB, in any case, with no space before it; any other unit is refused. A setup step that exits 137 ran out of memory.

memory = "8G"

mount_at

string, default "/workspace". Env BOXER_MOUNT_AT.

Where the worktree is mounted in the guest: an absolute path below /, made of letters, digits, ., _, - and /, with no . or .. segment and no trailing /. Anything else is refused when boxer.toml loads. A devcontainer workspaceFolder that breaks these rules is ignored with a warning in boxer doctor. boxer run from a subdirectory runs in the matching subdirectory. With integration = "inside" the worktree is mounted at its host path instead.

mount_at = "/src"

mounts

[]string, default [].

Extra host directories, as host:guest or host:guest:ro, the guest path absolute. A leading ~/ in the host half is expanded. The worktree is always mounted. boxer checks only that the guest half is absolute and hands the entry to the backend otherwise as written: give the host half as an absolute or ~/ path, because a relative one is read by the backend (docker takes a bare name as a named volume), and a mode other than ro, such as :z, reaches the backend, which may refuse it. A repository's entry is held back unless yours lists the same string.

mounts = ["~/.m2:/root/.m2:ro"]

volumes

[]string, default [].

Named directories that outlive the sandbox, as name:/guest/path. Each is a directory on the host, ~/.local/state/boxer/volumes/<scope>/<name>, bind-mounted read-write on every backend. It survives boxer down, boxer rm, --recreate, --rebuild and idle reclaim, so a database keeps its data. It is deleted by boxer rm --volumes, by boxer down --volumes in its worktree, which works after the sandbox is gone, or by boxer gc once its worktree has been gone for 7 days. The week covers a drive that was unplugged, or a repository moved and moved back: the first sweep that finds the worktree missing only marks the volumes, and a worktree that comes back clears the mark. Volumes belong to the worktree's path, so a repository moved for good starts with empty ones at its new path, and a new worktree created at an old one's path gets the old one's volumes. An orchestrator that deletes a worktree when you archive a task takes its volumes with it a week later. Copy out what you want to keep first. A name is letters, digits, - and _. Volumes are not part of the environment pack.

volumes = ["pgdata:/var/lib/postgresql/data"]

user

string, default "".

The guest user for setup, start and every command, as a name or uid[:gid], made of letters, digits, _, . and -. Empty uses the image's USER. image_setup always runs as root. When the user cannot write the worktree, boxer gives it your host uid on smolvm and recreates the sandbox once with --userns=keep-id on podman.

user = "node"

Prep

[prep] runs commands on the host while the sandbox boots. See dependencies. Because these run on the host, prep is one of the keys held back until a person approves the configuration with boxer trust.

prep.commands

[]string, default [].

Run on the host with sh -lc, in the worktree, once per worktree, and again when the list or the target changes. A failure stops provisioning with PREP_FAILED. The commands get BOXER_TARGET_OS, BOXER_TARGET_CPU, BOXER_TARGET_LIBC, BOXER_TARGET_FLAGS (--os=linux --cpu=arm64 --libc=musl) and BOXER_WORKTREE. boxer never adds the flags to your command.

[prep]
commands = ["npm ci $BOXER_TARGET_FLAGS"]

[prep] is only safe for packages that ship prebuilt platform binaries. A package that compiles at install time (node-gyp, cgo) builds for the host and fails in the guest with invalid ELF header. boxer doctor names such packages.

prep.target

string, default "auto".

The guest platform offered to prep.commands. auto derives it from the image, none offers nothing, and os/cpu/libc sets it. boxer checks only that shape (three non-empty parts of letters, digits, ., _ and -, separated by /); the parts are passed on as written.

[prep]
target = "linux/arm64/musl"

Cache

cache.enabled

bool, default false. Env none.

Mount the host's package caches into the guest, read-only. Installs still run in the guest, so only the download is saved. Installing a package the host has not cached fails, because the tool cannot write to its read-only cache. See host package caches.

[cache]
enabled = true

cache.managers

[]string, default ["auto"].

Which caches. auto detects them from lockfiles. Otherwise any of npm, pnpm, yarn, bun, uv, poetry, cargo, go.

[cache]
managers = ["pnpm", "cargo"]

Setup and services

See environment for when to use each.

image_setup

[]string, default [].

Commands that change the image, run in the guest as root, once per sandbox (on smolvm, once per host). On smolvm the result is saved in the environment pack, so the next worktree skips them. A failure is SETUP_FAILED.

image_setup = ["apt-get update && apt-get install -y build-essential"]

setup

[]string, default [].

Commands that prepare this worktree, run in the guest as user, once per worktree and again when the list changes or on boxer up --rebuild. A pack never skips them, because the worktree is mounted from the host. They must write into the worktree: a recreated sandbox does not run them again, so anything installed elsewhere is lost. A changed list runs on the next up or run. A failure is SETUP_FAILED. The sandbox stays usable, so you can find out why, and boxer up runs setup again. Interrupting boxer during setup stops the step in the sandbox and exits 130 or 143 with cause INTERRUPTED, and the setup runs again on the next command.

setup = ["npm ci"]

start

[]string, default [].

Commands run detached every time the sandbox starts, after setup. A service that crashes is restarted, as restart says. Their output goes to /tmp/boxer-start.log in the guest. A step that cannot be launched is START_FAILED. A list changed while the sandbox is running takes effect at the next start: up and run print a boxer: warning: until boxer restart launches it.

start = ["npm run dev"]

ready

string, default "".

A command polled in the guest until it exits 0, before the sandbox is reported up. Empty means no wait. After a NOT_READY, boxer up waits for it again; boxer run does not, even when it runs a changed setup list first, so a service that never comes up does not hold every command for ready_timeout.

ready = "curl -sf http://127.0.0.1:3000/"

ready_timeout

string (Go duration), default "60s".

How long to poll ready, a positive duration. When it runs out, the command fails with NOT_READY and quotes the tail of the start log.

ready_timeout = "3m"

restart

string, default "on-failure". One of on-failure, never.

What happens when a start service exits non-zero. on-failure restarts it after 1 second, then 2, 4 and so on up to 30. A run that lasted 10 seconds or more resets the delay. After five quick crashes in a row it gives up, and the start log says so. A service that exits 0 has finished and is not restarted. never leaves a crashed service down. Every restart is a line in /tmp/boxer-start.log. boxer restart relaunches the services by hand.

restart = "never"

Environment

env

table of strings, default {}.

Set in the guest for every command. Part of the environment pack's key and saved in the pack, so keep secrets out of it. A later file replaces a secrets or env_passthrough list whole rather than adding to it, so a secrets = [...] in boxer.toml drops the names a devcontainer forwarded; list them together if you need both. A name, here and in secrets and env_passthrough, is anything a process environment can hold: it cannot contain =, whitespace or control characters, and is otherwise taken as written, so a name npm reads such as npm_config_@scope:registry works.

[env]
NODE_ENV = "development"

env_passthrough

[]string, default ["CI"].

Host variables forwarded to the guest by name at run time, when the host sets them. Values never enter a command line, a pack or an event. They reach setup and image_setup too.

env_passthrough = ["CI", "DEBUG"]

secrets

[]string, default [].

Forwarded exactly like env_passthrough. List credentials here so the file says which variables are secrets. See secrets.

secrets = ["NPM_TOKEN"]

Network

network.mode

string, default "allowlist". One of allowlist, on, off. Env BOXER_NETWORK_MODE.

allowlist lets the guest reach allow_hosts plus the registry hosts its image pull needs. on allows all traffic. off turns the network off. allowlist needs backend = "smolvm".

[network]
mode = "on"

network.allow_hosts

[]string, default [].

What the guest may reach under allowlist. Each entry is one of these.

EntryExampleAllows
a hostnameregistry.npmjs.orgthat exact name, and the addresses it resolves to when the sandbox starts
an address203.0.113.7, 2001:db8::1that address
a CIDR block10.0.0.0/8, 2001:db8::/48every address in the block
an address range10.0.0.10-10.0.0.40every address from the first to the last, inclusive

An address, block or range is reachable on every port and needs no DNS. A hostname is resolved once, when the sandbox starts. If its addresses change later, run boxer up --recreate. A name that is not listed does not resolve in the guest at all.

These are refused when boxer.toml loads, with an error that names the entry:

  • Wildcards, such as *.example.com. smolvm matches exact names only, and it accepts a wildcard without allowing anything. List each host, or use allow_presets.
  • Ports, such as example.com:443 or example.com:8000-8100. Every allowed host or range is reachable on every port.
  • A block with host bits set, such as 10.0.0.1/8. The error suggests 10.0.0.0/8.

A failed command names the hosts and addresses the allowlist refused while it ran, and not those an earlier command was refused. boxer doctor lists every refusal smolvm has recorded under denied_hosts. Under network.mode = "on" the list does nothing, because the guest can reach every host; boxer doctor warns when both are set.

[network]
allow_hosts = ["registry.npmjs.org", "github.com", "10.20.0.0/16", "192.168.1.10-192.168.1.20"]

network.allow_presets

[]string, default [].

Package ecosystems whose hosts join allow_hosts, so you do not have to find out which CDN a registry downloads from. Only used under allowlist. Under on or off it is ignored, without an error, so one boxer.toml works on every backend.

PresetHosts
alpinedl-cdn.alpinelinux.org
cratescrates.io, index.crates.io, static.crates.io
debiandeb.debian.org, security.debian.org
githubgithub.com, api.github.com, codeload.github.com, objects.githubusercontent.com, raw.githubusercontent.com
goproxy.golang.org, sum.golang.org, storage.googleapis.com
gradleservices.gradle.org, downloads.gradle.org, plugins.gradle.org, plugins-artifacts.gradle.org, repo.maven.apache.org
mavenrepo.maven.apache.org, repo1.maven.org
npmregistry.npmjs.org
pypipypi.org, files.pythonhosted.org
rubygemsrubygems.org, index.rubygems.org, rubygems.global.ssl.fastly.net
ruststatic.rust-lang.org, sh.rustup.rs
yarnregistry.yarnpkg.com, repo.yarnpkg.com, registry.npmjs.org
[network]
allow_presets = ["npm", "github"]

network.ports

[]string, default [].

Port forwards. host:guest and a bare guest are bound to 127.0.0.1; an explicit address you write (0.0.0.0:8080:3000, [::1]:8080:3000) is kept as written, so only you can publish on every interface. A /tcp, /udp or /sctp suffix and one-to-one ranges (8000-8002:8000-8002) are allowed; both sides of a range must be the same length. auto:<guest> takes a free host port, so worktrees do not collide, and never takes a port a stopped sandbox holds. boxer status shows which host port it got. When no port is free, the command fails with NO_FREE_PORT. A port is 1 to 65535. An address must be a valid IPv4 or bracketed IPv6 address. Forwarding the same host port twice on one protocol, on one address or on 0.0.0.0 (or [::]) and another address of its family, including through overlapping ranges, is refused when boxer.toml loads.

On smolvm, host:guest and a bare guest are bound to both 127.0.0.1 and [::1], and a forward that names an address is refused with cause UNSUPPORTED, because smolvm 1.16 takes no address in a forward. Write it without the address. The container backends bind 127.0.0.1 only, and take any address. boxer url and boxer status report a forward on the address it names.

[network]
ports = ["auto:3000", "5432:5432"]

network.dns

string, default "".

The guest resolver on smolvm. Empty uses the host's caching resolver, off uses smolvm's default public resolvers, and an IP address is used as given. An IPv6 address is written bare (::1), without brackets or a zone (%en0). Anything else is an error.

[network]
dns = "10.0.0.2"

URLs

[urls] names forwarded ports through portless. See URLs.

urls.enabled

bool, default false. Env BOXER_URLS (a boolean).

Give each forwarded port a stable name, such as https://fix-ui.myapp.localhost:1355. Needs portless on the host. Without it, boxer warns and runs as if this were off.

[urls]
enabled = true

urls.provider

string, default "portless". One of portless.

What serves the names.

[urls]
provider = "portless"

urls.name

string, default "".

The base hostname, before the worktree prefix: one DNS label (letters, digits and -, at most 63 characters, not starting or ending with -). Empty uses the repository's directory name.

[urls]
name = "shop"

urls.names

table of strings, default {}.

A label per guest port, giving <label>.<name>. One forwarded port needs no label. Several unlabelled ports are named by their number. A key is the guest port as network.ports writes it ("3000"); a key that matches no forwarded port is ignored. A label is lower-cased, each character outside letters, digits and - becomes -, and it is cut to 63; one left empty counts as no label.

[urls]
names = { "3000" = "web", "8080" = "api" }

Tasks

tasks.<name>

string or table, default none.

A named command line, run with boxer run --task <name>, or with the boxer_run MCP tool's task argument. The table form takes cmd (required), description, junit (paths or globs), timeout (a positive Go duration) and env. Any other key is an error. An empty cmd, a timeout that is not a positive duration, an env name holding =, whitespace or a control character, or a name other than letters, digits, ., _, : and - (starting with a letter or digit) is an error. A task is replaced whole by a later file, not merged key by key: a later file that sets only description for a task drops its cmd. See tasks.

[tasks]
test = "npm test"

[tasks.e2e]
cmd         = "npm run e2e"
description = "the browser suite; needs the dev server"
junit       = ["reports/junit.xml"]
timeout     = "10m"
env         = { HEADLESS = "1" }

Results

See test results.

results.auto

[]string, default [].

Worktree-relative JUnit XML paths or globs to summarise after every boxer run. A task's junit and the --junit flag take precedence. Only regular files inside the worktree are read: an absolute pattern or one with a .. is refused before it is matched, and a match that leads outside through a symlink is skipped, however old the file it points at. Either way the warning names the pattern, not what it matched. A match that is not a regular file (a FIFO, a socket) is skipped with a warning naming it.

[results]
auto = ["reports/*.xml"]

results.fail_on_test_failures

bool, default false.

Exit 1 when the command exited 0 and a test in the reports failed. A non-zero exit is never changed.

[results]
fail_on_test_failures = true

Lifecycle

create_on

[]string, default ["session_start", "run", "mcp"].

Signals that may create a sandbox. Any of session_start, subagent_start, run, mcp. Without run, boxer run fails with NO_SANDBOX until boxer up has run.

create_on = ["session_start", "subagent_start", "run", "mcp"]

destroy_on

[]string, default [].

Hook signals that delete the sandbox. Any of session_end, subagent_stop, never. Empty keeps the sandbox after the session, for gc to reclaim when idle.

destroy_on = ["session_end"]

warm_on_session_start

bool, default false. Env BOXER_WARM_ON_SESSION_START.

When true, the session-start hook provisions in a detached boxer up and returns at once, so the session never waits for a create. The first intercepted command waits for it instead. When false, the session-start hook waits for the sandbox, up to the hook's 10-minute limit.

warm_on_session_start = true

Reclaiming

auto_reclaim

bool, default true.

When true, ordinary commands start the gc sweep in the background, at most once per reclaim_every. BOXER_NO_RECLAIM=1 skips it for one process. The sweep deletes packs every repository on the host shares, so a repository file that turns this on when your own setting is off is held back until boxer trust.

auto_reclaim = false

reclaim_every

string (Go duration), default "6h".

The minimum interval between automatic sweeps, a positive duration. A repository file that shortens it is held back until boxer trust.

reclaim_every = "1h"

idle_timeout

string (Go duration or "never"), default "2h".

A sandbox or environment pack unused this long is reclaimable. What happens to a sandbox is idle_action. never, and a zero duration such as "0s", turn the idle rule off. A negative duration is refused. gc judges each sandbox by its own repository's idle_timeout and idle_action, wherever it runs, so one repository's settings never reclaim another's sandboxes. The current directory's value ages packs, which every repository on the host shares, so a repository file that shortens it is held back until boxer trust. A sandbox with a fork child in use is not idle.

idle_timeout = "24h"

idle_action

string, default "stop". One of stop, delete.

What idle reclaim does to a sandbox whose worktree still exists. stop frees its memory and keeps its disk, so the next command starts it again with what it had installed and stored. delete frees both, which was the only behaviour before 1.2. A sandbox whose worktree is gone is always deleted. gc --all still deletes stopped sandboxes.

idle_action = "delete"

min_free_gb

float, default 5.

The free disk space boxer keeps, in GB. Below it, boxer skips writing a pack and pulls the image instead, and boxer doctor warns. 0 turns the check off. nan and inf are refused. A repository's value lower than yours is held back until boxer trust approves it.

min_free_gb = 20

packs_keep_last

int, default 5.

Keep at most this many unused packs, whatever their age: environment, image and harness packs together, newest first. A pack a sandbox was created from is not counted and not removed. 0 keeps every pack the idle rule allows. Packs are shared by every repository on the host, so a repository file that lowers this is held back until boxer trust.

packs_keep_last = 2

Harness overrides

harness.<name>

table, default none.

Overrides for one harness, applied after every file and variable. Only mode, enforcement and isolation are accepted, each checked against the same values as the top-level key. <name> is the harness name boxer install takes, and the call selects it with --harness or BOXER_HARNESS. Inside mode's program names work too: [harness.claude] and [harness.claude-code] configure the same harness. A name boxer does not know is an error, so a misspelt table cannot quietly do nothing.

[harness.kimi]
mode        = "tool"
enforcement = "hook"
isolation   = "session"

Telemetry

See events.

telemetry.enabled

bool, default false.

Record events. Off means no log, no metrics and no network. true with sink = "none" uses file.

[telemetry]
enabled = true

telemetry.sink

string, default "none". One of none, file, stderr, otel. Env BOXER_TELEMETRY_SINK.

Where events go. Setting the variable to anything but none also sets enabled, and setting it to none sets enabled = false.

[telemetry]
enabled = true
sink = "stderr"

telemetry.path

string, default "".

The file sink's path. Empty uses $XDG_STATE_HOME/boxer/events.jsonl, else ~/.local/state/boxer/events.jsonl. BOXER_TRACE overrides it.

[telemetry]
path = "/tmp/boxer-events.jsonl"

telemetry.record_commands

bool, default false.

Keep command lines, argv, env and setup in event payloads. Otherwise each is replaced by its length, as command_len and so on.

[telemetry]
record_commands = true

telemetry.endpoint

string, default "".

The OTLP endpoint for sink = "otel". Only a binary built with -tags otel has that sink.

[telemetry]
sink     = "otel"
endpoint = "http://127.0.0.1:4318"

Deprecated

These still load, so a boxer.toml that boxer 1.0 read keeps working. Each has no effect, prints a warning, and will be removed in 2.0.

require_linked_worktree

bool, default false. Use require_worktree = "require" instead.

reuse_existing

bool, default true. A scope always reuses its sandbox. Delete the line.

Environment variables

Eighteen scalar keys can be set from the environment, for a harness that offers no other way to configure a subprocess. Lists and tables cannot. A variable overrides every file, and a [harness.<name>] table overrides the variable. boxer doctor names the variable as the source. A variable set to the empty string is treated as unset, so BOXER_BACKEND= boxer up uses the files.

VariableKey
BOXER_BACKENDbackend
BOXER_ISOLATIONisolation
BOXER_ON_MISSING_IDon_missing_id
BOXER_REQUIRE_WORKTREErequire_worktree
BOXER_WORKTREE_MANAGEworktree.manage
BOXER_INTEGRATIONintegration
BOXER_MODEmode
BOXER_ENFORCEMENTenforcement
BOXER_ON_SANDBOX_UNAVAILABLEon_sandbox_unavailable
BOXER_IMAGEimage
BOXER_SMOLFILEsmolfile
BOXER_MOUNT_ATmount_at
BOXER_CPUScpus (an integer)
BOXER_MEMORYmemory
BOXER_NETWORK_MODEnetwork.mode
BOXER_URLSurls.enabled (a boolean)
BOXER_TELEMETRY_SINKtelemetry.sink, and telemetry.enabled unless the value is none
BOXER_WARM_ON_SESSION_STARTwarm_on_session_start (a boolean)

A value that does not parse as its type is an error that names the variable, as a bad value in boxer.toml is. BOXER_URLS holding a port map, which boxer sets inside the guest, is not read as this setting. A command line an agent runs may not set the ones that change what a command may reach (BOXER_BACKEND, BOXER_ISOLATION, BOXER_INTEGRATION, BOXER_MODE, BOXER_ENFORCEMENT, BOXER_ON_SANDBOX_UNAVAILABLE, BOXER_SMOLFILE, BOXER_NETWORK_MODE, BOXER_URLS, and BOXER_TRUST): the hook refuses it. Set them in the harness's environment before it starts. Variables with no key are listed in the CLI reference.

devcontainer.json

boxer reads the part of a devcontainer file it can honour. It is the lowest file layer, so any key boxer.toml sets wins. Comments and trailing commas are accepted.

devcontainer.jsonboxer.toml
imageimage
build.dockerfile, or dockerFilebuild, rewritten to be relative to the worktree
build.contextbuild_context, likewise
initializeCommandprep.commands, on the host, as the specification says
onCreateCommandimage_setup
updateContentCommand, then postCreateCommandsetup
postStartCommandstart
workspaceFoldermount_at
forwardPortsnetwork.ports as auto:<port>. A "service:port" string uses the port
portsAttributes.<port>.requireLocalPortThat forward kept fixed, as <port>:<port>
portsAttributes.<port>.labelurls.names
appPortnetwork.ports, fixed, as Docker's -p is
containerEnv, remoteEnvenv. remoteEnv wins where both name a variable
mountsmounts, bind mounts only
remoteUser, else containerUseruser
hostRequirements.cpus, hostRequirements.memorycpus, memory, raised to the minimum, never lowered

A command given as a string or an array is one line. An object of named commands becomes one line per name, in name order.

Variables are resolved on the host in every string: ${localWorkspaceFolder} and ${localWorkspaceFolderBasename} (this worktree), ${containerWorkspaceFolder} and ${containerWorkspaceFolderBasename} (the mount), and ${localEnv:NAME} or ${localEnv:NAME:default}, also spelled ${env:NAME}. ${containerEnv:NAME} resolves inside remoteEnv when containerEnv defines the name. Another ${containerEnv:NAME} or ${devcontainerId} gets a warning in boxer doctor, and an env value or mount that uses it is dropped.

An entry that passes a host variable under its own name, "GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}", becomes one of secrets rather than env: env is stored in the environment pack and passed by value, and a secret is read from the host when each command runs. Any other entry that takes a host value is kept in env, and boxer doctor warns about it by name. The guest can rewrite this file, so every other ${localEnv:NAME}, wherever it appears, is held back by name until you approve the configuration with boxer trust; until then it resolves as if the host had no such variable, which is the file's own default or nothing. A byte-order mark at the start of the file is ignored.

These have no effect. boxer doctor lists each one present under its warnings; other commands do not print them, so run doctor after adding a devcontainer.json.

KeyWhy
featuresboxer does not install features. Put them in image_setup or in the Dockerfile build names
build.args, build.target, build.cacheFrom, build.optionsboxer builds the Dockerfile as it is
dockerComposeFileIt runs several containers. boxer runs one guest per worktree
runArgs, privileged, capAdd, securityOptThey would change the sandbox's own boundary
workspaceMountboxer always mounts the worktree, at mount_at
overrideCommand: falseboxer never runs the image's own command. Put it in start
postAttachCommandNothing attaches to a sandbox
initThe guest already reaps what it starts
hostRequirements.gpu, unless false or "optional"No backend passes a GPU through

Every other key is ignored, including name, customizations, shutdownAction, userEnvProbe, otherPortsAttributes, waitFor (use ready) and hostRequirements.storage (min_free_gb covers disk). boxer always makes user able to write the worktree, as updateRemoteUserUID asks.

On this page