Claude-Memu
Persistent memory for Claude Code powered by memU.
Quick Start •
How It Works •
Configuration •
API •
License
Claude-Memu seamlessly preserves context across Claude Code sessions using memU for hierarchical memory storage. It automatically captures observations, generates summaries, and injects relevant context into future sessions.
Quick Start
Option A: Local Mode (No API Key Required)
Run fully locally with file-based storage:
# In Claude Code
/plugin marketplace add minhlucvan/claude-memu
/plugin install claude-memu
That's it! Without an API key, claude-memu automatically uses local file storage in ~/.claude-memu/data/.
Option B: Cloud Mode (memU API)
For advanced features like semantic search and proactive context:
1. Get a memU API Key
Sign up at api.memu.so or deploy a self-hosted instance.
2. Install the Plugin
# In Claude Code
/plugin marketplace add minhlucvan/claude-memu
/plugin install claude-memu
3. Configure
Set your API key in ~/.claude-memu/settings.json:
{
"CLAUDE_MEMU_API_KEY": "your-api-key-here"
}
Or via environment variable:
export CLAUDE_MEMU_API_KEY="your-api-key-here"
4. Restart Claude Code
Context from previous sessions will automatically appear in new sessions.
Features
- Dual Storage Modes - Run locally (no API) or with memU cloud
- Persistent Memory - Context survives across sessions
- Proactive Context - LLM-powered context retrieval (API mode)
- Semantic Search - RAG-based memory queries (API mode)
- Project Isolation - Memories organized by project
- Privacy Control - Use
<private> tags to exclude sensitive content
- Fully Offline - Local mode works without internet
How It Works
┌─────────────────────────────────────────────────────────────┐
│ Claude Code Plugin │
├─────────────────────────────────────────────────────────────┤
│ Hooks (5 Lifecycle Events) │
│ Setup → SessionStart → UserPromptSubmit → PostToolUse → Stop│
├─────────────────────────────────────────────────────────────┤
│ Worker Service (Express on :37777) │
├─────────────────────────────────────────────────────────────┤
│ UnifiedStore (auto-selects based on API key) │
├────────────────────────┬────────────────────────────────────┤
│ LocalStore │ MemuStore │
│ (File-based JSON) │ (memU API client) │
├────────────────────────┴────────────────────────────────────┤
│ ~/.claude-memu/data/ │ memU API (api.memu.so/self-hosted)│
└─────────────────────────────────────────────────────────────┘
Core Components
- Lifecycle Hooks - Capture tool usage at 5 lifecycle events via bun-runner
- Worker Service - HTTP API on port 37777
- UnifiedStore - Auto-selects between LocalStore and MemuStore
- LocalStore - File-based JSON storage (no API key required)
- MemuStore - memU API storage with semantic search
- MemuClient - HTTP client for memU API
Data Flow
- Setup - Install dependencies (runs
setup.sh)
- SessionStart - Start worker, retrieve relevant context, capture user message
- UserPromptSubmit - Start worker, create/init session
- PostToolUse - Start worker, store observations
- Stop - Start worker, generate and store session summary
Configuration
Settings in ~/.claude-memu/settings.json:
{
"CLAUDE_MEMU_MODE": "auto",
"CLAUDE_MEMU_API_KEY": "your-api-key",
"CLAUDE_MEMU_API_URL": "https://api.memu.so",
"CLAUDE_MEMU_NAMESPACE": "default",
"CLAUDE_MEMU_WORKER_PORT": "37777",
"CLAUDE_MEMU_WORKER_HOST": "127.0.0.1",
"CLAUDE_MEMU_DATA_DIR": "~/.claude-memu",
"CLAUDE_MEMU_LOG_LEVEL": "INFO",
"CLAUDE_MEMU_CONTEXT_LIMIT": "20",
"CLAUDE_MEMU_PROACTIVE_CONTEXT": "true",
"CLAUDE_MEMU_SHOW_SUMMARIES": "true"
}
Storage Modes