Restricted commands
A build script can do anything your account can do in a Standard terminal. A Restricted command gives it a smaller scope before its code starts: one project directory, the installed system tools and temporary scratch space, with no network and no host services.
Choose a project below your account home whose path has no dot-directory in it, so hidden credential folders and paths outside home are refused. Copy outside work into a dedicated project first. Everything already inside that project, hidden files and secrets included, is granted to the command.
terminal-delight restricted run --workdir "$HOME/Projects/example" -- sh -c 'make test'
Inside the command, the project is /work. Add --read-only before -- to refuse changes there. Home and /tmp are temporary. The arguments and input you give it are the command's too.
It needs /usr/bin/bwrap (bubblewrap) 0.12.0 or newer, Linux 5.11 or newer, and x86_64 or aarch64. If anything is missing, no command starts; there is no fallback to Standard.
Technical has what the command can reach, the optional note grant, and the run's one access proposal.
What the command can reach
The project directory#
Terminal Delight resolves the path, pins the directory by file descriptor, and walks it through that descriptor, checking each entry's device and mount. A nested mount, a hard-linked regular file, a socket, a pipe or a device refuses the launch, and so does a directory that changed after it was pinned. A tree of more than 200,000 entries or deeper than 128 levels is refused. A symlink stays a symlink; it can't reveal a host path that was never mounted.1
The resolved path must sit strictly below your account home as the system records it, with no part of it starting with a dot. Changing HOME doesn't change the rule. The directory can't overlap $XDG_CONFIG_HOME, $XDG_STATE_HOME or the runtime directory, and $XDG_RUNTIME_DIR must lie inside /run/user/<uid>. A project can still hold .git or other hidden content; look before you grant it. The rule follows resolved paths, so a volume mounted at an allowed path under home belongs to that grant.
The sandbox#
The command sees read-only /usr, /bin, /lib and /lib64 where they exist, the linker cache and /etc/alternatives, fresh /proc and /dev, and a 64 MiB temporary /tmp and home, /home/td. It runs as a user called td with your user and group ids. Its environment is cleared and set to PATH=/run/td/bin:/usr/bin:/bin, HOME=/home/td, TMPDIR=/tmp, LANG=C.UTF-8, TERM=dumb and TD_RESTRICTED=offline-v1, so it inherits no provider keys or desktop endpoints.1
It gets its own user, process, network, IPC, hostname and cgroup namespaces, drops every capability, and can't create another user namespace. Its syscall filter blocks new connections, listening sockets, addressed sends, descriptor passing, io_uring, and the key, performance, userfaultfd and BPF interfaces. Its one channel to Terminal Delight is the gateway handed to it at launch; a program that closes inherited descriptors loses it and can't reconnect. Root and set-ID launches are refused.2
Output#
All three standard streams are pipes. Output comes through as UTF-8 text with control characters and bidirectional display controls removed, keeping newlines, carriage returns and tabs. That suits line-oriented offline commands and builds; terminal UIs, GUI programs, online agents and automatic handoffs are unavailable. The tests run shell commands, Python, and a small C program built with the system compiler. Other build systems and toolchains installed under your home need their own check. The run's exit code is the command's, or 128 plus the signal that ended it.3
Notes on the pane#
By default the command can't write anything to Terminal Delight. --td-note lets it put a note on the pane it was launched from, and nowhere else. The grant fixes that pane and the process generations of the pane and its window at launch, and every note still goes through the MCP server, so the server and its writes switch must be on. A note has 1 to 10 words, at most 512 bytes, at most one attempt a second, and lands titled RESTRICTED.1
terminal-delight restricted call '{"op":"note","text":"Build complete"}'
terminal-delight restricted call '{"op":"status"}'
terminal-delight restricted call '{"op":"request_access","reason":"Need external packages"}'
These run inside the command. The gateway takes those three operations and nothing else: it can't aim at another pane, approve a request, change a switch, open a document or hand work on. status answers with the run, its directory and access, and what is granted.
The access proposal#
A run may make one access proposal, a reason of 1 to 40 words. Terminal Delight prints it in the run's terminal under RESTRICTED ACCESS PROPOSAL — workload request, no access granted, naming the run, the directory and its access, and saying that changing scope needs a new run. There is no approval action, and the attention rail doesn't show these proposals.1
The launch prints a run ID of 32 lowercase hex characters. From a Standard terminal, use it with:
terminal-delight restricted status RUN
terminal-delight restricted dismiss RUN
terminal-delight restricted revoke RUN
dismiss clears the waiting proposal without changing access, and the run can't make another. revoke stops further notes once any note already accepted has landed; file work carries on. The command can't dismiss its own proposal, revoke its grant or widen it. When the run ends its sockets and grants go with it, and a new run inherits nothing. These commands, like restricted call, exit 0 when the answer says "ok":true and 2 otherwise.
Limits#
Restricted protects the rest of your account from the command. It doesn't protect against a hostile process already running as you, an administrator or a kernel exploit, and it sets no complete CPU, memory, process or disk quotas.
A note, printed instructions or a shared output file can still mislead a later reader that runs with more authority; running that output is a separate decision. Standard terminals keep ordinary account access, and marking a pane off-limits to agents controls what Terminal Delight shows them, without sandboxing anything in it.
What would prove this wrong#
A Restricted command that reads a file outside its project and the system paths above, opens a network connection, reaches a host socket, or puts a note anywhere but its own launch pane breaks the profile.
Sources
- The launch, the gateway and the proposal: restricted.rs; the directory walk: restricted/work.rs; the note grant: ctl.rs.
- The syscall filter: restricted/seccomp.rs; the helper's options: bubblewrap manual; descriptor mount identity: statx manual.
- The real Linux probes: tests/restricted.rs.