用途
Memory Integration 用于在多次会话之间维持上下文。其核心原则是:会话之间没有记忆,必须使用这些工具来记住信息。它整合两套记忆系统:
- Episodic Memory:对话历史搜索。
- Knowledge Graph(mcp__memory):结构化事实与关系。
何时使用记忆
| 时机 | 记忆操作 |
|---|---|
| 会话开始 | 搜索相关上下文 |
| 开始 issue 前 | 搜索以往工作 |
| 做决策时 | 检查过去的决策 |
| 完成工作时 | 存储重要经验 |
| 会话结束 | 存储关键成果 |
Episodic Memory
存储内容
- 完整对话历史
- 做出的决策
- 解决的问题
- 尝试过的方法
- 学到的经验
搜索 Episodic Memory
使用 episodic-memory 技能或 MCP 工具,可搜索:
- Issue 编号:"issue 123"、"#123"
- 功能名称:"authentication"、"user login"
- 问题类型:"TypeScript error"、"build failure"
- 项目名称:仓库名
语义搜索(单查询):
// Search with natural language
mcp__plugin_episodic-memory_episodic-memory__search({
query: "user authentication implementation decisions"
})
精确搜索(多概念):
// Search for intersection of concepts
mcp__plugin_episodic-memory_episodic-memory__search({
query: ["authentication", "session", "JWT"]
})
读取完整对话:
// Read the full conversation
mcp__plugin_episodic-memory_episodic-memory__read({
path: "/path/to/conversation.jsonl"
})
搜索什么
| 情境 | 搜索词 |
|---|---|
| 开始 issue #123 | "issue 123"、"#123" |
| 处理 auth | "authentication"、"login"、"session" |
| TypeScript 问题 | "TypeScript"、"type error"、具体错误信息 |
| 类似功能 | 功能名称、相关概念 |
Knowledge Graph(mcp__memory)
存储内容
- 实体(Projects、Issues、Decisions、Patterns)
- 实体之间的关系
- 关于实体的观察
创建实体
// Create an entity for a project decision
mcp__memory__create_entities({
entities: [{
name: "Decision: Use JWT for Auth",
entityType: "Decision",
observations: [
"Decided on 2024-12-01",
"JWT chosen over sessions for API statelessness",
"Related to issue #123",
"Implementation in src/auth/jwt.ts"
]
}]
})
创建关系
// Create relationships
mcp__memory__create_relations({
relations: [
{
from: "Project: MyApp",
to: "Decision: Use JWT for Auth",
relationType: "has_decision"
},
{
from: "Issue #123",
to: "Decision: Use JWT for Auth",
relationType: "resulted_in"
}
]
})
搜索图谱
// Search for relevant nodes
mcp__memory__search_nodes({
query: "authentication"
})
// Open specific nodes
mcp__memory__open_nodes({
names: ["Decision: Use JWT for Auth"]
})
// Read entire graph (for small graphs)
mcp__memory__read_graph({})
记忆协议
会话开始时
搜索 episodic memory:
- 当前 issue 编号
- 项目/仓库名称
- 正在处理的活跃功能
搜索知识图谱:
- 项目实体
- 相关决策
- 已知模式
在继续之前综合上下文。
工作过程中
随时存储:
| 事件 | 存储位置 |
|---|---|
| 重大决策 | 知识图谱实体 |
| 解决的问题 | 向 issue 实体添加观察 |
| 发现的模式 | 知识图谱实体 |
| 学到的经验 | 添加观察 |
会话结束时
更新知识图谱:
- 新做出的决策
- 解决的问题
- 发现的模式
向已有实体添加观察:
- issue 进展
- 经验
- 下一步
实体类型
知识图谱建议的实体类型:
| 类型 | 用途 | 示例 |
|---|---|---|
| Project | 仓库/代码库 | "Project: MyApp" |
| Issue | GitHub issues | "Issue #123: Auth" |
| Decision | 架构决策 | "Decision: Use JWT" |
| Pattern | 代码模式 | "Pattern: Repository Layer" |
| Problem | 已知问题 | "Problem: Race Condition in X" |
| Person | 协作者 | "Person: Alice (maintainer)" |
示例:Issue 记忆流程
会话 1:开始 Issue
// Search for any previous context
const episodic = await search("issue 456 user profile");
const graph = await search_nodes("user profile");
// If nothing found, create fresh entity
await create_entities({
entities: [{
name: "Issue #456: User Profile Page",
entityType: "Issue",
observations: [
"Started: 2024-12-01",
"Scope: Profile display, edit, avatar upload"
]
}]
});
会话 1:工作中决策
// Store a decision made
await add_observations({
observations: [{
entityName: "Issue #456: User Profile Page",
contents: [
"Decision: Using react-image-crop for avatar cropping",
"Reason: Best mobile support, active maintenance"
]
}]
});
会话 2:恢复工作
// Search for context
const results = await search("issue 456");
// Read: "Using react-image-crop for avatar cropping"
// Continue with context maintained
存储什么
始终存储
- 带理由的架构决策
- 非显而易见的问题解决方案
- 发现的重要约束
- 组件之间的依赖关系
不要存储
- 琐碎的实现细节
- 从代码中显而易见的内容
- 临时调试笔记
- 没有结论的推测
检查清单
会话开始时:
- 在 episodic memory 中搜索 issue/项目
- 在知识图谱中搜索上下文
- 记录相关发现
工作过程中:
- 存储重大决策
- 记录问题解决方案
- 记录发现的模式
会话结束时:
- 用进展更新实体
- 添加新经验
- 记录下一步
集成
此技能被以下调用:
- session-start - 初始上下文收集
- issue-driven-development - 第 4 步
此技能支持:
- 跨会话连续性
- 决策文档化
- 模式发现
限制
资料未提供关于收费、价格、平台支持范围、性能效果或具体安装步骤的说明,暂未提供。