Loading...
Loading...
Manage AI agent memory files (AGENTS.md/CLAUDE.md). Supports update and restructure modes. Use this when users need to sync, update, or restructure agent memory files. Triggered by keywords such as "记忆文件", "memory file", "AGENTS.md", "更新记忆", "重构记忆", "memory sync", "memory restructure".
npx skill4agent add ab300819/skills agent-memoryProject Information Sources (codebase + documentation)
│
│ Distill key information
▼
AGENTS.md (concise, stable, cross-AI-tool compatible) ← Only edit point for general information
│
├── CLAUDE.md (@AGENTS.md import + Claude Code exclusive supplements)
├── .claude/rules/devdocs-state.md (DevDocs projects only, numbered status)
└── Future: .cursorrules / .windsurfrules (reserved, not implemented)@AGENTS.md.claude/rules/--update--restructure/init/init/init/init--update/agent-memory → Intelligent detection (Does AGENTS.md exist? Does it need an update?)
/agent-memory --update → Extract information from project sources and update AGENTS.md
/agent-memory --restructure → Restructure existing AGENTS.md according to best practices| Mode | Read Project | Write Files | Applicable Scenario |
|---|---|---|---|
| Intelligent Detection | As needed | As needed | When uncertain |
| ✅ | AGENTS.md + CLAUDE.md (if missing) + devdocs-state.md (DevDocs only) | Sync after completing phased work |
| ✅ | AGENTS.md + CLAUDE.md | When memory file structure is disorganized |
Check if AGENTS.md exists
│
├── Does not exist → Scan project sources, create AGENTS.md + CLAUDE.md for the first time
│
└── Exists → Analyze content status
├── Outdated information → Recommend --update
└── Disorganized structure → Recommend --restructure| Source | Extracted Content |
|---|---|
| package.json / go.mod / Cargo.toml | Tech stack, run commands |
| README.md | Project overview |
| git log | Commit conventions |
| Code structure | Key directories, entry files |
| Source | Extracted Content |
|---|---|
| 02-system-design.md | Tech stack, Architecture Decision Record (ADR) summaries |
| 01-requirements.md | Domain terminology |
| 04-dev-tasks.md | Active tasks + progress |
| All documents | Numbered status (max F/US/AC/T/ADR) |
--update1. Scan project information sources
├── General extraction (package managers, README, git, code structure)
└── DevDocs enhanced extraction (if docs/devdocs/ exists)
│
▼
1.5 Check if AGENTS.md exists
├── Does not exist → Create using memory-template.md
└── Exists → Perform incremental update
│
▼
2. Distill key information
├── Tech stack
├── ADR summaries (if available; extract key decisions from change logs if no ADR format exists)
├── Domain terminology
├── Active tasks + progress
├── Numbered status (DevDocs projects only)
└── Run commands
│
▼
2.5 Filter according to best-practices.md
├── Content filtering criteria: Should include vs. Should exclude
└── Quality guidelines: 6 checks
│
▼
3. Update AGENTS.md (using templates/memory-template.md)
│
▼
4. Ensure CLAUDE.md exists (create import file if missing; skip if already exists, do not overwrite supplement section)
│
▼
5. Generate/update .claude/rules/devdocs-state.md (DevDocs projects only)| Information Type | Target Location | Reason |
|---|---|---|
| Tech stack, run commands | AGENTS.md | Cross-tool compatible, needed in every session |
| Architecture Decision (ADR) summaries | AGENTS.md | Prevent repeated queries |
| Active tasks + progress | AGENTS.md | Immediate action context |
| Domain terminology, business boundaries | AGENTS.md | High-frequency and stable, prevent misunderstandings |
| Code conventions, commit formats | AGENTS.md | Consistent across tools |
| Numbered status (max F/US/AC/T/ADR) | | Claude-exclusive runtime state |
| Complete requirements/design/test details | Keep in | Too detailed for memory files |
--restructure1. Read existing AGENTS.md
│
▼
2. Detect non-compliant items according to best-practices.md
├── Line limit (≤ 60 lines)
├── Tool agnosticism
├── Section order (align with structure standards)
├── Anti-pattern detection
└── Missing sections
│
▼
3. Restructure according to templates/memory-template.md
│
▼
4. Display restructuring proposal, write to file after confirmation
│
▼
5. Ensure CLAUDE.md exists (create import file if missing; skip if already exists)@AGENTS.md/agent-memory.claude/rules/devdocs-state.md.claude/rules/devdocs-state.md00-context.md--restructure| Scenario | Collaborating Skill | Description |
|---|---|---|
| Initial creation | | Scan project sources to create; perform incremental update if |
| Phased documentation changes | | Recommend running /agent-memory after onboard completion |
| Lightweight update after task completion | | Inline update "current status" in step 6.5 of dev-workflow |
| Context summary | | onboard generates 00-context.md, does not involve memory files |