Use this skill when the task involves memory design or memory hygiene for Claude Code or a similar coding agent.
This skill organizes memory into three layers:
The intent is to keep each layer narrow, useful, and easy to trust.
CLAUDE.md or CLAUDE.local.md. Other common examples are AGENTS.md and .github/copilot-instructions.md..agent-memory/..agent-memory/session/summary.md.Treat the host instruction file as the rule layer. In Claude Code, this is the CLAUDE.md layer.
Put information here only if it is:
Good candidates:
Do not place transient task state here.
Maintain .agent-memory/session/summary.md as the short-lived working notebook for the current thread.
It should answer:
This layer should be updated during long tasks and before compaction or handoff.
Use this structure:
# Session Title
# Current State
# Task Specification
# Files and Functions
# Workflow
# Errors and Corrections
# Key Results
# Worklog
Keep it concise but concrete. Prefer file paths, exact commands, and specific failure modes over generic summaries.
Use .agent-memory/ for long-lived memories that should survive across conversations.
Store durable memories in topic files and keep .agent-memory/MEMORY.md as an index.
Use the following durable memory types:
user-profileInformation about the user's role, goals, background, and level of familiarity.
Examples:
working-styleGuidance about how to collaborate with this user or team.
Examples:
project-contextImportant project facts that are not derivable from the repo.
Examples:
external-referencePointers to systems outside the repo.
Examples:
Each durable memory should live in its own file with frontmatter:
---
name: testing-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 migration failure was missed by mock-based coverage.
How to apply:
When changing data access or migrations, prefer real-db integration coverage over mocks.
The index file should stay short:
- [Testing Policy](testing-policy.md) - Real database integration tests are expected here
Do not save these unless there is a strong reason and the non-obvious part is the actual point:
If it can be recovered cheaply from the current repo, prefer not to save it as durable memory.
Never trust durable memory blindly.
Before acting on it:
When reviewing memory, classify each item:
Promote into the instruction layer when the item has become a rule.
Keep it in durable memory when it remains useful context but is not a rule.
Keep it only in session memory when it is tied to the present thread.
When the user asks to review memory:
CLAUDE.md.agent-memory/MEMORY.md.agent-memory/session/summary.md if current-thread context mattersDo not modify durable memory or instruction files without user approval unless the user explicitly asked you to apply the cleanup.
.agent-memory/
├── MEMORY.md
├── user/
├── style/
├── project/
├── references/
└── session/
└── summary.md
共 1 个版本