← 返回 Skills 市场
minmengxhw-cpu

File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama

作者 minmengxhw-cpu · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ✓ 安全检测通过
196
总下载
3
收藏
1
当前安装
3
版本数
在 OpenClaw 中安装
/install mnemo
功能描述
完整的记忆系统 - 文件系统记忆 + 支持搜索 + 自动加载 + 内存刷新
使用说明 (SKILL.md)

Memory System 🧠

完整的记忆系统 - 文件系统记忆 + 支持搜索 + 自动加载 + 内存刷新

特性

  • 📁 文件系统存储 - 基于 Markdown 文件,无数据库依赖,可读、可手动编辑、易备份
  • 🔍 支持搜索 - 支持语义搜索(需配置 Ollama);未配置时自动降级为关键词匹配
  • 自动加载 - 会话启动时自动加载相关记忆,无需手动触发
  • 🏠 群组隔离 - 支持多群组独立记忆,群组之间数据互不干扰
  • 💾 Memory Flush - 上下文接近阈值时自动持久化,防止信息丢失
  • 🔒 安全防护 - 路径验证防止目录遍历攻击,确保文件操作仅限于 memoryDir

安全说明

  • 所有文件读写操作都经过路径验证
  • 禁止 ../ 目录遍历
  • 禁止访问 memoryDir 外的任何文件
  • 绝对路径和符号链接都会被解析并验证

安装

clawhub install memory-system

配置

openclaw.json 中配置:

{
  "skills": {
    "memory-system": {
      "memoryDir": "~/.openclaw/workspace/memory",
      "flushMode": "safeguard",
      "softThresholdTokens": 300000,
      "vectorEnabled": true,
      "embeddingModel": "nomic-embed-text"
    }
  }
}

配置项说明

配置项 类型 默认值 说明
memoryDir string ~/.openclaw/workspace/memory 记忆文件存储目录
flushMode string safeguard Flush 触发模式,见下方说明
softThresholdTokens number 300000 触发自动 Flush 的 token 软阈值
vectorEnabled boolean false 是否启用语义搜索
embeddingModel string nomic-embed-text Ollama 使用的嵌入模型

flushMode 说明

行为
safeguard 上下文 token 超过 softThresholdTokens 时,自动将当前会话记忆持久化到文件,防止丢失(推荐)
manual 仅在显式调用 memory_flush 时触发持久化
off 禁用 Flush,记忆仅存在于当前会话

工具

memory_search

语义搜索记忆文件,返回最相关的记忆片段。

参数

参数 类型 必填 说明
query string 搜索关键词或自然语言描述
group string 限定搜索的群组,不传则搜索全局
topK number 返回结果数量,默认 5

示例

{
  "query": "用户上次提到的项目需求",
  "group": "project-a",
  "topK": 3
}

vectorEnabledfalse 或 Ollama 不可用,自动降级为关键词全文匹配。


memory_get

读取指定记忆文件的完整内容。

参数

参数 类型 必填 说明
file string 记忆文件路径(相对于 memoryDir
group string 群组名称,用于定位文件

示例

{
  "file": "user-preferences.md",
  "group": "project-a"
}

memory_write

写入或追加内容到记忆文件。文件不存在时自动创建。

参数

参数 类型 必填 说明
file string 目标文件路径(相对于 memoryDir
content string 写入的 Markdown 内容
group string 群组名称
mode string overwrite(覆盖)或 append(追加),默认 append

示例

{
  "file": "user-preferences.md",
  "content": "## 偏好设置\
- 语言:中文\
- 风格:简洁",
  "group": "project-a",
  "mode": "append"
}

memory_flush

手动触发记忆持久化,将当前会话中的记忆写入文件系统。

参数

参数 类型 必填 说明
group string 仅持久化指定群组,不传则持久化全部

示例

{
  "group": "project-a"
}

建议在长会话结束前手动调用一次,确保数据不丢失。


搜索配置(可选)

语义搜索依赖本地 Ollama 服务,需提前安装并拉取嵌入模型:

# 安装 Ollama(参考官网)
ollama pull nomic-embed-text

确认 Ollama 服务正在运行后,将 vectorEnabled 设置为 true 即可启用。

未配置 Ollama 时:系统自动降级为关键词全文匹配,不影响基本功能使用。


注意事项

  • 同一群组内并发写入时,以最后一次写入为准(last-write-wins),建议避免并发写入同一文件
  • memoryDir 目录需要有读写权限,首次使用时会自动创建
  • 记忆文件为标准 Markdown 格式,可用任意编辑器手动查看和修改

作者:团宝 (openclaw)
版本:1.0.2

安全使用建议
This skill appears to do what it says: local Markdown-based memory storage with optional semantic search using a local Ollama instance. Before installing, consider: 1) Confirm or set memoryDir to a location you control and that only contains data you want the agent to access (the skill restricts file operations to memoryDir). 2) Vector search requires running Ollama locally; the skill only talks to http://localhost:11434 (no external endpoints). 3) The skill will try to read session token counts via an internal openclaw API if available—this is optional and used only to decide flush behavior. 4) Avoid enabling this on multi-user or shared machines unless you trust all users, since written memory files may contain sensitive user data. If you want additional assurance, review the included source files (embed.ts, get.ts, write.ts, search.ts) yourself—they contain the path validation and local-only network calls described above.
功能分析
Type: OpenClaw Skill Name: mnemo Version: 1.0.4 The memory-system skill provides a local file-based memory and search system for OpenClaw agents. The implementation demonstrates strong security awareness, including explicit path traversal protections in src/get.ts and src/write.ts to ensure file operations remain within the designated memory directory. Additionally, src/embed.ts uses native fetch calls to interact with a local Ollama instance rather than risky shell commands, and no evidence of data exfiltration or malicious prompt injection was found.
能力评估
Purpose & Capability
Name/description match the implementation: file-system memory, search, auto-load, and flush are implemented. Optional vector embeddings are provided via a local Ollama service (localhost:11434), which is consistent with the described 'vectorEnabled' option and the README/SKILL.md.
Instruction Scope
SKILL.md and tools.json describe operations that map to code (memory_search, memory_get, memory_write, memory_flush, auto-load hooks). Runtime instructions only reference the memoryDir and local Ollama; there are no instructions to read unrelated user files, query external services other than localhost Ollama, or exfiltrate secrets. The code limits file operations to memoryDir and validates paths to prevent directory traversal.
Install Mechanism
No install spec is provided (instruction-only install via user actions). The code is bundled with the skill files; there are no remote downloads or execution of arbitrary installers. The optional dependency on Ollama is documented as an external local service the user must install separately.
Credentials
The skill does not require credentials or additional environment variables (only uses process.env.HOME). It attempts to import an internal 'openclaw' module to read runtime session status (token counts) if available; this is proportional to its flush/tokens feature and is optional (code falls back safely if unavailable). No unrelated secrets are requested.
Persistence & Privilege
The skill is not forced (always:false) and does not modify other skills or system-wide config. It writes only to the configured memoryDir and includes path/symlink validation to restrict writes to that directory. Autonomous invocation is allowed by default but is standard for skills and not combined with broad privileges here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install mnemo
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /mnemo 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.4
- 增强了安全性,增加路径验证和目录遍历防护,防止非授权文件访问 - 补充安全说明,明确禁止访问 memoryDir 外部路径和符号链接绕过 - 其他功能和工具保持不变
v1.0.3
Fixed three security vulnerabilities in the initial release: Command injection (embed.ts): Replaced child_process.exec + curl shell calls with native fetch. User content is now sent as a JSON request body and never interpolated into a shell command. Path traversal (get.ts, write.ts): Added path validation to ensure all file operations stay within the configured memoryDir. Absolute paths and ../ traversal are now rejected.
v1.0.2
**Initial Release** 🎉 - Introduced file-system-based persistent memory with a structured directory layout (`MEMORY.md`, daily journals, group memories). - Added `memory_search` tool: semantic search over historical memory using local vector embeddings (Ollama + nomic-embed-text). Supports `top_k` and `group` filtering. - Added `memory_get` tool: retrieve memory content by file path and optional section heading. - Implemented automatic context loading on session start — loads long-term summary and current daily journal into the agent context. - Implemented token-aware flush mechanism (`safeguard` mode): automatically archives session context to daily records and updates the long-term summary when approaching the 300k token soft threshold. - Flush modes: `safeguard` (auto), `manual`, and `disabled`. - All storage paths are configurable via `memoryDir` in `skill.json` — no hardcoded paths. - Fully local: no external API dependencies; vector embeddings run on-device via Ollama.
元数据
Slug mnemo
版本 1.0.4
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 3
常见问题

File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama 是什么?

完整的记忆系统 - 文件系统记忆 + 支持搜索 + 自动加载 + 内存刷新. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 196 次。

如何安装 File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama?

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

File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama 是免费的吗?

是的,File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama 支持哪些平台?

File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 File-system + vector-powered memory skill for OpenClaw — semantic recall, daily journaling, and safeguard flushing, all running locally via Ollama?

由 minmengxhw-cpu(@minmengxhw-cpu)开发并维护,当前版本 v1.0.4。

💬 留言讨论