@@ -5,73 +5,153 @@ description: 手动添加新的记忆到系统中
55
66# Step: 存储记忆
77
8- ## EXECUTION RULES
8+ ## ⚠️ CRITICAL RULE
99
10- - ✅ Get content from user if not provided
11- - ✅ Classify and route to correct storage
12- - ✅ Confirm before storing
10+ ** MUST classify EVERY piece of information into project-level OR user-level BEFORE storing!**
11+
12+ - ** 项目级** → Write to ` _omp/memory/*.md ` or ` decisions.yaml ` files
13+ - ** 用户级** → Call ` add_memories_openmemory ` MCP tool
14+
15+ ** DO NOT store everything to openmemory! Project-specific info MUST go to ` _omp/memory/ ` !**
16+
17+ ---
18+
19+ ## CLASSIFICATION RULES (MANDATORY)
20+
21+ ### 项目级 → ` _omp/memory/ ` (Write to files)
22+
23+ | Info Type | Target File | Examples |
24+ | -----------| -------------| ----------|
25+ | 项目概述、目标、范围 | ` projectbrief.md ` | "这是一个简历生成器项目" |
26+ | 产品需求、用户故事 | ` productContext.md ` | "用户需要导出 PDF" |
27+ | 技术栈、框架、依赖 | ` techContext.md ` | "使用 React + TypeScript" |
28+ | 部署 URL、环境变量、路径 | ` techContext.md ` | "部署到 vercel.app" |
29+ | 架构决策、技术选型 | ` decisions.yaml ` | "选择 PostgreSQL 而非 MongoDB" |
30+ | 代码规范、设计模式 | ` systemPatterns.md ` | "使用 Repository 模式" |
31+ | 当前任务、进度 | ` activeContext.md ` | "正在实现登录功能" |
32+ | 里程碑、完成状态 | ` progress.md ` | "v1.0 已发布" |
33+
34+ ### 用户级 → openmemory (MCP tool)
35+
36+ | Info Type | Examples |
37+ | -----------| ----------|
38+ | 用户偏好 | "我喜欢用 pnpm", "偏好函数式编程" |
39+ | 用户技能 | "熟悉 Python", "有 5 年 React 经验" |
40+ | 跨项目习惯 | "习惯用 Vim 键位", "喜欢暗色主题" |
41+ | 个人信息 | "我是全栈工程师", "在北京工作" |
1342
1443---
1544
1645## EXECUTION
1746
18- ### 1. Get Content
47+ ### Step 1: Get Content
1948
20- If user provided content in their command, use it directly.
21- Otherwise ask:
49+ If user provided content, use it. Otherwise ask:
2250> "请输入要存储的信息:"
2351
24- ### 2. Classify Information
52+ ### Step 2: MANDATORY Classification
53+
54+ ** For EACH piece of information, determine:**
2555
26- Analyze content and determine storage location:
56+ ```
57+ ┌─────────────────────────────────────────────────────────┐
58+ │ 这条信息是关于... │
59+ ├─────────────────────────────────────────────────────────┤
60+ │ ❓ 这个项目的配置/决策/架构? │
61+ │ → 项目级 → _omp/memory/{file}.md │
62+ │ │
63+ │ ❓ 用户个人的偏好/技能/习惯? │
64+ │ → 用户级 → openmemory │
65+ └─────────────────────────────────────────────────────────┘
66+ ```
2767
28- | Keywords | Storage | Action |
29- | ----------| ---------| --------|
30- | 项目路径, URL, 配置, deploy, domain | ` _omp/memory/ ` | Write to YAML |
31- | 选择, 决定, 使用, 采用 (技术决策) | ` _omp/memory/decisions.yaml ` | Append decision |
32- | 喜欢, 偏好, 习惯 (用户偏好) | openmemory | ` add_memories_openmemory ` |
33- | 熟悉, 擅长, 会用 (用户技能) | openmemory | ` add_memories_openmemory ` |
34- | Other | Ask user | - |
68+ ### Step 3: Show Classification Result
3569
36- ### 3. Confirm Storage
70+ Display classification for user confirmation:
3771
3872```
39- 📝 即将存储:
40-
41- 内容: "{content}"
42- 类型: {type}
43- 位置: {location}
73+ 📝 信息分类结果:
74+
75+ ┌─────────────────────────────────────────────────────────┐
76+ │ 📁 项目级 (_omp/memory/) │
77+ ├─────────────────────────────────────────────────────────┤
78+ │ 1. "部署到 vercel.app" → techContext.md │
79+ │ 2. "使用 React + TypeScript" → techContext.md │
80+ │ 3. "选择 PostgreSQL" → decisions.yaml │
81+ ├─────────────────────────────────────────────────────────┤
82+ │ 👤 用户级 (openmemory) │
83+ ├─────────────────────────────────────────────────────────┤
84+ │ 4. "熟悉 Python" → openmemory │
85+ │ 5. "偏好函数式编程" → openmemory │
86+ └─────────────────────────────────────────────────────────┘
4487
4588确认存储?[Y/n]
4689```
4790
48- ### 4. Execute Storage
91+ ### Step 4: Execute Storage
4992
50- ** For project-level:**
51- - Read existing YAML file
52- - Append new entry with timestamp
53- - Write back
93+ #### For 项目级 (MUST use file operations):
5494
55- ** For user-level:**
56- - Call ` add_memories_openmemory ` with content
95+ ** techContext.md example:**
96+ ``` markdown
97+ ## Tech Stack
5798
58- ### 5. Display Result
99+ | Category | Technology | Version |
100+ | ----------| ------------| ---------|
101+ | Language | TypeScript | 5.x |
102+ | Framework | React | 18.x |
103+ | Deployment | Vercel | - |
104+ ```
59105
106+ ** decisions.yaml example:**
107+ ``` yaml
108+ decisions :
109+ - id : dec-2026-02-03-001
110+ date : 2026-02-03
111+ title : " Database Selection"
112+ context : " Need complex queries"
113+ choice : " PostgreSQL"
114+ alternatives : ["MongoDB", "MySQL"]
115+ impact : " All data models use SQL"
60116` ` `
61- 💾 记忆已存储
62117
63- 类型: {type}
64- 内容: "{content}"
65- 位置: {location}
66- 时间: {timestamp}
118+ **Action:** Read file → Append/Update content → Write file
119+
120+ #### For 用户级:
121+
122+ **Action:** Call ` add_memories_openmemory` with content
123+
124+ # ## Step 5: Display Result
125+
67126```
127+ 💾 存储完成
128+
129+ 📁 项目级 (_ omp/memory/):
130+ ✓ techContext.md: 添加 2 条
131+ ✓ decisions.yaml: 添加 1 条
132+
133+ 👤 用户级 (openmemory):
134+ ✓ 添加 2 条记忆
135+
136+ 时间: 2026-02-03
137+ ```
138+
139+ ---
140+
141+ ## EXAMPLE: Batch Storage
142+
143+ User says: "存储一下:项目用 React,部署到 Vercel,我熟悉 TypeScript"
68144
69- ### 6. Batch Storage
145+ **Classification:**
146+ | Content | Type | Target |
147+ |---------|------|--------|
148+ | "项目用 React" | 项目技术栈 | `techContext.md` |
149+ | "部署到 Vercel" | 项目部署 | `techContext.md` |
150+ | "我熟悉 TypeScript" | 用户技能 | openmemory |
70151
71- If content contains multiple items (comma/semicolon separated):
72- - Split into individual items
73- - Classify each separately
74- - Store all with confirmation
152+ **Execution:**
153+ 1. Update `_omp/memory/techContext.md` with React + Vercel
154+ 2. Call `add_memories_openmemory("用户熟悉 TypeScript")`
75155
76156---
77157
0 commit comments