MemoryAI
核心原则
MemoryAI 通过本地存储大量持久化知识,并仅检索有界且高度相关的子集供 LLM 上下文使用,从而提供几乎无限的持久记忆。
传统 AI 工作流会将原始对话日志(80,000+ 令牌)直接灌入上下文窗口,导致 API 成本高昂、注意力退化与提示词漂移。MemoryAI 作为一个自主认知层运行,拦截对话事件、提取持久化决策,并在严格的令牌预算下动态分层组织上下文:
User Request / IDE Event
↓
Event Normalizer (session.*, task.*, file.*, decision.*)
↓
Policy Evaluator (ignore, observe, capture, review, immediate)
↓
Memory Orchestrator (Two-Phase Writes & Privacy Redaction)
↓
SQLite Engine (FTS5 BM25 + Dense Vectors + Version Ledger)
↓
Hybrid Retrieval & Multi-Factor Reranking
↓
Progressive Disclosure Context (Level 1 → Level 2 → Level 3 → Level 4)
↓
Strict Token Budget (300 / 500 / 1,000 / 2,000 tokens)
↓
LLMRelated MCP server: ContextKeep
主要亮点
零手动开销: MemoryAI 通过 Git/包清单自动检测项目身份,回忆相关上下文,捕获持久化决策,并生成会话交接记录。
通用跨客户端可移植性: 标准化对话事件(
MemoryAIConversationEvent)无缝桥接 Claude Code、Cursor、Codex、Gemini CLI、ChatGPT 和 MCP 客户端。MCP 2026 无状态核心与 Tasks 扩展: 完全兼容 MCP 2026 规范,支持无状态执行、显式应用句柄(
memoryContextId、taskId、handoffId、snapshotId)和后台任务管理。四级渐进式披露: 上下文渐进式构建——从 Level 1(150 令牌摘要) 和 Level 2(规范化事实) 一直到 Level 3(支撑证据) 和 Level 4(对话痕迹)。
记忆快照与历史差异: 获取时间点项目快照(
memoryai snapshot create)并跨架构决策检查历史差异(memoryai diff)。项目记忆健康诊断: 实时 0–100 健康评分,评估新鲜度、置信度、冲突率、来源完整性和交接完整性(
memoryai health)。隐私与两阶段写入: 在永久存储之前自动检测并编辑 RSA 私钥、AWS 访问密钥、JWT 令牌、连接字符串和个人身份信息 (PII)。
零停机嵌入迁移: 原子影子表向量索引,具备安全回滚能力(
memoryai embeddings migrate)。可移植的
.memorypack格式: 通过 SHA-256 完整性校验导出、备份和恢复持久化记忆。
快速开始
1. 安装
# Clone the repository
git clone https://github.com/memoryai/memoryai.git
cd memoryai
# Install dependencies and build monorepo packages
npm install
npm run build2. 运行 14 项诊断 Doctor
# Verify database, vector indexes, encryption, SSRF protection, and MCP tools
node cli/dist/bin.js doctor3. 基本用法(记住与回忆)
# Store a durable architectural decision
node cli/dist/bin.js remember "Architectural decision: Standardized on Fastify v4 and SQLite with WAL mode" --type decision --importance 0.95
# Recall bounded context with a 500 token budget
node cli/dist/bin.js recall "Fastify and SQLite database decisions" --max-tokens 500架构
MemoryAI Platform
│
┌────────────────────────┼────────────────────────┐
▼ ▼ ▼
AI Clients MCP 2026 Layer Local SDK & CLI
(Claude, Cursor, (Stateless HTTP/Stdio, (Node, Shell, API)
Gemini, Codex, GPT) Explicit Handles)
│ │ │
└────────────────────────┼────────────────────────┘
▼
Event Normalizer
(session.*, task.*, file.*, memory.*)
│
▼
Event Policy Engine
(ignore, observe, capture, review, immediate)
│
▼
Memory Orchestrator
┌────────────────────────┼────────────────────────┐
▼ ▼ ▼
Memory Brain & Memory Job & Tasks Progressive Context
Two-Phase Write Engine (Async Long-Running) (Level 1 - 4 Layers)
│ │ │
▼ ▼ ▼
Privacy Classifier & Integrity Checker & Semantic Cache &
Selective Encryption Health Monitor (0-100) Model Router
│ │ │
└────────────────────────┼────────────────────────┘
▼
SQLite Storage Engine
(Memories, Vectors, Versions, Snapshots, Tasks, Events, Sync Queue)事件驱动记忆
MemoryAI 自动响应 IDE 和智能体生命周期事件,无需手动干预:
# Emit an event to the MemoryAI pipeline
node cli/dist/bin.js remember "Project migrated to Angular 21 with standalone components" --type decision事件类型 | 策略动作 | 默认处理 |
|
| 立即持久化并标记为高重要性 |
|
| 通过 Memory Brain 评估处理 |
|
| 取代之前的依赖版本 |
|
| 存储为结构化会话连续性记录 |
|
| 若置信度较低,则隔离到审查队列 |
|
| 记录在本地事件日志中,不增加上下文负担 |
|
| 自动检测项目身份并准备交接记录 |
渐进式披露上下文
仅检索当前提示词所需的信息深度:
Level 1(摘要): 不超过 150 令牌的目标与关键事实执行摘要。
Level 2(规范化): 以安全的
<MEMORY_DATA>容器格式化的去重、高重要性记忆记录。Level 3(证据): 规范化记录附带来源出处、文件链接和时间戳元数据。
Level 4(对话): 在明确要求时深入检索原始片段痕迹。
# Recall Level 1 summary context
node cli/dist/bin.js recall "OAuth architecture" --max-tokens 300MCP 2026 与 Tasks 扩展
MemoryAI 通过 stdio 为 Claude Desktop、Claude Code、Cursor、Codex 以及任何 MCP 客户端提供完全合规的 MCP 服务器。
核心 MCP 工具(30 个活动工具):
memory_auto_context:自动项目检测、意图评估和有界记忆回忆。memory_recall:令牌有界的混合检索。memory_progressive_recall:多层级渐进式上下文披露。memory_remember:自主的持久化记忆捕获。task_create、task_get、task_cancel、task_list:用于后台作业的非阻塞 MCP 2026 Tasks 扩展。memory_snapshot_create、memory_snapshot_list、memory_snapshot_compare:时间点状态管理。memory_diff:历史记忆版本比较。memory_health:带有诊断明细的 0–100 项目健康评分。memory_review_queue:隔离记忆的检查与审查。memory_handoff_create、memory_handoff_get:跨多日的会话连续性。memory_share:限定范围并经过权限检查的共享。memory_explain、memory_explain_capture:检索与捕获的诊断解释。
快照与版本控制
# Create a point-in-time milestone snapshot
node cli/dist/bin.js snapshot create v1.0.0-release "Production release snapshot"
# List project snapshots
node cli/dist/bin.js snapshot list
# Compare two project snapshots
node cli/dist/bin.js snapshot compare snap_abc123 snap_def456
# View historical diff of a memory record
node cli/dist/bin.js diff mem_123 1 2健康与诊断
# Check 0-100 Project Memory Health score and diagnostic breakdown
node cli/dist/bin.js health
# Scan for orphaned vectors, broken provenance, or duplicate hashes
node cli/dist/bin.js verify
# Run automated conservative self-healing repair
node cli/dist/bin.js repair
# Calculate token economics and cloud API cost savings
node cli/dist/bin.js cost
# Run sandbox memory policy simulation
node cli/dist/bin.js simulate balanced
# Disaster recovery mode
node cli/dist/bin.js recovery安全与隐私架构
安全控制 | 实现方式 |
隐私分类器 | 自动拒绝/编辑私钥、AWS 凭证、JWT 令牌、数据库 URI 和个人身份信息 (PII) |
提示注入防护 | 严格的 |
租户与用户隔离 (IDOR) | 服务器在每个查询和变更上强制实施租户、用户和项目授权检查 |
SSRF 防御 | 校验 URL,阻止回环地址( |
存储加密 | 对敏感内容字段使用 AES-256-GCM 认证加密 |
限流器 | 内存滑动窗口令牌桶限流器 |
归档安全 | Zip-slip 目录穿越防护与解压炸弹比例限制 |
CLI 参考
命令 | 描述 |
| 初始化本地 |
| 显示本地记忆统计、项目身份和指标 |
| 存储持久化决策、偏好或事实 |
| 在严格的令牌限制下检索有界上下文 |
| 使用混合 FTS 与向量匹配搜索记忆 |
| 管理结构化会话交接记录 |
| 管理时间点项目快照 |
| 比较记忆记录的历史版本 |
| 项目记忆健康评分(0–100) |
| 扫描数据库以查找完整性问题 |
| 保守的自动化完整性修复 |
| 计算云端令牌缩减与成本节省 |
| 运行沙箱策略模拟 |
| 运行 14 项系统诊断 |
| 验证安全加固状态 |
| 将记忆导出为可移植的 |
| 从 |
测试与验证
# Run all 89 unit, integration, memory, retrieval, MCP, concurrency, and performance tests
npm test
# Run all 22 OWASP API Top 10 and Privacy Security tests
npm run test:security
# Run combined full test suite
npm run test:all许可证
MIT License。版权所有 (c) 2026 MemoryAI Contributors。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides AI agents with persistent, searchable memory that survives across conversations using semantic search, temporal versioning, and smart organization. Enables long-term context retention and cross-session continuity for AI assistants.14
- AlicenseNot gradedqualityAmaintenanceProvides infinite long-term memory for AI agents with persistent, searchable storage of project details, preferences, and snippets. Reduces token costs by retrieving only relevant memories while keeping all data stored locally.154MIT
- AlicenseNot gradedqualityAmaintenanceEnables persistent, portable memory for AI agents across sessions, devices, and providers with token-efficient 5-level lazy loading and automatic session capture.41MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to maintain persistent, local memory with retrieval-augmented search, knowledge graphs, and context surfacing, without any cloud dependencies.144MIT
Related MCP Connectors
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Persistent memory for AI agents — verbatim conversations, searchable by meaning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/toozuuu/MemoryAI'
If you have feedback or need assistance with the MCP directory API, please join our Discord server