--- title: "MCP Memory Integration" type: source tags: [] date: 2026-05-02 --- ## Source File - [[Agent/agency-agents/integrations/mcp-memory/README.md]] ## Summary(用中文描述) - 核心主题:通过 MCP(Model Context Protocol)为 The Agency 中的任意 AI Agent 添加跨会话持久记忆能力 - 问题域:Agent 默认每次会话从零开始,缺乏记忆;多 Agent 间交接依赖手动 copy-paste,无法自动延续上下文 - 方法/机制:在 Agent 提示词中加入 Memory Integration 指令段,Agent 自动调用 MCP 内存工具(remember/recall/rollback/search);MCP Server 由外部提供,配置在 Claude Code/Cursor 等 MCP Client 中 - 结论/价值:无需修改 Agent 代码,只需在 prompt 中加入标准化的 Memory Integration 段落,即可实现跨会话记忆、交接延续和失败回滚;Rollback 是核心杀手级功能 ## Key Claims(用中文描述) - Agent 默认每次会话从零开始,缺乏上下文延续能力 - MCP Memory Server 提供 remember、recall、rollback、search 四个核心工具 - 只需在 Agent prompt 中加入 Memory Integration 段落,即可为任意 Agent 赋予持久记忆 - Rollback 是 MCP Memory 的杀手级功能:当 QA 检查失败或架构决策出错时,回滚到上一个已知良好状态,而非从头重建 - 标签一致性是关键:每次记忆都使用 Agent 名称和项目名称作为标签,确保 recall 可靠 - 无需修改 Agent 代码,无需编写 API 调用,MCP 工具处理所有持久化逻辑 ## Key Quotes > "Give any agent persistent memory across sessions using the Model Context Protocol (MCP)." — MCP Memory Integration 的设计目标 > "Rollback is the killer feature: When a Reality Checker fails a deliverable, the original agent can roll back to its last checkpoint instead of trying to manually undo changes." — Rollback 作为关键恢复机制的定位 > "No code changes to the agent files. No API calls to write. The MCP tools handle everything." — 零侵入性的集成方式 ## Key Concepts - [[Cross-Session-Memory]]:跨会话记忆能力,Agent 在新会话中能自动检索并恢复上一次的决策和上下文 - [[Handoff-Continuity]]:多 Agent 交接延续性,一个 Agent 完成任务后交接给下一个 Agent,后者能通过 MCP Memory 自动获取前者的交付物和待办,无需手动 copy-paste - [[Rollback]]:失败回滚机制,当 QA 检查失败或架构决策出错时,恢复到上一个已知良好状态 - [[Memory-Integration-Pattern]]:Memory Integration 段落——在 Agent prompt 中加入标准化指令,指导 Agent 在关键时机调用 MCP 内存工具(remember/recall/rollback/search) - [[MCP-Memory-Tools]]:MCP Memory Server 提供的四个核心工具——remember(存储记忆)、recall(检索记忆)、rollback(回滚状态)、search(跨 Agent 搜索记忆) - [[Checkpoint]]:检查点,Agent 在完成关键决策或交付物时存储的快照状态,供后续 rollback 使用 ## Key Entities - [[The-Agency]]:The Agency 多智能体编码框架,MCP Memory Integration 的应用目标 - [[MCP]]:Model Context Protocol,MCP Memory Integration 的底层协议,定义了 remember/recall/rollback/search 等内存工具的接口规范 - [[Backend-Architect]]:后端架构师 Agent,MCP Memory Integration 的具体应用示例(见 backend-architect-with-memory.md) - [[Startup-MVP-Workflow]]:创业 MVP 工作流,MCP Memory Integration 的完整工作流示例(见 workflow-with-memory.md) ## Connections - [[The-Agency]] ← enables ← [[Memory-Integration-Pattern]] - [[MCP]] ← provides_tools_for ← [[Cross-Session-Memory]] - [[MCP]] ← provides_tools_for ← [[Rollback]] - [[Backend-Architect]] ← enhanced_by ← [[MCP-Memory-Integration]] - [[Startup-MVP-Workflow]] ← enhanced_by ← [[MCP-Memory-Integration]] - [[Memory-Integration-Pattern]] ← uses ← [[MCP-Memory-Tools]] ## Contradictions - 无已知内容冲突