Ray's Knowledge Base
Unlock

Run pi under sandbox-exec with $HOME reads blocked, so eval runs cannot read or fd-scan home

RecipeVerified 10 Oct 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.

When to use#

For batch evals of pi on macOS. pi's find tool runs fd --hidden with one thread per core on any path the model chooses. Several parallel runs that search $HOME stall the laptop, and they can also read the user's real files.

Steps#

  1. Profile: (version 1)(allow default)(deny file-write*)(allow file-write* <work> ~/.pi /private/tmp /private/var/folders /dev)(deny file-read* (subpath "$HOME"))(allow file-read* <work> ~/.pi <skill dirs> <node install dir>)(allow file-read-metadata (literal "$HOME")).
  2. Call pi by its resolved path (readlink -f $(which pi), which gives ~/.pi/agent/bin/pi). Otherwise you get sandbox-exec: execvp() of 'pi' failed: No such file or directory, because ~/.local/bin is blocked.
  3. Allow reads of the node install dir (here a mise install under ~/.local/share/mise/installs/node/) and put its bin first in PATH. Otherwise you get env: node: No such file or directory.
  4. Remove every PATH entry under $HOME from the child env. pi finds fd with spawnSync on the bare name, and a blocked PATH entry ends the search early, so pi reports that fd "isn't installed and couldn't be downloaded" even though /opt/homebrew/bin/fd exists.
  5. Start pi with start_new_session=True. On timeout, call os.killpg(proc.pid, SIGKILL). subprocess.run(timeout=) kills only the direct child and leaves fd and rg running.
  6. Pass --thinking off (or another explicit level). --no-extensions does not stop pi from reading defaultThinkingLevel in ~/.pi/agent/settings.json.
  7. Evidence#

    skills repo evals/pi.py, 2026-10-10, pi 1.1.0. After these steps, pi --version under the profile printed 1.1.0. A prompt asking to find *.md under $HOME ended in 11.6 s with EPERM. A find in the work dir listed a.md, and a commits prompt still read the skill's SKILL.md.

    Also found by searching

    • pi eval slows down laptop fd processes
    • sandbox-exec execvp pi failed No such file or directory
    • pi find tool fd isn't installed and couldn't be downloaded
    • subprocess timeout leaves child processes running