Sandbox tmpdir mechanism is opaque and fails silently
Problem
The Bash sandbox creates temp directories at
/private/tmp/claude-501/<encoded-project-path>/<session-uuid>/tasks — this is:
- Undocumented — not in the settings schema or docs
- Unconfigurable — no setting to change the location
- Opaque — the encoded path format and UUID structure aren't explained
- Fragile — when permissions break (macOS temp cleanup, ownership changes), every
Bash call fails with EACCES: permission denied, mkdir before the actual command
runs
## Observed behavior
Agent hit EACCES on this path, retried 4 times, then attempted TMPDIR workarounds — all
because the error gives no indication it's a sandbox infrastructure problem vs. a
command problem.
## Suggestion
- Document the sandbox tmpdir mechanism
- Provide a clear error message when sandbox infrastructure fails (e.g. "Sandbox temp
directory could not be created. Run /sandbox to reconfigure.")
- Allow configuring the tmpdir location in settings.json
- Consider using the project's own .claude/ directory or a user-configurable path
instead of /private/tmp/
## Environment
- macOS Darwin 25.3.0
- Claude Code CLI
sandbox.enabled: falseworks as a mitigation but shouldn't be necessary
## Workaround
Disabled sandbox entirely via "sandbox": { "enabled": false } in settings.json.
Using hooks and deny rules as the enforcement layer instead.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗