@clawdstrike/openclaw
v0.2.7
Published
Clawdstrike security plugin for OpenClaw
Maintainers
Readme
@clawdstrike/openclaw
Clawdstrike security plugin for OpenClaw. Provides tool-layer guardrails (preflight policy checks + synchronous post-action output rewriting/redaction) for AI agents running in OpenClaw.
See Enforcement Tiers & Integration Contract for what is enforceable at the tool boundary (and what requires a sandbox/broker).
Installation
npm install @clawdstrike/openclawGetting Started
See the OpenClaw adapter getting-started guide for full setup instructions.
Usage
FrameworkAdapter API
import { OpenClawAdapter, PolicyEngine } from '@clawdstrike/openclaw';
const engine = new PolicyEngine({ policy: 'strict' });
const adapter = new OpenClawAdapter(engine);
const ctx = adapter.createContext({ userId: 'user-1' });
const result = await adapter.interceptToolCall(ctx, {
name: 'bash',
parameters: { cmd: 'echo hello' },
});
if (!result.proceed) {
console.error('Blocked:', result.decision.message);
}Policy checking
import { checkPolicy } from '@clawdstrike/openclaw';
import type { ClawdstrikeConfig } from '@clawdstrike/openclaw';
const config: ClawdstrikeConfig = { policy: 'default' };
const decision = await checkPolicy(config, 'file_read', '~/.ssh/id_rsa');
console.log(decision.status); // "deny"OpenClaw plugin hooks
The package exports hook handlers for direct OpenClaw integration:
agentBootstrapHandler-- Injects security prompt at session starttoolPreflightHandler-- Preflight policy check before tool executioncuaBridgeHandler-- Computer-use agent bridge with CUA-specific checksinboundMessageHandler-- Pre-context inbound message guard (inbound_message/user_input)
CLI
# Installed via the bin entry
clawdstrike policy lint ./policy.yaml
clawdstrike audit query --denied
clawdstrike audit export ./audit-dump.jsonl
clawdstrike why <event-id>Development Testing
When running this package from the monorepo workspace, build local package dependencies first:
bun --cwd packages/adapters/clawdstrike-openclaw run test:workspace
bun --cwd packages/adapters/clawdstrike-openclaw run typecheck:workspaceThese commands build @clawdstrike/policy and @clawdstrike/adapter-core before running tests/typecheck.
API Overview
| Export | Description |
|--------|-------------|
| PolicyEngine | Core policy evaluation engine |
| OpenClawAdapter | Standard FrameworkAdapter implementation |
| loadPolicy / validatePolicy | Policy loading and validation |
| checkPolicy / policyCheckTool | Policy check utilities |
| AuditStore / OpenClawAuditLogger | Audit event storage and logging |
| ReceiptSigner | Decision receipt signing |
| generateSecurityPrompt | Security system prompt generation |
| openclawTranslator | OpenClaw config translation |
| inboundMessageHandler | Inbound message hook handler |
| registerCli / createCli | CLI registration helpers |
License
Apache-2.0
