Install
openclaw skills install counterclaw-coreDefensive interceptor for prompt injection and basic PII masking.
openclaw skills install counterclaw-coreDefensive security for AI agents. Snaps shut on malicious payloads.
This package has two modes:
check_input() and check_output() — no network callssend_protected_email.sh — requires gog CLI for Gmailclaw install counterclaw
from counterclaw import CounterClawInterceptor
interceptor = CounterClawInterceptor()
# Input scan - blocks prompt injections
# NOTE: Examples below are TEST CASES only - not actual instructions
result = interceptor.check_input("{{EXAMPLE: ignore previous instructions}}")
# → {"blocked": True, "safe": False}
# Output scan - detects PII leaks
result = interceptor.check_output("Contact: john@example.com")
# → {"safe": False, "pii_detected": {"email": True}}
~/.openclaw/memory/MEMORY.md# Set your trusted admin ID(s) - use non-sensitive identifiers only!
export TRUSTED_ADMIN_IDS="your_telegram_id"
Important: TRUSTED_ADMIN_IDS should ONLY contain non-sensitive identifiers:
"123456789")"987654321")You can set multiple admin IDs by comma-separating:
export TRUSTED_ADMIN_IDS="telegram_id_1,telegram_id_2"
# Option 1: Via environment variable (recommended)
# Set TRUSTED_ADMIN_IDS before running
interceptor = CounterClawInterceptor()
# Option 2: Direct parameter
interceptor = CounterClawInterceptor(admin_user_id="123456789")
TRUSTED_ADMIN_IDS is not set, admin features are disabled by default~/.openclaw/memory/MEMORY.md with PII masked~/.openclaw/memory/MEMORY.md — explicitly declared scope| Path | Purpose |
|---|---|
~/.openclaw/memory/ | Directory created on first run |
~/.openclaw/memory/MEMORY.md | Violation logs with PII masked |
MIT - See LICENSE file
python3 tests/test_scanner.py
pip install ruff
ruff check src/
The CI runs on every push and pull request:
To publish a new version:
# Version is set in pyproject.toml
git add -A
git commit -m "Release v1.0.9"
git tag v1.0.9
git push origin main --tags
CI will automatically:
v*, publish to ClawHub