SuperAPI AI Directory

memory

Office & productivity

View repository

Updated 10-15 11:00

About this skill

Memory Management (Memory)

Memory is a memo that spans sessions. Global memory spans projects, project memory follows the project.

Slash Commands

Command Function
/memory list View all global + project-level memories
/memory save <内容> Save a memory (automatically determines the level and type)
/memory clean Batch-check expired/duplicate memories and give cleanup suggestions
/memory forget <关键词> Delete a specified memory
/memory move <关键词> --to global Migrate project memory to global
/memory move <关键词> --to project Migrate global memory to project

You can also trigger it with natural language: "remember xxx", "view memory", "forget xxx", "clean memory".


Memory System

~/.claude/
├── memory/                              ← 全局记忆(所有项目可见)
│   ├── MEMORY.md                            索引文件
│   └── *.md                                 记忆文件
└── projects/<path>/memory/              ← 项目记忆(仅当前项目可见)
    ├── MEMORY.md                            索引文件
    └── *.md                                 记忆文件
Level What to store Example
Global Cross-project general personal preferences, work habits, general experience "I like concise commit messages", "Use CONCURRENTLY when adding an index to a large table"
Project Project-specific decisions, constraints, pitfalls "This project uses SQLite, which does not support ALTER COLUMN"

Operation 1: Write Memory (save)

Triggered when the user says "remember xxx", "save to memory", "note down this experience".

Execution Flow

用户要求保存
  │
  ├─ 判断层级
  │   ├─ 跨项目通用?→ 全局(~/.claude/memory/)
  │   └─ 项目特定?→ 项目级
  │   └─ 不确定?→ 问用户
  │
  ├─ 判断类型
  │   ├─ 用户偏好/角色信息 → user 类型
  │   ├─ 做法纠正/做法确认 → feedback 类型
  │   ├─ 项目阶段性目标/约束 → project 类型
  │   └─ 外部资源位置 → reference 类型
  │
  ├─ 检查去重
  │   └─ 读 MEMORY.md 索引,确认没有重复或矛盾的条目
  │
  ├─ 写入
  │   ├─ 创建记忆文件(带 frontmatter)
  │   └─ 更新 MEMORY.md 索引
  │
  └─ 确认:"已保存到 [全局/项目] 记忆:[一句话描述]"

Three Questions Before Writing

Go through these before writing:

  1. Will it still be needed in the next conversation? → If not, don't write it
  2. Can it be derived from code/git/docs? → If it can be derived, don't write it
  3. Is it general across projects? → If general, put it in global; if specific, put it in the project

What not to write

  • Code structure, file paths, function signatures (visible from the code)
  • Bug fix solutions (visible from git)
  • What is already written in CLAUDE.md or docs/ (already persisted)

Operation 2: View Memory (list)

Triggered when the user says "view memory", "what memories are there currently", "memory list".

Execution Flow

1. 读取全局 MEMORY.md(如存在)
2. 读取项目级 MEMORY.md(如存在)
3. 汇总输出,按类型分组

输出格式:
## 全局记忆(X 条)
### Feedback
- [标题](文件) — 描述

### User
- [标题](文件) — 描述

## 项目记忆(X 条)
### Feedback
- [标题](文件) — 描述

合计:全局 X 条 + 项目 X 条

Operation 3: Clean Memory (clean)

Triggered when the user says "clean memory", "forget xxx", "the memory has expired".

Delete a single item

When the user specifies what to forget:

  1. Find the corresponding entry in MEMORY.md
  2. Delete the memory file
  3. Remove the index line from MEMORY.md
  4. Confirm: "Deleted [global/project] memory: [title]"

Batch Cleanup

When the user says "clean up the memory", "check for expired memory":

1. 读取所有记忆文件
2. 逐条检查:
   │
   ├─ project 类型超过 1 个月?→ 标记待确认
   ├─ feedback 引用的代码/模块还存在吗?→ 不存在则标记
   ├─ 内容已写入 CLAUDE.md 或 docs/?→ 标记可删除
   ├─ 两条内容重复或矛盾?→ 标记合并
   └─ reference 引用的资源还有效吗?→ 无法验证则标记

3. 输出清理建议(不自动删,让用户确认):

## 记忆清理建议

### 建议删除(X 条)
- [标题] — 原因:内容已沉淀到 CLAUDE.md
- [标题] — 原因:引用的模块 src/old/ 已删除

### 建议合并(X 组)
- [标题A] + [标题B] — 内容重叠

### 建议保留(X 条)
- [标题] — 仍然有效

4. 用户确认后批量执行

Operation 4: Migrate Memory (move)

Migrate between project memory and global memory.

Triggered when the user says "move this to global", "this experience can be used by other projects too".

1. 复制记忆文件到目标层级的 memory 目录
2. 更新目标层级的 MEMORY.md
3. 删除源层级的记忆文件和索引条目
4. 确认:"已将 [标题] 从 [项目/全局] 迁移到 [全局/项目]"

Relationship with Other Skills

task-manager 标 done → 自动写入项目记忆(Step 5,按写入规则判断)
docs-management Lint → 顺带检查记忆健康
memory-manage(本 skill)→ 用户手动触发写入/查看/清理/迁移
  • Automatic writingHandled by task-manager (extracting experience during retrospectives)
  • Manual managementHandled by this skill (user-initiated)
  • The two are complementary: automatic writing ensures nothing is missed, manual management ensures nothing rots