agent-memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent 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
安装(推荐)

bash
npx skills add t4sh/skills4sh --skill agent-memory
bash
npx skills add t4sh/skills4sh --skill agent-memory

Via manual install scripts

通过手动安装脚本安装

PlatformScriptUsage
macOS / Linux
install.sh
./install.sh --global
or
./install.sh --project
Windows
install.ps1
.\install.ps1 -Global
or
.\install.ps1 -Project
Both scripts copy skill files to either
~/.claude/skills/agent-memory
(global) or
./.claude/skills/agent-memory
(project-local), handling existing installations, excluding meta files, and prompting for credential setup if a
.env.example
is present.

平台脚本用法
macOS / Linux
install.sh
./install.sh --global
./install.sh --project
Windows
install.ps1
.\install.ps1 -Global
.\install.ps1 -Project
两种脚本都会将skill文件复制到
~/.claude/skills/agent-memory
(全局)或
./.claude/skills/agent-memory
(项目本地),自动处理现有安装、排除元文件,若存在
.env.example
则提示进行凭据配置。

What I Can Help With

支持的功能

  • Initializing project memory — scaffold the
    .agent-memory/
    system with proper directory structure and entry points
  • 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:
  1. Current State
    • Does
      .agent-memory/
      already exist?
    • What version/structure is in place?
    • Are there older formats (CURSOR.md, flat files, INDEX.yaml) that need migration?
  2. User's Goal
    • First-time setup or ongoing management?
    • Saving learnings from this session or doing maintenance?
    • Working across multiple AI interfaces?
  3. 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?

操作记忆前,需要先明确以下信息:
  1. 当前状态
    • .agent-memory/
      目录是否已经存在?
    • 现有记忆的版本/结构是什么?
    • 是否有需要迁移的旧格式文件(CURSOR.md、扁平文件、INDEX.yaml)?
  2. 用户目标
    • 是首次配置还是日常管理?
    • 是保存本次会话经验还是执行维护任务?
    • 是否需要跨多个AI接口协作?
  3. 项目上下文
    • 项目类型是什么?(会影响核心记忆类型的选择)
    • 是否有可用于引导的现有文档?
    • 有多少人员/Agent参与贡献?

Trigger

触发方式

Invoke with
/agent-memory
or when the user mentions managing project memory.
通过
/agent-memory
调用,或当用户提到管理项目记忆时自动触发。

Commands

命令

The user triggers an operation with a keyword:
KeywordOperationDescription
initInitializeScaffold
.agent-memory/
, README, index, AGENTS.md, CLAUDE.md, .claude/, .cursor/rules/
migrateMigrateDetect and migrate older structures (CURSOR.md, flat files, INDEX.yaml) to v2.1
buildBuildScan project and auto-generate initial memory files from existing docs
saveSaveCapture learnings from the current session into memory
maintainMaintainCompact, trim stale, fix index, clean old session logs
syncSyncPull in external changes + save current session (end-of-session habit)
statusStatusRead-only health check — file counts, staleness, sync
If no keyword is given, ask:
What would you like to do with agent memory?
  1. Init — Set up
    .agent-memory/
    for this project (first time)
  2. Build — Scan project and generate initial memories
  3. Save — Capture current session learnings
  4. Sync — Pull in external changes + save this session (recommended end-of-session)
  5. Maintain — Compact, trim stale, fix index
  6. Status — Show memory health report

用户可通过关键字触发对应操作:
关键字操作描述
init初始化搭建
.agent-memory/
、README、索引、AGENTS.md、CLAUDE.md、.claude/、.cursor/rules/
migrate迁移检测并将旧结构(CURSOR.md、扁平文件、INDEX.yaml)迁移到v2.1标准
build构建扫描项目,从现有文档自动生成初始记忆文件
save保存将本次会话的经验捕获到记忆中
maintain维护压缩、清理过期内容、修复索引、清理旧会话日志
sync同步拉取外部变更 + 保存当前会话(推荐会话结束时使用)
status状态只读健康检查:文件数量、过期情况、同步状态
如果未提供关键字,询问用户:
你想要对agent记忆执行什么操作?
  1. Init — 为该项目设置
    .agent-memory/
    (首次使用)
  2. Build — 扫描项目生成初始记忆
  3. Save — 捕获当前会话经验
  4. Sync — 拉取外部变更 + 保存本次会话(推荐会话结束时使用)
  5. Maintain — 压缩、清理过期内容、修复索引
  6. Status — 展示记忆健康报告

Operation: Init

操作:初始化

Scaffold the
.agent-memory/
system from scratch. Delegates to the bootstrap script when available.
从零搭建
.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 memory
Key principles:
  • AGENTS.md
    at project root is the single source of truth (all tools read it)
  • CLAUDE.md
    is thin: "Read AGENTS.md first" + Claude-only gotchas
  • .claude/
    and
    .cursor/rules/
    hold tool-native configs
  • Never put shared instructions inside
    .claude/
    or
    .cursor/
    — those are tool-specific
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
    是唯一可信源(所有工具都会读取)
  • CLAUDE.md
    是精简入口:仅包含「优先读取AGENTS.md」+ Claude专属注意事项
  • .claude/
    .cursor/rules/
    存放工具原生配置
  • 永远不要把共享指令放在
    .claude/
    .cursor/
    内部,这些是工具专属目录

Steps

操作步骤

  1. Check if
    .agent-memory/bootstrap.sh
    exists
    in the working directory.
    • If yes:
      bash .agent-memory/bootstrap.sh init
    • If no: check if a global copy exists at
      ~/.agents/skills/agent-memory/bootstrap.sh
      and copy it in first.
    • If neither exists: create the directory structure and files manually (see structure below).
  2. Verify the result (v2.1):
    • .agent-memory/
      directory with subdirs:
      user/
      ,
      feedback/
      ,
      project/
      ,
      decisions/
      ,
      context/
      ,
      conventions/
      ,
      reference/
      ,
      sessions/
    • .agent-memory/README.md
      — self-describing spec
    • .agent-memory/index.yaml
      — empty registry
    • AGENTS.md
      at project root — canonical shared instructions
    • CLAUDE.md
      at project root — thin pointer to AGENTS.md
    • .claude/settings.json
      — Claude Code permissions
    • .cursor/rules/index.mdc
      — Cursor "Always" rule
  3. Fill in TODOs in AGENTS.md with the project's actual structure and rules.
  4. Report what was created.

  1. 检查工作目录中是否存在
    .agent-memory/bootstrap.sh
    • 存在:执行
      bash .agent-memory/bootstrap.sh init
    • 不存在:先检查全局路径
      ~/.agents/skills/agent-memory/bootstrap.sh
      是否存在,存在则先复制到本地
    • 两者都不存在:手动创建目录结构和文件(参考下方结构)
  2. 验证v2.1标准结构:
    • .agent-memory/
      目录包含子目录:
      user/
      feedback/
      project/
      decisions/
      context/
      conventions/
      reference/
      sessions/
    • .agent-memory/README.md
      — 自描述规范
    • .agent-memory/index.yaml
      — 空注册表
    • 项目根目录下的
      AGENTS.md
      — 标准共享指令
    • 项目根目录下的
      CLAUDE.md
      — 指向AGENTS.md的精简入口
    • .claude/settings.json
      — Claude Code权限配置
    • .cursor/rules/index.mdc
      — Cursor「始终执行」规则
  3. 填充AGENTS.md中的待办项,填入项目的实际结构和规则。
  4. 上报所有创建的内容。

Operation: Migrate

操作:迁移

Detect and migrate older structures to the v2.1 standard.
检测旧结构并迁移到v2.1标准。

What Gets Migrated

迁移映射关系

Old StructureNew StructureAction
CURSOR.md
at root
.cursor/rules/index.mdc
Content moved, old file renamed
.migrated
INDEX.yaml
(uppercase)
index.yaml
(lowercase)
Renamed
Flat
{type}--{topic}.md
{type}/{topic}.md
Moved to directory
summary:
frontmatter
description:
frontmatter
Field renamed
CLAUDE.md
with full instructions (no AGENTS.md)
AGENTS.md
+ thin
CLAUDE.md
Promoted
旧结构新结构操作
根目录下的
CURSOR.md
.cursor/rules/index.mdc
迁移内容,旧文件重命名为
.migrated
大写的
INDEX.yaml
小写的
index.yaml
重命名
扁平格式
{type}--{topic}.md
{type}/{topic}.md
移动到对应目录
frontmatter字段
summary:
frontmatter字段
description:
重命名字段
包含完整指令的
CLAUDE.md
(无AGENTS.md)
AGENTS.md
+ 精简版
CLAUDE.md
升级结构

Steps

操作步骤

  1. Run:
    bash .agent-memory/bootstrap.sh migrate
  2. Review the migration report.
  3. Manually update
    CLAUDE.md
    to be a thin pointer if it was promoted.
  4. Run
    bash .agent-memory/bootstrap.sh fix
    to verify index sync.

  1. 执行:
    bash .agent-memory/bootstrap.sh migrate
  2. 审核迁移报告。
  3. 如果CLAUDE.md被升级,手动更新为精简入口格式。
  4. 执行
    bash .agent-memory/bootstrap.sh fix
    验证索引同步。

Operation: Build

操作:构建

Scan the project and auto-generate initial memory files from existing documentation.
扫描项目,从现有文档自动生成初始记忆文件。

Steps

操作步骤

  1. Scan for documentation sources:
    • *.md
      files (README, specs, plans, guides)
    • package.json
      ,
      pyproject.toml
      ,
      Cargo.toml
      (project metadata)
    • CLAUDE.md
      ,
      AGENTS.md
      (existing context files)
    • *.yaml
      ,
      *.yml
      config files
    • .env.example
      (technology indicators)
    • Existing
      .agent-memory/
      files from older formats (migrate them)
  2. For each significant source, distill into a memory file:
    • Project overview →
      project/overview.md
    • Architecture / tech stack →
      project/architecture.md
      or
      reference/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
  3. 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
      docs/architecture.md
      for full details."
    • Use the standard frontmatter format with appropriate tags.
  4. Migrate old formats if found:
    • Flat
      {type}--{topic}.md
      files → move to
      {type}/{topic}.md
    • INDEX.yaml
      (uppercase) → rename to
      index.yaml
    • Old frontmatter fields (
      summary
      description
      , add
      source
      and
      status
      )
    • v1 index entries → update paths to use directory format
  5. Update
    index.yaml
    with all new/migrated entries.
  6. Run
    bash .agent-memory/bootstrap.sh fix
    to verify sync.
  7. Report what was generated, with a summary table.

  1. 扫描文档源:
    • *.md
      文件(README、规范、计划、指南)
    • package.json
      pyproject.toml
      Cargo.toml
      (项目元数据)
    • CLAUDE.md
      AGENTS.md
      (现有上下文文件)
    • *.yaml
      *.yml
      配置文件
    • .env.example
      (技术栈标识)
    • 旧格式的
      .agent-memory/
      文件(先迁移)
  2. 针对每个有效源,提炼为记忆文件:
    • 项目概览 →
      project/overview.md
    • 架构/技术栈 →
      project/architecture.md
      reference/architecture.md
    • 路线图/阶段规划 →
      project/roadmap.md
    • 设计决策 →
      decisions/{topic}.md
    • 编码规范 →
      conventions/{topic}.md
    • 用户身份(从CLAUDE.md、提交历史获取) →
      user/identity.md
  3. 提炼规则:
    • 仅总结,不复制原文。记忆是指向源文件的指针+提炼后的知识
    • 每个文件仅对应一个主题,若源文件覆盖多个无关主题则拆分
    • 引用源文档:"完整内容查看
      docs/architecture.md
      "
    • 使用标准frontmatter格式并添加合适的标签
  4. 如果发现旧格式则迁移:
    • 扁平格式
      {type}--{topic}.md
      → 移动到
      {type}/{topic}.md
    • 大写
      INDEX.yaml
      → 重命名为
      index.yaml
    • 旧frontmatter字段(
      summary
      description
      ,新增
      source
      status
    • v1索引条目 → 更新为目录格式的路径
  5. 更新
    index.yaml
    ,添加所有新生成/迁移的条目。
  6. 执行
    bash .agent-memory/bootstrap.sh fix
    验证同步。
  7. 上报所有生成的内容,并提供汇总表格。

Operation: Save

操作:保存

Capture learnings from the current conversation into memory.
将当前会话的经验捕获到记忆中。

Steps

操作步骤

  1. 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
  2. For each piece of knowledge, determine:
    • Does an existing memory cover this? → Update the file (bump
      updated
      , edit body)
    • Is this new? → Create a new file in the appropriate
      {type}/
      directory
    • Significant session? → Create a session log in
      sessions/
  3. 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
  4. Write memory files using the standard format (see File Format below).
  5. 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
  6. Update
    index.yaml
    — add new entries, update descriptions for modified entries.
  7. Report what was saved/updated.

  1. 回顾会话,筛选可保存的知识:
    • 做出的决策(架构、命名、工具选择、实现方案)
    • 收到的反馈(修正、确认、偏好)
    • 发现或建立的规范
    • 状态变更(阶段切换、阻塞解决、功能完成)
    • 下一次会话需要知晓的重要上下文
  2. 针对每一条知识,判断处理方式:
    • 已有记忆覆盖该内容?→ 更新对应文件(更新
      updated
      字段、修改正文)
    • 新增内容?→ 在对应
      {type}/
      目录下创建新文件
    • 会话内容重要?→ 在
      sessions/
      目录下创建会话日志
  3. 确定源标识:
    • Claude App (Cowork):
      claude-app
    • Claude Code CLI:
      claude-code
    • VSCode扩展:
      vscode
    • Craft Agent:
      craft-agent
    • 不确定则询问用户或使用
      other
  4. 使用标准格式编写记忆文件(参考下方文件格式说明)。
  5. 会话日志(用于重要会话):
    markdown
    ---
    id: sessions/YYMMDD-{slug}
    type: session
    title: "会话标题"
    description: >-
      会话内容简要描述
    tags: [相关标签]
    source: {源标识}
    created: YYYY-MM-DD
    updated: YYYY-MM-DD
    status: active
    ---
    
    ## 完成内容
    - 已完成工作的要点
    
    ## 做出的决策
    - 所有决策及简要理由
    
    ## 待处理事项
    - 未完成工作或下一次会话需要解决的问题
  6. 更新
    index.yaml
    — 添加新条目,更新修改条目的描述。
  7. 上报所有保存/更新的内容。

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
.agent-memory/
, files get added or modified externally. Running
sync
in one pass avoids needing
/agent-memory :maintain
then
/agent-memory :save
separately.
当4个不同接口(Claude App、CLI、VSCode、Craft Agent)操作同一个
.agent-memory/
时,外部可能新增或修改文件。单次执行
sync
可避免分开执行
/agent-memory :maintain
/agent-memory :save
的麻烦。

Steps

操作步骤

Phase 1 — Ingest external changes:
  1. Run bootstrap fix to detect filesystem↔index mismatches:
    bash
    bash .agent-memory/bootstrap.sh fix
  2. Scan for unindexed files — memory files on disk that aren't in
    index.yaml
    :
    • For each unindexed
      .md
      file in a memory directory (
      user/
      ,
      feedback/
      ,
      project/
      , etc.):
      • Read its frontmatter
      • Add an entry to
        index.yaml
        with its
        id
        ,
        path
        ,
        type
        ,
        title
        ,
        tags
        ,
        description
    • Report each file discovered with its source (who created it)
  3. Scan for orphan index entries — entries in
    index.yaml
    whose files no longer exist:
    • Remove orphan entries from
      index.yaml
    • Report each removal
  4. Check for updated content — files whose
    updated
    date is newer than what the current agent last saw:
    • Read the file to absorb the updated content into context
    • No file changes needed — just awareness
Phase 2 — Save current session:
  1. 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:
  1. 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 — 拉取外部变更:
  1. 执行引导修复脚本,检测文件系统与索引的不匹配问题:
    bash
    bash .agent-memory/bootstrap.sh fix
  2. 扫描未索引文件 — 磁盘上存在但未录入
    index.yaml
    的记忆文件:
    • 针对记忆目录(
      user/
      feedback/
      project/
      等)下每个未索引的
      .md
      文件:
      • 读取其frontmatter
      • index.yaml
        中添加对应条目,包含
        id
        path
        type
        title
        tags
        description
    • 上报每个发现的文件及其创建源
  3. 扫描孤立索引条目 — 索引中存在但对应文件已不存在的条目:
    • index.yaml
      中移除孤立条目
    • 上报每个移除的条目
  4. 检查更新的内容
    updated
    日期晚于当前Agent上次读取时间的文件:
    • 读取文件内容,将更新内容纳入上下文
    • 无需修改文件,仅更新本地认知即可
阶段2 — 保存当前会话:
  1. 执行完整的保存操作(参考上述「操作:保存」):
    • 回顾会话筛选可保存的知识
    • 更新现有记忆或创建新记忆
    • 如会话内容重要则创建会话日志
    • 更新
      index.yaml
阶段3 — 上报:
  1. 输出组合报告:
    同步报告
    ───────────────
    已拉取外部变更:
      发现新文件:      X  (已添加到索引)
      孤立条目:       X  (已从索引移除)
      外部更新内容:   X  (已刷新内容)
    
    已保存会话:
      更新记忆:     X
      新建记忆:     X
      会话日志:          是/否
    
    索引总条目:          X

Operation: Maintain

操作:维护

Full maintenance cycle: compact, trim stale, fix index, clean old session logs.
完整维护周期:压缩内容、清理过期条目、修复索引、清理旧会话日志。

Steps

操作步骤

  1. Run bootstrap doctor:
    bash
    bash .agent-memory/bootstrap.sh doctor
    This handles index↔filesystem sync and basic health reporting.
  2. Staleness check:
    • context/
      memories not updated in 30+ days → ask: update, archive, or remove?
    • Any memory with
      expires
      date in the past → same question
    • Any memory with
      status: archived
      older than 90 days → suggest deletion
  3. 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
      conventions/
      or
      decisions/
      .
  4. 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.
  5. 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

  1. 执行引导诊断脚本:
    bash
    bash .agent-memory/bootstrap.sh doctor
    该脚本会处理索引与文件系统的同步,并输出基础健康报告。
  2. 过期检查:
    • 30天以上未更新的
      context/
      记忆 → 询问用户:更新、归档还是删除?
    • expires
      日期已过的记忆 → 同上
    • status: archived
      且超过90天的记忆 → 建议删除
  3. 内容压缩:
    • 读取所有记忆文件,识别内容重叠的部分
    • 当两个文件覆盖同一主题时建议合并
    • 查找会话日志中可升级为
      conventions/
      decisions/
      的通用规则
  4. 会话日志清理:
    • 超过60天的会话日志:检查核心信息是否已被其他记忆文件收录
    • 已收录 → 可安全删除
    • 未收录 → 先将有价值的信息提取到对应记忆文件,再删除
  5. 上报完整健康摘要:
    记忆健康报告
    ───────────────────────
    总记忆数:        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

操作步骤

  1. Run:
    bash
    bash .agent-memory/bootstrap.sh status
  2. If
    .agent-memory/
    doesn't exist, suggest running
    init
    .
  3. Report the output. If issues are found, suggest running
    maintain
    .

  1. 执行:
    bash
    bash .agent-memory/bootstrap.sh status
  2. 如果
    .agent-memory/
    不存在,建议用户执行
    init
  3. 上报输出结果。如果发现问题,建议执行
    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

记忆类型

TypeDirectoryWhat Goes HereChanges
useruser/Role, goals, preferences, collaboration styleRarely
feedbackfeedback/Corrections and confirmations — do/don'tAs given
projectproject/What the project IS (concept, progress, status)Often
decisiondecisions/Why things are the way they are (rationale)When changed
contextcontext/Current state, active work, sprint focusFrequently
conventionconventions/Patterns and rules for working on this projectOccasionally
referencereference/External resources, architecture, patternsRarely
sessionsessions/Lightweight session logsEach session
类型目录内容说明更新频率
useruser/角色、目标、偏好、协作风格很少
feedbackfeedback/修正和确认信息 — 可做/不可做规则收到反馈即更新
projectproject/项目定义(概念、进度、状态)经常
decisiondecisions/决策背后的理由变更时更新
contextcontext/当前状态、进行中工作、迭代重点频繁
conventionconventions/项目工作的模式和规则偶尔
referencereference/外部资源、架构、模式很少
sessionsessions/轻量会话日志每次会话

Rules

规则

  1. Distill, don't transcribe. Summaries and decisions, not conversation dumps.
  2. One idea per file. Split if a memory covers unrelated topics.
  3. Update in place. When facts change, edit the file. Don't append forever.
  4. Keep index in sync. Every file in index, every index entry points to a file.
  5. Use
    expires
    on context.
    Context goes stale. Set a review date.
  6. Reference, don't copy. Point to source docs instead of duplicating content.
  7. No secrets. No credentials, PII, or sensitive data in memory files.
  8. Absolute dates. Convert "next Thursday" to "2026-03-27" when saving.

  1. 提炼而非转录。仅保存总结和决策,不要存储完整会话记录。
  2. 每个文件仅对应一个主题。如果记忆覆盖无关主题则拆分。
  3. 原地更新。事实变更时直接编辑文件,不要永久追加内容。
  4. 保持索引同步。每个文件都要录入索引,每个索引条目都对应实际文件。
  5. 上下文记忆设置
    expires
    字段
    。上下文会过期,设置复查日期。
  6. 引用而非复制。指向源文档,不要重复内容。
  7. 禁止存储敏感信息。记忆文件中不要存放凭据、个人身份信息或敏感数据。
  8. 使用绝对日期。保存时将「下周四」转换为「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)

通用规范(所有接口适用)

FormatHow to Display
Markdown (
.md
)
Render the file body directly as inline markdown (strip YAML frontmatter — show only the body, optionally with the
title
as a heading)
YAML (
.yaml
,
.yml
)
Render in a
yaml
fenced code block
JSON (
.json
)
Render in a
json
fenced code block
Plain text (
.txt
,
.log
)
Render in a plain fenced code block
格式展示方式
Markdown (
.md
)
直接将文件正文渲染为行内markdown(移除YAML frontmatter,仅展示正文,可选择将
title
作为标题)
YAML (
.yaml
,
.yml
)
放在
yaml
围栏代码块中渲染
JSON (
.json
)
放在
json
围栏代码块中渲染
纯文本 (
.txt
,
.log
)
放在纯文本围栏代码块中渲染

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.
FormatRich PreviewFallback
PDF (
.pdf
)
pdf-preview
code block with
"src"
Show file path as link + page count
Images (
.png
,
.jpg
,
.jpeg
,
.gif
,
.webp
,
.svg
)
image-preview
code block with
"src"
Show file path as link
HTML (
.html
)
html-preview
code block with
"src"
Show file path as link
Multiple filesUse
items
array with tabs
Render each under a heading
Index / tables
datatable
code block
yaml
code block
如果接口支持富预览块(例如Craft Agent),优先用富预览展示二进制和富格式文件。否则降级为展示文件路径作为可点击链接。
格式富预览降级方案
PDF (
.pdf
)
"src"
属性的
pdf-preview
代码块
展示文件路径链接 + 页数
图片 (
.png
,
.jpg
,
.jpeg
,
.gif
,
.webp
,
.svg
)
"src"
属性的
image-preview
代码块
展示文件路径链接
HTML (
.html
)
"src"
属性的
html-preview
代码块
展示文件路径链接
多个文件使用带标签页的
items
数组
每个文件放在独立标题下渲染
索引/表格
datatable
代码块
yaml
代码块

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
    index.yaml
    , use whichever format is most readable — a table, datatable, or yaml code block.

  • 除非用户明确要求外部编辑文件,否则永远不要打开外部编辑器
  • 展示markdown时移除frontmatter。省略
    ---
    包裹的YAML frontmatter块,仅展示markdown正文。
  • 大文件处理。对于超长markdown文件,先总结内容并提供展示特定部分的选项。对于超过10页的PDF,标注页数。
  • 索引展示。展示
    index.yaml
    时使用可读性最高的格式:表格、datatable或yaml代码块。

Common Issues by Project Type

不同项目类型的常见问题

Solo Developer Projects

个人开发者项目

  • Memory accumulates fast with no pruning — run
    maintain
    monthly
  • Session logs dominate the index — promote recurring patterns to
    conventions/
    or
    decisions/
  • Context memories go stale within days — always set
    expires
    dates
  • 记忆快速堆积且无清理 — 每月执行一次
    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
    sync
    at session end
  • Duplicate memories from different interfaces covering same topic —
    maintain
    detects and suggests merges
  • Source attribution missing — always set the
    source
    field so you know which agent wrote what
  • 多个接口创建文件会导致索引不同步 — 会话结束时执行
    sync
  • 不同接口生成覆盖同一主题的重复记忆 —
    maintain
    会检测并建议合并
  • 缺少来源标识 — 始终设置
    source
    字段,明确是哪个Agent生成的内容

Team / Shared Repository Projects

团队/共享仓库项目

  • Memory files committed to git create merge conflicts — keep
    .agent-memory/
    in
    .gitignore
    or use a shared branch strategy
  • Different team members save contradictory decisions — use
    supersedes
    field to track which decision is current
  • Onboarding context missing — run
    build
    to auto-generate from existing docs before new team members start
  • 提交到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
    expires
    on decision memories
  • 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

  • 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
    bash .agent-memory/bootstrap.sh fix
    — this reconciles filesystem with index
  • If
    fix
    doesn't resolve it, run
    bash .agent-memory/bootstrap.sh doctor
    for a full diagnostic
  • 执行
    bash .agent-memory/bootstrap.sh fix
    — 该命令会同步文件系统和索引
  • fix
    无法解决,执行
    bash .agent-memory/bootstrap.sh doctor
    进行完整诊断

Migration Fails

迁移失败

  • Check for file permission issues on
    .agent-memory/
    directory
  • 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
    AGENTS.md
    exists at project root and references
    .agent-memory/
  • Check that
    .claude/settings.json
    includes read permissions for the memory directory
  • Ensure
    .cursor/rules/index.mdc
    references
    AGENTS.md

  • 验证项目根目录下存在
    AGENTS.md
    且引用了
    .agent-memory/
  • 检查
    .claude/settings.json
    包含记忆目录的读取权限
  • 确认
    .cursor/rules/index.mdc
    引用了
    AGENTS.md

Tools Referenced

参考工具

Built-in
  • bootstrap.sh
    — shell script for init, migrate, fix, doctor, status operations
  • index.yaml
    — machine-readable registry of all memory files
  • AGENTS.md
    — canonical shared instructions (Linux Foundation standard)
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
    .cursor/rules/index.mdc
    → AGENTS.md →
    .agent-memory/
  • Craft Agent — reads AGENTS.md +
    .agent-memory/
    with rich preview support

内置工具
  • bootstrap.sh
    — 用于初始化、迁移、修复、诊断、状态查询的shell脚本
  • index.yaml
    — 所有记忆文件的机器可读注册表
  • AGENTS.md
    — 标准共享指令(遵循Linux Foundation标准)
支持的AI接口
  • Claude App (Cowork) — 读取AGENTS.md +
    .agent-memory/
  • Claude Code CLI — 读取CLAUDE.md → AGENTS.md →
    .agent-memory/
  • VSCode (Claude扩展) — 读取CLAUDE.md → AGENTS.md
  • Cursor — 读取
    .cursor/rules/index.mdc
    → AGENTS.md →
    .agent-memory/
  • Craft Agent — 读取AGENTS.md +
    .agent-memory/
    ,支持富预览

Task-Specific Questions

任务前置问题

  1. Is this a new project or does
    .agent-memory/
    already exist?
  2. Are you working across multiple AI interfaces (Claude App, CLI, VSCode, Cursor)?
  3. Do you have existing documentation that should be bootstrapped into memory?
  4. Is this a solo project or shared with a team?
  5. When was the last time memory maintenance was run?

  1. 这是新项目,还是已经存在
    .agent-memory/
    目录?
  2. 你是否需要跨多个AI接口(Claude App、CLI、VSCode、Cursor)工作?
  3. 你有没有需要导入到记忆的现有文档?
  4. 这是个人项目还是团队共享项目?
  5. 上一次执行记忆维护是什么时候?

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: 用于发现可生成有用记忆条目的其他技能