← 返回 Skills 市场
hollis9087

Agent Memory Cleanup

作者 hollis9087 · GitHub ↗ · v0.3.3 · MIT-0
windowsmacoslinux ✓ 安全检测通过
63
总下载
0
收藏
0
当前安装
7
版本数
在 OpenClaw 中安装
/install agent-memory-cleanup
功能描述
Audit, clean, consolidate, and maintain long-term user memory files for OpenClaw, Hermes Agent, Codex, Claude, and other agents. Use when the user asks to cl...
使用说明 (SKILL.md)

Agent Memory Cleanup

This skill should be lightweight and mostly invisible. Do not announce that a skill is being used unless the user asks. The user only needs to see a plain memory-quality prompt 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:
python scripts/audit_memory.py memory.md --summary-json
  1. If quality.intervention is no_intervention_needed, do not interrupt the user.
  2. If intervention is needed, say briefly that memory appears too long, duplicated, conflicted, stale, or unsafe, and ask whether to review cleanup recommendations.
  3. After the user agrees, run:
python scripts/audit_memory.py memory.md --mode propose-patch --include-diff
  1. Apply only after a second explicit approval, unless unattended cleanup was already authorized:
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:
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_intervention_needed: stay silent.

Load Extra Context Only When Needed

Do not read references by default. Load them only for the matching need:

  • references/default-rules.json: deterministic thresholds and regex rules.
  • references/classification-rubric.md: manual fallback if Python cannot run.
  • references/agent-paths.md: path discovery when memory files are unclear.
  • references/mcp-version.md: MCP wrapper design.

Safety

  • Keep only stable global preferences and durable cross-task context.
  • Remove or redact secrets, stale task state, branch/PR/debug notes, and one-off plans.
  • Do not rewrite clean memory just for style.
  • Do not broadly scan the user home directory without explicit request.
  • Back up every edited memory file.
安全使用建议
Install only if you want an agent to inspect long-term memory files for cleanup. Review proposed diffs before approving apply mode, keep the generated backups until satisfied, and avoid running output/write options against unrelated paths.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The scripts and instructions match the stated purpose: audit agent memory files, detect stale task notes, duplicates, conflicts, and suspected secrets, then propose or apply cleanup.
Instruction Scope
The skill supports proactive auditing when memory pressure or pollution is detected and asks before review and again before applying edits, though users should understand that audit mode reads memory contents.
Install Mechanism
The package has no external dependency install path and no network behavior, but the frontmatter does not declare Python as a required binary even though the primary workflow uses a Python script.
Credentials
Default discovery is limited to current workspace and known memory/config roots, with explicit instructions not to broadly scan the home directory unless requested.
Persistence & Privilege
Apply mode overwrites approved memory files after creating timestamped backups; this is expected for the cleanup purpose but affects durable agent state.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-memory-cleanup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-memory-cleanup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.3.3
Keep lightweight behavior without losing capability: make --summary-json a true fast path that skips proposal/diff generation, while preserving full propose-patch/apply-approved behavior and adding tests for both paths.
v0.3.2
Make the skill lightweight and user-invisible: shrink SKILL.md to a thin trigger/UX layer, prefer silent summary-json checks, load references only on demand, and add a regression test to keep the prompt small.
v0.3.1
Add memory quality triggers beyond file length: pollution scoring, secret/task/conflict counts, candidate pre-write lint, short polluted memory fixture, and regression tests for quality-trigger intervention.
v0.3.0
Refactor to Python-first architecture: thin SKILL.md orchestration layer, configurable default-rules.json, class-based audit engine, summary JSON outputs, deterministic backup writer, no-op clean memory behavior, and run_tests.py regression suite.
v0.2.1
Clarify proactive memory-pressure UX: users do not need to name the skill, agents should offer cleanup recommendations automatically, and writes require a second explicit approval unless unattended cleanup was pre-authorized.
v0.2.0
Add deterministic audit script, execution modes, memory pressure thresholds, secret redaction, duplicate/conflict handling, agent path reference, MCP wrapper guidance, README, license, and expanded fixtures/evals.
v0.1.0
Initial release: audit and cleanup guidance for agent memory files, proactive triggers for memory-full/write-failed cases, approval-gated edits, backups, and reusable test fixtures.
元数据
Slug agent-memory-cleanup
版本 0.3.3
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 7
常见问题

Agent Memory Cleanup 是什么?

Audit, clean, consolidate, and maintain long-term user memory files for OpenClaw, Hermes Agent, Codex, Claude, and other agents. Use when the user asks to cl... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 63 次。

如何安装 Agent Memory Cleanup?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-memory-cleanup」即可一键安装,无需额外配置。

Agent Memory Cleanup 是免费的吗?

是的,Agent Memory Cleanup 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Memory Cleanup 支持哪些平台?

Agent Memory Cleanup 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(windows, macos, linux)。

谁开发了 Agent Memory Cleanup?

由 hollis9087(@hollis9087)开发并维护,当前版本 v0.3.3。

💬 留言讨论