memory-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMemory Integration
记忆集成
Overview
概述
Use both memory systems to maintain context across sessions.
Core principle: You have no memory between sessions. Use these tools to remember.
Systems:
- Episodic Memory - Conversation history search
- Knowledge Graph (mcp__memory) - Structured facts and relationships
同时使用两种记忆系统来在会话间维持上下文。
核心原则: 会话之间没有默认记忆,需使用这些工具来留存信息。
系统组成:
- Episodic Memory - 对话历史检索
- 知识图谱(mcp__memory)- 结构化事实与关系
When to Use Memory
何时使用记忆功能
| Moment | Memory Action |
|---|---|
| Session start | Search for relevant context |
| Before starting issue | Search for previous work |
| Making decision | Check for past decisions |
| Completing work | Store important learnings |
| Session end | Store key outcomes |
| 场景 | 记忆操作 |
|---|---|
| 会话开始 | 检索相关上下文 |
| 开始处理问题前 | 检索过往工作记录 |
| 做决策时 | 查看过往决策 |
| 完成工作后 | 存储重要经验 |
| 会话结束 | 存储关键成果 |
Episodic Memory
Episodic Memory
What It Stores
存储内容
- Full conversation history
- Decisions made
- Problems solved
- Approaches tried
- Lessons learned
- 完整对话历史
- 已做出的决策
- 已解决的问题
- 尝试过的方案
- 积累的经验
Searching Episodic Memory
检索Episodic Memory
Use the episodic-memory skill or MCP tools:
Search for:
- Issue number: "issue 123", "#123"
- Feature name: "authentication", "user login"
- Problem type: "TypeScript error", "build failure"
- Project name: repository name使用episodic-memory技能或MCP工具:
检索关键词:
- 问题编号:"issue 123", "#123"
- 功能名称:"authentication", "user login"
- 问题类型:"TypeScript error", "build failure"
- 项目名称:仓库名称Semantic Search (Single Query)
语义检索(单查询)
javascript
// Search with natural language
mcp__plugin_episodic-memory_episodic-memory__search({
query: "user authentication implementation decisions"
})javascript
// 使用自然语言检索
mcp__plugin_episodic-memory_episodic-memory__search({
query: "user authentication implementation decisions"
})Precise Search (Multiple Concepts)
精准检索(多概念)
javascript
// Search for intersection of concepts
mcp__plugin_episodic-memory_episodic-memory__search({
query: ["authentication", "session", "JWT"]
})javascript
// 检索多个概念的交集
mcp__plugin_episodic-memory_episodic-memory__search({
query: ["authentication", "session", "JWT"]
})Reading Full Conversations
读取完整对话
After finding relevant results:
javascript
// Read the full conversation
mcp__plugin_episodic-memory_episodic-memory__read({
path: "/path/to/conversation.jsonl"
})找到相关结果后:
javascript
// 读取完整对话
mcp__plugin_episodic-memory_episodic-memory__read({
path: "/path/to/conversation.jsonl"
})What to Search For
检索方向
| Situation | Search Terms |
|---|---|
| Starting issue #123 | "issue 123", "#123" |
| Working on auth | "authentication", "login", "session" |
| TypeScript problem | "TypeScript", "type error", specific error message |
| Similar feature | Feature name, related concepts |
| 场景 | 检索关键词 |
|---|---|
| 开始处理issue #123 | "issue 123", "#123" |
| 处理认证功能 | "authentication", "login", "session" |
| TypeScript问题 | "TypeScript", "type error", 具体错误信息 |
| 类似功能 | 功能名称、相关概念 |
Knowledge Graph (mcp__memory)
知识图谱(mcp__memory)
What It Stores
存储内容
- Entities (Projects, Issues, Decisions, Patterns)
- Relationships between entities
- Observations about entities
- 实体(项目、问题、决策、模式)
- 实体间的关系
- 实体相关的观察记录
Creating Entities
创建实体
Store important facts:
javascript
// 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"
]
}]
})存储重要事实:
javascript
// 为项目决策创建实体
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"
]
}]
})Creating Relationships
创建关系
Link entities together:
javascript
// 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"
}
]
})关联不同实体:
javascript
// 创建关系
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"
}
]
})Searching the Graph
检索图谱
javascript
// 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({})javascript
// 检索相关节点
mcp__memory__search_nodes({
query: "authentication"
})
// 打开特定节点
mcp__memory__open_nodes({
names: ["Decision: Use JWT for Auth"]
})
// 读取完整图谱(适用于小型图谱)
mcp__memory__read_graph({})Memory Protocol
记忆协议
At Session Start
会话开始时
-
Search episodic memory for:
- Current issue number
- Project/repository name
- Active feature being worked on
-
Search knowledge graph for:
- Project entity
- Related decisions
- Known patterns
-
Synthesize context before proceeding
-
检索Episodic Memory:
- 当前问题编号
- 项目/仓库名称
- 正在开发的功能
-
检索知识图谱:
- 项目实体
- 相关决策
- 已知模式
-
合成上下文后再开展工作
During Work
工作过程中
Store as you go:
| Event | Store In |
|---|---|
| Major decision | Knowledge graph entity |
| Problem solved | Add observation to issue entity |
| Pattern discovered | Knowledge graph entity |
| Lesson learned | Add observation |
随时存储信息:
| 事件 | 存储位置 |
|---|---|
| 重大决策 | 知识图谱实体 |
| 问题解决 | 为问题实体添加观察记录 |
| 发现模式 | 知识图谱实体 |
| 积累经验 | 添加观察记录 |
At Session End
会话结束时
-
Update knowledge graph with:
- New decisions made
- Problems solved
- Patterns discovered
-
Add observations to existing entities:
- Progress on issues
- Learnings
- Next steps
-
更新知识图谱:
- 新增决策
- 已解决的问题
- 发现的新模式
-
为现有实体添加观察记录:
- 问题进展
- 积累的经验
- 下一步计划
Entity Types
实体类型
Suggested entity types for the knowledge graph:
| Type | Use For | Example |
|---|---|---|
| Project | Repository/codebase | "Project: MyApp" |
| Issue | GitHub issues | "Issue #123: Auth" |
| Decision | Architectural decisions | "Decision: Use JWT" |
| Pattern | Code patterns | "Pattern: Repository Layer" |
| Problem | Known issues | "Problem: Race Condition in X" |
| Person | Collaborators | "Person: Alice (maintainer)" |
知识图谱建议使用的实体类型:
| 类型 | 适用场景 | 示例 |
|---|---|---|
| Project | 仓库/代码库 | "Project: MyApp" |
| Issue | GitHub问题 | "Issue #123: Auth" |
| Decision | 架构决策 | "Decision: Use JWT" |
| Pattern | 代码模式 | "Pattern: Repository Layer" |
| Problem | 已知问题 | "Problem: Race Condition in X" |
| Person | 协作者 | "Person: Alice (maintainer)" |
Example: Issue Memory Flow
示例:问题记忆流程
Session 1: Starting Issue
会话1:开始处理问题
javascript
// 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"
]
}]
});javascript
// 检索过往上下文
const episodic = await search("issue 456 user profile");
const graph = await search_nodes("user profile");
// 若无结果,创建新实体
await create_entities({
entities: [{
name: "Issue #456: User Profile Page",
entityType: "Issue",
observations: [
"Started: 2024-12-01",
"Scope: Profile display, edit, avatar upload"
]
}]
});Session 1: Mid-Work Decision
会话1:工作中做出决策
javascript
// 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"
]
}]
});javascript
// 存储已做出的决策
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"
]
}]
});Session 2: Resuming
会话2:继续处理
javascript
// Search for context
const results = await search("issue 456");
// Read: "Using react-image-crop for avatar cropping"
// Continue with context maintainedjavascript
// 检索上下文
const results = await search("issue 456");
// 读取到:"Using react-image-crop for avatar cropping"
// 基于留存的上下文继续工作What to Store
存储建议
Always Store
需存储的内容
- Architectural decisions with rationale
- Non-obvious problem solutions
- Important constraints discovered
- Dependencies between components
- 带有决策依据的架构决策
- 非显而易见的问题解决方案
- 发现的重要约束
- 组件间的依赖关系
Don't Store
无需存储的内容
- Trivial implementation details
- Things obvious from code
- Temporary debugging notes
- Speculation without conclusion
- 琐碎的实现细节
- 代码中显而易见的内容
- 临时调试笔记
- 无结论的推测
Checklist
检查清单
At session start:
- Search episodic memory for issue/project
- Search knowledge graph for context
- Note relevant findings
During work:
- Store major decisions
- Record problem solutions
- Note discovered patterns
At session end:
- Update entities with progress
- Add new learnings
- Record next steps
会话开始时:
- 检索Episodic Memory获取问题/项目信息
- 检索知识图谱获取上下文
- 记录相关发现
工作过程中:
- 存储重大决策
- 记录问题解决方案
- 记录发现的模式
会话结束时:
- 更新实体的进展
- 添加新积累的经验
- 记录下一步计划
Integration
集成说明
This skill is called by:
- - Initial context gathering
session-start - - Step 4
issue-driven-development
This skill supports:
- Cross-session continuity
- Decision documentation
- Pattern discovery
本技能被以下功能调用:
- - 初始上下文收集
session-start - - 步骤4
issue-driven-development
本技能支持:
- 跨会话连续性
- 决策文档化
- 模式发现