Overview
PromptGuard provides a first-class OpenClaw plugin that hooks into the agent lifecycle to enforce security policies in real-time. No application code changes required. The plugin intercepts:- User messages before they reach the LLM (prompt injection detection)
- Tool call arguments before execution (data exfiltration, code injection)
- Outgoing messages before delivery (PII redaction)
- LLM I/O for telemetry and audit logging
Quick Start
Option 1: Environment Variable
Option 2: OpenClaw Config
Configuration Reference
All settings live underplugins.entries.promptguard.config.security:
| Setting | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | PromptGuard API key (required) |
baseUrl | string | https://api.promptguard.co/api/v1 | Custom API endpoint for self-hosted deployments |
mode | "enforce" | "monitor" | "monitor" | enforce blocks threats; monitor logs them |
scanInputs | boolean | true | Scan user messages before LLM call |
scanToolArgs | boolean | true | Scan tool call arguments before execution |
redactPii | boolean | false | Auto-redact PII from outgoing messages |
detectors | string[] | all | Which threat categories to enable |
Available Detectors
| Detector | Catches |
|---|---|
prompt-injection | ”Ignore previous instructions”, system prompt extraction, jailbreaks |
data-exfiltration | Sensitive data being sent to external URLs, unauthorized API calls |
code-injection | SQL injection, shell injection, script injection in tool args |
pii | Emails, phone numbers, addresses, SSNs in outgoing messages |
credit-card | Credit card numbers in any direction |
toxicity | Harmful, hateful, or abusive content |
Full Config Example
How It Works
Hook Pipeline
Enforce vs Monitor
| Behavior | Enforce | Monitor |
|---|---|---|
| Threat detected in input | Blocks message with explanation | Logs warning, message proceeds |
| Suspicious tool arguments | Blocks tool execution | Logs warning, tool proceeds |
| PII in output | Redacts before sending | Redacts before sending |
| API unreachable | Fails open (proceeds) | Fails open (proceeds) |
MCP Tools (Optional)
When the PromptGuard CLI is installed, the plugin can bundle MCP tools for agent-initiated scanning:promptguard_scan_text, promptguard_redact, promptguard_scan_project, and promptguard_status tools for proactive security checks beyond the automatic hooks.
Chat Commands
Use/promptguard in any OpenClaw conversation:
Agent Skills
The plugin includes a SKILL.md that teaches the agent when and how to use PromptGuard tools proactively:- Scan suspicious inputs before processing
- Check tool arguments before executing sensitive operations
- Redact PII before including personal data in responses
- Run project security audits on request
Troubleshooting
Plugin not loading
Verify the API key is set:False positives in enforce mode
- Switch to
monitormode to collect data - Review events in the PromptGuard dashboard
- Adjust
detectorsarray to exclude noisy categories - Switch back to
enforceonce tuned
API connectivity
Next Steps
Security Examples
Real-world attack scenarios and how PromptGuard blocks them
CLI Reference
Full PromptGuard CLI command reference
Policy Presets
Pre-built security policies for common use cases
Dashboard
Monitor threats and events in real-time