← 返回 Skills 市场
Three Tier Memory
作者
forvendettaw
· GitHub ↗
· v1.0.0
792
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install monica-three-tier-memory
功能描述
三级记忆管理系统 (Three-Tier Memory Management)。用于管理 AI 代理的短期、中期、长期记忆。包括:(1) 滑动窗口式短期记忆,(2) 自动摘要生成中期记忆,(3) 向量检索长期记忆 (RAG)。当需要管理对话历史、优化上下文、构建个人知识库、或实现记忆持久化时使用此 Skill。
使用说明 (SKILL.md)
Memory Manager Skill
管理 AI 代理的三级记忆系统:短期(滑动窗口)、中期(自动摘要)、长期(向量检索)。
快速开始
# 初始化记忆系统
python3 scripts/memory_manager.py init
# 添加短期记忆
python3 scripts/memory_manager.py add --type short --content "用户喜欢黑色"
# 查询记忆
python3 scripts/memory_manager.py search "用户的偏好"
架构概览
| 层级 | 存储位置 | 触发条件 | 用途 |
|---|---|---|---|
| 短期 | memory/sliding-window.json |
实时 | 保持当前对话连贯 |
| 中期 | memory/summaries/ |
Token 阈值 | 压缩历史,保留大意 |
| 长期 | memory/vector-store/ |
语义检索 | 永久记忆,RAG |
核心功能
1. 短期记忆:滑动窗口
- 配置:
config/window_size(默认 10 条) - 逻辑:FIFO 队列,超出则丢弃最旧消息
- 文件:
memory/sliding-window.json
2. 中期记忆:自动摘要
- 触发:当前 token >
config/summary_threshold(默认 4000) - 模型:使用廉价模型(如 GPT-3.5-Haiku)
- 输出:
memory/summaries/YYYY-MM-DD.json
3. 长期记忆:向量检索
- 后端:ChromaDB(本地向量库)
- 存:对话结束/摘要生成后自动向量化存储
- 取:每次查询前先检索相关记忆
配置文件
创建 memory/config.yaml:
memory:
short_term:
enabled: true
window_size: 10
max_tokens: 2000
medium_term:
enabled: true
summary_threshold: 4000
summary_model: "glm-4-flash" # 或 gpt-3.5-turbo
long_term:
enabled: true
backend: "chromadb"
top_k: 3
min_relevance: 0.7
使用场景
- 新对话开始:先
search长期记忆,注入相关上下文 - 对话中:自动管理短期/中期记忆,超阈值自动摘要
- 对话结束:将重要信息存入长期记忆
详细用法
See REFERENCES.md for complete command reference.
安全使用建议
This skill appears to implement the advertised three-tier memory system, but there are several mismatches between the documentation and the code you should review before installing: (1) The docs ask for a YAML config but the script uses a JSON config file; (2) The docs mention automatic summarization via LLMs, yet the script currently uses a local placeholder summary routine (no LLM network calls) — if you expect integrated LLM summaries you must inspect/modify code to provide the intended API hooks and ensure credentials are handled safely; (3) The script writes files into WORKSPACE_DIR (default /Users/scott/.openclaw/workspace) but the SKILL.md does not declare or highlight this environment variable — set WORKSPACE_DIR to an isolated directory or inspect the default path before running; (4) The long-term store uses chromadb if installed; installing third-party Python packages should be done in a virtualenv and reviewed. Recommendation: review the included scripts/memory_manager.py source yourself (or run it in an isolated environment), confirm where files will be written, and only enable LLM/network integrations after verifying how credentials would be provided and stored. If you need higher assurance, request a version that actually integrates with your intended LLM backend and documents required env vars and install steps.
功能分析
Type: OpenClaw Skill
Name: monica-three-tier-memory
Version: 1.0.0
The OpenClaw AgentSkills bundle 'monica-three-tier-memory' is designed to manage an AI agent's memory across short, medium, and long terms. All file operations are confined to the designated `WORKSPACE_DIR` (either from an environment variable or a local default path). The `SKILL.md` and `references/references.md` files provide clear, benign instructions and usage examples, with no evidence of prompt injection attempts. The `scripts/memory_manager.py` script correctly handles local file storage and uses `chromadb` for vector storage within the workspace. The `generate_summary` function is noted as a `TODO` for actual LLM integration, indicating an incomplete feature rather than a security flaw. No indicators of data exfiltration, unauthorized execution, persistence, or obfuscation were found.
能力评估
Purpose & Capability
The code implements short/medium/long-term memory (sliding-window JSON, summaries, and a local ChromaDB vector store) which matches the skill's stated purpose. Using a local vector DB (Chroma) and local files is reasonable for this purpose.
Instruction Scope
SKILL.md and references instruct running the included Python script and mention YAML config and external LLM models, but the script: (a) actually saves config as JSON (not YAML), (b) implements a placeholder local summarize function instead of calling an LLM, and (c) the behavior writes files to a workspace directory — these mismatches mean the runtime behavior may differ from user expectations. The SKILL.md also suggests using specific models (e.g., 'glm-4-flash', 'gpt-3.5-turbo') though the script does not perform real LLM calls.
Install Mechanism
No install spec is provided (instruction-only + included script). That is low-risk in terms of install mechanism because nothing is fetched during install; code is shipped with the skill.
Credentials
The skill declares no required env vars, but the script reads WORKSPACE_DIR (defaulting to '/Users/scott/.openclaw/workspace') to determine where it writes memory files. This environment dependency is not documented in SKILL.md. No credentials or secret env vars are requested, which is proportionate.
Persistence & Privilege
The skill does not request always: true and does not modify other skills or system-wide settings. It persists data under a workspace directory (creates files and directories), which is expected behavior for a memory manager.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install monica-three-tier-memory - 安装完成后,直接呼叫该 Skill 的名称或使用
/monica-three-tier-memory触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
常见问题
Three Tier Memory 是什么?
三级记忆管理系统 (Three-Tier Memory Management)。用于管理 AI 代理的短期、中期、长期记忆。包括:(1) 滑动窗口式短期记忆,(2) 自动摘要生成中期记忆,(3) 向量检索长期记忆 (RAG)。当需要管理对话历史、优化上下文、构建个人知识库、或实现记忆持久化时使用此 Skill。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 792 次。
如何安装 Three Tier Memory?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install monica-three-tier-memory」即可一键安装,无需额外配置。
Three Tier Memory 是免费的吗?
是的,Three Tier Memory 完全免费(开源免费),可自由下载、安装和使用。
Three Tier Memory 支持哪些平台?
Three Tier Memory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Three Tier Memory?
由 forvendettaw(@forvendettaw)开发并维护,当前版本 v1.0.0。
推荐 Skills