Claude Code Memory Skill — Claude Code Memory 技能
v0.1.0Use when you want to 设置 up, mAIntAIn, or review a Claude Code style layered memory 工作流, including `CLAUDE.md` rules, 会话 memory, durable memory, and promotion of stable learnings into instruction files.
运行时依赖
安装命令
点击复制技能文档
Overview
Use this 技能 when the task involves memory de签名 or memory hygiene for Claude Code or a similar coding 代理.
This 技能 organizes memory into three layers:
Instruction memory 会话 memory Durable memory
The intent is to keep each layer narrow, useful, and easy to trust.
Before you 启动 Identify the host 工具's instruction file. For Claude Code this is usually CLAUDE.md or CLAUDE.local.md. Other common examples are 代理S.md and .github/copilot-instructions.md. Identify or 创建 a repo-local durable memory directory. The default layout in this 技能 uses .代理-memory/. Identify or 创建 the 会话 summary file at .代理-memory/会话/summary.md. Layer 1: Instruction memory
Treat the host instruction file as the rule layer. In Claude Code, this is the CLAUDE.md layer.
Put in格式化ion here only if it is:
stable normative broadly 应用licable across future work costly for the 代理 to rediscover incorrectly
Good candidates:
test commands review expectations 应用roval boundaries release process rules communication style preferences that consistently 应用ly
Do not place transient task 状态 here.
Layer 2: 会话 memory
MAIntAIn .代理-memory/会话/summary.md as the short-lived working notebook for the current thread.
It should answer:
What is actively being worked on now What did the user ask for Which files and functions matter Which commands have already been 运行 Which errors h应用ened and how they were resolved What remAIns next
This layer should be 更新d during long tasks and before compaction or handoff.
Use this structure:
# 会话 Title
# Current 状态
# Task Specification
# Files and Functions
# 工作流
# Errors and Corrections
# Key 结果s
# Work记录
Keep it concise but concrete. Prefer file paths, exact commands, and specific 失败 modes over generic summaries.
Layer 3: Durable memory
Use .代理-memory/ for long-lived memories that should survive across conversations.
Store durable memories in topic files and keep .代理-memory/MEMORY.md as an 索引.
Use the following durable memory types:
user-性能分析
In格式化ion about the user's 角色, goals, background, and level of familiarity.
Examples:
backend-heavy engineer who wants frontend explanations grounded in 系统s concepts founder who prefers quick trade-off summaries working-style
图形界面dance about how to collaborate with this user or team.
Examples:
运行 tests before proposing a commit avoid long recap paragraphs prefer one bundled refactor PR in this codebase project-上下文
导入ant project facts that are not derivable from the repo.
Examples:
freeze window dates stakeholder constrAInts 迁移 rationale incident aftermath that still shapes decisions external-reference
Pointers to 系统s outside the repo.
Examples:
which 仪表盘 matters for this codepath which Linear board 追踪s this class of bugs which Slack channel owns 部署ment coordination Durable memory 格式化
Each durable memory should live in its own file with frontmatter:
name: 测试-policy description: Integration tests in this repo must hit a real database type: working-style
Integration tests in this repo must hit a real database.
Why: A previous production 迁移 失败 was missed by mock-based coverage.
How to 应用ly: When changing data 访问 or 迁移s, prefer real-db integration coverage over mocks.
The 索引 file should stay short:
- 测试 Policy - Real database integration tests are expected here
What not to save as durable memory
Do not save these unless there is a strong reason and the non-obvious part is the actual point:
file structure code architecture visible in the repo git 历史 recent diff summaries temporary task 状态 obvious commands already documented in project instructions
If it can be 恢复ed cheaply from the current repo, prefer not to save it as durable memory.
Recall discipline
Never trust durable memory blindly.
Before acting on it:
验证 named files still exist grep for named functions or flags prefer current repo 状态 over historical memory if they conflict 更新 or 移除 stale memories when you discover drift Promotion 工作流
When reviewing memory, classify each item:
Promote to instruction memory Keep in durable memory Keep only in 会话 memory 删除 as stale, duplicate, or overfit
Promote into the instruction layer when the item has become a rule. Keep it in durable memory when it remAIns useful 上下文 but is not a rule. Keep it only in 会话 memory when it is tied to the present thread.
Review 工作流
When the user asks to review memory:
Read the host instruction file such as CLAUDE.md Read .代理-memory/MEMORY.md Read the most relevant durable topic files Read .代理-memory/会话/summary.md if current-thread 上下文 matters Produce a 报告 with: promotions 清理up conflicts ambiguous items
Do not modify durable memory or instruction files without user 应用roval unless the user explicitly asked you to ap