# Render terminal sandbox section in system prompt behind feature flag \(\#57430\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ffbda20db176f65402ab9f61b723fa1e435df81e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ffbda20db176f65402ab9f61b723fa1e435df81e

Requested commit: ffbda20db176f65402ab9f61b723fa1e435df81e

Commit: ffbda20db176f65402ab9f61b723fa1e435df81e

Tree: 9b2c416f8a15e9d98653c23349a9c941fefe6565

Author: Richard Feldman

Committer: GitHub

## Message

```
Render terminal sandbox section in system prompt behind feature flag (#57430)

Stacked on top of #57429.

Adds a new `sandboxing` feature flag (off for staff by default) and a
single source-of-truth helper `sandboxing_enabled(cx) = cfg!(target_os =
"macos") && cx.has_flag::<SandboxingFeatureFlag>()`. When the helper
returns true, the agent's system prompt gains a new `## Terminal
sandbox` section that:

- Lists each worktree's absolute path as a writable directory.
- Describes the per-command `$TMPDIR` scratch directory.
- States that outbound network access is blocked.
- Documents the three per-command flags (`allow_network`,
`allow_fs_write`, `unsandboxed`) the model can request to relax the
sandbox.
- Tells the model the section is stable for the duration of the
conversation.

When the flag is off, the section is omitted entirely — no mention of
sandboxing at all.

No behavior change to terminal execution yet; that's the next PR in the
stack.

Three new tests cover: section omitted when `sandboxing: false`, section
rendered with all worktrees + flag docs when `sandboxing: true`, and the
zero-worktrees case.

Release Notes:

- N/A

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martin@zed.dev>
```

## Parents

- [c3b9cacc0e90276495f372cf6ecc76f49cfbdea6](https://git.cafe/gitcafe/zed/commit/c3b9cacc0e90276495f372cf6ecc76f49cfbdea6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ffbda20db176f65402ab9f61b723fa1e435df81e?format=markdown)
