memory-persistence
Multi-backend memory system with optional embedding, private/shared memories, conversation summarization, and maintenance tools. For AI agents to store and retrieve persistent memories.
Best use case
memory-persistence is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Multi-backend memory system with optional embedding, private/shared memories, conversation summarization, and maintenance tools. For AI agents to store and retrieve persistent memories.
Teams using memory-persistence should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/memory-persistence/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How memory-persistence Compares
| Feature / Agent | memory-persistence | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Multi-backend memory system with optional embedding, private/shared memories, conversation summarization, and maintenance tools. For AI agents to store and retrieve persistent memories.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
SKILL.md Source
# 🧠 Memory System
A flexible memory system for AI agents with optional embedding support and multiple storage backends.
## Features
- **Private & Shared Memories** - Private by default, shared memories for multi-agent collaboration
- **Embedding Search** - Semantic search using sentence-transformers
- **Multiple Backends** - Local file / SQLite / GitHub / Gitee
- **LLM Summarization** - Auto-extract key info from conversations
- **Memory Maintenance** - Review, consolidate, tag suggestions
- **Templates** - Quick memory creation with templates
## Installation
```bash
pip install sentence-transformers scikit-learn pyyaml numpy
```
## Quick Start
### Python API
```python
from memory_system import MemoryManager
# Initialize (local storage)
mm = MemoryManager(backend='local')
# Add
mm.add("User prefers dark theme", tags=["preference"])
# Search
results = mm.search("dark theme preference")
# List
entries = mm.list(tags=["preference"])
```
### CLI
```bash
# Add
python3 memory_cli.py add "User feedback: slow page load" --tags "bug,performance"
# List
python3 memory_cli.py list
# Search
python3 memory_cli.py -e search "performance issue"
# Semantic search (with embedding)
python3 memory_cli.py -e search "dark mode"
```
## Private vs Shared Memory
| Type | Storage | Access | Use Case |
|------|---------|--------|----------|
| **Private** | `./memory_data/` | Current agent only | User preferences, personal notes |
| **Shared** | `./shared_memory/` | All agents | Team decisions, collaboration |
**Default**: All memories are private. Use `shared add` only when other agents need to know.
```python
# Private memory - user says "remember..."
mm.add("User name is Zhang San")
# Shared memory - user says "tell other agents..."
smm.add("Team decision: use React", agent_id="agent_a")
```
## Storage Backends
### Local (Default)
```python
mm = MemoryManager(backend='local')
```
### SQLite (High Performance)
```python
mm = MemoryManager(backend='sqlite', base_path='./memory.db')
```
### GitHub
```bash
export GITHUB_TOKEN="your_token"
```
```python
mm = MemoryManager(
backend='github',
repo='owner/repo',
branch='main'
)
```
### Gitee
```bash
export GITEE_TOKEN="your_token"
```
```python
mm = MemoryManager(
backend='gitee',
repo='owner/repo',
branch='master'
)
```
## Embedding & Semantic Search
Embedding is optional and auto-downloads on first use.
```python
# Enable embedding
mm = MemoryManager(backend='local', use_embedding=True)
# Add (auto-generates vector)
mm.add("User works from 9am to 6pm")
# Semantic search - finds similar content
results = mm.search("what time does user work")
```
CLI with embedding:
```bash
python3 memory_cli.py -e search "working hours"
```
## Shared Memory (Multi-Agent)
```python
from memory_system import SharedMemoryManager
# Initialize
smm = SharedMemoryManager(backend='local', shared_path='./shared_memory')
# Add shared memory (from an agent)
smm.add("Bug #123 fixed", agent_id='agent_b')
# List shared memories
shared = smm.list()
# By agent
by_agent = smm.get_by_agent('agent_b')
```
CLI:
```bash
# Add shared
python3 memory_cli.py shared add "Team decision: use Vue" --agent "agent_a"
# List
python3 memory_cli.py shared list
# Search
python3 memory_cli.py -e shared search "Vue decision"
```
## Conversation Summarization
Auto-extract key information from conversation history.
```python
from memory_system import MemoryManager, MemorySummarizer, ConversationMemoryProcessor
mm = MemoryManager(use_embedding=True)
summarizer = MemorySummarizer() # Auto-detects OpenClaw model
processor = ConversationMemoryProcessor(mm, summarizer, auto_save=True)
conversation = """
User: I prefer dark theme
Assistant: Changed to dark theme
User: Page loads slowly
Assistant: Optimized images
"""
memories = processor.process(conversation)
```
CLI:
```bash
python3 memory_cli.py summarize --file conversation.txt --save
```
## Memory Maintenance
```bash
# Generate report
python3 memory_cli.py maintenance report
# Review old memories
python3 memory_cli.py maintenance review --days 7
# Find similar memories
python3 memory_cli.py maintenance consolidate
# Suggest tags for untagged memories
python3 memory_cli.py maintenance suggest-tags
# Mark as outdated
python3 memory_cli.py maintenance outdated --mark <id> --reason "expired"
```
## Templates
Predefined formats for quick memory creation.
```bash
# List templates
python3 memory_cli.py template list
# Show template
python3 memory_cli.py template show task
# Use template
python3 memory_cli.py template use task \
--field title="Complete report" \
--field priority="high"
```
## Memory Groups
Organize memories into groups.
```bash
# Add to group
python3 memory_cli.py add "work task" --tags "work" --group "work"
# List groups
python3 memory_cli.py group list
# Show group
python3 memory_cli.py group show "work"
```
## Batch Operations
```bash
# Batch add tags
python3 memory_cli.py batch-add-tags id1,id2 --tags "important,priority"
# Batch delete (requires confirmation)
python3 memory_cli.py batch-delete id1,id2 --force
```
## API Reference
### MemoryManager
| Method | Description |
|--------|-------------|
| `add(content, tags, metadata, group)` | Add memory |
| `get(id)` | Get by ID |
| `delete(id)` | Delete |
| `list(tags, limit, offset)` | List with pagination |
| `search(query, tags, top_k, threshold)` | Search |
| `batch_delete(ids)` | Batch delete |
| `list_groups()` | List groups |
| `export_json(filepath)` | Export JSON |
### SharedMemoryManager
| Method | Description |
|--------|-------------|
| `add(content, agent_id, tags)` | Add shared memory |
| `list(tags)` | List shared |
| `get_by_agent(agent_id)` | By agent |
| `search(query)` | Search shared |
## Files Structure
```
memory_system/
├── memory_manager.py # Core manager
├── shared_memory.py # Shared
├── summarizer.py # LLM summarization
├── maintenance.py # Maintenance tools
├── templates.py # Templates
├── embedding.py # Embedding handler
├── storage/ # Storage backends
│ ├── local.py
│ ├── sqlite.py
│ ├── github.py
│ └── gitee.py
└── memory_cli.py # CLI entry (run with python3)
```
## Configuration
`config.yaml`:
```yaml
STORAGE_BACKEND: "local"
USE_EMBEDDING: false
EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2"
storage:
local:
base_path: "./memory_data"
sqlite:
base_path: "./memory.db"
github:
repo: "owner/repo"
token_env: "GITHUB_TOKEN"
gitee:
repo: "owner/repo"
token_env: "GITEE_TOKEN"
```
## License
MITRelated Skills
Agent Memory Architecture
Complete zero-dependency memory system for AI agents — file-based architecture, daily notes, long-term curation, context management, heartbeat integration, and memory hygiene. No APIs, no databases, no external tools. Works with any agent framework.
memory-cache
High-performance temporary storage system using Redis. Supports namespaced keys (mema:*), TTL management, and session context caching. Use for: (1) Saving agent state, (2) Caching API results, (3) Sharing data between sub-agents.
Memory
Infinite organized memory that complements your agent's built-in memory with unlimited categorized storage.
auto-memory
Indestructible agent memory — permanently stored, never lost. Save decisions, identity, and context as a memory chain on the Autonomys Network. Rebuild your full history from a single CID, even after total state loss.
Triple-Layer Memory System
三层记忆系统 - 解决 AI Agent 长对话记忆丢失和上下文管理问题
agent-memory-os
Stop agents from "forgetting, mixing projects, and rotting over time" by giving them a practical memory operating system: global memory, project memory, promotion rules, validation cases, and a maintenance loop.
benos-memory-core
Core runtime/volatile memory module for BenOS agent environment. Use to: store and retrieve active session state, open loops, decisions, and scratch notes at runtime.
elite-longterm-memory
Ultimate AI agent memory system with WAL protocol, vector search, git-notes, and cloud backup. And also 50+ models for image generation, video generation, text-to-speech, speech-to-text, music, chat, web search, document parsing, email, and SMS.
memory-agent
维护用户审美偏好与创作历史,为其他 Agent 提供可复用的风格参考。当开始新任务或用户表达喜好时触发。
bamdra-memory-upgrade-operator
Safely install, uninstall, reinstall, or upgrade the Bamdra OpenClaw memory suite when stale config, existing plugin directories, or partial installs break normal `openclaw plugins install` flows.
hierarchical-memory
Manage and navigate a multi-layered, branch-based memory system. This skill helps organize complex agent context into Root, Domain, and Project layers to prevent context bloat. It includes a helper script `add_branch.py` which creates local markdown files and directories to structure your memory.
agentmemory
End-to-end encrypted cloud memory for AI agents. 100GB free storage. Store memories, files, and secrets securely.