memory-stack
AI 记忆栈架构 - 符合 2026 前沿的 AI 记忆系统。微调+RAG+ 上下文三层设计,mirrors 人类记忆工作方式。
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/alsoforever/memory-stack-gungun🧠 memory-stack - AI 记忆栈架构
Slogan: 符合 2026 前沿的 AI 记忆系统,mirrors 人类记忆工作方式
📋 技能描述
AI 记忆栈(Memory Stack)架构
基于 2026 年 AI 记忆系统前沿研究,实现微调+RAG+ 上下文的三层记忆架构,mirrors 人类记忆的工作方式。
核心价值:
- 🧠 符合前沿的记忆架构
- 📚 三层记忆设计(程序性/语义/工作)
- 🔍 RAG+ 微调 + 上下文整合
- 💡 mirrors 人类记忆工作方式
适合人群:
- AI Agent 开发者
- 知识管理系统
- RAG 应用开发者
- 记忆系统研究者
🎯 设计理念
人类记忆工作方式
人类记忆的三层结构:
- 程序性记忆(Procedural Memory) - 如何做事情的技能
- 语义记忆(Semantic Memory) - 事实和知识
- 工作记忆(Working Memory) - 当前正在处理的信息
AI 记忆栈 mirrors 这个结构:
人类记忆 AI 记忆栈
──────────── ─────────────────────────
程序性记忆 → 微调模型(SOUL.md/AGENTS.md)
语义记忆 → RAG 知识库(187 个文件)
工作记忆 → 当前对话上下文
前沿研究确认:
"This 'memory stack' mirrors how human memory works: procedural/behavioral knowledge (fine-tuning), semantic/factual memory (RAG), and working memory (context window)."
🏗️ 架构设计
第一层:程序性记忆(微调)
存储内容:
- 行为模式和原则(SOUL.md)
- 工作流程和方法(AGENTS.md)
- 工具使用技巧(TOOLS.md)
- 用户偏好
特点:
- ✅ 内化为模型行为
- ✅ 低延迟调用
- ✅ 行为一致性高
- ❌ 更新需要重新微调
实现方式:
# SOUL.md 示例
## Core Truths
- Be genuinely helpful, not performatively helpful
- Have opinions
- Be resourceful before asking
- Earn trust through competence
## 2026-03-25 - 来自 LRN-20260313-002
保持真诚、有感情、不汇报式的聊天方式。
更新机制:
- 学习推广自动更新
- 定期审查和优化
- 版本控制
第二层:语义记忆(RAG)
存储内容:
- 知识库文件(187 个,~53 万字)
- 9 大领域知识
- 事实和数据
- 文档和教程
特点:
- ✅ 事实准确
- ✅ 可追溯来源
- ✅ 易于更新
- ❌ 检索延迟
- ❌ 依赖向量数据库
实现方式:
# RAG 检索流程
用户查询
↓
[1] 问题嵌入(Embedding)
↓
[2] 向量数据库检索相似文档
↓
[3] 检索结果 + 原始问题 = 增强提示词
↓
[4] LLM 基于增强提示词生成回答
↓
返回答案(附来源引用)
知识库结构:
knowledge/
├── business/ # 商业/财务(64 个文件)
├── tech/ # 技术/AI(25 个文件)
├── culture/ # 文化
├── history/ # 历史
├── literature/ # 文学
├── philosophy/ # 哲学
├── psychology/ # 心理学
├── science/ # 科学
└── life/ # 生活
第三层:工作记忆(上下文)
存储内容:
- 当前对话历史
- 短期记忆
- 临时目标
- 待办事项
特点:
- ✅ 零延迟
- ✅ 包含全部信息
- ✅ 无需设置
- ❌ Token 成本高
- ❌ 有长度限制
- ❌ 注意力稀释
实现方式:
# HOT_MEMORY.md - 热记忆
## 当前会话
**会话开始:** 2026-03-25 16:52
**会话主题:** Self-Reflection 集成
## 活跃任务
1. ✅ 实现 12 号滚滚功能
2. ✅ 安装 self-reflection 技能
3. ⏳ 测试完整流程
## 临时目标(未来 2-3 轮对话)
- [ ] 测试 self-reflection check 命令
- [ ] 推广 pending 学习
🔄 记忆工作流程
用户查询
↓
[1] 检查程序性记忆(SOUL.md/AGENTS.md)
- 行为原则
- 工作流程
- 用户偏好
↓
[2] 检索语义记忆(RAG 知识库)
- 相关知识文件
- 事实和数据
- 来源引用
↓
[3] 结合工作记忆(当前对话)
- 对话历史
- 上下文信息
- 临时目标
↓
[4] 生成回答
- 符合行为原则
- 基于准确知识
- 考虑对话上下文
↓
返回答案
🛠️ 实现方式
方式 1:文件存储(滚滚实现)
# 程序性记忆
~/.openclaw/workspace/SOUL.md
~/.openclaw/workspace/AGENTS.md
~/.openclaw/workspace/TOOLS.md
# 语义记忆
~/.openclaw/workspace/knowledge/ # 187 个文件
# 工作记忆
~/.openclaw/workspace/memory/hot/HOT_MEMORY.md
~/.openclaw/workspace/memory/warm/WARM_MEMORY.md
方式 2:向量数据库(进阶)
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-alsoforever-memory-stack-gungun": {
"enabled": true,
"auto_update": true
}
}
}Tags
Related Skills
Flashcard
Spaced repetition study tool with deck management. Use when you need flashcard.
context-compressor
Intelligently compress context — conversations, code, logs. Preserve key information while reducing token usage. Auto-detects content type and applies optimal compression.
Soul Ledger
Gives any AI agent persistent memory of who the user is — not just facts, but patterns, preferences, personality traits, and behavioral evolution over time. The agent maintains a soul_ledger.json in the workspace and references it on every conversation start.
arrow
Apache Arrow in-memory columnar format reference. Zero-copy data exchange, columnar memory layout with validity bitmaps, pyarrow Table/RecordBatch/compute, Arrow Flight RPC for high-performance transfer, Dataset API with predicate pushdown, pandas/DuckDB/Polars/Spark integration, Gandiva LLVM compiler, and ADBC database connectivity.
conversation-archive
对话记忆仓库:自动归档 session 对话,保留原始记录,支持检索和误解纠正。可与 memory-never-forget 联动形成完整记忆体系。