--- name: openclaw-memory-hygiene description: Nexos-style purge: clean all reference files when removing an arsenal item ---
When removing a model/profile/tool from the arsenal
Static config cleanup is NOT enough. Sweep these paths in order, each time:
1. openclaw.json + agents/main/agent/auth-profiles.json + agents/main/sessions/sessions.json (runtime layer)
2. System-prompt-injected docs (Tier 1 — ALWAYS):
- HEARTBEAT.md, GOLDEN_RULES.md, MEMORY.md, AGENTS.md, SOUL.md, USER.md, TOOLS.md, IDENTITY.md
3. Tier 2 reference docs that show up in /new bootstrap or are read on-demand:
- CAPABILITIES.md, DECISION_MATRIX.md, DOMAIN_MODEL_RANKINGS.md, AGREEMENTS.md, STRATEGIES.md, MODEL_REGISTRY.md
4. Skills + scripts that hardcode the item:
- grep -rn -i '<item>' workspace/skills/ workspace/scripts/
5. Add a *_guard.sh script + hourly cron if there is any chance the runtime re-injects it (M-027 pattern: auto authProfileOverride).
6. Patch verify_agreements.sh so future drift is caught automatically.
7. Backups: cp -p file file.bak.$(date +%s) before each edit; never edit destructively without rollback path.
8. After all writes, run verify_agreements.sh AND a final grep -ci '<item>' per file to prove the remaining mentions are only prohibitions / historical references, not active "PRIMARY/default" claims.
Anti-pattern: replying "تم تنظيفه" after only fixing config files. The user will catch the drift in the next /new because Tier-1/Tier-2 docs still say "default = <item>".