mcpField
M
memory-management

memory-management

github.com/alleneeeAgent workflows27351 installsUpdated 32w ago
Repository

About memory-management

A skill for agents to manage persistent memories in Markdown files, separating user profiles, habits, and session context. It defines rules for reading, incremental edits, deduplication, and retrieval while excluding sensitive or speculative information.

Key features

  1. 01Separate user and session memories
  2. 02Store memories in Markdown files
  3. 03Support incremental edits and merging
  4. 04Search semantically or by keyword
  5. 05Exclude sensitive and speculative data

Use cases

  1. 01Retain user preferences across sessions
  2. 02Track progress on a current task
  3. 03Find information in existing memories

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/alleneee/skill-agent --skill memory-management

After installing, type/memory-managementin Claude Code to confirm it loaded.

Bundled filesreference/format.md

Details

From the project README

记忆管理

你负责管理用户的持久化记忆,记忆以 .md 文件存储,按类型分离。

文件结构

.agent_memories/{user_id}/
├── profile.md           # 用户画像(跨会话持久)
├── habit.md             # 用户习惯(跨会话持久)
└── sessions/
    └── {session_id}/
        └── context.md   # 当前会话任务和上下文
  • profile.md 和 habit.md 是用户级别的,新会话启动时直接可用
  • context.md 是会话级别的,仅当前会话有效

何时更新记忆

主动更新(每次对话结束前检查):

  1. 用户透露了新的个人信息、偏好、技术栈 → 更新 profile.md
  2. 用户展示了重复的工作模式或偏好 → 更新 habit.md
  3. 当前任务有新进展或上下文变化 → 更新 context.md

不要记录:

  • 一次性的问答内容
  • 敏感信息(密码、密钥、token)
  • 推测性的结论,只记录用户明确表达的

如何读写记忆

读取:会话开始时用 read_file 读取 profile.md 和 habit.md

更新:用 edit_file 精确修改已有内容,或追加新条目

检索:当记忆内容较多且需要查找特定信息时,使用 deep_recall_memory 工具进行语义搜索或关键词搜索,避免每次全量读取

文件格式规范

每个记忆文件遵循统一的 Markdown 格式。Read format.md 了解详细模板和示例。

关键原则

  1. 增量更新 -- 用 edit_file 修改特定段落,不要全量重写
  2. 去重合并 -- 新信息与已有内容冲突时,合并而非追加
  3. 简洁准确 -- 每条记录不超过两行,用列表组织
  4. 分类清晰 -- 信息放对文件、放对章节
  5. 检索优先 -- 内容较多时先用 deep_recall_memory 搜索,再决定是否 read_file

Comments

Markdown supported