OpenShell is a managed sandbox backend: instead of running Docker containers
locally, OpenClaw delegates sandbox lifecycle to the openshell CLI, which
provisions remote environments and executes commands over SSH.
The plugin reuses the same SSH transport and remote filesystem bridge as the
generic SSH backend, and adds OpenShell
lifecycle (sandbox create/get/delete/ssh-config) plus an optional mirror
workspace sync mode.
Prerequisites
- OpenShell plugin installed (
openclaw plugins install @openclaw/openshell-sandbox)
openshell CLI on PATH (or a custom path via
plugins.entries.openshell.config.command)
- An OpenShell account with sandbox access
- OpenClaw Gateway running on the host
Quick start
Restart the Gateway. On the next agent turn OpenClaw creates an OpenShell
sandbox and routes tool execution through it. Verify with:
Workspace modes
This is the most important OpenShell decision.
mirror (default)
plugins.entries.openshell.config.mode: "mirror" keeps the local workspace
canonical:
- Before
exec, OpenClaw syncs the local workspace into the sandbox.
- After
exec, OpenClaw syncs the remote workspace back to local.
- File tools go through the sandbox bridge, but local stays source of truth
between turns.
Best for development workflows: local edits outside OpenClaw show up on the
next exec, and the sandbox behaves close to the Docker backend.
Tradeoff: upload + download cost on every exec turn.
remote
mode: "remote" makes the OpenShell workspace canonical:
- On first sandbox creation, OpenClaw seeds the remote workspace from local
once.
- After that,
exec, read, write, edit, and apply_patch operate
directly on the remote workspace. OpenClaw does not sync remote changes
back to local.
- Prompt-time media reads still work (file/media tools read through the
sandbox bridge).
Best for long-running agents and CI: lower per-turn overhead, and host-local
edits cannot silently clobber remote state.
Editing files on the host outside OpenClaw after the initial seed is invisible to the remote sandbox. Run openclaw sandbox recreate to re-seed.
Choosing a mode
Configuration reference
All OpenShell config lives under plugins.entries.openshell.config:
remoteWorkspaceDir and remoteAgentWorkspaceDir must be absolute paths and
stay under the managed roots /sandbox or /agent; other absolute paths are
rejected.
Sandbox-level settings (mode, scope, workspaceAccess) live under
agents.defaults.sandbox like any backend. See
Sandboxing for the full matrix.
Examples
Minimal remote setup
Mirror mode with GPU
Per-agent OpenShell with custom gateway
Lifecycle management
For remote mode, recreate is especially important: it deletes the canonical
remote workspace for that scope, and the next use seeds a fresh one from
local. For mirror mode, recreate mainly resets the remote execution
environment since local stays canonical.
Recreate after changing any of:
agents.defaults.sandbox.backend
plugins.entries.openshell.config.from
plugins.entries.openshell.config.mode
plugins.entries.openshell.config.policy
Security hardening
The mirror-mode filesystem bridge pins the local workspace root and rechecks
canonical paths (via realpath) before every read, write, mkdir, remove, and
rename, rejecting mid-path symlinks. A symlink swap or remounted workspace
cannot redirect file access outside the mirrored tree.
Current limitations
- Sandbox browser is not supported on the OpenShell backend.
sandbox.docker.binds does not apply to OpenShell; sandbox creation fails
if binds are configured.
- Docker-specific runtime knobs under
sandbox.docker.* (other than env)
apply only to the Docker backend.
How it works
- OpenClaw runs
sandbox get for the sandbox name (with any configured
--gateway/--gateway-endpoint); if that fails it creates one with
sandbox create, passing --name, --from, --policy when set, --gpu
when enabled, --auto-providers/--no-auto-providers, and one
--provider flag per configured provider.
- OpenClaw runs
sandbox ssh-config for the sandbox name to fetch SSH
connection details.
- Core writes the SSH config to a temp file and opens an SSH session through
the same remote filesystem bridge as the generic SSH backend.
- In
mirror mode: sync local to remote before exec, run, sync back after.
- In
remote mode: seed once on create, then operate directly on the remote
workspace.