remember
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRemember - Store Decisions and Patterns
Remember - 存储决策与模式
Store important decisions, patterns, or context in the knowledge graph for future sessions. Supports tracking success/failure outcomes for building a Best Practice Library.
将重要决策、模式或上下文存储在knowledge graph中,供后续会话使用。支持追踪成功/失败结果,用于构建最佳实践库。
Architecture
架构
The remember skill uses knowledge graph as storage:
- Knowledge Graph: Entity and relationship storage via and
mcp__memory__create_entities- FREE, zero-config, always worksmcp__memory__create_relations
Benefits:
- Zero configuration required - works out of the box
- Explicit relationship queries (e.g., "what does X use?")
- Cross-referencing between entities
- No cloud dependency
Automatic Entity Extraction:
- Extracts capitalized terms as potential entities (PostgreSQL, React, pgvector)
- Detects agent names (database-engineer, backend-system-architect)
- Identifies pattern names (cursor-pagination, connection-pooling)
- Recognizes "X uses Y", "X recommends Y", "X requires Y" relationship patterns
Remember技能使用knowledge graph作为存储:
- Knowledge Graph:通过和
mcp__memory__create_entities进行实体和关系存储 - 免费、零配置、随时可用mcp__memory__create_relations
优势:
- 无需配置,开箱即用
- 支持显式关系查询(例如:“X使用了什么?”)
- 实体间可交叉引用
- 无云依赖
自动实体提取:
- 提取大写术语作为潜在实体(PostgreSQL, React, pgvector)
- 检测Agent名称(database-engineer, backend-system-architect)
- 识别模式名称(cursor-pagination, connection-pooling)
- 识别“X uses Y”、“X recommends Y”、“X requires Y”这类关系模式
Usage
使用方法
Store Decisions (Default)
存储决策(默认)
/remember <text>
/remember --category <category> <text>
/remember --success <text> # Mark as successful pattern
/remember --failed <text> # Mark as anti-pattern
/remember --success --category <category> <text>/remember <文本内容>
/remember --category <分类> <文本内容>
/remember --success <文本内容> # 标记为成功模式
/remember --failed <文本内容> # 标记为反模式
/remember --success --category <分类> <文本内容>Agent-scoped memory
Agent专属记忆
/remember --agent <agent-id> <text> # Store in agent-specific scope
/remember --global <text> # Store as cross-project best practice
undefined/remember --agent <agent-id> <文本内容> # 存储在特定Agent的专属范围内
/remember --global <文本内容> # 存储为跨项目最佳实践
undefinedFlags
标记参数
| Flag | Behavior |
|---|---|
| (default) | Write to graph |
| Mark as successful pattern |
| Mark as anti-pattern |
| Set category |
| Scope memory to a specific agent |
| Store as cross-project best practice |
| 参数 | 行为 |
|---|---|
| (默认) | 写入图谱 |
| 标记为成功模式 |
| 标记为反模式 |
| 设置分类 |
| 将记忆限定在特定Agent范围内 |
| 存储为跨项目最佳实践 |
Categories
分类
- - Why we chose X over Y (default)
decision - - System design and patterns
architecture - - Code conventions and standards
pattern - - Known issues and workarounds
blocker - - Limitations and requirements
constraint - - User/team preferences
preference - - Pagination strategies
pagination - - Database patterns
database - - Auth approaches
authentication - - API design patterns
api - - Frontend patterns
frontend - - Performance optimizations
performance
- - 我们选择X而非Y的原因(默认)
decision - - 系统设计与模式
architecture - - 代码规范与标准
pattern - - 已知问题与解决方法
blocker - - 限制条件与需求
constraint - - 用户/团队偏好
preference - - 分页策略
pagination - - 数据库模式
database - - 认证方案
authentication - - API设计模式
api - - 前端模式
frontend - - 性能优化
performance
Outcome Flags
结果标记
- - Pattern that worked well (positive outcome)
--success - - Pattern that caused problems (anti-pattern)
--failed
If neither flag is provided, the memory is stored as neutral (informational).
- - 效果良好的模式(正向结果)
--success - - 引发问题的模式(反模式)
--failed
如果未提供任一标记,记忆将被存储为中性(仅信息性内容)。
Workflow
工作流程
1. Parse Input
1. 解析输入
Check for --success flag → outcome: success
Check for --failed flag → outcome: failed
Check for --category <category> flag
Check for --agent <agent-id> flag → agent_id: "ork:{agent-id}"
Check for --global flag → use global user_id
Extract the text to remember
If no category specified, auto-detect from content检查是否存在--success标记 → 结果:success
检查是否存在--failed标记 → 结果:failed
检查是否存在--category <分类>标记
检查是否存在--agent <agent-id>标记 → agent_id: "ork:{agent-id}"
检查是否存在--global标记 → 使用全局user_id
提取需要记忆的文本内容
如果未指定分类,从内容中自动检测2. Auto-Detect Category
2. 自动检测分类
| Keywords | Category |
|---|---|
| chose, decided, selected | decision |
| architecture, design, system | architecture |
| pattern, convention, style | pattern |
| blocked, issue, bug, workaround | blocker |
| must, cannot, required, constraint | constraint |
| pagination, cursor, offset, page | pagination |
| database, sql, postgres, query | database |
| auth, jwt, oauth, token, session | authentication |
| api, endpoint, rest, graphql | api |
| react, component, frontend, ui | frontend |
| performance, slow, fast, cache | performance |
| 关键词 | 分类 |
|---|---|
| chose, decided, selected | decision |
| architecture, design, system | architecture |
| pattern, convention, style | pattern |
| blocked, issue, bug, workaround | blocker |
| must, cannot, required, constraint | constraint |
| pagination, cursor, offset, page | pagination |
| database, sql, postgres, query | database |
| auth, jwt, oauth, token, session | authentication |
| api, endpoint, rest, graphql | api |
| react, component, frontend, ui | frontend |
| performance, slow, fast, cache | performance |
3. Extract Lesson (for anti-patterns)
3. 提取经验教训(针对反模式)
If outcome is "failed", look for:
- "should have", "instead use", "better to"
- If not found, prompt user: "What should be done instead?"
如果结果为“failed”,查找以下内容:
- "should have", "instead use", "better to"
- 如果未找到,提示用户:“应该改用什么方案?”
4. Extract Entities from Text
4. 从文本中提取实体
Step A: Detect entities:
1. Find capitalized terms (PostgreSQL, React, FastAPI)
2. Find agent names (database-engineer, backend-system-architect)
3. Find pattern names (cursor-pagination, connection-pooling)
4. Find technology keywords (pgvector, HNSW, RAG)Step B: Detect relationship patterns:
| Pattern | Relation Type |
|---|---|
| "X uses Y" | USES |
| "X recommends Y" | RECOMMENDS |
| "X requires Y" | REQUIRES |
| "X enables Y" | ENABLES |
| "X prefers Y" | PREFERS |
| "chose X over Y" | CHOSE_OVER |
| "X for Y" | USED_FOR |
步骤A:检测实体:
1. 查找大写术语(PostgreSQL, React, FastAPI)
2. 查找Agent名称(database-engineer, backend-system-architect)
3. 查找模式名称(cursor-pagination, connection-pooling)
4. 查找技术关键词(pgvector, HNSW, RAG)步骤B:检测关系模式:
| 模式 | 关系类型 |
|---|---|
| "X uses Y" | USES |
| "X recommends Y" | RECOMMENDS |
| "X requires Y" | REQUIRES |
| "X enables Y" | ENABLES |
| "X prefers Y" | PREFERS |
| "chose X over Y" | CHOSE_OVER |
| "X for Y" | USED_FOR |
5. Create Graph Entities (PRIMARY)
5. 创建图谱实体(核心步骤)
Use :
mcp__memory__create_entitiesjson
{
"entities": [
{
"name": "pgvector",
"entityType": "Technology",
"observations": ["Used for vector search", "From remember: '{original text}'"]
},
{
"name": "database-engineer",
"entityType": "Agent",
"observations": ["Recommends pgvector for RAG"]
}
]
}Entity Type Assignment:
- Capitalized single words ending in common suffixes: Technology (PostgreSQL, FastAPI)
- Words with hyphens matching agent pattern: Agent (database-engineer)
- Words with hyphens matching pattern names: Pattern (cursor-pagination)
- Project context: Project (current project name)
- Failed patterns: AntiPattern
使用:
mcp__memory__create_entitiesjson
{
"entities": [
{
"name": "pgvector",
"entityType": "Technology",
"observations": ["Used for vector search", "From remember: '{original text}'"]
},
{
"name": "database-engineer",
"entityType": "Agent",
"observations": ["Recommends pgvector for RAG"]
}
]
}实体类型分配:
- 以常见后缀结尾的大写单个单词:Technology(PostgreSQL, FastAPI)
- 符合Agent模式的带连字符单词:Agent(database-engineer)
- 符合模式名称的带连字符单词:Pattern(cursor-pagination)
- 项目上下文:Project(当前项目名称)
- 失败的模式:AntiPattern
6. Create Graph Relations
6. 创建图谱关系
Use :
mcp__memory__create_relationsjson
{
"relations": [
{
"from": "database-engineer",
"to": "pgvector",
"relationType": "RECOMMENDS"
},
{
"from": "pgvector",
"to": "RAG",
"relationType": "USED_FOR"
}
]
}使用:
mcp__memory__create_relationsjson
{
"relations": [
{
"from": "database-engineer",
"to": "pgvector",
"relationType": "RECOMMENDS"
},
{
"from": "pgvector",
"to": "RAG",
"relationType": "USED_FOR"
}
]
}7. Confirm Storage
7. 确认存储
For success:
✅ Remembered SUCCESS (category): "summary of text"
→ Stored in knowledge graph
→ Created entity: {entity_name} ({entity_type})
→ Created relation: {from} → {relation_type} → {to}
📊 Graph: {N} entities, {M} relationsFor failed:
❌ Remembered ANTI-PATTERN (category): "summary of text"
→ Stored in knowledge graph
→ Created entity: {anti-pattern-name} (AntiPattern)
💡 Lesson: {lesson if extracted}For neutral:
✓ Remembered (category): "summary of text"
→ Stored in knowledge graph
→ Created entity: {entity_name} ({entity_type})
📊 Graph: {N} entities, {M} relations成功结果:
✅ 已记录成功模式(分类):"文本摘要"
→ 已存储在knowledge graph中
→ 已创建实体:{entity_name} ({entity_type})
→ 已创建关系:{from} → {relation_type} → {to}
📊 图谱:{N}个实体,{M}个关系失败结果:
❌ 已记录反模式(分类):"文本摘要"
→ 已存储在knowledge graph中
→ 已创建实体:{anti-pattern-name} (AntiPattern)
💡 经验教训:{提取到的经验教训}中性结果:
✓ 已记录(分类):"文本摘要"
→ 已存储在knowledge graph中
→ 已创建实体:{entity_name} ({entity_type})
📊 图谱:{N}个实体,{M}个关系Examples
示例
Basic Remember (Graph Only)
基础记忆(仅图谱存储)
Input:
/remember Cursor-based pagination scales well for large datasetsOutput:
✓ Remembered (pagination): "Cursor-based pagination scales well for large datasets"
→ Stored in knowledge graph
→ Created entity: cursor-pagination (Pattern)
📊 Graph: 1 entity, 0 relations输入:
/remember Cursor-based pagination scales well for large datasets输出:
✓ 已记录(pagination):"Cursor-based pagination scales well for large datasets"
→ 已存储在knowledge graph中
→ 已创建实体:cursor-pagination (Pattern)
📊 图谱:1个实体,0个关系Anti-Pattern
反模式示例
Input:
/remember --failed Offset pagination caused timeouts on tables with 1M+ rowsOutput:
❌ Remembered ANTI-PATTERN (pagination): "Offset pagination caused timeouts on tables with 1M+ rows"
→ Stored in knowledge graph
→ Created entity: offset-pagination (AntiPattern)
💡 Lesson: Use cursor-based pagination for large datasets
📊 Graph: 1 entity, 0 relations输入:
/remember --failed Offset pagination caused timeouts on tables with 1M+ rows输出:
❌ 已记录反模式(pagination):"Offset pagination caused timeouts on tables with 1M+ rows"
→ 已存储在knowledge graph中
→ 已创建实体:offset-pagination (AntiPattern)
💡 经验教训:对大型数据集使用cursor-based pagination
📊 图谱:1个实体,0个关系Agent-Scoped Memory
Agent专属记忆示例
Input:
/remember --agent backend-system-architect Use connection pooling with min=5, max=20Output:
✓ Remembered (database): "Use connection pooling with min=5, max=20"
→ Stored in knowledge graph
→ Created entity: connection-pooling (Pattern)
→ Created relation: project → USES → connection-pooling
📊 Graph: 1 entity, 1 relation
🤖 Agent: backend-system-architect输入:
/remember --agent backend-system-architect Use connection pooling with min=5, max=20输出:
✓ 已记录(database):"Use connection pooling with min=5, max=20"
→ 已存储在knowledge graph中
→ 已创建实体:connection-pooling (Pattern)
→ 已创建关系:project → USES → connection-pooling
📊 图谱:1个实体,1个关系
🤖 Agent:backend-system-architectDuplicate Detection
重复检测
Before storing, search for similar patterns in graph:
- Query graph with for entity names
mcp__memory__search_nodes - If exact entity exists:
- Add observation to existing entity via
mcp__memory__add_observations - Inform user: "✓ Updated existing entity (added observation)"
- Add observation to existing entity via
- If similar pattern found with opposite outcome:
- Warn: "⚠️ This conflicts with an existing pattern. Store anyway?"
存储前,在图谱中搜索相似模式:
- 使用查询图谱中的实体名称
mcp__memory__search_nodes - 如果存在完全匹配的实体:
- 通过为现有实体添加观测记录
mcp__memory__add_observations - 告知用户:"✓ 已更新现有实体(添加观测记录)"
- 通过
- 如果发现结果相反的相似模式:
- 警告:"⚠️ 该模式与现有模式存在冲突。是否仍要存储?"
File-Based Memory Updates
基于文件的记忆更新
When updating or project memory files:
.claude/memory/MEMORY.md- PREFER Edit over Write to preserve existing content and avoid overwriting
- Use stable anchor lines: ,
## Recent Decisions,## Patterns## Preferences - See the skill's "Permission-Free File Operations" section for the full Edit pattern
memory - This applies to the calling agent's file operations, not to the knowledge graph operations above
更新或项目记忆文件时:
.claude/memory/MEMORY.md- 优先使用编辑而非覆盖,以保留现有内容,避免覆写
- 使用稳定的锚定行:,
## Recent Decisions,## Patterns## Preferences - 查看技能的“无权限文件操作”章节,了解完整的编辑模式
memory - 此规则适用于调用Agent的文件操作,而非上述knowledge graph操作
Related Skills
相关技能
- - Search, load, sync, visualize (read-side operations)
memory
- - 搜索、加载、同步、可视化(读取操作)
memory
Error Handling
错误处理
- If knowledge graph unavailable, show configuration instructions
- If text is empty, ask user to provide something to remember
- If text >2000 chars, truncate with notice
- If both --success and --failed provided, ask user to clarify
- If --agent used without agent-id, prompt for agent selection
- If entity extraction fails, create a generic Decision entity
- If relation creation fails (e.g., entity doesn't exist), create entities first then retry
- 如果knowledge graph不可用,显示配置说明
- 如果文本为空,提示用户提供需要记忆的内容
- 如果文本超过2000字符,截断并通知用户
- 如果同时提供--success和--failed标记,提示用户明确选择
- 如果使用--agent但未提供agent-id,提示用户选择Agent
- 如果实体提取失败,创建通用的Decision实体
- 如果关系创建失败(例如:实体不存在),先创建实体再重试