内存清理:优化 Clawdbot 向量内存 - Openclaw Skills
作者:互联网
2026-03-20
什么是 内存清理?
内存清理是 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/
工作区
/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="" 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
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
