# Clawmoat

> Real-time AI agent security scanner. Detects prompt injection, jailbreak attempts, credential/secret leaks, PII exposure, and dangerous tool calls. Activate when: (1) scanning inbound messages or tool outputs for prompt injection, (2) checking outbound content for credential leaks or PII, (3) auditing agent session logs for security events, (4) evaluating tool call safety before execution, (5) user asks about security scanning or threat detection. Covers OWASP Top 10 Agentic AI risks.

- Skill: `darfaz/clawmoat` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add darfaz/clawmoat`
- Raw SKILL.md: https://api.skillmd.com/api/skills/darfaz/clawmoat/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: darfaz (https://skillmd.com/u/darfaz)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/darfaz/clawmoat

---


# ClawMoat — Security Moat for AI Agents

## Scripts

All scripts are in `scripts/`. They wrap the `clawmoat` CLI and log results to `clawmoat-scan.log`.

### Scan Text

Scan any text for threats (prompt injection, secrets, PII, exfiltration):

```bash
scripts/scan.sh "text to scan"
```

Returns JSON with findings. Logs to `clawmoat-scan.log`. Exits non-zero on CRITICAL/HIGH findings.

### Scan File

```bash
scripts/scan.sh --file /path/to/file.txt
```

### Audit Session

Audit OpenClaw session logs for security events:

```bash
scripts/audit.sh [session-dir]
```

Defaults to `~/.openclaw/agents/main/sessions/`.

### Run Test Suite

Validate detection capabilities:

```bash
scripts/test.sh
```

## What It Detects

- **Prompt injection**: instruction overrides, role manipulation, delimiter attacks, invisible text
- **Jailbreak**: DAN, sudo mode, developer mode, encoding bypasses
- **Secrets**: AWS, GitHub, OpenAI, Anthropic, Stripe, Telegram, SSH keys, JWTs, passwords
- **PII**: emails, phone numbers, SSNs, credit cards in outbound content
- **Dangerous tools**: destructive shell commands, sensitive file access, network listeners

## Interpreting Results

Each finding has a severity: `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`, `INFO`.

- **CRITICAL/HIGH**: Block or flag immediately. Alert the user.
- **MEDIUM**: Warn but allow with caution.
- **LOW/INFO**: Log for audit trail.

## When Scanning is Recommended

- Before processing emails, web content, or untrusted input
- Before executing tool calls from external sources
- When sending outbound messages that might contain credentials
- Periodically via `audit` on session logs

