Skip to content

Open source CapCut alternative.

TypeScript

docs: update sandbox/harness guides for the allow-by-default jail and confined interpreters

David Lebee2551658dd
diff --git a/docs/guides/agent-harness.md b/docs/guides/agent-harness.md
index 2d05c109..77623eb8 100644
--- a/docs/guides/agent-harness.md
+++ b/docs/guides/agent-harness.md
@@ -226,11 +226,15 @@ command-line equivalent.
Shell safety has two layers: a kernel sandbox that bounds what a command *can*
do, and consent that governs what it is *allowed* to do.
-Every tool the agent spawns runs inside a macOS sandbox. Its writes are confined
-to the conversation's own folder, so a command that tries to change a file
-elsewhere fails at the kernel even when the model errs. Reads are open — the agent
-can inspect a file the user pointed it at — and the network is reachable for API
-calls and downloads. (See the [Workspace Sandbox](workspace-sandbox.md) guide.)
+Every tool the agent spawns runs inside a macOS sandbox that allows everything
+except writing outside the conversation's own folder. A command that tries to change
+a file elsewhere fails at the kernel even when the model errs; anything else it needs
+— the GPU, the network, whatever syscalls a bundled tool makes — just works, because
+none of that escapes the folder. The sandbox is not a list of permitted capabilities
+(that shape made each unforeseen one a tool needed fail until a rule was added); it
+allows by default and denies only the out-of-folder write. Reads are open so the
+agent can inspect a file the user pointed it at. (See the
+[Workspace Sandbox](workspace-sandbox.md) guide.)
On top of that, each command is sorted by its tokens into a risk tier:
@@ -249,6 +253,15 @@ the kernel widens to let that one write land. Anything the sandbox does not
contain — driving other apps, changing system settings, elevated privileges,
network egress — gates on consent the same way.
+A scripting interpreter (`python3`, `ruby`, `node`) gets the same pass for the
+same reason, but earned through the kernel rather than its arguments: its code is
+opaque, so the runtime jails it to the agent's folder and runs it unprompted.
+Confined that way its writes can only land on files the agent owns — a write aimed
+at a user file is stopped by the kernel, not a prompt. Reads and the network stay
+open as for any spawn, so a script that inspects a file or calls an API still
+works. An interpreter that runs where there is no folder to jail it into falls back
+to asking first.
+
The planner discovers what is available by doing. It runs the command it needs
by name, and a "command not found" is just another observation it adapts to —
reaching for another tool or reporting what is missing. It never probes the
diff --git a/docs/guides/workspace-sandbox.md b/docs/guides/workspace-sandbox.md
index 24890a95..e6454298 100644
--- a/docs/guides/workspace-sandbox.md
+++ b/docs/guides/workspace-sandbox.md
@@ -21,9 +21,9 @@ a tool the model runs (shell command, bundled converter, ffmpeg)
launched through the macOS sandbox, scoped to the task folder
|
v
-write → task folder (+ the user's home, once a prompt approved the command)
-read → open (bundled-tool pipelines: only system libraries + declared inputs)
-network → open
+everything → allowed (GPU, semaphores, Mach services, network — any capability)
+write → denied, except the task folder (+ the user's home, once a prompt approved it)
+read → open (bundled-tool pipelines: only system libraries + declared inputs)
```
A tool is launched through the macOS sandbox (`sandbox-exec`) under a profile
@@ -31,6 +31,15 @@ built fresh for the task. The runtime builds and applies that profile
automatically for every task that owns a folder, so confinement holds by
construction.
+The profile **allows everything by default and denies only out-of-workspace file
+writes.** It is deliberately not a list of permitted capabilities. An earlier
+deny-by-default profile had to name every capability a tool might use, and each one
+nobody had predicted — a video tool reaching for the GPU, a downloader using a System
+V semaphore — failed with a cryptic error until someone added a rule. Allowing by
+default removes that whole class of failure: a tool can use any capability, because
+none of them let it escape the folder. The filesystem write boundary is the one thing
+the jail enforces, so it is the one thing the profile spells out.
+
The kernel decides what a tool *can* touch; consent decides what it's *allowed*
to do. They are separate layers: the kernel bounds the filesystem writes, and
consent (see the harness guide) governs the rest — touching the user's own files,
@@ -46,9 +55,8 @@ driving another app, changing a system setting, reaching out over the network.
Reads are open because the agent reading a file is already treated as free — the
risk it's guarding against is *changing* things, and a read changes nothing. The
-network stays open so a task can call APIs and fetch data; the tools that could
-exfiltrate (a downloader, an interpreter) are gated by consent like any other
-out-of-folder effect.
+network stays open so a task can call APIs and fetch data; a downloader run by its
+own name is still gated by consent like any other out-of-folder effect.
A bundled-tool pipeline (the caption, shorts, PDF, and media-cut orchestrators) is
the one exception to open reads: it processes one named input, so its profile
@@ -78,9 +86,16 @@ command goes through the normal consent prompt, because it would change a file
the user owns. When the user approves, the kernel widens for that command to let
the approved write land. Any resolution ambiguity errs toward asking, never away.
-Consent also gates what a filesystem boundary can't contain at all: an interpreter
-or a downloader (its effect is the code it runs or the bytes it fetches), driving
-another app, changing a setting, elevated privileges.
+A scripting interpreter (`python3`, `ruby`, `node`) earns the same unprompted pass,
+but through the kernel rather than its arguments. Its code is opaque, so the runtime
+jails it to the task folder and lets it run: confined that way its **writes** can only
+land on files the agent owns, and a write aimed at a user file is stopped by the kernel,
+not a prompt. Reads and the network stay open, as they are for every spawn, so a script
+that inspects a file or calls an API still works. An interpreter that runs where there
+is no folder to jail it into falls back to asking first.
+
+Consent still gates what no folder boundary contains: a downloader run by its own name,
+driving another app, changing a setting, elevated privileges.
The agent does not overwrite an existing user file unless the user explicitly
asked. By default it writes a new copy or alternate version and leaves the