AgentMailGuard for Openclaw

A zero-dependency security middleware that sanitizes email and calendar data to prevent prompt injection and malicious exfiltration in AI agents.

discodaddy
v1.4.0
Feb 28, 2026
1
950
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install agent-mail-guard

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install agent-mail-guard using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is AgentMailGuard?

AgentMailGuard is a specialized security layer designed to sit between untrusted data sources and your AI agent context window. Built specifically for the Openclaw Skills ecosystem, it neutralizes a wide array of attack vectors including prompt injections, hidden unicode, and markdown-based data exfiltration. By processing incoming emails and calendar events through a rigorous sanitization pipeline, it ensures that your LLM only receives safe, structured text.

This tool is critical for developers who want to grant their agents access to communication tools without exposing the system to malicious 'ignore previous instructions' style attacks. It prioritizes privacy and security by performing all processing locally, ensuring no sensitive data ever leaves your machine while maintaining a high standard of protection.

AgentMailGuard Use Cases

  • Automating email processing from Gmail or Outlook while preventing system instruction overrides.
  • Safely summarizing calendar invitations that may contain malicious hidden payloads.
  • Filtering untrusted text inputs in any Openclaw Skills workflow that handles external user data.
  • Detecting and flagging suspicious senders before their content reaches the agent context.
  • Protecting sensitive data from exfiltration via malicious markdown image tags.

How AgentMailGuard Works

  1. The skill ingests raw text data from email or calendar sources via CLI tools or direct Python calls.
  2. The sanitization engine runs the input through 13+ regex patterns to identify prompt injection attempts and fake conversation turns.
  3. It strips invisible unicode characters, homoglyphs, HTML tags, and Base64 payloads that could be used for obfuscation.
  4. The sender is evaluated against a local trust tier configuration (contacts.json) to determine context priority.
  5. A sanitized JSON object is produced, containing safety flags and truncated body text safe for agent consumption.

AgentMailGuard Setup

To integrate this security layer into your Openclaw Skills setup, ensure you have Python 3.11 or higher installed.

# Navigate to the skill directory
cd agent-mail-guard

# Configure your trusted contacts
cp contacts.json.example contacts.json
# Edit contacts.json to include your known domains and VIPs

# Run a test sanitization on an email via gog CLI
bash scripts/check-email.sh

# Run the built-in test suite to verify security patterns
python3 -m pytest scripts/test_sanitizer.py

AgentMailGuard Data Schema & Taxonomy

The skill produces a structured JSON output for every processed item, allowing Openclaw Skills to handle the data programmatically:

Key Description
sender The validated email address of the sender.
sender_tier Classification as known, unknown, or vip.
subject The sanitized and cleaned subject line.
body_clean The safe, truncated version of the body text.
suspicious Boolean flag indicating if injection patterns were found.
flags A list of specific security violations detected (e.g., 'markdown_img').
date ISO formatted date string.

AgentMailGuard Advanced Features

  • Support for sender trust tiers to minimize the attack surface of unknown contacts.
  • Advanced detection of URL smuggling and reference-style markdown exfiltration.
  • Comprehensive character mapping to identify homoglyph (lookalike) attacks.
  • Zero-dependency architecture relying solely on the Python standard library for maximum portability.
  • Local-first processing ensuring full data sovereignty for sensitive communications.
  • Integration ready for any Openclaw Skills automation that utilizes external text inputs.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*