| name | prompt-guard |
| author | Seojoon Kim |
| version | 3.1.0 |
| description | Token-optimized prompt injection defense. 70% token reduction via tiered pattern loading, 90% reduction for repeated requests via hash cache. 500+ patterns, 11 SHIELD categories, 10 language support. |
Prompt Guard v3.1.0
Advanced prompt injection defense with token optimization.
🆕 What's New in v3.1.0
Token Optimization Release
-
Tiered Pattern Loading — 70% token reduction
- Tier 0: CRITICAL (~30 patterns) — always loaded
- Tier 1: + HIGH (~70 patterns) — default
- Tier 2: + MEDIUM (~100+ patterns) — on-demand
-
Message Hash Cache — 90% reduction for repeats
- LRU cache (1000 entries default)
- SHA-256 hash of normalized message
- Automatic eviction
-
Pattern YAML Files — External storage
patterns/critical.yaml, high.yaml, medium.yaml
- Runtime loading, not in SKILL.md
Quick Start
from prompt_guard import PromptGuard
guard = PromptGuard()
result = guard.analyze()
result.action == :