The command sandbox
Commands the agent runs are confined. Commands you run yourself (! in a chat,
/run) aren't. On Linux this is Landlock (Linux 6.12 or later, x86_64 and aarch64); on Windows (10 1809 or
later), an AppContainer. There's no sandbox on macOS yet.
On Linux
- Writes: the workspace, the command's own temp folder (one per project, emptied when a session
starts; not all of
/tmp), your[sandbox] writefolders and the project's own write folders. A workspace that is, or holds, your home folder is refused. - Reads: the system as it is; in your home folder, only the workspace, the write folders, the
toolchain folders that exist (
~/.cargo,~/.rustup,~/.npm,~/.cache,~/go, ...) and your[sandbox] readfolders. Credential stores inside them (~/.cargo/credentials.toml, ...) and matter's own config and data stay out. - Network: off unless
network = true. A project's own servers still work: a command may listen on 127.0.0.1 or ::1 and connect to a server its session's commands are listening on (a test suite's local server). Other interfaces and the machine's own localhost services (databases, matter's daemon, Docker) stay unreachable. - Always off: unix sockets (D-Bus, ssh-agent, docker.sock), io_uring, the kernel keyrings, and signals to processes outside.
- A clean environment: PATH, HOME, LANG,
LC_*, TERM, USER, SHELL, TZ, and the names you list inenv. - What a command leaves running ends with it, including anything it put in the background.
- Fail closed: where it can't confine fully, the agent's commands don't run;
[sandbox] offin your config.toml is the only way to run them unconfined.
On Windows
- Files: the container reads and writes only what it's granted: the workspace, the command's temp
folder and your
writefolders (change), yourreadfolders (read). Windows itself lets containers read System32, Program Files and Windows. Your profile,.ssh, browsers' data and other projects stay unreadable. - Network: none unless
network = true. Loopback to your own servers stays blocked even then: a dev server on localhost isn't reachable from a confined command. - Processes: everything a command starts ends with it.
matter sandbox resetremoves the permissions matter added to your folders.- On Windows 10, Windows Server and Windows 11 before 24H2, containers can't open the NUL device, so git and cargo
builds couldn't run inside the sandbox: there it's off by default, and matter says so once. The agent's commands
then run with your own permissions (it still asks before changing anything).
[sandbox] on = trueconfines them anyway, with git, cargo and> nulfailing confined.
Checking it: matter sandbox test
Runs real confined commands on this machine and says what is and isn't stopped. What it never stops, by design: code planted in the project for later (a Makefile, a script, the source itself: review the diff), reading the project's own files, the network when you've allowed it, and CPU and memory use.
Changes a confined command makes to files other tools run later (.git/hooks, .git/config,
.envrc, .vscode/tasks.json, .npmrc, ...) are reported loudly in the tool result,
to you, and in the audit log. They aren't undone: review them before you run git, direnv or an editor task there.
Allowing more
# config.toml (yours)
[sandbox]
network = true
write = ["~/.npm-global"] # folders commands may write
read = ["~/notes"] # folders in your home folder they may read
env = ["CARGO_HOME"] # extra environment variables to keep
# shm = true # /dev/shm
# off = true # no sandbox at all
A project can have its own .matter/sandbox.toml, but until you trust the project it can only tighten
these. All the [sandbox] keys.
Project trust
Everything matter would obey or run from a project (.matter/ settings, hooks, skills,
.mcp.json) applies only once you've trusted the project as its files are now: matter sandbox
trust lists the files and what they turn on, and asks. Until then, or after they change, its sandbox settings
only tighten, its hooks don't run, its MCP servers don't start, and its allow rules cover only tools that read.