stonewall.sh

agents / opencode

Stonewall for OpenCode

Stonewall runs OpenCode inside a kernel-enforced sandbox. The agent only sees your project directory and the few binaries and paths the policy names. Everything else on your machine, from ~/.ssh to your browser profile, is invisible to it, no matter what a prompt says.

Policy

For OpenCode, stonewall.sh provides a specific policy at https://stonewall.sh/policies/opencode.yml. You can use it by simply including it in your .stonewall.yml config, or using the CLI:

stonewall policy include https://stonewall.sh/policies/opencode.yml

It covers only what OpenCode needs to start and authenticate:

It intentionally does not allow sh, bash, git or any other tool the agent could use to run arbitrary programs.

The OpenCode policy is meant to be combined with policies for what your project actually needs:

Usage

Start the agent through stonewall instead of directly:

stonewall opencode

Or alias it in your bash / zsh profile:

alias opencode="stonewall opencode"