内存清理:优化 Clawdbot 向量内存 - Openclaw Skills
什么是 内存清理?
内存清理是 Openclaw Skills 用户维护精简高效 AI 智能体的关键工具。随着时间的推移,向量内存可能会被心跳包或瞬时日志等垃圾内存填满,导致高 Token 消耗和无关的自动回想。此技能提供了审计现有内存、擦除膨胀数据库以及重新注入核心事实所需的工具和协议。
通过合成“有意识存储”的核心价值,内存清理确保您的智能体专注于项目决策、用户偏好和关键架构选择等高价值数据,同时忽略瞬时噪音。它是确保智能体长期稳定性和成本效益的必备组件。
下载入口:https://github.com/openclaw/skills/tree/main/skills/dylanbaker24/memory-hygiene
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install memory-hygiene
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 memory-hygiene。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
内存清理 应用场景
- 减少由无关或膨胀的向量内存回想引起的 Token 浪费。
- 在重大项目转型或工作流变更后重置智能体内存。
- 设置自动化月度维护周期,防止长期内存退化。
- 从高噪音的自动捕获过渡到有意识的高价值内存存储。
- 使用内存回想执行手动审计,识别低价值条目和垃圾数据。
- 在配置中禁用自动捕获,以防止瞬时信息的持续累积。
- 当存储变得不可控时,通过删除本地 LanceDB 目录执行完整的内存擦除。
- 使用从文档或手动输入中提取的基本事实、偏好和决策重新填充干净的数据库。
- 建立定时任务 (Cron Job),按月定期自动执行此维护生命周期。
内存清理 配置指南
要在 Openclaw Skills 生态系统中配置内存清理,首先通过 gateway action=config.patch 禁用 autoCapture:
{
"plugins": {
"entries": {
"memory-lancedb": {
"config": {
"autoCapture": false,
"autoRecall": true
}
}
}
}
}
要执行内存的手动擦除,请在终端中运行以下命令,然后重启网关:
rm -rf ~/.clawdbot/memory/lancedb/
clawdbot gateway restart
内存清理 数据架构与分类体系
内存清理与 LanceDB 向量库交互,并根据重要性和类别元数据组织数据。条目字数保持在 100 字以内时效果最佳。
| 类别 | 内容类型 | 重要性得分 |
|---|---|---|
| preference | 工作流、工具和沟通风格 | 0.8 - 1.0 |
| fact | 账户、联系人和凭据位置 | 0.9 - 1.0 |
| decision | 项目选择和架构路径 | 0.7 - 0.9 |
| lesson | 回顾和优化的模式 | 0.6 - 0.8 |
name: memory-hygiene
description: Audit, clean, and optimize Clawdbot's vector memory (LanceDB). Use when memory is bloated with junk, token usage is high from irrelevant auto-recalls, or setting up memory maintenance automation.
homepage: https://github.com/xdylanbaker/memory-hygiene
Memory Hygiene
Keep vector memory lean. Prevent token waste from junk memories.
Quick Commands
Audit: Check what's in memory
memory_recall query="*" limit=50
Wipe: Clear all vector memory
rm -rf ~/.clawdbot/memory/lancedb/
Then restart gateway: clawdbot gateway restart
Reseed: After wipe, store key facts from MEMORY.md
memory_store text="<fact>" category="preference|fact|decision" importance=0.9
Config: Disable Auto-Capture
The main source of junk is autoCapture: true. Disable it:
{
"plugins": {
"entries": {
"memory-lancedb": {
"config": {
"autoCapture": false,
"autoRecall": true
}
}
}
}
}
Use gateway action=config.patch to apply.
What to Store (Intentionally)
? Store:
- User preferences (tools, workflows, communication style)
- Key decisions (project choices, architecture)
- Important facts (accounts, credentials locations, contacts)
- Lessons learned
? Never store:
- Heartbeat status ("HEARTBEAT_OK", "No new messages")
- Transient info (current time, temp states)
- Raw message logs (already in files)
- OAuth URLs or tokens
Monthly Maintenance Cron
Set up a monthly wipe + reseed:
cron action=add job={
"name": "memory-maintenance",
"schedule": "0 4 1 * *",
"text": "Monthly memory maintenance: 1) Wipe ~/.clawdbot/memory/lancedb/ 2) Parse MEMORY.md 3) Store key facts to fresh LanceDB 4) Report completion"
}
Storage Guidelines
When using memory_store:
- Keep text concise (<100 words)
- Use appropriate category
- Set importance 0.7-1.0 for valuable info
- One concept per memory entry
-
07.30
解限机玛什马克紫箱金武速刷方法
-
07.30
红色沙漠游戏砍树方法介绍
-
07.30
遗忘之海官网预约入口位置介绍
-
07.30
欧皇无敌宠物选择避坑指南
-
07.30
明末渊虚之羽新手探索思路
-
07.30
巨龙之巢恭喜发财预计何时上线
-
-
-
- 时空奥德赛贪婪的夏特通关攻略
- 07.30
-
- 斗罗大陆猎魂世界鹿的地点在哪
- 07.30
-
- 地下城堡4骑士与破碎编年史墓地100层过关方法
- 07.30
-
- 星塔旅人怎样养成魔王
- 07.30
-
-
下载
- |
-
-
下载
- 《行尸走肉第一章》免安装中文汉化硬盘版下载
- 单机|436 MB
- 一款以动作冒险为主题的游戏
-
-
下载
- 《街头霸王X铁拳》免安装中文汉化硬盘版下载
- 单机|111MB
- 一款非常好玩的格斗游戏
-
-
下载
- |
-
-
下载
- 《暗黑破坏神3》免安装繁体中文正式版下载
- 单机|7630 MB
- 一款以角色扮演为主题的游戏
-
-
下载
- 《马克思佩恩3》免安装硬盘版下载
- 单机|27033 MB
- 一款以第三人称射击为主题的游戏