aimemory
Gives AI agents persistent memory with semantic search, automatic extraction, and memory decay, accessible via MCP protocol.
README
✳️ aimemory
Give your AI a real memory.
AI Agent Memory Service — cross-platform, model-agnostic, fully under your control.
Why?
ChatGPT, Claude, Gemini — they all start from scratch every conversation. They don't remember who you are, what you prefer, or what decisions you've made.
aimemory fixes that:
- 🧠 Smart extraction — automatically picks out worth-remembering info from conversations
- 🔍 Semantic search — finds memories by meaning, not just keywords (3-engine: local neural network → Gemini API → TF-IDF)
- 📂 Auto-categorization — people, preferences, decisions, events, knowledge
- ⏰ Memory decay — simulates human forgetting curves: important things stick, trivial things fade
- 🔌 MCP protocol — any MCP-compatible AI agent can use it directly
- 🌍 Bilingual — full Chinese + English support, cross-language search
- 🧠 Local neural network — all-MiniLM-L6-v2 (22M params), runs on CPU, zero API cost
- 💰 Zero cost — local SQLite storage, works fully offline
Quick Start
# 一行命令配置 MCP(自动检测 Claude Desktop / Cursor / Windsurf / Cline)
npx aimemory-agent setup
# Or if installed globally
aimem setup
# Add a memory
aimem add "User prefers dark mode and minimal UI" --cat preference --imp 0.8
# Keyword search
aimem search "dark mode"
# Semantic search (finds related meanings)
aimem search -s "what does the user like"
# Export all memories
aimem export backup.json
# Import memories
aimem import backup.json
# Stats
aimem stats
# Apply memory decay
aimem decay
MCP Server
Auto Setup (Recommended)
aimem setup # 自动检测并配置所有已安装的客户端
aimem setup --force # 强制覆盖已有配置
aimem setup cursor # 只配置 Cursor
Manual Config
{
"mcpServers": {
"aimemory": {
"command": "node",
"args": ["path/to/aimemory/src/mcp-server.js"]
}
}
}
Available Tools
| Tool | Description |
|---|---|
memory_add |
Store a new memory |
memory_search |
Keyword search |
memory_semantic_search |
Semantic similarity search |
memory_forget |
Delete a memory |
memory_extract |
Auto-extract memories from text |
memory_rebuild_index |
Rebuild vector index |
memory_auto |
Auto-extract & save memories from conversation summary |
memory_stats |
Get statistics |
Architecture
CLI / MCP Server
↓
MemoryEngine (memory.js)
├── Keyword search (FTS5 + LIKE)
├── Semantic search (Gemini embedding + TF-IDF fallback)
├── Memory decay (forgetting curve)
└── Entity relations
↓
SQLite (db.js)
Dual Search Engine
- Gemini embedding (3072-dim) — real semantic understanding, cross-language
- TF-IDF fallback — zero-dependency, works offline
- Gemini is used when API key is available; TF-IDF kicks in automatically otherwise
Zero Dependencies
Only uses Node.js built-in modules. No node_modules needed for core functionality.
Data Storage
Default: ~/.aimemory/memories.db
Override with:
export AIMEM_DB=/path/to/your/memories.db
Roadmap
- [x] Core engine (storage + search + extraction + decay)
- [x] Semantic search (dual engine)
- [x] MCP Server
- [x] CLI with export/import
- [ ] npm package publish
- [ ] Web Dashboard
- [ ] Cloud sync
- [ ] Chrome extension
- [ ] Obsidian plugin
License
MIT
中文说明
让你的AI真正记住你。
AI Agent 记忆服务 — 跨平台、跨模型、你完全掌控。
功能
- 🧠 智能记忆提取 — 自动从对话中抽取值得记住的信息
- 🔍 语义搜索 — 双引擎:Gemini embedding(跨语言)+ TF-IDF(离线兜底)
- 📂 自动分类 — 人物、偏好、决策、事件、知识
- ⏰ 记忆衰减 — 模拟人类遗忘曲线
- 🔌 MCP协议 — 任何支持MCP的AI agent都能接入
- 💰 零成本 — 本地SQLite,零外部依赖
快速使用
# 一行命令配置 MCP
aimem setup
aimem add "用户喜欢简洁的UI" --cat preference --imp 0.8
aimem search -s "用户喜欢什么"
aimem export backup.json
aimem import backup.json
详细用法见上方英文文档。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.