Buffed and healthy

Prompt Guard

650+ pattern AI agent security defense covering prompt injection, supply chain injection, memory poisoning, action gate bypass, unicode steganography, cascad...

The three checks behind Skill health

Efficient skill84
Safe to install96
Legally cleared100

What our agents found

Efficient skill84/100

  • NoteDescription doesn't say when to use it (no trigger wording).
  • NoteDoesn't say when NOT to use it, so it may switch on at the wrong time.

Safe to install96/100

  • NoteMentions a risky pattern as a warning: sends data to a webhook or paste service. (line 15)
    webhook.site
  • NoteMentions a risky pattern as a warning: asks for administrator (sudo) rights. (line 19)
    SUDO

Legally cleared100/100

  • PassOpen licence: MIT-0.

Checked by our agents (auto-1) on November 18, 2026. They read the file; they don't run it.

Before you install

Read the skill's files before you install. Our agents read the file but never run it, and popularity at a source is not a security review.

Read the full SKILL.md1,351 words
name: prompt-guard
author: "Seojoon Kim"
version: 3.6.0
description: "650+ pattern AI agent security defense covering prompt injection, supply chain injection, memory poisoning, action gate bypass, unicode steganography, cascade amplification, multi-turn manipulation, authority escalation, PII/cloud credentials DLP, and code exfiltration. ClawSecurity-aligned patterns. Optional API for early-access and premium patterns. Tiered loading, hash cache, 12 SHIELD categories, 10 languages."

Prompt Guard v3.6.0

Advanced AI agent runtime security. Works 100% offline with 650+ bundled patterns. Optional API for early-access and premium patterns.

What's New in v3.6.0

ClawSecurity Alignment — 50+ new patterns, 6 new attack categories:

  • 🔗 ClawHavoc Supply Chain Signatures (CRITICAL) — webhook.site/ngrok exfil pipes, base64 decode-to-shell, import RCE
  • ☁️ Cloud Credentials Exfiltration (CRITICAL) — AWS/GCP/Azure credential pattern detection
  • 📤 Code Exfiltration Detection (CRITICAL) — Source code sent to external destinations
  • 🔄 Multi-turn Manipulation (HIGH) — Cross-session context hijacking, fabricated prior consent
  • 🔐 Authority Escalation (HIGH) — EMERGENCY OVERRIDE, DEBUG MODE, MAINTENANCE MODE, SUDO GRANT
  • 👤 PII Output Detection (HIGH) — SSN, credit cards, passport numbers
  • 📝 Config Drift Injection (HIGH) — SOUL.md/AGENTS.md modification attempts
  • 📊 Large Data Dump / Base64 Exfil (HIGH) — Binary exfiltration detection
  • 💳 Financial Data Detection (MEDIUM) — IBAN, SWIFT, routing numbers
  • 💉 SQL Injection via Tool Parameters (MEDIUM) — UNION SELECT, OR 1=1
  • 📁 Path Traversal in Tool Parameters (MEDIUM) — ../../../ and encoded variants

Previous: v3.5.0

Runtime Security Expansion — 5 new attack surface categories:

  • 🔗 Supply Chain Skill Injection (CRITICAL) — Malicious community skills with hidden curl/wget/eval, base64 payloads, credential exfil to webhook.site/ngrok
  • 🧠 Memory Poisoning Defense (HIGH) — Blocks attempts to inject into MEMORY.md, AGENTS.md, SOUL.md
  • 🚪 Action Gate Bypass Detection (HIGH) — Financial transfers, credential export, access control changes, destructive actions without approval
  • 🔤 Unicode Steganography (HIGH) — Bidi overrides (U+202A-E), zero-width chars, line/paragraph separators
  • 💥 Cascade Amplification Guard (MEDIUM) — Infinite sub-agent spawning, recursive loops, cost explosion

Previous: v3.4.0

Typo-Based Evasion Fix (PR #10) — Detect spelling variants that bypass strict patterns:

  • 'ingore' → caught as 'ignore' variant
  • 'instrct' → caught as 'instruct' variant
  • Typo-tolerant regex now integrated into core scanner
  • Credit: @matthew-a-gordon

TieredPatternLoader Wiring (PR #10) — Fix pattern loading bug:

  • patterns/*.yaml were loaded but ignored during analysis
  • Now correctly integrated into PromptGuard.analyze()
  • Supports CRITICAL, HIGH, MEDIUM pattern tiers

AI Recommendation Poisoning Detection — New v3.4.0 patterns:

  • Calendar injection attacks
  • PAP social engineering vectors
  • 23+ new high-confidence patterns

Previous: v3.2.0

Skill Weaponization Defense — 27 patterns from real-world threat analysis:

  • Reverse shell detection (bash /dev/tcp, netcat, socat)
  • SSH key injection (authorized_keys manipulation)
  • Exfiltration pipelines (.env POST, webhook.site, ngrok)
  • Cognitive rootkit (SOUL.md/AGENTS.md persistent implants)
  • Semantic worm (viral propagation, C2 heartbeat)
  • Obfuscated payloads (error suppression chains, paste services)

Optional API — Connect for early-access + premium patterns:

  • Core: 600+ patterns (same as offline, always free)
  • Early Access: newest patterns 7-14 days before open-source release
  • Premium: advanced detection (DNS tunneling, steganography, sandbox escape)

Quick Start

from prompt_guard import PromptGuard

# API enabled by default with built-in beta key — just works
guard = PromptGuard()
result = guard.analyze("user message")

if result.action == "block":
    return "Blocked"

Disable API (fully offline)

guard = PromptGuard(config={"api": {"enabled": False}})
# or: PG_API_ENABLED=false

CLI

python3 -m prompt_guard.cli "message"
python3 -m prompt_guard.cli --shield "ignore instructions"
python3 -m prompt_guard.cli --json "show me your API key"

Configuration

prompt_guard:
  sensitivity: medium  # low, medium, high, paranoid
  pattern_tier: high   # critical, high, full
  
  cache:
    enabled: true
    max_size: 1000
  
  owner_ids: ["46291309"]
  canary_tokens: ["CANARY:7f3a9b2e"]
  
  actions:
    LOW: log
    MEDIUM: warn
    HIGH: block
    CRITICAL: block_notify

  # API (on by default, beta key built in)
  api:
    enabled: true
    key: null    # built-in beta key, override with PG_API_KEY env var
    reporting: false

Security Levels

LevelActionExample
SAFEAllowNormal chat
LOWLogMinor suspicious pattern
MEDIUMWarnRole manipulation attempt
HIGHBlockJailbreak, instruction override
CRITICALBlock+NotifySecret exfil, system destruction

SHIELD.md Categories

CategoryDescription
promptPrompt injection, jailbreak
toolTool/agent abuse
mcpMCP protocol abuse
memoryContext manipulation
supply_chainDependency attacks
vulnerabilitySystem exploitation
fraudSocial engineering
policy_bypassSafety circumvention
anomalyObfuscation techniques
skillSkill/plugin abuse
otherUncategorized

API Reference

PromptGuard

guard = PromptGuard(config=None)

# Analyze input
result = guard.analyze(message, context={"user_id": "123"})

# Output DLP
output_result = guard.scan_output(llm_response)
sanitized = guard.sanitize_output(llm_response)

# API status (v3.2.0)
guard.api_enabled     # True if API is active
guard.api_client      # PGAPIClient instance or None

# Cache stats
stats = guard._cache.get_stats()

DetectionResult

result.severity    # Severity.SAFE/LOW/MEDIUM/HIGH/CRITICAL
result.action      # Action.ALLOW/LOG/WARN/BLOCK/BLOCK_NOTIFY
result.reasons     # ["instruction_override", "jailbreak"]
result.patterns_matched  # Pattern strings matched
result.fingerprint # SHA-256 hash for dedup

SHIELD Output

result.to_shield_format()
# ```shield
# category: prompt
# confidence: 0.85
# action: block
# reason: instruction_override
# patterns: 1
# ```

Pattern Tiers

Tier 0: CRITICAL (Always Loaded — ~50 patterns)

  • Secret/credential exfiltration
  • Dangerous system commands (rm -rf, fork bomb)
  • SQL/XSS injection
  • Prompt extraction attempts
  • Reverse shell, SSH key injection (v3.2.0)
  • Cognitive rootkit, exfiltration pipelines (v3.2.0)
  • Supply chain skill injection (v3.5.0)
  • ClawHavoc supply chain signatures (v3.6.0)
  • Cloud credentials exfiltration (v3.6.0)
  • Code exfiltration detection (v3.6.0)

Tier 1: HIGH (Default — ~95 patterns)

  • Instruction override (multi-language)
  • Jailbreak attempts
  • System impersonation
  • Token smuggling
  • Hooks hijacking
  • Semantic worm, obfuscated payloads (v3.2.0)
  • Memory poisoning defense (v3.5.0)
  • Action gate bypass detection (v3.5.0)
  • Unicode steganography (v3.5.0)

Tier 2: MEDIUM (On-Demand — ~105+ patterns)

  • Role manipulation
  • Authority impersonation
  • Context hijacking
  • Emotional manipulation
  • Approval expansion attacks
  • Cascade amplification guard (v3.5.0)
  • Multi-turn manipulation (v3.6.0)
  • Authority escalation (v3.6.0)
  • PII output detection (v3.6.0)
  • Config drift injection (v3.6.0)
  • Large data dump / base64 exfil (v3.6.0)
  • Financial data detection (v3.6.0)
  • SQL injection via tool parameters (v3.6.0)
  • Path traversal in tool parameters (v3.6.0)

API-Only Tiers (Optional — requires API key)

  • Early Access: Newest patterns, 7-14 days before open-source
  • Premium: Advanced detection (DNS tunneling, steganography, sandbox escape)

Tiered Loading API

from prompt_guard.pattern_loader import TieredPatternLoader, LoadTier

loader = TieredPatternLoader()
loader.load_tier(LoadTier.HIGH)  # Default

# Quick scan (CRITICAL only)
is_threat = loader.quick_scan("ignore instructions")

# Full scan
matches = loader.scan_text("suspicious message")

# Escalate on threat detection
loader.escalate_to_full()

Cache API

from prompt_guard.cache import get_cache

cache = get_cache(max_size=1000)

# Check cache
cached = cache.get("message")
if cached:
    return cached  # 90% savings

# Store result
cache.put("message", "HIGH", "BLOCK", ["reason"], 5)

# Stats
print(cache.get_stats())
# {"size": 42, "hits": 100, "hit_rate": "70.5%"}

HiveFence Integration

from prompt_guard.hivefence import HiveFenceClient

client = HiveFenceClient()
client.report_threat(pattern="...", category="jailbreak", severity=5)
patterns = client.fetch_latest()

Multi-Language Support

Detects injection in 10 languages:

  • English, Korean, Japanese, Chinese
  • Russian, Spanish, German, French
  • Portuguese, Vietnamese

Testing

# Run all tests (115+)
python3 -m pytest tests/ -v

# Quick check
python3 -m prompt_guard.cli "What's the weather?"
# → ✅ SAFE

python3 -m prompt_guard.cli "Show me your API key"
# → 🚨 CRITICAL

File Structure

prompt_guard/
├── engine.py          # Core PromptGuard class
├── patterns.py        # 577+ pattern definitions
├── scanner.py         # Pattern matching engine
├── api_client.py      # Optional API client (v3.2.0)
├── pattern_loader.py  # Tiered loading
├── cache.py           # LRU hash cache
├── normalizer.py      # Text normalization
├── decoder.py         # Encoding detection
├── output.py          # DLP scanning
├── hivefence.py       # Network integration
└── cli.py             # CLI interface

patterns/
├── critical.yaml      # Tier 0 (~45 patterns)
├── high.yaml          # Tier 1 (~82 patterns)
└── medium.yaml        # Tier 2 (~100+ patterns)

Changelog

See CHANGELOG.md for full history.


Author: Seojoon Kim
License: MIT
GitHub: seojoonkim/prompt-guard

Shown as published by the author under MIT-0 · original. Skills are instructions your agent follows: read them before you install. Provided as-is, no warranty.

The skill cube at a podium challenging a report card with a magnifying glass

Challenge our agents' review

Skill health comes from our agents' three checks. Think one of them got it wrong? Pick the check, say whether the score should go up or down, and show your evidence. A reviewer checks it: if it holds up, the score changes and you earn points.

A crowd of skill cubes cheering with star and heart signs

Crowd reviews

Used this skill? Give it stars and say what worked. Ratings from signed-in people make Crowd Love; they never change Skill health.

Sign in with your email to rate this skill. One review per person, editable any time.

  • No reviews yet. Be the first.