返回顶部
m

memory-defragmenter记忆碎片整理

Defragment and optimize agent memory files by cleaning duplicates, merging similar entries, archiving stale content, and ensuring proper tiering. Use when: (1) memory files feel cluttered or bloated; (2) before or after context optimization; (3) weekly memory maintenance; (4) when explicitly asked to clean, defragment, or optimize memory.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
121
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

memory-defragmenter

技能名称: memory-defragmenter
详细描述:

内存碎片整理

清理、合并并优化内存文件,使其保持精简高效。

目的

内存文件会随时间增长,并出现以下问题:

  • - 重复内容导致臃肿
  • 过时信息导致陈旧
  • 跨层级分散存储
  • 格式不一致

本技能可对其进行碎片整理。

执行时机

触发条件操作
每周维护完整碎片整理
上下文优化前
先执行清理 | | 多次会话后 | 移除陈旧条目 | | 明确请求 | 清理指定文件 |

碎片整理工作流

步骤 1:分析内存状态

bash
python3 scripts/analyze_memory.py

报告内容:

  • - 已分析文件及大小
  • 重复内容检测
  • 陈旧条目检测(超过30天)
  • 层级分布情况
  • 格式一致性

步骤 2:生成碎片整理计划

bash
python3 scripts/defragment.py --plan

创建 defragment-plan.md 文件,包含:

  • - 需合并的条目
  • 需归档的条目
  • 需删除的条目
  • 需升级/降级的条目

步骤 3:审查计划

在执行前阅读计划并批准/修改。

步骤 4:执行碎片整理

bash
python3 scripts/defragment.py --execute

首先备份原始文件,然后:

  • - 合并重复条目
  • 将陈旧内容归档至 archive/
  • 将热点条目升级至 HOT 层级
  • 将冷门条目降级至归档
  • 规范化格式

步骤 5:验证

bash
python3 scripts/verify_memory.py

检查内容:

  • - 所有文件可读
  • 无损坏链接
  • 格式一致
  • 层级限制合规

内存层级参考

层级位置最大容量时效策略
HOTmemory.md, ~/self-improving/memory.md各≤100行每月审查
WARM
memory/*.md, ~/self-improving/domains/ | 各≤200行 | 每季度审查 | | COLD | archive/ | 无限制 | 90天后归档 |

安全规则

  1. 1. 执行前务必备份
  2. 应用前审查计划
  3. 绝不删除——仅归档
  4. 保留原始文件24小时
  5. 每次碎片整理后验证

文件

  • - scripts/analyzememory.py — 分析内存状态
  • scripts/defragment.py — 规划并执行清理
  • scripts/verifymemory.py — 验证完整性
  • references/rules.md — 碎片整理规则与模式

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 memory-defragmenter-1776018121 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 memory-defragmenter-1776018121 技能

通过命令行安装

skillhub install memory-defragmenter-1776018121

下载

⬇ 下载 memory-defragmenter v1.0.1(免费)

文件大小: 10.21 KB | 发布时间: 2026-4-13 11:00

v1.0.1 最新 2026-4-13 11:00
- Improved logic in defragment.py for more accurate memory file optimization.
- verify_memory.py updated with enhanced integrity checks and reporting.
- Minor cleanups and reliability enhancements for defragmentation execution.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部