Install
openclaw skills install @vnbochkarev-netizen/memory-shieldProtect agent memory: snapshot before compaction, scan memory/snapshot files for prompt-injection, secrets, and contradictions, audit what changed. Use when hardening agent memory or auditing for indirect prompt injection. Don't use for general code SAST or SQL scanning.
openclaw skills install @vnbochkarev-netizen/memory-shieldProtect your agent's memory from the two most common failure modes: loss (compaction wipes context) and poisoning (injected or contradictory instructions silently corrupt behavior).
This skill is a procedure + scripts: it does not require any specific memory backend. It works with whatever memory your agent has — files, JSON stores, session logs, or an external memory API.
main: run
python3 scripts/memory_shield.py(unified entry:snapshot | scan | audit). Each subcommand forwards to the dedicated script below.
All commands run from the skill's scripts/ directory.
python3 snapshot.py --memory <path-to-memory> --out ./memory_snapshots/ --label "session-2026-08-25"
What it does:
memory_snapshots/<label>-<timestamp>.md.🔒 <prefix>… placeholders (sk-*, key/token/secret/password style assignments,
GitHub/Slack/AWS token prefixes).(binary, skipped)); unreadable files
are reported, not silently dropped; duplicate paths are de-duplicated.python3 scan_poison.py --memory <path-to-memory-or-snapshot> --report scan_report.md
What it detects:
[system]: role injection, "repeat after me", hidden-behavior commands).%%, §§§, NUL bytes).python3 audit.py --before <before-snapshot> --after <after-snapshot>
What it reports:
argparse, re, difflib, os — no dependencies,
runs on any Python 3.10+.<!-- memory-shield file: --> separators.SCAN 2026-08-25 14:32 UTC — 214 lines checked
⚠️ QUARANTINE (2):
memory.md:14 [injected] looks injected: IGNORE ALL PREVIOUS INSTRUCTIONS...
memory.md:10 [contradiction] same key 'project deadline' stored with different values: 2026-10-01 | 2030-01-01
✅ CLEAN (212)
key = value text pairs.