openmemory-plus 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmemory-plus",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "Agent Memory Management CLI - Install, configure, and manage OpenMemory Plus",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,86 +1,6 @@
1
1
  ---
2
- description: '记忆管理入口 - 统一管理项目级和用户级记忆'
2
+ name: 'memory'
3
+ description: '记忆管理 - 统一管理项目级和用户级记忆'
3
4
  ---
4
5
 
5
- # /memory
6
-
7
- OpenMemory Plus 记忆管理统一入口。
8
-
9
- ## 行为
10
-
11
- 当用户输入 `/memory` 时:
12
-
13
- 1. **快速状态检测**
14
- - 读取 `_omp/.memory/` 目录状态
15
- - 调用 `list_memories_openmemory` 获取用户记忆数量
16
-
17
- 2. **显示菜单**
18
-
19
- ```
20
- 📊 记忆管理系统
21
-
22
- 当前状态快览:
23
- ├── 项目级 (_omp/.memory/): {n} 个文件
24
- └── 用户级 (openmemory): {n} 条记忆
25
-
26
- 选择操作:
27
-
28
- 1. 📋 查看状态 - 详细记忆状态
29
- 2. 🔍 搜索记忆 - 语义搜索
30
- 3. 💾 存储记忆 - 手动添加
31
- 4. 🧹 清理记忆 - 清理 ROT
32
- 5. 🔄 同步检查 - 冲突检测
33
- 6. ⏰ 衰减分析 - 时间衰减
34
- 7. 🔗 知识图谱 - 实体关系
35
-
36
- 输入数字,或直接描述你的需求:
37
- ```
38
-
39
- 3. **等待用户输入**
40
-
41
- ## 路由逻辑
42
-
43
- 根据用户输入路由到对应子文件:
44
-
45
- | 输入 | 意图关键词 | 加载文件 |
46
- |------|-----------|----------|
47
- | `1` | 状态、概览、overview | `./memory-actions/status.md` |
48
- | `2` | 搜索、找、查、search | `./memory-actions/search.md` |
49
- | `3` | 存储、记住、保存、store | `./memory-actions/store.md` |
50
- | `4` | 清理、删除、过期、clean | `./memory-actions/clean.md` |
51
- | `5` | 同步、冲突、检查、sync | `./memory-actions/sync.md` |
52
- | `6` | 衰减、aging、decay | `./memory-actions/decay.md` |
53
- | `7` | 图谱、关系、依赖、graph | `./memory-actions/graph.md` |
54
-
55
- ## 自然语言兼容
56
-
57
- 用户也可以直接描述需求,Agent 根据意图关键词路由:
58
-
59
- - "搜索一下部署配置" → 加载 search.md
60
- - "清理过期的记忆" → 加载 clean.md
61
- - "这个项目用 React" → 加载 store.md
62
- - "查看记忆衰减状态" → 加载 decay.md
63
-
64
- ## MCP 工具
65
-
66
- Agent 可使用以下工具:
67
-
68
- | 工具 | 用途 |
69
- |------|------|
70
- | `add_memories_openmemory` | 添加用户级记忆 |
71
- | `search_memory_openmemory` | 语义搜索记忆 |
72
- | `list_memories_openmemory` | 列出所有记忆 |
73
- | `delete_memories_openmemory` | 删除指定记忆 |
74
-
75
- ## 项目级记忆
76
-
77
- 直接读写 `_omp/.memory/` 目录下的 YAML 文件:
78
-
79
- - `project.yaml` - 项目配置
80
- - `decisions.yaml` - 技术决策
81
- - `changelog.yaml` - 变更历史
82
-
83
- ## 返回菜单
84
-
85
- 每个子动作完成后,提示用户:
86
- > "还需要其他操作吗?输入 `/memory` 返回菜单"
6
+ IT IS CRITICAL THAT YOU FOLLOW THIS COMMAND: LOAD the FULL @{project-root}/_omp/workflows/memory/workflow.md, READ its entire contents and follow its directions exactly!
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: clean
3
+ description: 清理过期、冗余或琐碎的记忆 (ROT)
4
+ ---
5
+
6
+ # Step: 清理记忆
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Analyze all memories for ROT
11
+ - ✅ Show candidates before deletion
12
+ - ✅ Require user confirmation
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Get All Memories
19
+
20
+ Call `list_memories_openmemory` to get all user memories.
21
+
22
+ ### 2. Analyze ROT
23
+
24
+ Identify cleanup candidates:
25
+
26
+ | Type | Definition | Detection |
27
+ |------|------------|-----------|
28
+ | **Redundant** (冗余) | 重复或相似 | 语义相似度 > 0.9 |
29
+ | **Outdated** (过时) | 超过 90 天 | 创建时间 > 90 days |
30
+ | **Trivial** (琐碎) | 无实际价值 | 内容 < 10 chars or too generic |
31
+
32
+ ### 3. Display Candidates
33
+
34
+ ```
35
+ 🧹 清理候选记忆
36
+
37
+ 以下记忆可能需要清理:
38
+
39
+ ⚠️ Outdated (过时):
40
+ {foreach outdated}
41
+ {n}. "{content}"
42
+ 创建: {days_ago} 天前
43
+ {/foreach}
44
+
45
+ ⚠️ Redundant (冗余):
46
+ {foreach redundant}
47
+ {n}. "{content}" (与 "{similar_to}" 相似)
48
+ {/foreach}
49
+
50
+ ⚠️ Trivial (琐碎):
51
+ {foreach trivial}
52
+ {n}. "{content}"
53
+ {/foreach}
54
+
55
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
+
57
+ 操作选项:
58
+ - "全部删除" - 删除所有候选
59
+ - "删除 1,2,3" - 删除指定项
60
+ - "取消" - 不删除
61
+ ```
62
+
63
+ ### 4. Execute Deletion
64
+
65
+ Based on user selection:
66
+ - Get memory IDs to delete
67
+ - Call `delete_memories_openmemory` with IDs
68
+ - Display deletion result
69
+
70
+ ### 5. Display Result
71
+
72
+ ```
73
+ 🗑️ 清理完成
74
+
75
+ 已删除 {n} 条记忆
76
+ 释放空间: {estimated_size}
77
+ ```
78
+
79
+ ---
80
+
81
+ ## SAFETY
82
+
83
+ - ⚠️ NEVER delete without user confirmation
84
+ - ⚠️ Show content preview before deletion
85
+ - ⚠️ Support selective deletion
86
+
87
+ ---
88
+
89
+ ## RETURN TO MENU
90
+
91
+ 完成后提示:
92
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: decay
3
+ description: 分析记忆的时间衰减状态
4
+ ---
5
+
6
+ # Step: 衰减分析
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Calculate decay scores for all memories
11
+ - ✅ Group by decay status
12
+ - ✅ Provide actionable recommendations
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Get All Memories
19
+
20
+ Call `list_memories_openmemory` to get all user memories with timestamps.
21
+
22
+ ### 2. Calculate Decay Scores
23
+
24
+ For each memory, calculate decay score based on:
25
+ - Days since creation
26
+ - Content importance (keywords)
27
+
28
+ **Simplified formula:**
29
+ ```
30
+ score = max(0, 1 - (daysSinceCreation / 180))
31
+ ```
32
+
33
+ ### 3. Classify by Status
34
+
35
+ | Status | Score Range | Meaning |
36
+ |--------|-------------|---------|
37
+ | 🟢 Active | 0.7 - 1.0 | 活跃,近期创建 |
38
+ | 🟡 Aging | 0.3 - 0.7 | 老化,需要关注 |
39
+ | 🔴 Stale | 0.1 - 0.3 | 陈旧,考虑清理 |
40
+ | ⚫ Cleanup | 0 - 0.1 | 待清理 |
41
+
42
+ ### 4. Display Analysis
43
+
44
+ ```
45
+ ⏰ 记忆衰减分析
46
+
47
+ 📊 总览: {total} 条记忆
48
+
49
+ 🟢 Active ({n}条) {progress_bar} {percent}%
50
+ {foreach top_3}
51
+ ├── {content} [{score}]
52
+ {/foreach}
53
+ └── ... (输入 "展开 active" 查看全部)
54
+
55
+ 🟡 Aging ({n}条) {progress_bar} {percent}%
56
+ {foreach all}
57
+ ├── {content} [{score}]
58
+ {/foreach}
59
+
60
+ 🔴 Stale ({n}条) {progress_bar} {percent}%
61
+ {foreach all}
62
+ └── {content} [{score}]
63
+ {/foreach}
64
+
65
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
+
67
+ 💡 建议:
68
+ {recommendations}
69
+ ```
70
+
71
+ ### 5. Follow-up Actions
72
+
73
+ - `"清理 stale"` → Delete all Stale memories
74
+ - `"刷新 N"` → Update memory (re-add to refresh)
75
+ - `"展开 {status}"` → Show all in category
76
+
77
+ ---
78
+
79
+ ## RETURN TO MENU
80
+
81
+ 完成后提示:
82
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: graph
3
+ description: 查看记忆中的实体关系图谱
4
+ ---
5
+
6
+ # Step: 知识图谱
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Extract entities from memories
11
+ - ✅ Identify relationships
12
+ - ✅ Visualize in ASCII or Mermaid
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Read Graph Data
19
+
20
+ Check for existing `_omp/.memory/graph.yaml`:
21
+ - If exists, load entities and relations
22
+ - If not, initialize empty graph
23
+
24
+ ### 2. Extract Entities
25
+
26
+ From project and user memories, extract:
27
+
28
+ | Entity Type | Examples |
29
+ |-------------|----------|
30
+ | project | Project name |
31
+ | technology | TypeScript, React, Python |
32
+ | service | API, CLI, Web |
33
+ | database | Qdrant, PostgreSQL |
34
+ | config | tsconfig.json, package.json |
35
+ | preference | User preferences |
36
+
37
+ ### 3. Identify Relations
38
+
39
+ | Relation | Meaning |
40
+ |----------|---------|
41
+ | uses | A uses B |
42
+ | depends_on | A depends on B |
43
+ | configured_by | A configured by B |
44
+ | prefers | User prefers A |
45
+
46
+ ### 4. Display Graph
47
+
48
+ ```
49
+ 🔗 知识图谱
50
+
51
+ 项目: {project_name}
52
+
53
+ 实体关系:
54
+ ┌─────────────────────────────────────────┐
55
+ │ │
56
+ │ [{entity}] ──{relation}──> [{entity}] │
57
+ │ │ │
58
+ │ └──{relation}──> [{entity}] │
59
+ │ │
60
+ │ [User] ──prefers──> [{preference}] │
61
+ │ │
62
+ └─────────────────────────────────────────┘
63
+
64
+ 统计: {n} 个实体, {n} 个关系
65
+ ```
66
+
67
+ ### 5. Follow-up Actions
68
+
69
+ - `"添加关系"` → Add new entity relation
70
+ - `"查看 {entity}"` → Show all relations for entity
71
+ - `"导出 mermaid"` → Export as Mermaid diagram
72
+ - `"导出 dot"` → Export as DOT format
73
+
74
+ ### 6. Mermaid Export Format
75
+
76
+ ```mermaid
77
+ graph LR
78
+ A[CLI] -->|uses| B[TypeScript]
79
+ A -->|depends_on| C[Commander.js]
80
+ D[User] -->|prefers| E[中文]
81
+ ```
82
+
83
+ ---
84
+
85
+ ## RETURN TO MENU
86
+
87
+ 完成后提示:
88
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: search
3
+ description: 在项目级和用户级记忆中进行语义搜索
4
+ ---
5
+
6
+ # Step: 搜索记忆
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Get search query from user if not provided
11
+ - ✅ Search both project and user memory
12
+ - ✅ Display results with relevance scores
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Get Search Query
19
+
20
+ If user provided query in their command, use it directly.
21
+ Otherwise ask:
22
+ > "请输入搜索关键词:"
23
+
24
+ ### 2. Search User Memory
25
+
26
+ Call `search_memory_openmemory` with the query:
27
+ - Get matching memories with scores
28
+ - Sort by relevance
29
+
30
+ ### 3. Search Project Memory
31
+
32
+ Search `_omp/.memory/*.md` and `_omp/.memory/*.yaml` files:
33
+ - Grep for query keywords
34
+ - Match file content
35
+
36
+ ### 4. Display Results
37
+
38
+ ```
39
+ 🔍 搜索结果: "{query}"
40
+
41
+ 📁 项目级结果:
42
+ {foreach result}
43
+ {n}. [{filename}] {matched_content}
44
+ 匹配位置: 行 {line_number}
45
+ {/foreach}
46
+
47
+ 👤 用户级结果:
48
+ {foreach result}
49
+ {n}. {memory_content}
50
+ 相关度: {score} | 创建: {time_ago} | 状态: {decay_status}
51
+ {/foreach}
52
+
53
+ 共找到 {total} 条相关记忆
54
+ ```
55
+
56
+ ### 5. Follow-up Actions
57
+
58
+ 用户可继续操作:
59
+ - `"删除 N"` → 删除指定记忆
60
+ - `"详情 N"` → 展示完整内容
61
+ - `"更新 N"` → 修改记忆内容
62
+
63
+ ---
64
+
65
+ ## RETURN TO MENU
66
+
67
+ 完成后提示:
68
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: status
3
+ description: 查看项目级和用户级记忆的详细状态
4
+ ---
5
+
6
+ # Step: 查看记忆状态
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Execute all steps in order
11
+ - ✅ Display results clearly
12
+ - ✅ End with menu prompt
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Read Project-Level Memory
19
+
20
+ Read `_omp/.memory/` directory:
21
+ - List all files with last modified time
22
+ - Count total files
23
+
24
+ ### 2. Get User-Level Memory
25
+
26
+ Call `list_memories_openmemory`:
27
+ - Get all user memories
28
+ - Count by decay status (Active/Aging/Stale/Cleanup)
29
+
30
+ ### 3. Display Status
31
+
32
+ ```
33
+ 📊 记忆系统详细状态
34
+
35
+ 📁 项目级 (_omp/.memory/)
36
+ ├── project.yaml ({last_modified})
37
+ ├── decisions.yaml ({last_modified})
38
+ └── ... 共 {n} 个文件
39
+
40
+ 👤 用户级 (openmemory)
41
+ ├── 总记忆数: {total} 条
42
+ ├── 最近添加: "{latest_memory}" ({time_ago})
43
+ └── 衰减状态:
44
+ ├── 🟢 Active: {n} 条
45
+ ├── 🟡 Aging: {n} 条
46
+ ├── 🔴 Stale: {n} 条
47
+ └── ⚫ Cleanup: {n} 条
48
+
49
+ {status_message}
50
+ ```
51
+
52
+ ### 4. Status Message Logic
53
+
54
+ - If Cleanup > 0: `"⚠️ 有 {n} 条待清理记忆,建议执行清理"`
55
+ - If Stale > 3: `"💡 有较多陈旧记忆,建议检查是否仍需要"`
56
+ - Else: `"✅ 系统状态正常"`
57
+
58
+ ---
59
+
60
+ ## RETURN TO MENU
61
+
62
+ 完成后提示:
63
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: store
3
+ description: 手动添加新的记忆到系统中
4
+ ---
5
+
6
+ # Step: 存储记忆
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Get content from user if not provided
11
+ - ✅ Classify and route to correct storage
12
+ - ✅ Confirm before storing
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Get Content
19
+
20
+ If user provided content in their command, use it directly.
21
+ Otherwise ask:
22
+ > "请输入要存储的信息:"
23
+
24
+ ### 2. Classify Information
25
+
26
+ Analyze content and determine storage location:
27
+
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 | - |
35
+
36
+ ### 3. Confirm Storage
37
+
38
+ ```
39
+ 📝 即将存储:
40
+
41
+ 内容: "{content}"
42
+ 类型: {type}
43
+ 位置: {location}
44
+
45
+ 确认存储?[Y/n]
46
+ ```
47
+
48
+ ### 4. Execute Storage
49
+
50
+ **For project-level:**
51
+ - Read existing YAML file
52
+ - Append new entry with timestamp
53
+ - Write back
54
+
55
+ **For user-level:**
56
+ - Call `add_memories_openmemory` with content
57
+
58
+ ### 5. Display Result
59
+
60
+ ```
61
+ 💾 记忆已存储
62
+
63
+ 类型: {type}
64
+ 内容: "{content}"
65
+ 位置: {location}
66
+ 时间: {timestamp}
67
+ ```
68
+
69
+ ### 6. Batch Storage
70
+
71
+ If content contains multiple items (comma/semicolon separated):
72
+ - Split into individual items
73
+ - Classify each separately
74
+ - Store all with confirmation
75
+
76
+ ---
77
+
78
+ ## RETURN TO MENU
79
+
80
+ 完成后提示:
81
+ > "还需要存储其他信息吗?输入 **M** 返回菜单,或直接输入下一个操作"
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: sync
3
+ description: 检测项目级和用户级记忆之间的冲突
4
+ ---
5
+
6
+ # Step: 同步检查
7
+
8
+ ## EXECUTION RULES
9
+
10
+ - ✅ Compare project and user memories
11
+ - ✅ Identify conflicts and duplicates
12
+ - ✅ Guide user through resolution
13
+
14
+ ---
15
+
16
+ ## EXECUTION
17
+
18
+ ### 1. Read Project Memory
19
+
20
+ Read all files in `_omp/.memory/`:
21
+ - Extract key-value pairs from YAML files
22
+ - Extract topics from markdown files
23
+
24
+ ### 2. Search User Memory
25
+
26
+ Call `search_memory_openmemory` with project topics:
27
+ - Find related user memories
28
+ - Compare values
29
+
30
+ ### 3. Detect Conflicts
31
+
32
+ | Conflict Type | Example | Detection |
33
+ |---------------|---------|-----------|
34
+ | 值不一致 | Project: "npm" vs User: "pnpm" | Same topic, different value |
35
+ | 重复记录 | Both have deploy URL | Same info in both |
36
+ | 过期信息 | Project updated, user not | Timestamp comparison |
37
+
38
+ ### 4. Display Conflicts
39
+
40
+ ```
41
+ 🔄 同步检查结果
42
+
43
+ {if no_conflicts}
44
+ ✅ 无冲突,项目级和用户级记忆同步正常
45
+ {else}
46
+ 发现 {n} 个冲突:
47
+
48
+ {foreach conflict}
49
+ ⚠️ 冲突 {n}: {description}
50
+ ├── 📁 项目级: {project_value}
51
+ └── 👤 用户级: {user_value}
52
+
53
+ 建议: {recommendation}
54
+ 操作: [A] {option_a} [B] {option_b} [S] 跳过
55
+ {/foreach}
56
+ {/if}
57
+ ```
58
+
59
+ ### 5. Resolution Options
60
+
61
+ - `"全部自动"` - Apply all recommendations
62
+ - `"逐个处理"` - Handle one by one
63
+ - `"A/B/S"` - Per-conflict decision
64
+
65
+ ### 6. Execute Resolution
66
+
67
+ Based on user selection:
68
+ - Update or delete memories as needed
69
+ - Display summary of changes
70
+
71
+ ---
72
+
73
+ ## RETURN TO MENU
74
+
75
+ 完成后提示:
76
+ > "还需要其他操作吗?输入 **M** 返回菜单,或直接输入下一个操作"