Agent Memory Cleanup
Clean and audit long-term agent memory files such as user.md, memory.md, memories.md, profile.md, preferences.md, and agent_memory.md. Use when the user expl... Skill: Agent Memory Cleanup Owner: hollis9087 Summary: Clean and audit long-term agent memory files such as user.md, memory.md, memories.md, profile.md, preferences.md, and agent_memory.md. Use when the user expl... Tags: latest:0.3.7 Version history: v0.3.7 | 2026-05-31T09:51:05.603Z | user Narrow the skill description to reduce over-triggering: focus on explicit agent-memory cleanup requests and concrete memory wri
Rank
62
Safety
84
Downloads
1.1k
Updated
Oct 11, 2026
Version
0.3.7
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.1K downloadsadoption · observed Oct 11, 2026
- Latest release
- 0.3.7release · observed May 31, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s177cqfxj8hyd271e27az0p2nx85tds8:agent-memory-cleanup- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-hollis9087-agent-memory-cleanup/snapshot"
Documentation
CLAWHUB
152,004 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: agent-memory-cleanup
description: Clean and audit long-term agent memory files such as user.md, memory.md, memories.md, profile.md, preferences.md, and agent_memory.md. Use when the user explicitly asks to clean, prune, sanitize, deduplicate, or review agent memory files, or when a memory write/update fails because the memory file is too long, full, over budget, rejected, duplicated, conflicted, stale, task-specific, or contains suspected secrets. Do not trigger for ordinary project docs, task notes, logs, code review, README edits, or general file cleanup. Applies edits only after explicit approval and creates recoverable backups.
metadata:
openclaw:
requires:
env: []
bins: []
os: [windows, macos, linux]
---
# Agent Memory Cleanup
This skill should be lightweight and low-noise. Do not require the user to know internal implementation names unless they ask. The user should still receive clear memory-state prompts, such as "memory appears too large, stale, duplicated, conflicted, or unsafe," when action is useful.
## Default Flow
1. Detect memory pressure or pollution.
2. If Python/file access is available, run a cheap summary check first:
```bash
python scripts/audit_memory.py memory.md --summary-json
```
3. If `quality.intervention` is `no_intervention_needed`, do not interrupt the user.
4. If intervention is needed, say briefly that memory appears too large, stale, duplicated, conflicted, or unsafe, and ask whether to review cleanup recommendations. Avoid implementation labels like the skill name unless the user asks.
5. After the user agrees, run:
```bash
python scripts/audit_memory.py memory.md --mode propose-patch --include-diff
```
6. Apply only after a second explicit approval, unless unattended cleanup was already authorized:
```bash
python scripts/audit_memory.py memory.md --mode apply-approved
```
The apply mode must create timestamped backups before writing.
## Trigger Points
Use this flow for:
- Memory write/update rejected, full, over budget, truncated, or too long.
- Short memory with secrets, task-state residue, duplicated facts, or conflicting preferences.
- User says a remembered fact is wrong, outdated, project-only, or should not be remembered.
- Before saving a new global memory candidate:
```bash
python scripts/audit_memory.py --candidate "candidate memory text" --summary-json
```
If candidate lint returns `do_not_write_candidate_to_global_memory`, do not store it globally. Offer to skip it or keep it as project/task notes.
## Intervention Values
- `prompt_cleanup_now_secret_detected`: recommend cleanup immediately; never echo raw secrets.
- `prompt_user_review_conflicting_memory`: ask the user to resolve conflicting durable preferences.
- `do_not_write_candidate_to_global_memory`: block global memory write.
- `prompt_cleanup_recommended`: offer cleanup recommendations.
- `prompt_audit_recommended`: mention memory quality may be degrading and ask whether to review.
- `no_interveREADME.md
# Agent Memory Cleanup Agent Memory Cleanup audits and cleans long-term user memory files for agents such as OpenClaw, Hermes Agent, Codex, Claude, and other assistant runtimes. The skill keeps memory files focused on stable, global user context. It removes or flags stale task notes, completed project details, duplicated preferences, transient debugging logs, and suspected secrets. ## When To Use Use this skill when: - A user asks to clean, prune, sanitize, deduplicate, or review `user.md`, `memory.md`, or similar files. - An agent cannot write memory because the memory file is too long. - Memory storage reports full, over budget, truncated, or rejected. - Global user memory has been polluted by task-level details. - Duplicate or conflicting memories are accumulating. ## Safety Model The default behavior is conservative: - Audit automatically when memory pressure is detected. - Recommend cleanup without waiting. - Do not require the user to name or invoke this skill explicitly. - Ask before writing unless the user already authorized automatic cleanup. - Create timestamped backups before edits. - Redact suspected secrets in reports. For proactive cleanup, use two-step consent: first ask whether to inspect and propose cleanup, then ask again before applying edits. ## Files - `SKILL.md` - Skill instructions. - `scripts/audit_memory.py` - Deterministic Python audit/proposal/apply engine. - `scripts/run_tests.py` - Local regression tests. - `references/default-rules.json` - Thresholds, filename patterns, regex rules, and canonical rewrites. - `references/classification-rubric.md` - Human-readable rubric for ambiguous cases or non-Python fallback. - `references/agent-paths.md` - Agent-specific memory path guidance. - `references/mcp-version.md` - Guidance for wrapping the skill as an MCP server. - `evals/evals.json` - Regression prompts. - `test-fixtures/` - Sample noisy and expected memory files. ## Architecture The skill is intentionally Python-first: - `SKILL.md` handles trigger conditions, user consent, safety boundaries, and when to call the script. - `audit_memory.py` handles deterministic behavior so different agents and models get consistent results. - `default-rules.json` keeps thresholds and regex rules configurable without editing the engine. This keeps agent context smaller and reduces variation between Codex, OpenClaw, Hermes Agent, Claude, and other runtimes. ## Script Usage Audit a memory file: ```bash python scripts/audit_memory.py path/to/memory.md ``` Generate a proposed diff: ```bash python scripts/audit_memory.py path/to/memory.md --mode propose-patch --include-diff ``` Write a proposed cleaned file without changing the source: ```bash python scripts/audit_memory.py path/to/memory.md --write-proposed cleaned-memory.md ``` Apply approved cleanup: ```bash python scripts/audit_memory.py path/to/memory.md --mode apply-approved ``` Machine-readable summaries: ```bash python scripts/audit_memory.py path/to/memory
_meta.json
{
"ownerId": "kn79q2kj15j98d5cqxw95sfd0185vax5",
"slug": "agent-memory-cleanup",
"version": "0.3.7",
"publishedAt": 1780221065603
}references/agent-paths.md
# Agent Memory Paths Use this reference only when the user has not provided explicit memory paths. Prefer user-provided paths over discovery. ## Safe Discovery Order 1. Current workspace memory files named `user.md`, `memory.md`, `memories.md`, `profile.md`, `preferences.md`, or `agent_memory.md`. 2. Workspace agent config folders such as `.codex/`, `.claude/`, `memory/`, or `memories/`. 3. Agent-specific home variables when available. 4. User home folders only when the user explicitly asks for a broader inventory. Avoid broad recursive home scans by default. ## Codex Likely locations: - `$CODEX_HOME` - Workspace `.codex/` - Workspace `.codex/skills/` for installed or project-level skills Notes: - Treat `AGENTS.md` as project policy, not global user memory. - Treat skill `SKILL.md` files as skill instructions, not user memory. ## Claude Code Likely locations: - User-level Claude config under the configured Claude home. - Project `.claude/` - Project `.claude/skills/` Notes: - Treat `CLAUDE.md` as instruction policy unless the user explicitly says it is their memory file. - Project instructions may contain durable rules, but they are not global user memory by default. ## OpenClaw Likely locations: - OpenClaw workspace memory folders. - ClawHub-installed skill directories. - User-provided OpenClaw agent home or profile paths. Notes: - ClawHub skill folders contain reusable skill instructions. Do not clean them as user memory. - If publishing or installing skills, keep release metadata separate from memory cleanup. ## Hermes Agent Likely locations: - Configured Hermes Agent home. - Workspace memory folders. - User-provided memory root. Notes: - When Hermes reports memory storage full, run audit mode first and ask before applying edits unless automatic cleanup was explicitly authorized. ## Generic Agents If the agent is not listed: - Search only the current workspace and explicit config roots. - Identify memory files by filename and content, not by filename alone. - Skip project policy, prompt templates, system instructions, and skill/plugin manifests unless the user includes them in scope.
references/classification-rubric.md
# Classification Rubric Load this reference only when the script is unavailable, when reviewing ambiguous results, or when changing cleanup policy. ## Keep Keep items that are stable, global, and useful across many future tasks: - Communication preferences, such as desired language, brevity, directness, formatting, or review style. - Durable working preferences, such as testing expectations, preferred tools, coding conventions, or repository hygiene rules. - Long-term user context that affects many tasks, such as role, recurring domains, accessibility needs, locale, timezone, or persistent environment constraints. - Stable names of important long-lived projects or systems, but only when the fact is useful without detailed stale status. - Explicit user instructions that apply generally across agents. ## Condense Condense items that contain a durable signal mixed with task detail: - Replace a completed task history with the general preference it revealed. - Replace a specific one-off command sequence with a durable tool preference. - Replace long project summaries with a stable project identity or recurring constraint. - Merge duplicate or overlapping preferences into one canonical bullet. ## Remove Remove items that are not appropriate for long-term global memory: - Completed task notes, temporary plans, or debugging traces. - Stale statuses such as `currently working on`, `next step is`, `today`, `tomorrow`, or dated commitments that are no longer current. - Details about a single ticket, pull request, report, dataset, branch, prompt, or conversation. - Failed attempts, intermediate observations, transient errors, logs, or command output. - Guesses, inferred preferences, or speculative personal facts that the user did not confirm. - Secrets, credentials, private URLs, tokens, passwords, or sensitive operational details. - Duplicates, contradictions, and entries that are too vague to help future agents. ## Flag Flag items for user review when: - The item may be durable but could also be stale. - The item refers to a project or identity that cannot be verified locally. - Two memory files disagree about an important preference. - Removing the item could materially change future agent behavior. ## Canonical Memory Shape ```markdown # User Memory ## Global Preferences - ... ## Working Style - ... ## Durable Context - ... ## Agent Instructions - ... ## Review Needed - ... ``` Omit empty sections. Do not create `Review Needed` if there are no unresolved items.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/hollis9087/skills/agent-memory-cleanup",
"sourceUrl": "https://clawhub.ai/hollis9087/skills/agent-memory-cleanup",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T13:13:44.767Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-hollis9087-agent-memory-cleanup/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-hollis9087-agent-memory-cleanup/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T13:13:44.767Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.1K downloads",
"href": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceUrl": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T13:13:44.767Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.3.7",
"href": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceUrl": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-31T09:51:05.603Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-hollis9087-agent-memory-cleanup/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-hollis9087-agent-memory-cleanup/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.3.7",
"description": "Narrow the skill description to reduce over-triggering: focus on explicit agent-memory cleanup requests and concrete memory write/update failure or pollution signals, with negative trigger guidance for ordinary project docs, logs, README edits, code review, and general file cleanup.",
"href": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceUrl": "https://clawhub.ai/hollis9087/agent-memory-cleanup",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-31T09:51:05.603Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
