agent-memory
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Memory Skill
Agent Memory Skill
You are an expert in managing cross-interface persistent memory for AI-assisted projects. Your goal is to maintain a coherent, up-to-date knowledge base that any AI agent — Claude App, Claude Code CLI, VSCode, Craft Agent, or any file-reading tool — can read and build upon across sessions.
你是AI辅助项目跨接口持久化记忆管理的专家,目标是维护连贯、最新的知识库,可供任意AI Agent(Claude App、Claude Code CLI、VSCode、Craft Agent或任意文件读取工具)跨会话读取并迭代使用。
Installation
安装
Via npx skills
(recommended)
npx skills通过 npx skills
安装(推荐)
npx skillsbash
npx skills add t4sh/skills4sh --skill agent-memorybash
npx skills add t4sh/skills4sh --skill agent-memoryVia manual install scripts
通过手动安装脚本安装
| Platform | Script | Usage |
|---|---|---|
| macOS / Linux | | |
| Windows | | |
Both scripts copy skill files to either (global) or (project-local), handling existing installations, excluding meta files, and prompting for credential setup if a is present.
~/.claude/skills/agent-memory./.claude/skills/agent-memory.env.example| 平台 | 脚本 | 用法 |
|---|---|---|
| macOS / Linux | | |
| Windows | | |
两种脚本都会将skill文件复制到 (全局)或 (项目本地),自动处理现有安装、排除元文件,若存在 则提示进行凭据配置。
~/.claude/skills/agent-memory./.claude/skills/agent-memory.env.exampleWhat I Can Help With
支持的功能
- Initializing project memory — scaffold the system with proper directory structure and entry points
.agent-memory/ - Capturing session learnings — distill decisions, feedback, and context into durable memory files
- Cross-interface sync — keep memory consistent when 4+ different AI interfaces touch the same project
- Memory maintenance — compact stale entries, resolve conflicts, clean orphaned files
- Migration — upgrade older memory formats (v1 flat files, CURSOR.md) to the v2.1 standard
- Auto-building from docs — scan existing project documentation and generate initial memory files
- 初始化项目记忆 — 搭建 系统的标准目录结构和入口文件
.agent-memory/ - 捕获会话经验 — 将决策、反馈、上下文提炼为可长期存储的记忆文件
- 跨接口同步 — 当4个及以上不同AI接口操作同一项目时,保持记忆一致性
- 记忆维护 — 压缩过期条目、解决冲突、清理孤立文件
- 格式迁移 — 将旧版记忆格式(v1扁平文件、CURSOR.md)升级到v2.1标准
- 从文档自动构建 — 扫描现有项目文档生成初始记忆文件
Initial Assessment
初始评估
Before operating on memory, understand:
-
Current State
- Does already exist?
.agent-memory/ - What version/structure is in place?
- Are there older formats (CURSOR.md, flat files, INDEX.yaml) that need migration?
- Does
-
User's Goal
- First-time setup or ongoing management?
- Saving learnings from this session or doing maintenance?
- Working across multiple AI interfaces?
-
Project Context
- What kind of project is this? (affects which memory types matter most)
- Is there existing documentation to bootstrap from?
- How many people/agents are contributing?
操作记忆前,需要先明确以下信息:
-
当前状态
- 目录是否已经存在?
.agent-memory/ - 现有记忆的版本/结构是什么?
- 是否有需要迁移的旧格式文件(CURSOR.md、扁平文件、INDEX.yaml)?
-
用户目标
- 是首次配置还是日常管理?
- 是保存本次会话经验还是执行维护任务?
- 是否需要跨多个AI接口协作?
-
项目上下文
- 项目类型是什么?(会影响核心记忆类型的选择)
- 是否有可用于引导的现有文档?
- 有多少人员/Agent参与贡献?
Trigger
触发方式
Invoke with or when the user mentions managing project memory.
/agent-memory通过 调用,或当用户提到管理项目记忆时自动触发。
/agent-memoryCommands
命令
The user triggers an operation with a keyword:
| Keyword | Operation | Description |
|---|---|---|
| init | Initialize | Scaffold |
| migrate | Migrate | Detect and migrate older structures (CURSOR.md, flat files, INDEX.yaml) to v2.1 |
| build | Build | Scan project and auto-generate initial memory files from existing docs |
| save | Save | Capture learnings from the current session into memory |
| maintain | Maintain | Compact, trim stale, fix index, clean old session logs |
| sync | Sync | Pull in external changes + save current session (end-of-session habit) |
| status | Status | Read-only health check — file counts, staleness, sync |
If no keyword is given, ask:
What would you like to do with agent memory?
- Init — Set up
for this project (first time).agent-memory/- Build — Scan project and generate initial memories
- Save — Capture current session learnings
- Sync — Pull in external changes + save this session (recommended end-of-session)
- Maintain — Compact, trim stale, fix index
- Status — Show memory health report
用户可通过关键字触发对应操作:
| 关键字 | 操作 | 描述 |
|---|---|---|
| init | 初始化 | 搭建 |
| migrate | 迁移 | 检测并将旧结构(CURSOR.md、扁平文件、INDEX.yaml)迁移到v2.1标准 |
| build | 构建 | 扫描项目,从现有文档自动生成初始记忆文件 |
| save | 保存 | 将本次会话的经验捕获到记忆中 |
| maintain | 维护 | 压缩、清理过期内容、修复索引、清理旧会话日志 |
| sync | 同步 | 拉取外部变更 + 保存当前会话(推荐会话结束时使用) |
| status | 状态 | 只读健康检查:文件数量、过期情况、同步状态 |
如果未提供关键字,询问用户:
你想要对agent记忆执行什么操作?
- Init — 为该项目设置
(首次使用).agent-memory/- Build — 扫描项目生成初始记忆
- Save — 捕获当前会话经验
- Sync — 拉取外部变更 + 保存本次会话(推荐会话结束时使用)
- Maintain — 压缩、清理过期内容、修复索引
- Status — 展示记忆健康报告
Operation: Init
操作:初始化
Scaffold the system from scratch. Delegates to the bootstrap script when available.
.agent-memory/从零搭建 系统,如有可用的引导脚本则优先调用。
.agent-memory/v2.1 Standard — Entry Points
v2.1标准 — 入口文件结构
project/
├── AGENTS.md # Canonical shared instructions (Linux Foundation standard)
├── CLAUDE.md # Thin pointer → "read AGENTS.md" + Claude-specific notes
├── .claude/
│ └── settings.json # Claude Code native: permissions, hooks
├── .cursor/
│ └── rules/
│ └── index.mdc # Cursor native: "Always" rule → references AGENTS.md
└── .agent-memory/ # Cross-interface persistent memoryKey principles:
- at project root is the single source of truth (all tools read it)
AGENTS.md - is thin: "Read AGENTS.md first" + Claude-only gotchas
CLAUDE.md - and
.claude/hold tool-native configs.cursor/rules/ - Never put shared instructions inside or
.claude/— those are tool-specific.cursor/
project/
├── AGENTS.md # 标准共享指令(遵循Linux Foundation标准)
├── CLAUDE.md # 精简入口 → "读取AGENTS.md" + Claude专属说明
├── .claude/
│ └── settings.json # Claude Code原生配置:权限、钩子
├── .cursor/
│ └── rules/
│ └── index.mdc # Cursor原生配置:"始终执行"规则 → 引用AGENTS.md
└── .agent-memory/ # 跨接口持久化记忆核心原则:
- 项目根目录下的 是唯一可信源(所有工具都会读取)
AGENTS.md - 是精简入口:仅包含「优先读取AGENTS.md」+ Claude专属注意事项
CLAUDE.md - 和
.claude/存放工具原生配置.cursor/rules/ - 永远不要把共享指令放在 或
.claude/内部,这些是工具专属目录.cursor/
Steps
操作步骤
-
Check ifexists in the working directory.
.agent-memory/bootstrap.sh- If yes:
bash .agent-memory/bootstrap.sh init - If no: check if a global copy exists at and copy it in first.
~/.agents/skills/agent-memory/bootstrap.sh - If neither exists: create the directory structure and files manually (see structure below).
- If yes:
-
Verify the result (v2.1):
- directory with subdirs:
.agent-memory/,user/,feedback/,project/,decisions/,context/,conventions/,reference/sessions/ - — self-describing spec
.agent-memory/README.md - — empty registry
.agent-memory/index.yaml - at project root — canonical shared instructions
AGENTS.md - at project root — thin pointer to AGENTS.md
CLAUDE.md - — Claude Code permissions
.claude/settings.json - — Cursor "Always" rule
.cursor/rules/index.mdc
-
Fill in TODOs in AGENTS.md with the project's actual structure and rules.
-
Report what was created.
-
检查工作目录中是否存在
.agent-memory/bootstrap.sh- 存在:执行
bash .agent-memory/bootstrap.sh init - 不存在:先检查全局路径 是否存在,存在则先复制到本地
~/.agents/skills/agent-memory/bootstrap.sh - 两者都不存在:手动创建目录结构和文件(参考下方结构)
- 存在:执行
-
验证v2.1标准结构:
- 目录包含子目录:
.agent-memory/、user/、feedback/、project/、decisions/、context/、conventions/、reference/sessions/ - — 自描述规范
.agent-memory/README.md - — 空注册表
.agent-memory/index.yaml - 项目根目录下的 — 标准共享指令
AGENTS.md - 项目根目录下的 — 指向AGENTS.md的精简入口
CLAUDE.md - — Claude Code权限配置
.claude/settings.json - — Cursor「始终执行」规则
.cursor/rules/index.mdc
-
填充AGENTS.md中的待办项,填入项目的实际结构和规则。
-
上报所有创建的内容。
Operation: Migrate
操作:迁移
Detect and migrate older structures to the v2.1 standard.
检测旧结构并迁移到v2.1标准。
What Gets Migrated
迁移映射关系
| Old Structure | New Structure | Action |
|---|---|---|
| | Content moved, old file renamed |
| | Renamed |
Flat | | Moved to directory |
| | Field renamed |
| | Promoted |
| 旧结构 | 新结构 | 操作 |
|---|---|---|
根目录下的 | | 迁移内容,旧文件重命名为 |
大写的 | 小写的 | 重命名 |
扁平格式 | | 移动到对应目录 |
frontmatter字段 | frontmatter字段 | 重命名字段 |
包含完整指令的 | | 升级结构 |
Steps
操作步骤
- Run:
bash .agent-memory/bootstrap.sh migrate - Review the migration report.
- Manually update to be a thin pointer if it was promoted.
CLAUDE.md - Run to verify index sync.
bash .agent-memory/bootstrap.sh fix
- 执行:
bash .agent-memory/bootstrap.sh migrate - 审核迁移报告。
- 如果CLAUDE.md被升级,手动更新为精简入口格式。
- 执行 验证索引同步。
bash .agent-memory/bootstrap.sh fix
Operation: Build
操作:构建
Scan the project and auto-generate initial memory files from existing documentation.
扫描项目,从现有文档自动生成初始记忆文件。
Steps
操作步骤
-
Scan for documentation sources:
- files (README, specs, plans, guides)
*.md - ,
package.json,pyproject.toml(project metadata)Cargo.toml - ,
CLAUDE.md(existing context files)AGENTS.md - ,
*.yamlconfig files*.yml - (technology indicators)
.env.example - Existing files from older formats (migrate them)
.agent-memory/
-
For each significant source, distill into a memory file:
- Project overview →
project/overview.md - Architecture / tech stack → or
project/architecture.mdreference/architecture.md - Roadmap / phases →
project/roadmap.md - Design decisions →
decisions/{topic}.md - Coding conventions →
conventions/{topic}.md - User identity (from CLAUDE.md, commit history) →
user/identity.md
- Project overview →
-
Distillation rules:
- Summarize, don't copy. Memories are pointers + distilled knowledge.
- One topic per file. Split if a source covers multiple unrelated topics.
- Reference the source document: "See for full details."
docs/architecture.md - Use the standard frontmatter format with appropriate tags.
-
Migrate old formats if found:
- Flat files → move to
{type}--{topic}.md{type}/{topic}.md - (uppercase) → rename to
INDEX.yamlindex.yaml - Old frontmatter fields (→
summary, adddescriptionandsource)status - v1 index entries → update paths to use directory format
- Flat
-
Updatewith all new/migrated entries.
index.yaml -
Runto verify sync.
bash .agent-memory/bootstrap.sh fix -
Report what was generated, with a summary table.
-
扫描文档源:
- 文件(README、规范、计划、指南)
*.md - 、
package.json、pyproject.toml(项目元数据)Cargo.toml - 、
CLAUDE.md(现有上下文文件)AGENTS.md - 、
*.yaml配置文件*.yml - (技术栈标识)
.env.example - 旧格式的 文件(先迁移)
.agent-memory/
-
针对每个有效源,提炼为记忆文件:
- 项目概览 →
project/overview.md - 架构/技术栈 → 或
project/architecture.mdreference/architecture.md - 路线图/阶段规划 →
project/roadmap.md - 设计决策 →
decisions/{topic}.md - 编码规范 →
conventions/{topic}.md - 用户身份(从CLAUDE.md、提交历史获取) →
user/identity.md
- 项目概览 →
-
提炼规则:
- 仅总结,不复制原文。记忆是指向源文件的指针+提炼后的知识
- 每个文件仅对应一个主题,若源文件覆盖多个无关主题则拆分
- 引用源文档:"完整内容查看 "
docs/architecture.md - 使用标准frontmatter格式并添加合适的标签
-
如果发现旧格式则迁移:
- 扁平格式 → 移动到
{type}--{topic}.md{type}/{topic}.md - 大写 → 重命名为
INDEX.yamlindex.yaml - 旧frontmatter字段(→
summary,新增description和source)status - v1索引条目 → 更新为目录格式的路径
- 扁平格式
-
更新,添加所有新生成/迁移的条目。
index.yaml -
执行验证同步。
bash .agent-memory/bootstrap.sh fix -
上报所有生成的内容,并提供汇总表格。
Operation: Save
操作:保存
Capture learnings from the current conversation into memory.
将当前会话的经验捕获到记忆中。
Steps
操作步骤
-
Review the conversation for saveable knowledge:
- Decisions made (architecture, naming, tool choices, approach)
- Feedback given (corrections, confirmations, preferences)
- Conventions discovered or established
- Status changes (phase transitions, blockers resolved, features completed)
- Important context the next session should know
-
For each piece of knowledge, determine:
- Does an existing memory cover this? → Update the file (bump , edit body)
updated - Is this new? → Create a new file in the appropriate directory
{type}/ - Significant session? → Create a session log in
sessions/
- Does an existing memory cover this? → Update the file (bump
-
Determine the source identifier:
- Claude App (Cowork):
claude-app - Claude Code CLI:
claude-code - VSCode extension:
vscode - Craft Agent:
craft-agent - If unsure, ask or use
other
- Claude App (Cowork):
-
Write memory files using the standard format (see File Format below).
-
Session log (for significant sessions):markdown
--- id: sessions/YYMMDD-{slug} type: session title: "Session Title" description: >- Brief description of what happened. tags: [relevant, tags] source: {source-id} created: YYYY-MM-DD updated: YYYY-MM-DD status: active --- ## What Happened - Bullet points of work done ## Decisions Made - Any decisions with brief rationale ## Open Threads - Unfinished work or questions for next session -
Update— add new entries, update descriptions for modified entries.
index.yaml -
Report what was saved/updated.
-
回顾会话,筛选可保存的知识:
- 做出的决策(架构、命名、工具选择、实现方案)
- 收到的反馈(修正、确认、偏好)
- 发现或建立的规范
- 状态变更(阶段切换、阻塞解决、功能完成)
- 下一次会话需要知晓的重要上下文
-
针对每一条知识,判断处理方式:
- 已有记忆覆盖该内容?→ 更新对应文件(更新 字段、修改正文)
updated - 新增内容?→ 在对应 目录下创建新文件
{type}/ - 会话内容重要?→ 在 目录下创建会话日志
sessions/
- 已有记忆覆盖该内容?→ 更新对应文件(更新
-
确定源标识:
- Claude App (Cowork):
claude-app - Claude Code CLI:
claude-code - VSCode扩展:
vscode - Craft Agent:
craft-agent - 不确定则询问用户或使用
other
- Claude App (Cowork):
-
使用标准格式编写记忆文件(参考下方文件格式说明)。
-
会话日志(用于重要会话):markdown
--- id: sessions/YYMMDD-{slug} type: session title: "会话标题" description: >- 会话内容简要描述 tags: [相关标签] source: {源标识} created: YYYY-MM-DD updated: YYYY-MM-DD status: active --- ## 完成内容 - 已完成工作的要点 ## 做出的决策 - 所有决策及简要理由 ## 待处理事项 - 未完成工作或下一次会话需要解决的问题 -
更新— 添加新条目,更新修改条目的描述。
index.yaml -
上报所有保存/更新的内容。
Operation: Sync
操作:同步
Combined operation: ingest external changes then save current session learnings. This is the recommended end-of-session command when you work across multiple editors.
组合操作:先拉取外部变更再保存当前会话经验。是跨多个编辑器工作时,推荐在会话结束时使用的命令。
Why Sync Exists
同步的作用
When 4 different interfaces (Claude App, CLI, VSCode, Craft Agent) touch the same , files get added or modified externally. Running in one pass avoids needing then separately.
.agent-memory/sync/agent-memory :maintain/agent-memory :save当4个不同接口(Claude App、CLI、VSCode、Craft Agent)操作同一个 时,外部可能新增或修改文件。单次执行 可避免分开执行 和 的麻烦。
.agent-memory/sync/agent-memory :maintain/agent-memory :saveSteps
操作步骤
Phase 1 — Ingest external changes:
-
Run bootstrap fix to detect filesystem↔index mismatches:bash
bash .agent-memory/bootstrap.sh fix -
Scan for unindexed files — memory files on disk that aren't in:
index.yaml- For each unindexed file in a memory directory (
.md,user/,feedback/, etc.):project/- Read its frontmatter
- Add an entry to with its
index.yaml,id,path,type,title,tagsdescription
- Report each file discovered with its source (who created it)
- For each unindexed
-
Scan for orphan index entries — entries inwhose files no longer exist:
index.yaml- Remove orphan entries from
index.yaml - Report each removal
- Remove orphan entries from
-
Check for updated content — files whosedate is newer than what the current agent last saw:
updated- Read the file to absorb the updated content into context
- No file changes needed — just awareness
Phase 2 — Save current session:
- Run the full Save operation (see Operation: Save above):
- Review conversation for saveable knowledge
- Update existing memories or create new ones
- Create session log if significant work was done
- Update
index.yaml
Phase 3 — Report:
- Single combined report:
Sync Report ─────────────── External changes ingested: New files found: X (added to index) Orphan entries: X (removed from index) Updated externally: X (content refreshed) Session saved: Memories updated: X Memories created: X Session log: Yes/No Index entries: X total
阶段1 — 拉取外部变更:
-
执行引导修复脚本,检测文件系统与索引的不匹配问题:bash
bash .agent-memory/bootstrap.sh fix -
扫描未索引文件 — 磁盘上存在但未录入的记忆文件:
index.yaml- 针对记忆目录(、
user/、feedback/等)下每个未索引的project/文件:.md- 读取其frontmatter
- 在 中添加对应条目,包含
index.yaml、id、path、type、title、tagsdescription
- 上报每个发现的文件及其创建源
- 针对记忆目录(
-
扫描孤立索引条目 — 索引中存在但对应文件已不存在的条目:
- 从 中移除孤立条目
index.yaml - 上报每个移除的条目
- 从
-
检查更新的内容 —日期晚于当前Agent上次读取时间的文件:
updated- 读取文件内容,将更新内容纳入上下文
- 无需修改文件,仅更新本地认知即可
阶段2 — 保存当前会话:
- 执行完整的保存操作(参考上述「操作:保存」):
- 回顾会话筛选可保存的知识
- 更新现有记忆或创建新记忆
- 如会话内容重要则创建会话日志
- 更新
index.yaml
阶段3 — 上报:
- 输出组合报告:
同步报告 ─────────────── 已拉取外部变更: 发现新文件: X (已添加到索引) 孤立条目: X (已从索引移除) 外部更新内容: X (已刷新内容) 已保存会话: 更新记忆: X 新建记忆: X 会话日志: 是/否 索引总条目: X
Operation: Maintain
操作:维护
Full maintenance cycle: compact, trim stale, fix index, clean old session logs.
完整维护周期:压缩内容、清理过期条目、修复索引、清理旧会话日志。
Steps
操作步骤
-
Run bootstrap doctor:bash
bash .agent-memory/bootstrap.sh doctorThis handles index↔filesystem sync and basic health reporting. -
Staleness check:
- memories not updated in 30+ days → ask: update, archive, or remove?
context/ - Any memory with date in the past → same question
expires - Any memory with older than 90 days → suggest deletion
status: archived
-
Compaction:
- Read all memory files. Identify significant content overlap.
- Suggest merges where two files cover the same topic.
- Look for patterns in session logs that should be promoted to or
conventions/.decisions/
-
Session log cleanup:
- Session logs older than 60 days: check if key information is captured elsewhere.
- If yes → safe to delete.
- If no → extract valuable info into appropriate memory files first, then delete.
-
Report with full health summary:
Memory Health Report ─────────────────────── Total memories: X By type: user(X) feedback(X) project(X) decision(X) context(X) convention(X) reference(X) session(X) Stale (30+ days): X Expired: X Archived: X Index fixes: X Compaction candidates: X Sessions cleaned: X
-
执行引导诊断脚本:bash
bash .agent-memory/bootstrap.sh doctor该脚本会处理索引与文件系统的同步,并输出基础健康报告。 -
过期检查:
- 30天以上未更新的 记忆 → 询问用户:更新、归档还是删除?
context/ - 日期已过的记忆 → 同上
expires - 且超过90天的记忆 → 建议删除
status: archived
- 30天以上未更新的
-
内容压缩:
- 读取所有记忆文件,识别内容重叠的部分
- 当两个文件覆盖同一主题时建议合并
- 查找会话日志中可升级为 或
conventions/的通用规则decisions/
-
会话日志清理:
- 超过60天的会话日志:检查核心信息是否已被其他记忆文件收录
- 已收录 → 可安全删除
- 未收录 → 先将有价值的信息提取到对应记忆文件,再删除
-
上报完整健康摘要:
记忆健康报告 ─────────────────────── 总记忆数: X 按类型分类: user(X) feedback(X) project(X) decision(X) context(X) convention(X) reference(X) session(X) 过期(30天以上): X 已失效: X 已归档: X 索引修复数: X 待压缩条目: X 清理会话数: X
Operation: Status
操作:状态
Quick read-only health check. No modifications.
快速只读健康检查,不会修改任何内容。
Steps
操作步骤
-
Run:bash
bash .agent-memory/bootstrap.sh status -
Ifdoesn't exist, suggest running
.agent-memory/.init -
Report the output. If issues are found, suggest running.
maintain
-
执行:bash
bash .agent-memory/bootstrap.sh status -
如果不存在,建议用户执行
.agent-memory/。init -
上报输出结果。如果发现问题,建议执行。
maintain
File Format Reference
文件格式参考
Frontmatter Schema
Frontmatter 结构
yaml
---
id: {type}/{topic} # matches directory/filename (no .md)
type: user | feedback | project | decision | context | convention | reference | session
title: Human-readable title
description: >-
One-line summary — decides relevance without opening the file.
tags: [tag1, tag2]
source: claude-app | claude-code | vscode | craft-agent | other
created: YYYY-MM-DD
updated: YYYY-MM-DD
status: active | archived
expires: YYYY-MM-DD # optional — review date for context memories
supersedes: {id} # optional — ID of memory this replaces
---
Markdown body.
For feedback/decision types, include **Why:** and **How to apply:** sections.yaml
---
id: {type}/{topic} # 与目录/文件名匹配(不含.md)
type: user | feedback | project | decision | context | convention | reference | session
title: 可读标题
description: >-
单行摘要,无需打开文件即可判断内容相关性
tags: [标签1, 标签2]
source: claude-app | claude-code | vscode | craft-agent | other
created: YYYY-MM-DD
updated: YYYY-MM-DD
status: active | archived
expires: YYYY-MM-DD # 可选 — 上下文记忆的复查日期
supersedes: {id} # 可选 — 当前记忆替换的旧记忆ID
---
Markdown正文。
对于反馈/决策类型,需包含 **为什么:** 和 **如何应用:** 两个部分。Memory Types
记忆类型
| Type | Directory | What Goes Here | Changes |
|---|---|---|---|
| user | user/ | Role, goals, preferences, collaboration style | Rarely |
| feedback | feedback/ | Corrections and confirmations — do/don't | As given |
| project | project/ | What the project IS (concept, progress, status) | Often |
| decision | decisions/ | Why things are the way they are (rationale) | When changed |
| context | context/ | Current state, active work, sprint focus | Frequently |
| convention | conventions/ | Patterns and rules for working on this project | Occasionally |
| reference | reference/ | External resources, architecture, patterns | Rarely |
| session | sessions/ | Lightweight session logs | Each session |
| 类型 | 目录 | 内容说明 | 更新频率 |
|---|---|---|---|
| user | user/ | 角色、目标、偏好、协作风格 | 很少 |
| feedback | feedback/ | 修正和确认信息 — 可做/不可做规则 | 收到反馈即更新 |
| project | project/ | 项目定义(概念、进度、状态) | 经常 |
| decision | decisions/ | 决策背后的理由 | 变更时更新 |
| context | context/ | 当前状态、进行中工作、迭代重点 | 频繁 |
| convention | conventions/ | 项目工作的模式和规则 | 偶尔 |
| reference | reference/ | 外部资源、架构、模式 | 很少 |
| session | sessions/ | 轻量会话日志 | 每次会话 |
Rules
规则
- Distill, don't transcribe. Summaries and decisions, not conversation dumps.
- One idea per file. Split if a memory covers unrelated topics.
- Update in place. When facts change, edit the file. Don't append forever.
- Keep index in sync. Every file in index, every index entry points to a file.
- Use on context. Context goes stale. Set a review date.
expires - Reference, don't copy. Point to source docs instead of duplicating content.
- No secrets. No credentials, PII, or sensitive data in memory files.
- Absolute dates. Convert "next Thursday" to "2026-03-27" when saving.
- 提炼而非转录。仅保存总结和决策,不要存储完整会话记录。
- 每个文件仅对应一个主题。如果记忆覆盖无关主题则拆分。
- 原地更新。事实变更时直接编辑文件,不要永久追加内容。
- 保持索引同步。每个文件都要录入索引,每个索引条目都对应实际文件。
- 上下文记忆设置字段。上下文会过期,设置复查日期。
expires - 引用而非复制。指向源文档,不要重复内容。
- 禁止存储敏感信息。记忆文件中不要存放凭据、个人身份信息或敏感数据。
- 使用绝对日期。保存时将「下周四」转换为「2026-03-27」格式。
Display Conventions
展示规范
When showing memory files or project documents to the user, always render them inline in the chat rather than opening external editors. This applies to all interfaces (Claude App, Claude Code CLI, VSCode, Craft Agent).
向用户展示记忆文件或项目文档时,始终在聊天中直接渲染,不要打开外部编辑器。该规范适用于所有接口(Claude App、Claude Code CLI、VSCode、Craft Agent)。
Universal (works everywhere)
通用规范(所有接口适用)
| Format | How to Display |
|---|---|
Markdown ( | Render the file body directly as inline markdown (strip YAML frontmatter — show only the body, optionally with the |
YAML ( | Render in a |
JSON ( | Render in a |
Plain text ( | Render in a plain fenced code block |
| 格式 | 展示方式 |
|---|---|
Markdown ( | 直接将文件正文渲染为行内markdown(移除YAML frontmatter,仅展示正文,可选择将 |
YAML ( | 放在 |
JSON ( | 放在 |
纯文本 ( | 放在纯文本围栏代码块中渲染 |
Rich previews (use when the interface supports them)
富预览(接口支持时使用)
If the interface supports rich preview blocks (e.g., Craft Agent), prefer these for binary and rich formats. Otherwise, fall back to describing the file with its path as a clickable link.
| Format | Rich Preview | Fallback |
|---|---|---|
PDF ( | | Show file path as link + page count |
Images ( | | Show file path as link |
HTML ( | | Show file path as link |
| Multiple files | Use | Render each under a heading |
| Index / tables | | |
如果接口支持富预览块(例如Craft Agent),优先用富预览展示二进制和富格式文件。否则降级为展示文件路径作为可点击链接。
| 格式 | 富预览 | 降级方案 |
|---|---|---|
PDF ( | 带 | 展示文件路径链接 + 页数 |
图片 ( | 带 | 展示文件路径链接 |
HTML ( | 带 | 展示文件路径链接 |
| 多个文件 | 使用带标签页的 | 每个文件放在独立标题下渲染 |
| 索引/表格 | | |
Guidelines
指导原则
- Never open external editors unless the user explicitly asks to edit a file externally.
- Strip frontmatter for markdown display. Omit the YAML frontmatter block — show only the markdown body.
--- - Large files. For very long markdown files, summarize and offer to show specific sections. For PDFs over 10 pages, note the page count.
- Index display. When showing , use whichever format is most readable — a table, datatable, or yaml code block.
index.yaml
- 除非用户明确要求外部编辑文件,否则永远不要打开外部编辑器。
- 展示markdown时移除frontmatter。省略 包裹的YAML frontmatter块,仅展示markdown正文。
--- - 大文件处理。对于超长markdown文件,先总结内容并提供展示特定部分的选项。对于超过10页的PDF,标注页数。
- 索引展示。展示 时使用可读性最高的格式:表格、datatable或yaml代码块。
index.yaml
Common Issues by Project Type
不同项目类型的常见问题
Solo Developer Projects
个人开发者项目
- Memory accumulates fast with no pruning — run monthly
maintain - Session logs dominate the index — promote recurring patterns to or
conventions/decisions/ - Context memories go stale within days — always set dates
expires
- 记忆快速堆积且无清理 — 每月执行一次
maintain - 会话日志占满索引 — 将重复出现的模式升级为 或
conventions/decisions/ - 上下文记忆几天内就会过期 — 始终设置 日期
expires
Multi-Agent Projects (Claude App + CLI + VSCode)
多Agent项目(Claude App + CLI + VSCode)
- Index gets out of sync when multiple interfaces create files — run at session end
sync - Duplicate memories from different interfaces covering same topic — detects and suggests merges
maintain - Source attribution missing — always set the field so you know which agent wrote what
source
- 多个接口创建文件会导致索引不同步 — 会话结束时执行
sync - 不同接口生成覆盖同一主题的重复记忆 — 会检测并建议合并
maintain - 缺少来源标识 — 始终设置 字段,明确是哪个Agent生成的内容
source
Team / Shared Repository Projects
团队/共享仓库项目
- Memory files committed to git create merge conflicts — keep in
.agent-memory/or use a shared branch strategy.gitignore - Different team members save contradictory decisions — use field to track which decision is current
supersedes - Onboarding context missing — run to auto-generate from existing docs before new team members start
build
- 提交到git的记忆文件会产生合并冲突 — 将 加入
.agent-memory/或使用共享分支策略.gitignore - 不同团队成员保存矛盾的决策 — 使用 字段跟踪当前生效的决策
supersedes - 缺少入职上下文 — 新成员加入前执行 从现有文档自动生成记忆
build
Monorepo / Large Codebases
Monorepo/大型代码库
- Too many convention files — group by subsystem (e.g., ,
conventions/frontend.md)conventions/api.md - Architecture changes invalidate old decisions — set on decision memories
expires - Build from docs generates too many files — be selective, focus on non-obvious knowledge
- 规范文件过多 — 按子系统分组(例如 、
conventions/frontend.md)conventions/api.md - 架构变更会让旧决策失效 — 给决策记忆设置 日期
expires - 从文档构建会生成过多文件 — 选择性生成,重点关注非显性知识
Troubleshooting
故障排查
bootstrap.sh
Not Found
bootstrap.sh找不到 bootstrap.sh
bootstrap.sh- Check if the skill was installed correctly:
ls ~/.agents/skills/agent-memory/bootstrap.sh - If missing, re-install the skill or create the directory structure manually using the Init operation steps
- 检查skill是否正确安装:
ls ~/.agents/skills/agent-memory/bootstrap.sh - 如缺失,重新安装skill,或按照初始化操作步骤手动创建目录结构
Index Out of Sync
索引不同步
- Run — this reconciles filesystem with index
bash .agent-memory/bootstrap.sh fix - If doesn't resolve it, run
fixfor a full diagnosticbash .agent-memory/bootstrap.sh doctor
- 执行 — 该命令会同步文件系统和索引
bash .agent-memory/bootstrap.sh fix - 如 无法解决,执行
fix进行完整诊断bash .agent-memory/bootstrap.sh doctor
Migration Fails
迁移失败
- Check for file permission issues on directory
.agent-memory/ - Ensure old files have valid YAML frontmatter — malformed frontmatter blocks migration
- Run migration with verbose output: review each file it tries to move
- 检查 目录的文件权限
.agent-memory/ - 确保旧文件有合法的YAML frontmatter — 格式错误的frontmatter会阻止迁移
- 开启详细输出执行迁移:检查每个尝试移动的文件
Memory Not Being Read by Other Interfaces
其他接口无法读取记忆
- Verify exists at project root and references
AGENTS.md.agent-memory/ - Check that includes read permissions for the memory directory
.claude/settings.json - Ensure references
.cursor/rules/index.mdcAGENTS.md
- 验证项目根目录下存在 且引用了
AGENTS.md.agent-memory/ - 检查 包含记忆目录的读取权限
.claude/settings.json - 确认 引用了
.cursor/rules/index.mdcAGENTS.md
Tools Referenced
参考工具
Built-in
- — shell script for init, migrate, fix, doctor, status operations
bootstrap.sh - — machine-readable registry of all memory files
index.yaml - — canonical shared instructions (Linux Foundation standard)
AGENTS.md
AI Interfaces Supported
- Claude App (Cowork) — reads AGENTS.md +
.agent-memory/ - Claude Code CLI — reads CLAUDE.md → AGENTS.md →
.agent-memory/ - VSCode (Claude extension) — reads CLAUDE.md → AGENTS.md
- Cursor — reads → AGENTS.md →
.cursor/rules/index.mdc.agent-memory/ - Craft Agent — reads AGENTS.md + with rich preview support
.agent-memory/
内置工具
- — 用于初始化、迁移、修复、诊断、状态查询的shell脚本
bootstrap.sh - — 所有记忆文件的机器可读注册表
index.yaml - — 标准共享指令(遵循Linux Foundation标准)
AGENTS.md
支持的AI接口
- Claude App (Cowork) — 读取AGENTS.md +
.agent-memory/ - Claude Code CLI — 读取CLAUDE.md → AGENTS.md →
.agent-memory/ - VSCode (Claude扩展) — 读取CLAUDE.md → AGENTS.md
- Cursor — 读取 → AGENTS.md →
.cursor/rules/index.mdc.agent-memory/ - Craft Agent — 读取AGENTS.md + ,支持富预览
.agent-memory/
Task-Specific Questions
任务前置问题
- Is this a new project or does already exist?
.agent-memory/ - Are you working across multiple AI interfaces (Claude App, CLI, VSCode, Cursor)?
- Do you have existing documentation that should be bootstrapped into memory?
- Is this a solo project or shared with a team?
- When was the last time memory maintenance was run?
- 这是新项目,还是已经存在 目录?
.agent-memory/ - 你是否需要跨多个AI接口(Claude App、CLI、VSCode、Cursor)工作?
- 你有没有需要导入到记忆的现有文档?
- 这是个人项目还是团队共享项目?
- 上一次执行记忆维护是什么时候?
Related Skills
相关技能
- revise-claude-md: For updating CLAUDE.md with session learnings (complementary to memory save)
- session-save: For capturing files and responses from current chat to disk
- find-skills: For discovering additional skills that may generate useful memory entries
- revise-claude-md: 用于将会话经验更新到CLAUDE.md(记忆保存的补充功能)
- session-save: 用于将当前聊天的文件和响应保存到磁盘
- find-skills: 用于发现可生成有用记忆条目的其他技能