| name | add-memory |
| description | Add a memory system to an agent — file awareness, knowledge graph, structured state, or multi-session tracking |
| argument-hint | [memory-type] |
| disable-model-invocation | false |
| user-invocable | true |
| allowed-tools | Read, Write, Bash, Glob, Grep, AskUserQuestion |
| metadata | {"version":"1.1","created":"2026-04-16T00:00:00.000Z","updated":"2026-05-16T00:00:00.000Z","author":"Ability.ai","changelog":["1.1: Add portability note — memory skills are copied into the agent so it stays self-contained with no plugin dependency","1.0: Initial version — adds a memory system (file-index, brain, json-state, or workspace) to an existing agent"]} |
Add Memory
ℹ️ First, set expectations: before anything else, print one short line with this skill's version and its most recent change — the top entry of metadata.changelog above — e.g. add-memory vX.Y — recent: <summary>. Then proceed.
Add a memory system to an existing agent. Memory skills are COPIED into the agent's .claude/skills/ directory — the agent becomes self-contained with no plugin dependency.
Memory Types
| Type | Description | Skills Installed |
|---|
| file-index | File system awareness — creates and maintains a searchable file index | setup-index, refresh-index, search-files |
| brain | Zettelkasten-style knowledge graph — atomic notes with connections | setup-brain, create-note, search-brain, find-connections |
| json-state | Structured JSON state with jq-based updates and action logging | setup-memory, load-memory, update-memory, memory-jq |
| workspace | Multi-session project tracking — organized folders, sessions, archives | setup-projects, create-project, create-session, archive-project |
Process
Step 1: Determine Agent Directory
Check if we're in an agent directory (has CLAUDE.md) or if user specified a path.
if [ -f "CLAUDE.md" ]; then
AGENT_DIR="$(pwd)"
else
fi
If no CLAUDE.md found, ask:
- Question: "What agent should I add memory to?"
- Hint: "Enter the path to the agent directory (should contain CLAUDE.md)"
Step 2: Check Argument or Ask Memory Type
If user provided an argument (e.g., /agent-dev:add-memory brain), use that.
Otherwise, use AskUserQuestion:
Step 3: Copy Memory Skills
Memory templates are stored in this plugin at:
agent-dev/memory-templates/
file-index/ # setup-index/, refresh-index/, search-files/
brain/ # setup-brain/, create-note/, search-brain/, find-connections/
json-state/ # setup-memory/, load-memory/, update-memory/, memory-jq/
workspace/ # setup-projects/, create-project/, create-session/, archive-project/
Copy the selected memory type's skills into the agent:
PLUGIN_DIR="$(dirname "$(dirname "$(dirname "$0")")")"
TEMPLATES_DIR="$PLUGIN_DIR/memory-templates"
cp -r "$TEMPLATES_DIR/[selected-type]/"* "$AGENT_DIR/.claude/skills/"
Step 4: Update Agent CLAUDE.md
Add a section documenting the new memory capabilities:
## Memory: [Type Name]
This agent has [type] memory installed. Available skills:
- `/[skill-1]` — description
- `/[skill-2]` — description
...
Run `/[setup-skill]` to initialize.
Step 5: Confirm and Guide
Output:
## Memory Added
Installed **[type]** memory to `[agent-name]`.
### New Skills
- `/[skill-1]` — description
- `/[skill-2]` — description
### Next Step
Run `/[setup-skill]` to initialize the memory system.
Notes
- Skills are COPIED, not linked — agent becomes self-contained
- Multiple memory types can be installed in the same agent
- If skills already exist (duplicate names), warn and ask before overwriting
- The setup skill initializes the memory system (creates directories, indexes, etc.)
- Portability: all data directories are created inside the agent repo — never in
~/. If using the native Claude Code memory: frontmatter field on custom subagent definitions, use memory: project (stores in .claude/agent-memory/, stays in repo) — never memory: user (stores in ~/.claude/, breaks portability)