$npx -y skills add IIIIQIIII/MemoryAgent --skill memory-manageManage agent memory stored as files. Record, recall, search, update, and analyze memory content. Supports exploratory analysis for building context before complex tasks.
| 1 | # Memory Management Skill |
| 2 | |
| 3 | A Claude Code skill that implements the **Memory as File** concept — treating conversation knowledge as persistent files, managed entirely through the Coding Agent's native tools. |
| 4 | |
| 5 | ## Default Behavior |
| 6 | |
| 7 | - Default memory file: `memory.txt` in the current working directory |
| 8 | - The user can specify a custom file path as the last argument to any command |
| 9 | - If the memory file does not exist yet, create it automatically on the first `record` |
| 10 | |
| 11 | ## Commands |
| 12 | |
| 13 | Parse `$ARGUMENTS` to determine which operation to perform. The first word is the command, the rest are arguments. |
| 14 | |
| 15 | ### `recall` — Read Memory |
| 16 | |
| 17 | Usage: `/memory recall [file]` |
| 18 | |
| 19 | Read the full contents of the memory file using the **Read** tool and display it to the user. |
| 20 | |
| 21 | - If the file does not exist, inform the user that no memory has been recorded yet. |
| 22 | - If the file is large (over 200 lines), provide a summary of its structure first, then ask if the user wants the full content. |
| 23 | |
| 24 | ### `record` — Append to Memory |
| 25 | |
| 26 | Usage: `/memory record <content> [file]` |
| 27 | |
| 28 | Append new information to the memory file. |
| 29 | |
| 30 | **Format each entry as:** |
| 31 | ``` |
| 32 | ## [YYYY-MM-DD HH:MM] <short topic> |
| 33 | <content> |
| 34 | ``` |
| 35 | |
| 36 | - Use the current date and time for the timestamp |
| 37 | - Derive a short topic label (3-5 words) from the content |
| 38 | - If the file does not exist, create it with a header line: `# Memory File` |
| 39 | - Use the **Read** tool to get existing content, then **Write** to append the new entry |
| 40 | - Do NOT overwrite existing content — always append |
| 41 | |
| 42 | ### `update` — Modify Memory |
| 43 | |
| 44 | Usage: `/memory update <old> -> <new> [file]` |
| 45 | |
| 46 | Replace specific content in the memory file. |
| 47 | |
| 48 | - Use the **Read** tool to find the content |
| 49 | - Use the **Edit** tool to perform the replacement |
| 50 | - Confirm the change to the user by showing the before and after |
| 51 | |
| 52 | ### `search` — Search Memory |
| 53 | |
| 54 | Usage: `/memory search <query> [file]` |
| 55 | |
| 56 | Search the memory file for matching content. |
| 57 | |
| 58 | - Use the **Grep** tool to find lines matching the query |
| 59 | - Display matching entries with surrounding context (2 lines before and after) |
| 60 | - If no matches are found, suggest alternative search terms based on the query |
| 61 | |
| 62 | ### `forget` — Remove from Memory |
| 63 | |
| 64 | Usage: `/memory forget <content> [file]` |
| 65 | |
| 66 | Remove specific content from the memory file. |
| 67 | |
| 68 | - Use the **Read** tool to locate the content |
| 69 | - Use the **Edit** tool to remove the matching section (including its timestamp header if it is a complete entry) |
| 70 | - Confirm what was removed |
| 71 | |
| 72 | ### `analyze` — Exploratory Analysis |
| 73 | |
| 74 | Usage: `/memory analyze [file]` |
| 75 | |
| 76 | **This is the most important command.** Perform a comprehensive exploratory analysis of the memory file to build context for subsequent work. |
| 77 | |
| 78 | Steps: |
| 79 | 1. Read the entire memory file using the **Read** tool |
| 80 | 2. Produce a structured analysis report with the following sections: |
| 81 | |
| 82 | ``` |
| 83 | ## Memory Analysis Report |
| 84 | |
| 85 | ### Summary |
| 86 | One-paragraph overview of what the memory contains — its scope, depth, and overall theme. |
| 87 | |
| 88 | ### Topics |
| 89 | Bulleted list of distinct topics and themes found in the memory, ordered by frequency or importance. |
| 90 | |
| 91 | ### Key Entities |
| 92 | People, projects, tools, technologies, and decisions mentioned. Group by category. |
| 93 | |
| 94 | ### Timeline |
| 95 | Chronological progression of events or knowledge, if timestamps or temporal references exist. |
| 96 | |
| 97 | ### Relationships |
| 98 | Connections between topics — how different pieces of memory relate to each other. |
| 99 | |
| 100 | ### Knowledge Gaps |
| 101 | What information is missing, incomplete, or unclear. What questions remain unanswered. |
| 102 | |
| 103 | ### Suggested Next Steps |
| 104 | Concrete, actionable recommendations for what the agent (or user) could do next based on the memory content. These should be specific enough to serve as task descriptions. |
| 105 | ``` |
| 106 | |
| 107 | 3. This report is designed to give the agent (or a sub-agent) a **basic info foundation** — enough context to understand the situation and continue working on downstream tasks without needing to re-read the full memory file. |
| 108 | |
| 109 | ## When No Command Is Specified |
| 110 | |
| 111 | If `/memory` is invoked without arguments or with an unrecognized command: |
| 112 | - Display a brief help message listing all available commands with one-line descriptions |
| 113 | - Default to `analyze` if the memory file exists, or inform the user to start with `record` if it does not |
| 114 | |
| 115 | ## Design Principles |
| 116 | |
| 117 | - **Files are memory** — all knowledge is persisted as human-readable text files |
| 118 | - **Native tools only** — use Read, Write, Edit, Grep, and Glob; no external dependencies |
| 119 | - **Human-auditable** — users can open and edit memory files directly at any time |
| 120 | - **Timestamp everything** — every recorded entry gets a timestamp for chronological tracking |
| 121 | - **Analyze before acting** — the `analyze` command provides the foundation for informed decision-making |