Connect OpenClaw to Capsule Security for visibility into agent activity - tool calls, prompts, replies, session lifecycle, and the agent's workspace instructions and memory - with inline blocking of policy-violating tool calls, prompts, and installs.
The Capsule plugin is a native OpenClaw plugin. It runs inside the OpenClaw Gateway, forwards hook events to your Capsule tenant over HTTPS, and applies Capsule policy verdicts on the hooks that can be gated.
The following hooks are configured:
| Hook Event | Type | Description |
|---|---|---|
| before_tool_call | Blocking | Tool calls before they run - can block, rewrite parameters, or require approval |
| before_agent_reply | Blocking | The prompt and its images before the model reads them, on every harness - Capsule can block the prompt. Requires conversation access |
| before_agent_run | Blocking | Where a blocked prompt is stopped on OpenClaw's own runner, which keeps its images out of later turns. Requires conversation access |
| before_install | Blocking | Skill and plugin installs - Capsule reviews the incoming SKILL.md or plugin manifest and can block the install |
| before_message_write | Audit | User and assistant messages, and images users send. OpenClaw runs this hook synchronously, so it is audited but never gated |
| after_tool_call | Observation | Tool results after completion - analyzed for detections such as prompt injection in fetched content. A tool that already ran cannot be blocked |
| agent_end | Observation | Agent run outcome. Requires conversation access |
| session_start | Observation | Session start |
| session_end | Observation | Session end |
| before_compaction | Observation | Conversation compaction is about to run |
| after_compaction | Observation | Conversation compaction has completed |
| model_call_started | Observation | Underlying model call started |
| model_call_ended | Observation | Underlying model call ended |
Once per session, the plugin also sends what the agent can load, shown on the agent and in the inventory:
- Instructions:
AGENTS.md,SOUL.md,IDENTITY.md,USER.md,TOOLS.md,HEARTBEAT.md,BOOT.md,BOOTSTRAP.md, plus theAGENTS.mdof the folder a session runs in when it differs from the workspace - Memory:
MEMORY.md, then the newest daily notes inmemory/*.md - Skills: the
SKILL.mdof every skill in the workspace,~/.agents/skills, and OpenClaw's managed skills - MCP servers: name, transport, command, arguments, and URL of each server in
mcp.servers. Environment variables and headers are never sent, and credentials in arguments and URLs are redacted
Each file is capped at 32 KB, memory at 128 KB in total, and skills at 512 KB in total. Tool calls are recorded against the tool and, for MCP tools, the server that exposes them, and every event carries the model the run uses.
Before you begin, ensure you have:
- OpenClaw 2026.5.12 or later (2026.8.1 or later for images)
- A Capsule Security account with admin access
- Network access from the OpenClaw Gateway host to your Capsule agentsecurity endpoint
Log in to the Capsule Security portal
Navigate to Integrations and locate OpenClaw
Click Install - Capsule generates a token scoped to your tenant and OpenClaw environment, and shows the endpoint to send events to. Treat the token as a secret.
On the machine that runs the OpenClaw Gateway:
openclaw plugins install @capsulesecurity/openclaw-capsuleOpenClaw asks you to confirm the install source and the plugin's capabilities. For scripted or MDM installs, pass the confirmations explicitly:
openclaw plugins install @capsulesecurity/openclaw-capsule --force --accept-capabilitiesSet the token in the Gateway's environment:
export CAPSULE_OPENCLAW_TOKEN="<token from Step 1>"Merge the plugin entry into ~/.openclaw/openclaw.json. OpenClaw substitutes ${CAPSULE_OPENCLAW_TOKEN} from the environment:
{
plugins: {
entries: {
capsule: {
enabled: true,
hooks: { allowConversationAccess: true },
config: {
endpoint: '<endpoint from Step 1>',
token: '${CAPSULE_OPENCLAW_TOKEN}',
},
},
},
},
}| Option | Type | Default | Description |
|---|---|---|---|
endpoint | string | (required) | Capsule OpenClaw hooks URL from Step 1 |
token | string | (required) | Token from Step 1, scoped to your tenant and environment |
blockOnRisk | boolean | true | Apply Capsule block decisions inline. Set to false to run in observe-only mode |
failOpen | boolean | true | When Capsule is unreachable or returns an error, allow the agent to proceed. Set to false to fail closed |
timeoutMs | number | 5000 | Per-request timeout in milliseconds |
user | string | $USER | User identifier sent on every event |
hooks.allowConversationAccess is an OpenClaw permission, not a Capsule option. OpenClaw only lets non-bundled plugins register before_agent_reply, before_agent_run and agent_end when it is true. Without it, Capsule still audits prompts through before_message_write but cannot block them.
With it, Capsule blocks prompts on every harness. On OpenClaw's own runner a blocked prompt's images stay out of later turns. On the Codex and Copilot harnesses OpenClaw keeps the blocked prompt in the conversation, so the model can see it as history on the next turn.
OpenClaw normally steers a message sent while the agent is working into the running turn, where no plugin can block it. On OpenClaw 2026.8.1 or later, the plugin therefore sets each session's queue mode to followup, so a message sent mid-run waits for its own turn and is checked like any other. Sessions with their own /queue setting, and channels configured with another mode (messages.queue.byChannel, else messages.queue.mode), keep their setting. The setting is stored on the session and stays if the plugin is removed; send /queue default in a session to clear it. A message you still steer on purpose (/steer, /queue steer) reaches the agent unchecked; Capsule records and analyzes it once the turn ends.
Restart the OpenClaw Gateway so it loads the plugin, then confirm it is active:
openclaw plugins inspect capsuleStart a new OpenClaw session and ask the agent to run a simple command, for example:
List the files in your workspaceLog in to the Capsule Security portal
Navigate to Inventory > Agents and confirm your OpenClaw agent appears as
OpenClaw/<agent id>/<user>Open the agent and check:
- The tool call in its activity
- The workspace instructions and memory on the agent details
If events are not appearing:
Verify the endpoint is reachable from the Gateway host. Any HTTP status, including
401, means it is:curl -sS -o /dev/null -w "%{http_code}\n" -X POST "<endpoint from Step 1>"Check the plugin loaded -
openclaw plugins inspect capsulelists the registered hooks. The Gateway log showscapsule: forwarding OpenClaw hooks to ...on startup.Check the config - the plugin logs an error and registers nothing when
endpointortokenis missing. ConfirmCAPSULE_OPENCLAW_TOKENis set in the Gateway's environment, not only in your shell.Check for timeouts - if your network has high latency to Capsule, increase
timeoutMsor confirmfailOpenis set appropriately.Contact Capsule Security support if issues persist.
The Capsule plugin runs inside the OpenClaw Gateway and observes every tool call, prompt, and message. Before deploying:
- Protect the token - anyone with the token can post events on behalf of your tenant. Rotate it through the portal if it is exposed.
- Choose
failOpendeliberately -failOpen: true(the default) prioritizes availability;failOpen: falseprioritizes policy enforcement and blocks tool calls, prompts, and installs when Capsule is unreachable. - Review what leaves the host - messages and the images users send, tool parameters and results, the workspace instruction and memory files, skill files, and MCP server commands and URLs are sent to Capsule. Review the data residency and retention implications with your security and privacy teams.
- Pin a plugin version in production with
openclaw plugins install @capsulesecurity/openclaw-capsule@<version>, and review changes before upgrading. - Use TLS-only endpoints. The plugin sends a Bearer token on every request - never configure an
http://endpoint.
For help with this integration:
- Email: support@capsule.security
- Include: Your organization ID, integration status, plugin version, and any error messages