失忆
diegosouzapw2026-10-26查看 1992复制 1965
为 AI 代理设置持久化记忆和身份。当用户希望为代理赋予持久身份、管理代理记忆文件、设置 IDENTITY.md/SOUL.md/MEMORY.md、创建记忆备份系统或实现基于文件的代理连续性时使用。触发词包括 "agent memory"、"persistent identity"、"IDENTITY.md"、"MEMORY.md"、"SOUL.md"、"agent backup"、"remember across sessions" 或 "agent continuity"。
📘如何使用这个技能
- 1复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
- 2打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
- 3粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
- 4直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景
💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。
SKILL.md3378 chars
--- name: amnesia description: Set up persistent memory and identity for AI agents. Use when the user wants to give an agent persistent identity, manage agent memory files, set up IDENTITY.md/SOUL.md/MEMORY.md, create memory backup systems, or implement file-based agent continuity. Triggers on "agent memory," "persistent identity," "IDENTITY.md," "MEMORY.md," "SOUL.md," "agent backup," "remember across sessions," or "agent continuity." --- # Amnesia Memory management toolkit for AI agents. Because forgetting is not an option. ## Quick Start 1. Copy templates to workspace: ```bash cp assets/templates/*.md /path/to/agent/workspace/ ``` 2. Fill in each template with agent-specific information 3. Set up automated backups: ```bash cp scripts/backup.sh /path/to/agent/scripts/ chmod +x /path/to/agent/scripts/backup.sh ``` ## Core Files | File | Purpose | |------|---------| | `IDENTITY.md` | Who the agent is — name, birthday, capabilities | | `SOUL.md` | How the agent behaves — values, style, boundaries | | `MEMORY.md` | Curated long-term memories | | `USER.md` | Information about the primary user | | `TOOLS.md` | Environment-specific notes | | `memory/*.md` | Daily episodic logs | ## Setting Up Identity ### IDENTITY.md Define static facts about the agent: ```markdown # IDENTITY.md - Who Am I? - **Name:** [Agent name] - **Creature:** [What the agent is] - **Vibe:** [One-line personality] - **Emoji:** [Representative emoji] - **Birthday:** [Creation date] ``` ### SOUL.md Define behavioral guidelines: ```markdown # SOUL.md - Who You Are ## Core Truths [Fundamental principles] ## Boundaries [What the agent won't do] ## Vibe [Communication style] ``` ## Memory Architecture ### Long-term Memory (MEMORY.md) Curated, important information: - Key learnings with dates - Important facts - People and relationships - Project status - Preferences discovered - Mistakes to avoid ### Daily Logs (memory/YYYY-MM-DD.md) Raw episodic memory: - Session starts - Events and timestamps - Conversations - Learnings - Tomorrow's tasks **Maintenance cycle:** Periodically review daily logs → extract insights → update MEMORY.md ## Backup System ### backup.sh Backs up workspace to git: ```bash ./scripts/backup.sh [workspace_dir] [backup_repo_dir] ``` Run on a cron schedule (e.g., hourly): ``` 0 * * * * /path/to/scripts/backup.sh ``` ### restore.sh Restores from backup after a wipe: ```bash ./scripts/restore.sh [backup_repo_dir] [workspace_dir] ``` ### new-day.sh Initializes today's memory log: ```bash ./scripts/new-day.sh [workspace_dir] ``` ## Session Startup Checklist When an agent starts a new session: 1. Read `IDENTITY.md` — establish who you are 2. Read `SOUL.md` — establish how you behave 3. Read `USER.md` — know who you're helping 4. Read `MEMORY.md` — recall long-term context 5. Read `memory/YYYY-MM-DD.md` (today + yesterday) — recent context 6. Check `TOOLS.md` — environment specifics ## Best Practices - **Save immediately** — Don't rely on context; write to files - **Date your entries** — When was this learned? - **Curate aggressively** — Not everything goes in MEMORY.md - **Back up frequently** — Hourly is good, more often is better - **Version control everything** — Git is your friend ## Resources - Templates: `assets/templates/` - Scripts: `scripts/` - GitHub: https://github.com/mulletmcnasty/amnesia