memory-layer

基于 Claude Code 记忆哲学的三层记忆管理系统。当需要以下操作时使用:(1) 设计 Index/Topic/Transcript 记忆架构,(2) 迁移现有记忆文件到分层结构,(3) 配置 autoDream 自动整理,(4) 优化上下文窗口使用率 70%+,(5) 实现基于重要性评分的记忆排序和检索。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "memory-layer" with this command: npx skills add whyischen/memory-layer

Memory Layer - 三层记忆系统

🧠 基于 Claude Code 记忆哲学,为 OpenClaw 设计


核心原则

原则说明
分层加载Index 永远加载,Topic 按需,Transcript 仅 grep
写纪律先写 Topic,再更新 Index(防止膨胀)
敏感数据不存储Transcript 是纯文本,禁止存储账号/密码/健康记录
自动化autoDream 夜间整理(默认禁用,需手动启用)

架构

┌─────────────────────────────────────────┐
│   MEMORY.md (Index 层)                   │
│   - 仅指针,≤25KB                        │
│   - 始终加载到上下文                      │
└───────────────┬─────────────────────────┘
                │ 按需加载 (2-5 个文件)
                ▼
┌─────────────────────────────────────────┐
│   memory/topics/*.md (Topic 层)          │
│   - 结构化知识,≤50KB/文件               │
│   - 仅在相关时加载                        │
└───────────────┬─────────────────────────┘
                │ 永不加载,仅 grep
                ▼
┌─────────────────────────────────────────┐
│   memory/transcripts/*.log (Transcript 层)│
│   - 原始日志,仅追加                      │
│   - >90 天自动归档                        │
└─────────────────────────────────────────┘

如何使用

1. 创建目录结构

mkdir -p memory/topics memory/transcripts/$(date +%Y-%m)

2. 迁移现有记忆文件

# 备份(重要)
cp -r memory/ memory.backup.$(date +%Y%m%d)

# 迁移(根据你的目录结构调整)
cp memory/investments/*.md memory/topics/  # 示例
cp memory/projects/*.md memory/topics/     # 示例
cp memory/assets/*.md memory/topics/       # 示例

3. 重构 MEMORY.md

手动重写为 Index 格式(参考 references/index-spec.md):

# MEMORY.md - OpenClaw 记忆索引

## Topics
| 领域 | 主题 | 路径 | 更新 | 摘要 | 标签 | 重要性 |
|------|------|------|------|------|------|--------|
| 项目 | 内容工具 | memory/topics/project-tool.md | 2026-04-02 | 创作工具 | AI | 0.7 |

4. 启用 autoDream(可选)

# 默认配置已禁用,需手动启用
openclaw cron add "0 23 * * *" "memory-system auto-dream"

依赖

依赖必需说明
OpenClaw CLI唯一依赖
OpenClaw Cron仅 autoDream 需要

无需额外工具:本 Skill 是纯文档设计,memory-system 等工具不存在。


配置

默认配置config/default.json(Skill 自带)

自定义配置~/.openclaw/memory-config.json(可选)

{
  "autoDream": {
    "enabled": false,
    "schedule": "23:00",
    "notifyOnComplete": false
  }
}

文档导航

文档说明
references/architecture.md完整架构设计
references/index-spec.mdIndex 层格式规范
references/topic-spec.mdTopic 层格式规范
references/transcript-spec.mdTranscript 层格式规范
references/autodream.mdautoDream 算法详情
references/config.md完整配置参数
guides/MIGRATION.md迁移指南
guides/EXAMPLES.md使用示例

版本:2.0 | 最后更新:2026-04-03 | 代号:Memory Layer

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

run.dev — Local Dev Environment Manager

Local dev environment manager. Process management, automatic HTTPS domains, SSL certificates, reverse proxy, and AI crash diagnosis — single binary, zero con...

Registry SourceRecently Updated
Coding

ifly-image-understanding

iFlytek Image Understanding (图片理解) — analyze and answer questions about images using Spark Vision model. WebSocket API, pure Python stdlib, no pip dependencies.

Registry SourceRecently Updated
Coding

Civic Google

Use gog (Google CLI) without manual OAuth setup — Civic handles token management automatically

Registry SourceRecently Updated
2000Profile unavailable
Coding

Agent Browser.Skip

A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured co...

Registry SourceRecently Updated
2000Profile unavailable