← 返回 Skills 市场
Enhanced Memory System V2
作者
minmengxhw-cpu
· GitHub ↗
· v1.2.0
· MIT-0
90
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install enhanced-memory-v2
功能描述
完整记忆系统 - 文件系统记忆 + 向量搜索 + 四类记忆分类 + AutoDream 自动整合
使用说明 (SKILL.md)
Memory System 🧠
完整记忆系统 - 文件系统记忆 + 向量搜索 + 四类记忆分类 + AutoDream 自动整合 + Feedback 双向记录
特性
- 📁 文件系统存储 - 基于 Markdown 文件,无数据库依赖
- 🔍 语义搜索 - 支持 Ollama 向量搜索
- ⚡ 自动加载 - 会话启动时自动加载相关记忆
- 💾 Memory Flush - 上下文接近阈值时自动持久化
- 📝 四类记忆分类 - User / Feedback / Project / Reference
- 🔄 Feedback 双向记录 - 同时记录纠正和确认
- 🌙 AutoDream - 定时自动整合记忆,保持记忆新鲜
安装
clawhub install memory-system
核心概念
1. 四类记忆
| 类型 | 作用域 | 用途 | 保存时机 |
|---|---|---|---|
| User | 私密 | 用户角色、偏好、知识 | 了解用户任何细节 |
| Feedback | 私密/团队 | 用户的纠正和确认 | 用户纠正或确认时 |
| Project | 团队 | 项目进展、目标、决策 | 了解项目动态时 |
| Reference | 团队 | 外部系统指针 | 发现外部资源时 |
2. Feedback 双向记录
为什么重要?
只记录"不要做什么" → AI 会变得保守,不敢做决定
双向记录 → AI 既能避免错误,也能复用成功经验
### 不要mock数据库
**Type:** negative
**Why:** 上一季度mock测试通过了但生产迁移失败
**How to apply:** 集成测试必须用真实数据库
### 接受单PR而非多个小PR
**Type:** positive
**Why:** 拆分反而造成不必要的开销
**How to apply:** 重构类需求优先合并为大PR
3. AutoDream 🌙
自动记忆整合系统,在空闲时整理记忆。
触发条件:
- 距离上次整合 >= 24 小时
- 新增 >= 3 个会话
整合任务:
- 扫描现有记忆文件
- 识别过时信息并删除
- 更新 MEMORY.md 索引
- 合并重复记忆
工具
memory_search
语义搜索记忆文件。
{
"query": "用户偏好",
"type": "user",
"topK": 5
}
memory_write
写入或追加记忆。
{
"file": "feedback/dev-rules.md",
"content": "### 不要mock数据库\
**Type:** negative\
**Why:** ...\
**How to apply:** ...",
"type": "feedback",
"mode": "append"
}
memory_flush
手动触发记忆持久化。
{ "force": true }
memory_dream ⭐
执行 AutoDream 记忆整合。
{ "force": false }
- 默认检查触发条件(时间 + 会话数)
force: true强制执行
memory_dream_status
查看 AutoDream 状态。
{}
返回:
- 上次整合时间
- 距下次触发还需多久
- 当前记忆文件数
配置
{
"skills": {
"memory-system": {
"memoryDir": "~/.openclaw/workspace/memory",
"flushMode": "safeguard",
"softThresholdTokens": 300000,
"vectorEnabled": true,
"embeddingModel": "nomic-embed-text",
"autoDream": {
"enabled": true,
"minHours": 24,
"minSessions": 3
}
}
}
}
AutoDream 配置
| 参数 | 默认值 | 说明 |
|---|---|---|
enabled |
true | 是否启用 |
minHours |
24 | 最小触发间隔(小时) |
minSessions |
3 | 最小新增会话数 |
目录结构
memory/
├── MEMORY.md # 索引文件
├── .auto-dream-state.json # AutoDream 状态
├── user/ # 用户记忆
├── feedback/ # 反馈记忆
│ ├── positive/ # 正面确认
│ └── negative/ # 纠正指导
├── project/ # 项目记忆
├── reference/ # 引用记忆
└── sessions/ # 会话历史
最佳实践
保存记忆
了解用户 → 保存到 user/
收到反馈 → 保存到 feedback/
了解项目 → 保存到 project/
发现资源 → 保存到 reference/
格式规范
### [标题]
**Type:** negative | positive
**Why:** [原因]
**How to apply:** [何时应用]
**Date:** YYYY-MM-DD
索引规范
- 每条索引 \x3C= 150 字符
- 绝对日期代替相对日期
- 定期清理过时记忆
版本
1.2.0 - 新增 AutoDream 自动整合系统
1.1.0 - 引入四类记忆分类 + Feedback 双向记录
作者:团宝 (openclaw)
安全使用建议
Key things to consider before installing:
- Backup your memory directory (~/.openclaw/workspace/memory by default). AutoDream describes deleting/merging outdated entries; even if the code currently only emits prompts, the overall flow can lead to deletions if an LLM or caller applies changes.
- This skill calls local commands (exec('ollama list') and uses curl to http://localhost:11434). Make sure you have a local Ollama service and curl available if you want vector search; the skill metadata did not declare these required binaries — runtime failures are likely otherwise.
- There is a dependency/typo inconsistency (embed default uses 'nomatic-embed-text' but config and dependencies mention 'nomic-embed-text'). Expect embedding issues; review embed.ts before trusting semantic search results.
- The skill dynamically imports platform APIs (import('openclaw')) to read session token counts; this is expected for integration but means the skill interacts with runtime session state.
- The skill uses child_process and shell-calls. Although network calls are to localhost in the code, child_process usage can run arbitrary commands — review the code and ensure you trust the author.
- Recommended actions: run in an isolated environment or test agent, set autoDream.enabled = false and flushMode = 'manual' in config initially, ensure you have file backups, and audit the code paths that would modify or delete files before enabling automated hooks.
If you want, I can point out the exact lines where the shell calls, file-writes, and AutoDream prompt generation occur and suggest concrete config changes to reduce risk (e.g., disable onHeartbeat, set autoDream.enabled=false).
功能分析
Type: OpenClaw Skill
Name: enhanced-memory-v2
Version: 1.2.0
The skill bundle implements a functional memory system but contains critical security vulnerabilities that could be exploited. Specifically, the `memory_get` and `memory_write` tools in `src/get.ts` and `src/write.ts` are vulnerable to Path Traversal, as they allow absolute paths or parent directory references (e.g., '../../') to access files outside the intended memory directory. Additionally, `src/embed.ts` uses `child_process.exec` to execute a `curl` command with parameters derived from user-controlled text, creating a risk of Shell Injection. While these represent significant RCE and data access risks, they appear to be unintentional design flaws rather than deliberate malicious logic.
能力评估
Purpose & Capability
The code implements the declared features (file-based memory, vector search via Ollama, auto-load/flush, AutoDream consolidation). However, there are mismatches: the skill.json lists dependencies ('ollama', 'nomic-embed-text') and the code calls the 'ollama' command and invokes curl, yet the metadata's 'required binaries' lists none. This omission is disproportionate: running vector embedding requires a local Ollama service and a curl/binary or an 'ollama' binary accessible on PATH. Also there is a small naming inconsistency in embed defaults ('nomatic-embed-text' vs 'nomic-embed-text') which looks like a bug.
Instruction Scope
SKILL.md and code legitimately read and write many files under the configured memoryDir (expected for a memory system). But AutoDream's described behavior includes '识别过时信息并删除' (identify and delete outdated information). The code's executeDream builds a prompt that instructs an LLM to delete/merge memory files; while the code itself doesn't directly delete files, the prompt delegates destructive decisions to an LLM or caller — that grants broad discretion to modify or remove user files. The skill also attempts to read session token counts via dynamic import('openclaw'), which accesses platform runtime state. These behaviors expand scope beyond passive read-only memory access and warrant caution.
Install Mechanism
There is no install spec (files are present in the bundle), so no external download step is present — good. But the code executes shell commands ('ollama list' and curl) and skill.json declares dependencies that may not correspond to npm packages; the lack of declared required binaries (curl, ollama) is inconsistent and may lead to runtime surprises. No remote/external download URLs or obfuscated installers were found.
Credentials
The skill does not request secrets or external API keys. It reads HOME and platform-provided APIs (globalThis.openclaw / import('openclaw')) which is expected for an OpenClaw skill. It does not attempt to exfiltrate to remote hosts — network calls are directed to localhost:11434 (Ollama).
Persistence & Privilege
The skill is not 'always: true' but registers hooks (onSessionStart, onHeartbeat). onHeartbeat will automatically check and (if conditions met) run AutoDream; that means the skill can autonomously run periodic consolidation logic and update its .auto-dream-state.json and possibly prompt an LLM to change memory content. This autonomous behavior combined with the potential to delete/merge memory files increases risk — consider disabling AutoDream until reviewed.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install enhanced-memory-v2 - 安装完成后,直接呼叫该 Skill 的名称或使用
/enhanced-memory-v2触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.0
v1.2.0: 新增AutoDream自动整合系统
元数据
常见问题
Enhanced Memory System V2 是什么?
完整记忆系统 - 文件系统记忆 + 向量搜索 + 四类记忆分类 + AutoDream 自动整合. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 90 次。
如何安装 Enhanced Memory System V2?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install enhanced-memory-v2」即可一键安装,无需额外配置。
Enhanced Memory System V2 是免费的吗?
是的,Enhanced Memory System V2 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Enhanced Memory System V2 支持哪些平台?
Enhanced Memory System V2 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Enhanced Memory System V2?
由 minmengxhw-cpu(@minmengxhw-cpu)开发并维护,当前版本 v1.2.0。
推荐 Skills