Skip to content

Sandboxes ​

Each trial runs in its own sandbox. The CTRF and the summary header always say how isolated the run was.

sh
npx proctor run path/to/review.eval.ts --agent claude-code                         # srt, isolation full
npx proctor run path/to/review.eval.ts --agent claude-code --sandbox local-temp    # isolation degraded, with a warning
srt (default)local-temp
Isolation written in the reportfulldegraded, plus a console warning
HOME, TMPDIR, XDG_*temporarytemporary
EnvPATH without the entries under the host home, LANG, LC_*, TERM, TZ, USER, LOGNAMEsame
Readhost home and temporary directories hidden, except the trial's workspace, home and TMPDIR, and the declared pathsthe whole disk
Writethe trial's workspace, home and TMPDIR, .allowWrite() pathsthe whole disk
Networkdeclared domains onlyopen

fake (src/testing/) runs nothing: isolation none, the default with --agent fake.

Checking the sandbox without a model ​

With a real sandbox, --agent fake runs one shell command through it, in the workspace, after the fixtures, the way an agent starts: the sandbox must start and the workspace must be writable. A dry run therefore checks the sandbox on the host, for example in a CI build, with no token and no cost.

sh
npx proctor run examples/hello.eval.ts --agent fake --sandbox srt

With MCP stubs, it then starts each stub through the sandbox and has it list its tools: node must be readable, the log writable. A failure ends the trial other with The MCP stub "pgsql" did not start in the sandbox. The fake agent calls no tool: graders that expect stub calls fail in a dry run.

When the check fails, the trial ends other with a message that starts with The sandbox did not run a command in the workspace, followed by the sandbox's own error. A suite with judge() also ends other under the fake judge, by design: a CI job tells the two apart by this message in the CTRF.

The srt policy ​

The policy of a trial (<trial root>/srt-settings.json, outside the writable directories) denies broadly, then opens narrowly: in srt, allowRead wins over denyRead.

text
host disk                                  what a trial sees under srt
├── ~  (host home)                         hidden: ~/.ssh, ~/.aws, ~/.claude…
├── /tmp, /var/folders, /Volumes           hidden
├── os.tmpdir()                            hidden: parent of every trial root
│   ├── ae-review-basel-a1b2c3/            this trial's root, not re-allowed itself
│   │   ├── srt-settings.json              hidden: the policy, read by srt outside the sandbox
│   │   ├── work/                          writable: cwd, the workspace
│   │   ├── home/                          writable: HOME, XDG_*, .claude/, .proctor/plugins/, .proctor/mcp/
│   │   └── tmp/                           writable: TMPDIR, CLAUDE_CODE_TMPDIR
│   └── ae-review-with--d4e5f6/            hidden: another trial (-j 2)
├── directory of the claude binary         readable (sandboxAccess)
├── directory of node                      readable (sandboxAccess) in a trial with MCP stubs: it runs them
├── .allowRead() / .allowWrite() paths     readable / writable
└── /usr, /opt, /etc…                      readable: binaries, libraries, certificates
RulePathsWhy
denyReadhost home~/.ssh, ~/.aws, ~/.config/gh, ~/.claude…
denyReadparent directory of the trial roots (os.tmpdir(), given path and real path)a trial does not read another trial's root (-j 2)
denyRead/tmp, /private/tmp, /var/folders, /private/var/folders, /Volumes (those that exist)/tmp/claude-<uid> holds the outputs of the host's Claude sessions; mounted disks
allowRead<root>/work, <root>/home, <root>/tmpnever the root itself: on Linux, srt binds a re-allowed directory back read-only after the writable binds, which would make the workspace read-only and stop bubblewrap at startup
allowReadthe @anthropic-ai/sandbox-runtime packageon Linux srt runs its seccomp filter from vendor/seccomp, inside the sandbox, and node_modules often sits under the hidden home
allowReaddirectory of the agent binary, directory of node (trials with MCP stubs only), .allowRead(), .allowWrite()what the agent and the suite declare; node installed by nvm, fnm or volta sits under the hidden home
allowWrite<root>/work, <root>/home, <root>/tmp, .allowWrite()nothing else; srt adds stdio and /tmp/claude, unreadable here
allowedDomainsthe model API for the profile, .allowDomains()everything else is blocked by the srt proxy
envCLAUDE_CODE_TMPDIR=<root>/tmpsrt gives the command TMPDIR=$CLAUDE_CODE_TMPDIR, otherwise /tmp/claude, shared and hidden
  • Domains come from the agent (sandboxAccess: the model API for the profile) and from the suite (.allowDomains(...)).

Opening the sandbox from a suite ​

ts
import { regex, suite } from "@fluce/proctor"

export default suite("dotnet")
  .allowDomains("api.nuget.org")
  .allowWrite("/tmp/.dotnet")
  .variant("baseline", (v) => v.permissions("full").prompt("Run dotnet test and report the result"))
  .case("tests-pass", (c) => c.expect(regex("passes", /passed/i)))

A private feed also requires a credential: out of scope.

Requirements ​

  • srt comes from the @anthropic-ai/sandbox-runtime dependency, not from a global install.
  • It needs rg on macOS, and bwrap, socat and rg on Linux. Otherwise create fails and says what to install, or to pass --sandbox local-temp.
  • It refuses native Windows: run proctor inside WSL2, see Windows (WSL2).
  • test/srt.integration.test.ts runs the real srt, without an LLM or network: reading a fake home and another trial is denied, writing outside the workspace is denied, the workspace and .allowWrite() are writable. It is skipped, with a message, where srt does not run, except with PROCTOR_REQUIRE_SRT=1: CI sets it and installs bubblewrap, socat and ripgrep, so the policy is checked on Linux at every build.