memory-system
它能做什么
这项技能为你的 AI 提供一个在聊天会话之间持续保存的记忆文件夹。它会保存偏好、约定和决定,让你不必重复说明。适合在很多天里持续与 AI 合作的人。
适用场景
- ✓当你厌倦了每次新会话开始都要重新解释偏好的时候。
- ✓当你希望 AI 记住项目规则和过往决定的时候。
- ✓当你想要一份简短的记忆索引,指向更详细笔记的时候。
技能链接
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/memory-system/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请记住我偏好简短的回答,并且这个项目使用 TypeScript。以后的会话中也保留这些信息。”
每周 5 个新技能,1 分钟读完。
工作原理
技能保存一个简短的索引文件,它指向包含更多细节的主题文件。AI 在会话开始时读取索引,然后打开需要的主题文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Memory System — Persistent Cross-Session Memory
Enables agents to remember across sessions. Never re-discover what was already learned.
Overview
The Memory System provides persistent, searchable memory that survives across sessions. Instead of re-explaining preferences, conventions, and past decisions every time, agents read a structured MEMORY.md index and topic files.
Token Impact: +1,000 tokens to load index, but saves 3,000-10,000 tokens by eliminating re-discovery.
Architecture
.agents/memory/
├── MEMORY.md ← Lightweight index (max 200 lines)
├── user-preferences.md ← Topic file: user role, style, tools
├── project-conventions.md ← Topic file: coding standards, patterns
├── tech-decisions.md ← Topic file: past architectural decisions
├── feedback-history.md ← Topic file: what user liked/disliked
└── [topic-name].md ← Additional topic files as needed
MEMORY.md Index Format
The index is a lightweight pointer file — short entries that reference topic files for details.
Rules:
- Maximum 200 lines total
- Each entry: ~150 characters max
- Format:
- [type] summary → topic-file.md - Types:
[user][feedback][project][reference]
Example:
# Memory Index
## User
- [user] Prefers dark mode, uses Windows 11, PowerShell → user-preferences.md
- [user] Senior DevOps engineer, 8 years experience → user-preferences.md
- [user] Primary language: English, sometimes Turkish → user-preferences.md
## Project
- [project] Always use bun instead of npm → project-conventions.md
- [project] Tailwind v4 preferred, no v3 → tech-decisions.md
- [project] No purple/violet colors in UI → project-conventions.md
## Feedback
- [feedback] User likes concise responses, no filler → feedback-history.md
- [feedback] User dislikes verbose explanations → feedback-history.md
- [feedback] User prefers tables over bullet lists → feedback-history.md
## Reference
- [reference] Squid proxy runs on port 3128 → infrastructure-notes.md
- [reference] Git workflow: feature branches → main → project-conventions.md
Topic File Format
Each topic file has frontmatter and structured content:
---
type: user | feedback | project | reference
created: 2026-04-01
updated: 2026-04-01
---
# User Preferences
## Development Environment
- OS: Windows 11
- Shell: PowerShell
- Editor: Cursor / Windsurf
- Package Manager: bun (NOT npm)
## Communication Style
- Prefers concise responses
- Likes tables for comparisons
- Dislikes verbose explanations
Memory Taxonomy
| Type | What to Store | Example |
|---|---|---|
| user | Role, preferences, tools, communication style | "Senior DevOps, prefers dark mode" |
| feedback | What user liked/disliked about agent output | "User said 'too verbose', prefers tables" |
| project | Coding standards, tech choices, conventions | "Use bun not npm, Tailwind v4" |
| reference | Non-sensitive infrastructure notes, public URLs, configs | "Prod API hostname and port" |
What NOT to Save
| Don't Save | Why |
|---|---|
| Secrets, credentials, tokens, passwords, private keys, or API keys | Memory is persistent and may be shared across sessions |
| Information derivable from code | Read package.json instead of memorizing deps |
| Temporary debug context | Clutters memory, not useful later |
| Exact code snippets | Code changes — memory becomes stale |
| File paths that may move | Use glob patterns or descriptions instead |
| Entire conversation transcripts | Memory is for distilled insights only |
Operations
Save (Trigger: user says "remember", "save", "don't forget")
- Identify the information type (user/feedback/project/reference)
- Check if relevant topic file exists
- If yes → append to existing topic file
- If no → create new topic file with frontmatter
- Update MEMORY.md index with one-line pointer
- Confirm to user: "Saved to memory: [summary]"
Recall (Trigger: session start, or "what do you remember about X")
- Read
.agents/memory/MEMORY.mdindex - Scan for relevant entries matching the current task
- If match found → read the referenced topic file
- Apply recalled context silently (don't recite memories unless asked)
Search (Trigger: "do I have any notes about X")
- Grep across
.agents/memory/*.mdfor the search term - Return matching entries with file references
- Offer to read full top
常见问题
记忆保存在哪里?
保存在项目内的一个记忆文件夹中,包含索引文件和主题文件。
索引可以有多大?
技能将索引限制在 200 行以内,条目简短,并指向具体细节。
它使用哪些类型的记忆?
它使用 user、feedback、project 和 reference 等条目类型。
详情
作者的原始描述
Persistent cross-session memory management. Enables agents to remember user preferences, project conventions, and past decisions across different sessions using a structured MEMORY.md index and topic files.
repo: vudovn/ag-kit
热度
- GitHub 星标
- 8.2k
- 排名
- #12536
- 许可证
- MIT
- 更新时间
- 2026/10/18
评论
- …