131 lines
3.6 KiB
Markdown
131 lines
3.6 KiB
Markdown
---
|
|
name: memory
|
|
description: >
|
|
This skill should be used when the user wants to store, retrieve, update, or delete
|
|
persistent memories with hierarchical categories. Supports MCP JSON-RPC interface
|
|
and CLI management with multi-format export.
|
|
---
|
|
|
|
# Memory Manager
|
|
|
|
Hierarchical memory storage with categories, MCP support, and multi-format export.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
memory/
|
|
├── SKILL.md
|
|
├── memories/ # Root storage
|
|
│ ├── index.md # Root index
|
|
│ ├── work/ # Category: work
|
|
│ │ ├── project-a/ # Sub-category
|
|
│ │ │ └── <id>.md # Memories
|
|
│ │ └── <id>.md
|
|
│ ├── personal/ # Category: personal
|
|
│ └── preferences/ # Category: preferences
|
|
└── scripts/
|
|
└── store.py # Main storage (CLI + MCP)
|
|
```
|
|
|
|
## When to Use
|
|
|
|
- User asks to "remember", "save", or "store" something
|
|
- User wants to "recall" or "retrieve" stored information
|
|
- User wants to organize memories into categories
|
|
- User asks to "forget" or "delete" stored information
|
|
- Export memories in different formats
|
|
|
|
## CLI Usage
|
|
|
|
```bash
|
|
# Add memory to category
|
|
python store.py add -t "API Key" -c "sk-xxx" --category work/secrets --tags secret api
|
|
|
|
# Get memory
|
|
python store.py get abc12345 --category work/secrets
|
|
|
|
# List all (recursive)
|
|
python store.py list
|
|
|
|
# List specific category (no recursion)
|
|
python store.py list --category work --no-recursive
|
|
|
|
# Search in category
|
|
python store.py search "api" --category work
|
|
|
|
# Update memory
|
|
python store.py update abc12345 -c "new content"
|
|
python store.py update abc12345 --move new/category # Move to category
|
|
|
|
# Delete memory
|
|
python store.py delete abc12345
|
|
|
|
# List category structure
|
|
python store.py ls /
|
|
python store.py ls work
|
|
|
|
# Create/remove category
|
|
python store.py mkdir new/category
|
|
python store.py rmdir empty/category
|
|
|
|
# Export
|
|
python store.py export --format json -o memories.json
|
|
python store.py export --format markdown -o memories.md
|
|
python store.py export --format csv -o memories.csv
|
|
python store.py export --category work --format json
|
|
```
|
|
|
|
## Category Structure
|
|
|
|
- **Root (`/`)**: Default, memories without category
|
|
- **Nested (`work/projects/api`)**: Hierarchical categories using `/` separator
|
|
- **Case-sensitive**: `Work` ≠ `work`
|
|
- **Auto-create**: Parent categories created automatically
|
|
|
|
## Memory File Format
|
|
|
|
```markdown
|
|
---
|
|
category: work/projects
|
|
created: 2024-01-01T00:00:00
|
|
id: abc12345
|
|
tags: [api, backend]
|
|
title: API Design
|
|
updated: 2024-01-01T00:00:00
|
|
---
|
|
|
|
Memory content goes here.
|
|
```
|
|
|
|
## MCP JSON-RPC Interface
|
|
|
|
Run as MCP server: `python store.py --mcp`
|
|
|
|
### Methods
|
|
|
|
| Method | Parameters | Description |
|
|
|--------|-----------|-------------|
|
|
| `add` | `title`, `content`, `category?`, `tags?` | Add memory |
|
|
| `get` | `id`, `category?` | Get memory |
|
|
| `list` | `category?`, `recursive?` | List memories |
|
|
| `search` | `query`, `category?` | Search memories |
|
|
| `update` | `id`, `category?`, `title?`, `content?`, `tags?`, `new_category?` | Update/Move |
|
|
| `delete` | `id`, `category?` | Delete memory |
|
|
| `ls` | `category?` | List category structure |
|
|
| `mkdir` | `category` | Create category |
|
|
| `rmdir` | `category` | Remove empty category |
|
|
| `export` | `format?`, `category?` | Export memories |
|
|
|
|
## Export Formats
|
|
|
|
- **JSON**: Array of memory objects
|
|
- **Markdown**: Human-readable with category sections
|
|
- **CSV**: Spreadsheet-compatible
|
|
|
|
## Tips
|
|
|
|
- Use categories to organize: `work/`, `personal/`, `preferences/`
|
|
- Add tags for cross-category search
|
|
- Use `ls /` to view full structure
|
|
- Export specific category: `--category work`
|