🎛️ Configuration
Litterbox configuration is split by who owns the decision:
- The person running the code owns the sandboxing mechanism: which backend, its settings, and where forwarded ports bind. That lives in the untracked local override and is never committed.
- The project owns what it needs: its provisioning steps, the ports it expects,
and how snapshots are stored. That lives in
.agentkit/litterbox/config.toml.
The committed project file may not select or configure a backend. If it tries, Litterbox says so and ignores the setting; the sandbox runs on your machine, so the choice is yours.
Where the files live
| Scope | Path |
|---|---|
| Project | .agentkit/litterbox/config.toml in the repository |
| Local override | .agentkit/litterbox/config.local.toml in the repository, project keys only |
| User config | ~/.config/agentkit/litterbox/config.toml, machine-owned |
Merge order is defaults, then the user config, then the project, then the local project override. The repository-local file may not carry machine settings or setup consent; those live in the user config outside the checkout.
User configuration
# The sandboxing mechanism. Omit to use the default.
backend = "docker"
# Allow a repository's command steps to run. Off by default: cloning a
# repository must not be enough to execute its shell command on your machine.
allow-project-setup = false
# Or allow specific projects by their namespace: the project slug that
# `litterbox list` prints, including its suffix.
allowed-projects = ["my-project-1a2b3c4d"]
# Accept a degraded mechanism, where a capability falls back to something
# weaker, instead of refusing to start.
accept-degraded = false
# Which store view a devshell step binds: "closure" (the default) or "whole".
# The whole store exposes paths the project did not declare; use it only when a
# workload reaches undeclared runtime dependencies.
store-view = "closure"
# Where forwarded ports bind on the host. Loopback unless you say otherwise,
# and only ever set here.
[forwarding]
bind = "127.0.0.1"
# A section per backend, in that backend's own vocabulary.
[backends.docker]
image = "ubuntu:latest"
# Memory ceiling per sandbox, in MiB. At least 6. Defaults to 4096.
memory-mb = 4096
# CPU cores per sandbox. At least 1. Defaults to 2.
cpus = 2
# Maximum tasks or processes per sandbox. At least 1. Defaults to 512.
pids-limit = 512
# Extra Linux capabilities to grant, such as CHOWN or SETUID. Empty by default;
# every other capability is dropped.
cap-add = []
# Largest archive, in bytes, one transfer between host and sandbox may carry,
# in either direction. Defaults to 4294967296 (4 GiB). Raise it to snapshot a
# workspace with a large build tree; lower it to bound what a transfer can cost.
max-transfer-bytes = 4294967296
# Bubblewrap's own section. It needs no image: the sandbox is a holder process
# in unprivileged user namespaces.
[backends.bubblewrap]
# Memory ceiling per sandbox, in MiB. At least 6. Unset means no bound, and a
# bound needs a cgroup v2 user scope.
memory-mb = 4096
# Maximum tasks or processes per sandbox. At least 1. Unset means no bound.
tasks = 512
# Whether the sandbox gets its own network namespace. "denied" (the default)
# confines it to its own loopback; "host" shares the host's network, so the
# sandbox reaches whatever the host reaches and a listener it starts is
# reachable from the host. A project that declares a port needs "host".
network = "denied"
# The program and leading arguments that run a shell string. The default is
# ["sh", "-c"]; a host whose userland has no `sh` entry can name another shell,
# for example ["bash", "-c"]. The program is resolved on the host and bound
# into the sandbox, so it does not have to be on the sandbox's PATH.
shell = ["sh", "-c"]
# Seatbelt's own section. It needs no image and no daemon: each command runs
# through a helper that applies a macOS sandbox profile.
[backends.seatbelt]
# "denied" (the default) emits no network-outbound rule at all, loopback
# included. "host" shares the host's network.
network = "denied"
# "default" adds the lists below to the built-in OS baseline; "none" uses them
# as the exact read and service sets, which is how to harden the sandbox.
baseline = "default"
# Extra OS paths a command may read. With baseline = "default" these are
# additions; with "none" they are the whole read set.
baseline-reads = []
# Extra mach services a command may look up, with the same merge rule.
mach-services = []
Prefer pinning the image by digest (image = "ubuntu@sha256:..."): a tag can
change under you, and the image is the sandbox's confinement boundary.
Every backend owns its section. Docker accepts image, memory-mb, cpus,
pids-limit, cap-add and max-transfer-bytes. Bubblewrap accepts memory-mb,
tasks, network and shell. Seatbelt accepts network, baseline,
baseline-reads and mach-services. A key a backend does
not define is rejected by name rather than ignored. Granting a capability widens
what code in the sandbox can do; add only the ones an image genuinely needs.
litterbox backends reports what this machine can run, marks the selected
backend, and explains anything that will not start.
Project configuration
[project]
slug = "my-project"
backends = ["docker"]
[[provision]]
identity = "setup"
kind = "command"
run = "echo 'Setup complete'"
[backends.docker]
provision = ["setup"]
[[ports]]
name = "web"
target = 8080
[git]
snapshot-mode = "direct"
project.slugidentifies the project. It must already be a valid slug; a value the rules would change is refused rather than silently rewritten.project.backendsnames the backends the project's provisioning supports. It is required when[[provision]]defines a step. The local override may replace it; selecting a backend it does not list is refused with both names. An empty list with no steps means no restriction; with steps it must name at least one.[[provision]]defines a step once, byidentity.kind = "command"runsrunonce, confined, with the workspace as its working directory, after the workspace is materialised, in the order the selected backend lists it. A command step's environment changes do not persist to later steps.[backends.<name>].provisionis that backend's ordered sequence of step identities. The list order is the execution order.provisionis the one project-owned key in a backend section; every other key there remains machine-owned and is ignored with a notice when the committed project file sets it.kind = "devshell"enters the project's Nix development shell on the host and contributes its environment and store closure to the sandbox. It takesinstallable, the flake or path to enter, and one backend sequence may name only one devshell step. Litterbox never realises the devShell: the output path must already be valid in the store, and create refuses with the remedy of runningnix develop <installable>on the host first.- A devshell step evaluates the flake and runs its shell hook on the host, so it
needs the same consent as a command step: the project namespace is in
allowed-projects, orallow-project-setuppermits every project. The sandbox receives no nix daemon socket, no store write and no network, so a command that expects to build fails as it would on a host without nix. - A project may define at most 32 provisioning steps and list at most 32 identities in one backend's sequence.
setup-commandused to live under[project]. It is now acommandstep; the old key is rejected with a message naming the replacement.portsdeclares what the project expects forwarded. The project cannot decide where those ports bind or who may reach them.git.snapshot-modeis"remote"(the default) to keep snapshots in an isolated bare clone, or"direct"to keep them as branches in your working repository.store-viewis machine-owned, so the committed project file may not set it. The defaultclosurebinds only the devShell's store closure;wholebinds all of/nix/store.litterbox doctorreports the view in force and the path count it produces.
[project] setup-command is removed. A configuration that still sets it fails
to load with a message naming a command step and the per-backend list.
A command that exits non-zero fails create with its identity, exit code and up to 4096 characters of output. Host logs record the exit code and length only; the bounded output is returned to the caller so an agent can report it.
litterbox doctor reports whether this project can create a sandbox here: the
selected backend and its readiness, the supported backends, and each step in the
selected backend's order with its state and remedy. It does not create anything.
--json emits the same report for scripts and tests.
Local project override
.agentkit/litterbox/config.local.toml takes the project file's project-owned
shape. A [project], [[ports]] or [git] entry there overrides the committed
value; [project] backends, [[provision]] and
[backends.<name>].provision are replaced wholesale, and an empty list is a
deliberate removal rather than a fallback to the project. Keep it untracked: it
describes this checkout, not the machine.
Machine settings and setup consent are rejected here; they belong in
~/.config/agentkit/litterbox/config.toml. Litterbox refuses a local override
that is tracked by Git, reached through a symlink, or larger than a small
configuration file; cloning a repository must not be able to grant itself setup
consent or choose its own backend.
A provisioning identity starts with a lowercase letter and continues with lowercase letters, digits, hyphens or underscores. The same rule applies in the committed project file.