Feature request for product/service
Cursor IDE
Describe the request
Sandboxed Agent shells inject cache env vars (CARGO_TARGET_DIR, CARGO_HOME, RUSTUP_HOME, npm/pip/go, …) into hashed paths like:
/var/folders/…/T/cursor-sandbox-cache/<hash>/cargo-target
On a large Rust workspace this is a new multi-GB compile tree per hash. I hit No space left on device (~18 GB free, APFS at 96%) while cargo test compiled wasmtime-wasi into a 2.7 GB sandbox cache. Another ~10 GB hash from an earlier session was still on disk. The agent then considered deleting caches and exporting CARGO_TARGET_DIR to the project target/ — that is a prompt workaround, not a product setting.
I want sandboxed agents to use the same incremental target/ as my own terminal, without disabling the sandbox.
What exists today (and why it is not enough)
sandbox.json has:
{ "enableSharedBuildCache": true }
Docs say this redirects npm/cargo/pip caches to a shared tmpdir so sandboxed and unsandboxed commands share caches. That still:
- Lives under temp, not the workspace
target/I already pay for on disk. - Does not document a stable identity across chats/hashes, or a way to set the path.
- Does not stop (or document) injecting
CARGO_TARGET_DIR, which overrides.cargo/config.toml[build] target-dir. - Is incomplete in practice: staff noted that
enableSharedBuildCache: falsedoes not work as expected (Playwright sandbox cache thread).
Workarounds (agent rules that unset/export vars, Legacy Terminal, unsandboxed all permissions) are unreliable: env injection still happens even when FS/network jail is off (env injection report).
Request
Add an explicit, documented way to opt into sharing the host/workspace build directory while keeping sandbox FS and network policy.
Sketch (names flexible):
{
"enableSharedBuildCache": true,
"buildCache": {
"mode": "workspace",
"cargoTargetDir": "${workspaceFolder}/target"
}
}
Modes that would cover the cases people already hit:
| Mode | Behavior |
|---|---|
isolated (today’s default) |
Hashed cursor-sandbox-cache/<id>/… |
sharedTmp |
Current enableSharedBuildCache: one tmpdir, sandboxed ↔ unsandboxed |
workspace |
Do not override CARGO_TARGET_DIR / CARGO_HOME / RUSTUP_HOME (and equivalents) when the destination is already writable via workspace or additionalReadwritePaths |
Also useful:
- Per-tool overrides (
cargoTargetDir,cargoHome, …) so a multi-root window can keep onetarget/per repo and not mix artifacts. - Document which env vars the shell injects (
CARGO_TARGET_DIRis the expensive one for Rust incremental builds;CARGO_HOMEis a different cache). - Honor this when
required_permissions: ["all"]is not set; isolation vs sharing should besandbox.json, not “turn the sandbox off.” - Do not require agents to
rm -rfsandbox hashes to recover disk.
Security can stay the same: writes still only to workspace + additionalReadwritePaths. Sharing ./target is not a wider FS grant.
Why this is not just “enable the flag”
enableSharedBuildCache is about tmp sharing. Disk-constrained Rust work needs one compile tree, the same one rust-analyzer / my terminal already use. A hashed 3–10 GB copy per agent session is the failure mode.
Environment
- OS: macOS (Darwin 24.6.0), APFS
/System/Volumes/Data - Product: Cursor IDE, Agent sandboxed terminal (not Legacy)
- Cursor version: <paste Help → About>
- Workload: large Cargo workspace (
cargo testpullingwasmtime-wasi/rocci-roc-host)
Related
- Rust and sandboxing —
CARGO_HOME/RUSTUP_HOMEredirected intocursor-sandbox-cache - Shell tool injects 30+ sandbox cache env vars — injection even with
all - Playwright / empty sandbox cache —
enableSharedBuildCacheopt-out broken - Docs: sandbox.json, Run Modes