How to Customize OpenClaw Prompts, Tools, and Sandbox Behavior
OpenClaw custom behavior comes from two places: workspace files such as AGENTS.md and SOUL.md, and gateway config for tools and sandboxing. Change both deliberately and verify the effective policy before you trust it.
How to customize OpenClaw prompts, tools, and sandbox behavior
OpenClaw behavior is shaped by workspace files plus gateway config. Workspace files control instructions and memory, while config controls what tools are available, whether web search works, and whether tool execution should move into Docker sandboxes.
Who this is for
- You already have a working OpenClaw install.
- You want to change behavior without patching the OpenClaw source code.
- You want a safer execution profile than the default host-only runtime.
What you need before you start
- A configured OpenClaw workspace.
- Docker available if you plan to enable sandboxed execution.
- The OpenClaw source checkout if you want to build the official sandbox image locally.
Step-by-step setup
Step 1: Find the active workspace
| openclaw config get agents.defaults.workspace |
Expected result: OpenClaw prints the workspace path, usually ~/.openclaw/workspace.
Step 2: Edit the core workspace files
Use the printed workspace path and update the files that matter most:
| ls ~/.openclaw/workspace |
The official workspace docs describe these files as the standard control surface:
AGENTS.mdfor operating rules and prioritiesSOUL.mdfor persona, tone, and boundariesUSER.mdfor user contextTOOLS.mdfor local tool notes and conventionsHEARTBEAT.mdfor heartbeat-only checklists
Step 3: Configure web search for the web_search tool
| openclaw configure --section web |
Expected result: OpenClaw stores the provider key in the correct tools.web.search.* config path so web_search can run.
Step 4: Build the default sandbox image if you want the official Docker sandbox
From an OpenClaw source checkout:
| git clone https://github.com/openclaw/openclaw.git |
| cd openclaw |
| scripts/sandbox-setup.sh |
Expected result: Docker builds openclaw-sandbox:bookworm-slim.
Step 5: Enable a minimal sandbox profile
| openclaw config set agents.defaults.sandbox.mode "non-main" |
| openclaw config set agents.defaults.sandbox.scope "session" |
| openclaw config set agents.defaults.sandbox.workspaceAccess "none" |
This mirrors the minimal enable example from the official sandbox docs and keeps only non-main sessions in sandboxes.
Step 6: Validate the config and inspect the effective sandbox policy
| openclaw config validate |
| openclaw sandbox explain |
Expected result: the config validates and sandbox explain shows the final mode, scope, workspace access, and any tool restrictions.
Verify it worked
openclaw config validatesucceeds.openclaw sandbox explainshows the exact effective sandbox policy you intended.web_searchhas a configured provider if you enabled it withopenclaw configure --section web.
Common problems and fixes
The sandbox is enabled, but package installs still fail
The sandbox docs call out three common blockers: docker.network: "none", readOnlyRoot: true, and a non-root container user for package installs.
A skill needs Node or more tools inside the sandbox
Build the more functional common image from a source checkout:
| scripts/sandbox-common-setup.sh |
Then point the sandbox image at openclaw-sandbox-common:bookworm-slim.
I changed config, but I do not know which value is actually winning
Use the explicit inspect command:
| openclaw sandbox explain --json |
FAQ
Which files are injected into the agent context automatically?
The context docs list the standard workspace files: AGENTS.md, SOUL.md, TOOLS.md, IDENTITY.md, USER.md, HEARTBEAT.md, and BOOTSTRAP.md when present.
Does TOOLS.md control tool availability?
No. The workspace docs say TOOLS.md is guidance only. Actual tool access is controlled by OpenClaw config and tool policy.
Does sandboxing isolate the whole gateway?
No. The sandbox docs explicitly state that the gateway process stays on the host while tool execution moves into isolated containers.
Official sources
Related OpenClaw guides
Follow the next most relevant setup guide without leaving the cluster.
Finish the OpenClaw onboarding wizard, configure the gateway, open the dashboard, and approve first device access when needed.
Build a conservative OpenClaw WhatsApp assistant with allowlists, group restrictions, and a dedicated number before enabling more automation.
Turn on OpenClaw heartbeats, keep them quiet outside active hours, and verify they run without spamming you.