openmemory-plus 1.1.0 → 1.2.3
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/dist/index.js +58 -38
- package/package.json +1 -1
- package/templates/augment/AGENTS.md +42 -22
- package/templates/claude/CLAUDE.md +31 -10
- package/templates/common/AGENTS.md +16 -8
- package/templates/cursor/.cursorrules +57 -33
- package/templates/gemini/gemini.md +42 -23
- package/templates/shared/_omp/commands/memory-actions/clean.md +54 -0
- package/templates/shared/_omp/commands/memory-actions/decay.md +64 -0
- package/templates/shared/_omp/commands/memory-actions/graph.md +75 -0
- package/templates/shared/_omp/commands/memory-actions/search.md +38 -0
- package/templates/shared/_omp/commands/memory-actions/status.md +35 -0
- package/templates/shared/_omp/commands/memory-actions/store.md +45 -0
- package/templates/shared/_omp/commands/memory-actions/sync.md +50 -0
- package/templates/shared/_omp/commands/memory.md +86 -0
- package/templates/shared/{skills → _omp/skills}/memory-extraction/SKILL.md +92 -51
- package/templates/shared/_omp/skills/memory-extraction/scripts/validate.sh +94 -0
- package/templates/shared/_omp/skills/memory-extraction/templates/decision.yaml.tmpl +32 -0
- package/templates/shared/_omp/skills/memory-extraction/templates/session.yaml.tmpl +35 -0
- package/templates/shared/commands/mem-clean.md +0 -117
- package/templates/shared/commands/mem-decay.md +0 -81
- package/templates/shared/commands/mem-extract.md +0 -84
- package/templates/shared/commands/mem-graph.md +0 -112
- package/templates/shared/commands/mem-search.md +0 -104
- package/templates/shared/commands/mem-status.md +0 -76
- package/templates/shared/commands/mem-sync.md +0 -106
- package/templates/shared/commands/memory.md +0 -89
- package/templates/shared/rules/classification.md +0 -108
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import ora from "ora";
|
|
|
9
9
|
import inquirer from "inquirer";
|
|
10
10
|
import { exec as exec2 } from "child_process";
|
|
11
11
|
import { promisify as promisify2 } from "util";
|
|
12
|
-
import { existsSync, mkdirSync, copyFileSync, writeFileSync, readdirSync } from "fs";
|
|
12
|
+
import { existsSync, mkdirSync, copyFileSync, writeFileSync, readdirSync, readFileSync } from "fs";
|
|
13
13
|
import { join, dirname } from "path";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
15
|
|
|
@@ -107,17 +107,17 @@ async function checkAllDependencies() {
|
|
|
107
107
|
return { docker, ollama, qdrant, openmemory, bgeM3 };
|
|
108
108
|
}
|
|
109
109
|
function isSystemReady(status) {
|
|
110
|
-
return status.docker.installed && status.docker.running && status.ollama.installed && status.ollama.running && status.qdrant.running && status.bgeM3.installed;
|
|
110
|
+
return status.docker.installed === true && status.docker.running === true && status.ollama.installed === true && status.ollama.running === true && status.qdrant.running === true && status.bgeM3.installed === true;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// src/commands/install.ts
|
|
114
114
|
var execAsync2 = promisify2(exec2);
|
|
115
115
|
var IDE_CONFIGS = {
|
|
116
|
-
augment: { dir: ".augment", configFile: "AGENTS.md", commandsDir: "commands", skillsDir: "skills"
|
|
117
|
-
claude: { dir: ".", configFile: "CLAUDE.md", commandsDir: ".claude/commands", skillsDir: ".claude/skills"
|
|
118
|
-
cursor: { dir: ".cursor", configFile: ".cursorrules", commandsDir: "commands", skillsDir: "skills"
|
|
119
|
-
gemini: { dir: ".", configFile: "gemini.md", commandsDir: ".gemini/commands", skillsDir: ".gemini/skills"
|
|
120
|
-
common: { dir: ".", configFile: "AGENTS.md", commandsDir: ".agents/commands", skillsDir: ".agents/skills"
|
|
116
|
+
augment: { dir: ".augment", configFile: "AGENTS.md", commandsDir: "commands", skillsDir: "skills" },
|
|
117
|
+
claude: { dir: ".", configFile: "CLAUDE.md", commandsDir: ".claude/commands", skillsDir: ".claude/skills" },
|
|
118
|
+
cursor: { dir: ".cursor", configFile: ".cursorrules", commandsDir: "commands", skillsDir: "skills" },
|
|
119
|
+
gemini: { dir: ".", configFile: "gemini.md", commandsDir: ".gemini/commands", skillsDir: ".gemini/skills" },
|
|
120
|
+
common: { dir: ".", configFile: "AGENTS.md", commandsDir: ".agents/commands", skillsDir: ".agents/skills" }
|
|
121
121
|
};
|
|
122
122
|
var BANNER = `
|
|
123
123
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
@@ -202,15 +202,22 @@ function getTemplatesDir() {
|
|
|
202
202
|
return possiblePaths[0];
|
|
203
203
|
}
|
|
204
204
|
function copyDir(src, dest) {
|
|
205
|
-
if (!existsSync(src))
|
|
205
|
+
if (!existsSync(src)) {
|
|
206
|
+
console.warn(chalk.yellow(` \u26A0 \u6E90\u76EE\u5F55\u4E0D\u5B58\u5728: ${src}`));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
206
209
|
mkdirSync(dest, { recursive: true });
|
|
207
210
|
for (const file of readdirSync(src, { withFileTypes: true })) {
|
|
208
211
|
const srcPath = join(src, file.name);
|
|
209
212
|
const destPath = join(dest, file.name);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
try {
|
|
214
|
+
if (file.isDirectory()) {
|
|
215
|
+
copyDir(srcPath, destPath);
|
|
216
|
+
} else {
|
|
217
|
+
copyFileSync(srcPath, destPath);
|
|
218
|
+
}
|
|
219
|
+
} catch (err) {
|
|
220
|
+
console.warn(chalk.yellow(` \u26A0 \u590D\u5236\u5931\u8D25: ${srcPath}`));
|
|
214
221
|
}
|
|
215
222
|
}
|
|
216
223
|
}
|
|
@@ -224,7 +231,7 @@ project:
|
|
|
224
231
|
description: ""
|
|
225
232
|
|
|
226
233
|
memory:
|
|
227
|
-
project_store: "
|
|
234
|
+
project_store: "_omp/.memory/"
|
|
228
235
|
user_store: "openmemory"
|
|
229
236
|
|
|
230
237
|
classification:
|
|
@@ -248,6 +255,10 @@ agent:
|
|
|
248
255
|
fallback_to_file: true
|
|
249
256
|
`;
|
|
250
257
|
}
|
|
258
|
+
function processTemplate(content, projectName) {
|
|
259
|
+
const now = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
260
|
+
return content.replace(/\{\{PROJECT_NAME\}\}/g, projectName).replace(/\{\{CREATED_AT\}\}/g, now);
|
|
261
|
+
}
|
|
251
262
|
function showMcpConfig(ide) {
|
|
252
263
|
console.log(chalk.bold("\n\u{1F4CB} MCP \u914D\u7F6E (\u590D\u5236\u5230 IDE \u914D\u7F6E\u6587\u4EF6):"));
|
|
253
264
|
const mcpConfig = {
|
|
@@ -369,32 +380,41 @@ async function phase2_initProject(options) {
|
|
|
369
380
|
}
|
|
370
381
|
const config = IDE_CONFIGS[ide];
|
|
371
382
|
console.log(chalk.bold("\n\u{1F4C1} \u521B\u5EFA\u914D\u7F6E\u6587\u4EF6...\n"));
|
|
372
|
-
const memoryDir = join(cwd, ".memory");
|
|
373
|
-
if (!existsSync(memoryDir)) {
|
|
374
|
-
mkdirSync(memoryDir, { recursive: true });
|
|
375
|
-
}
|
|
376
|
-
console.log(chalk.green(" \u2713 \u521B\u5EFA .memory/"));
|
|
377
|
-
const projectYaml = join(memoryDir, "project.yaml");
|
|
378
|
-
writeFileSync(projectYaml, generateProjectYaml(projectName));
|
|
379
|
-
console.log(chalk.green(" \u2713 \u521B\u5EFA .memory/project.yaml"));
|
|
380
383
|
const templatesDir = getTemplatesDir();
|
|
381
|
-
const
|
|
384
|
+
const ompTemplates = join(templatesDir, "shared", "_omp");
|
|
382
385
|
const ideTemplates = join(templatesDir, ide === "common" ? "common" : ide);
|
|
383
|
-
const
|
|
384
|
-
mkdirSync(
|
|
385
|
-
copyDir(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
386
|
+
const ompDir = join(cwd, "_omp");
|
|
387
|
+
mkdirSync(ompDir, { recursive: true });
|
|
388
|
+
copyDir(ompTemplates, ompDir);
|
|
389
|
+
console.log(chalk.green(" \u2713 \u521B\u5EFA _omp/ (\u6838\u5FC3\u76EE\u5F55)"));
|
|
390
|
+
const ompMemoryDir = join(ompDir, ".memory");
|
|
391
|
+
mkdirSync(ompMemoryDir, { recursive: true });
|
|
392
|
+
if (existsSync(ompMemoryDir)) {
|
|
393
|
+
const memoryFiles = readdirSync(ompMemoryDir);
|
|
394
|
+
for (const file of memoryFiles) {
|
|
395
|
+
const filePath = join(ompMemoryDir, file);
|
|
396
|
+
const content = readFileSync(filePath, "utf-8");
|
|
397
|
+
writeFileSync(filePath, processTemplate(content, projectName));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const projectYaml = join(ompMemoryDir, "project.yaml");
|
|
401
|
+
writeFileSync(projectYaml, generateProjectYaml(projectName));
|
|
402
|
+
console.log(chalk.green(" \u2713 \u521B\u5EFA _omp/.memory/project.yaml"));
|
|
403
|
+
const commandsCount = existsSync(join(ompDir, "commands")) ? readdirSync(join(ompDir, "commands")).filter((f) => f.endsWith(".md")).length : 0;
|
|
404
|
+
const actionsCount = existsSync(join(ompDir, "commands", "memory-actions")) ? readdirSync(join(ompDir, "commands", "memory-actions")).length : 0;
|
|
405
|
+
console.log(chalk.green(` \u2713 \u521B\u5EFA _omp/commands/ (${commandsCount} \u547D\u4EE4, ${actionsCount} \u5B50\u52A8\u4F5C)`));
|
|
406
|
+
console.log(chalk.green(" \u2713 \u521B\u5EFA _omp/skills/ (memory-extraction)"));
|
|
407
|
+
const ideDir = join(cwd, config.dir);
|
|
408
|
+
const ideCommandsDir = join(cwd, config.dir, config.commandsDir);
|
|
409
|
+
mkdirSync(ideCommandsDir, { recursive: true });
|
|
410
|
+
copyDir(join(ompDir, "commands"), ideCommandsDir);
|
|
411
|
+
console.log(chalk.green(` \u2713 \u590D\u5236\u5230 ${config.dir}/${config.commandsDir}/`));
|
|
412
|
+
const ideSkillsDir = join(cwd, config.dir, config.skillsDir);
|
|
413
|
+
mkdirSync(ideSkillsDir, { recursive: true });
|
|
414
|
+
copyDir(join(ompDir, "skills"), ideSkillsDir);
|
|
415
|
+
console.log(chalk.green(` \u2713 \u590D\u5236\u5230 ${config.dir}/${config.skillsDir}/`));
|
|
396
416
|
if (existsSync(ideTemplates)) {
|
|
397
|
-
copyDir(ideTemplates,
|
|
417
|
+
copyDir(ideTemplates, ideDir);
|
|
398
418
|
console.log(chalk.green(` \u2713 \u590D\u5236 ${config.configFile}`));
|
|
399
419
|
}
|
|
400
420
|
return ide;
|
|
@@ -404,8 +424,8 @@ function phase3_showCompletion(ide, showMcp) {
|
|
|
404
424
|
console.log(chalk.green.bold("\u{1F389} OpenMemory Plus \u5DF2\u6210\u529F\u5B89\u88C5!\n"));
|
|
405
425
|
console.log(chalk.bold("\u{1F4A1} \u4E0B\u4E00\u6B65:"));
|
|
406
426
|
console.log(chalk.gray(" 1. \u5728 IDE \u4E2D\u6253\u5F00\u9879\u76EE"));
|
|
407
|
-
console.log(chalk.gray(" 2. \u4F7F\u7528 ") + chalk.cyan("/memory") + chalk.gray(" \
|
|
408
|
-
console.log(chalk.gray(" 3. \
|
|
427
|
+
console.log(chalk.gray(" 2. \u4F7F\u7528 ") + chalk.cyan("/memory") + chalk.gray(" \u6253\u5F00\u8BB0\u5FC6\u7BA1\u7406\u83DC\u5355"));
|
|
428
|
+
console.log(chalk.gray(" 3. \u9009\u62E9\u64CD\u4F5C\u6216\u7528\u81EA\u7136\u8BED\u8A00\u63CF\u8FF0\u9700\u6C42"));
|
|
409
429
|
console.log("");
|
|
410
430
|
if (showMcp) {
|
|
411
431
|
showMcpConfig(ide);
|
package/package.json
CHANGED
|
@@ -4,40 +4,60 @@
|
|
|
4
4
|
|
|
5
5
|
## 快速使用
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**只需记住一个命令:**
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/memory
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
输入后会显示菜单,选择数字或用自然语言描述需求:
|
|
14
|
+
|
|
15
|
+
| 选项 | 说明 |
|
|
8
16
|
|------|------|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
17
|
+
| 1 | 📋 查看状态 - 详细记忆状态 |
|
|
18
|
+
| 2 | 🔍 搜索记忆 - 语义搜索 |
|
|
19
|
+
| 3 | 💾 存储记忆 - 手动添加 |
|
|
20
|
+
| 4 | 🧹 清理记忆 - 清理 ROT |
|
|
21
|
+
| 5 | 🔄 同步检查 - 冲突检测 |
|
|
22
|
+
| 6 | ⏰ 衰减分析 - 时间衰减 |
|
|
23
|
+
| 7 | 🔗 知识图谱 - 实体关系 |
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
**示例:**
|
|
26
|
+
- 输入 `2` 或 "搜索部署配置"
|
|
27
|
+
- 输入 `4` 或 "清理过期的记忆"
|
|
28
|
+
|
|
29
|
+
## 核心目录
|
|
17
30
|
|
|
18
31
|
```
|
|
19
|
-
|
|
20
|
-
├──
|
|
21
|
-
│ ├──
|
|
22
|
-
│
|
|
23
|
-
|
|
24
|
-
└──
|
|
25
|
-
|
|
26
|
-
├──
|
|
27
|
-
└──
|
|
32
|
+
_omp/ # OpenMemory Plus 核心目录
|
|
33
|
+
├── commands/
|
|
34
|
+
│ ├── memory.md # 主命令入口
|
|
35
|
+
│ └── memory-actions/ # 7 个子动作
|
|
36
|
+
├── skills/
|
|
37
|
+
│ └── memory-extraction/ # 自动提取 Skill
|
|
38
|
+
└── .memory/ # 项目级记忆
|
|
39
|
+
├── project.yaml # 项目配置 (SSOT)
|
|
40
|
+
└── *.md # 上下文文件
|
|
28
41
|
```
|
|
29
42
|
|
|
43
|
+
## 双层记忆架构
|
|
44
|
+
|
|
45
|
+
| 系统 | 存储位置 | 用途 |
|
|
46
|
+
|------|----------|------|
|
|
47
|
+
| 项目级 | `_omp/.memory/` | 项目配置、技术决策、变更记录 |
|
|
48
|
+
| 用户级 | `openmemory` MCP | 用户偏好、技能、跨项目上下文 |
|
|
49
|
+
|
|
30
50
|
## 自动行为
|
|
31
51
|
|
|
32
52
|
### 对话开始时
|
|
33
53
|
1. 搜索 `openmemory` 获取用户上下文
|
|
34
|
-
2. 加载
|
|
54
|
+
2. 加载 `_omp/.memory/project.yaml` 获取项目配置
|
|
35
55
|
3. 融合上下文提供个性化响应
|
|
36
56
|
|
|
37
57
|
### 对话结束时
|
|
38
58
|
1. 检测有价值信息
|
|
39
59
|
2. 按分类规则路由存储
|
|
40
|
-
3. 项目级 →
|
|
60
|
+
3. 项目级 → `_omp/.memory/`
|
|
41
61
|
4. 用户级 → `openmemory`
|
|
42
62
|
|
|
43
63
|
## MCP 工具
|
|
@@ -53,12 +73,12 @@ Agent 记忆系统
|
|
|
53
73
|
|
|
54
74
|
| 信息类型 | 存储位置 | 示例 |
|
|
55
75
|
|----------|----------|------|
|
|
56
|
-
| 项目配置 |
|
|
57
|
-
| 技术决策 |
|
|
76
|
+
| 项目配置 | `_omp/.memory/` | 部署 URL、路径 |
|
|
77
|
+
| 技术决策 | `_omp/.memory/` | 框架选择、架构 |
|
|
58
78
|
| 用户偏好 | `openmemory` | 语言、风格 |
|
|
59
79
|
| 用户技能 | `openmemory` | 熟悉的技术栈 |
|
|
60
80
|
|
|
61
|
-
详细规则见 `.
|
|
81
|
+
详细规则见 `.augment/skills/memory-extraction/SKILL.md`
|
|
62
82
|
|
|
63
83
|
---
|
|
64
84
|
*由 OpenMemory Plus CLI 生成 | https://github.com/Alenryuichi/openmemory-plus*
|
|
@@ -4,22 +4,44 @@
|
|
|
4
4
|
|
|
5
5
|
本项目已启用 OpenMemory Plus 双层记忆管理。
|
|
6
6
|
|
|
7
|
+
### 核心目录
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
_omp/ # OpenMemory Plus 核心目录
|
|
11
|
+
├── commands/
|
|
12
|
+
│ ├── memory.md # 主命令入口
|
|
13
|
+
│ └── memory-actions/ # 7 个子动作
|
|
14
|
+
├── skills/
|
|
15
|
+
│ └── memory-extraction/ # 自动提取 Skill
|
|
16
|
+
└── .memory/ # 项目级记忆
|
|
17
|
+
└── project.yaml # 项目配置 (SSOT)
|
|
18
|
+
```
|
|
19
|
+
|
|
7
20
|
### 命令入口
|
|
8
21
|
|
|
9
|
-
|
|
22
|
+
**只需记住一个命令:**
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/memory
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
输入后会显示菜单,选择数字或用自然语言描述需求:
|
|
29
|
+
|
|
30
|
+
| 选项 | 说明 |
|
|
10
31
|
|------|------|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
32
|
+
| 1 | 📋 查看状态 - 详细记忆状态 |
|
|
33
|
+
| 2 | 🔍 搜索记忆 - 语义搜索 |
|
|
34
|
+
| 3 | 💾 存储记忆 - 手动添加 |
|
|
35
|
+
| 4 | 🧹 清理记忆 - 清理 ROT |
|
|
36
|
+
| 5 | 🔄 同步检查 - 冲突检测 |
|
|
37
|
+
| 6 | ⏰ 衰减分析 - 时间衰减 |
|
|
38
|
+
| 7 | 🔗 知识图谱 - 实体关系 |
|
|
17
39
|
|
|
18
40
|
### 存储架构
|
|
19
41
|
|
|
20
42
|
| 系统 | 存储位置 | 用途 |
|
|
21
43
|
|------|----------|------|
|
|
22
|
-
| 项目级 |
|
|
44
|
+
| 项目级 | `_omp/.memory/` | 项目配置、技术决策、变更记录 |
|
|
23
45
|
| 用户级 | `openmemory` MCP | 用户偏好、技能、跨项目上下文 |
|
|
24
46
|
|
|
25
47
|
### 自动提取 (Memory Extraction)
|
|
@@ -27,7 +49,7 @@
|
|
|
27
49
|
对话结束时自动执行:
|
|
28
50
|
1. 检测有价值信息
|
|
29
51
|
2. 智能分类路由
|
|
30
|
-
3. 项目级 →
|
|
52
|
+
3. 项目级 → `_omp/.memory/`
|
|
31
53
|
4. 用户级 → `openmemory`
|
|
32
54
|
|
|
33
55
|
### MCP 工具
|
|
@@ -41,4 +63,3 @@
|
|
|
41
63
|
|
|
42
64
|
---
|
|
43
65
|
*由 OpenMemory Plus CLI 生成*
|
|
44
|
-
|
|
@@ -4,14 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
## 快速使用
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**只需记住一个命令:**
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/memory
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
输入后会显示菜单,选择数字或用自然语言描述需求:
|
|
14
|
+
|
|
15
|
+
| 选项 | 说明 |
|
|
8
16
|
|------|------|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
17
|
+
| 1 | 📋 查看状态 - 详细记忆状态 |
|
|
18
|
+
| 2 | 🔍 搜索记忆 - 语义搜索 |
|
|
19
|
+
| 3 | 💾 存储记忆 - 手动添加 |
|
|
20
|
+
| 4 | 🧹 清理记忆 - 清理 ROT |
|
|
21
|
+
| 5 | 🔄 同步检查 - 冲突检测 |
|
|
22
|
+
| 6 | ⏰ 衰减分析 - 时间衰减 |
|
|
23
|
+
| 7 | 🔗 知识图谱 - 实体关系 |
|
|
15
24
|
|
|
16
25
|
## 双层记忆架构
|
|
17
26
|
|
|
@@ -40,4 +49,3 @@
|
|
|
40
49
|
|
|
41
50
|
---
|
|
42
51
|
*由 OpenMemory Plus CLI 生成*
|
|
43
|
-
|
|
@@ -2,56 +2,80 @@
|
|
|
2
2
|
|
|
3
3
|
本项目已启用 OpenMemory Plus 双层记忆管理系统。
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
## 快速使用
|
|
6
|
+
|
|
7
|
+
**只需记住一个命令:**
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/memory
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
输入后会显示菜单,选择数字或用自然语言描述需求:
|
|
14
|
+
|
|
15
|
+
| 选项 | 说明 |
|
|
16
|
+
|------|------|
|
|
17
|
+
| 1 | 📋 查看状态 - 详细记忆状态 |
|
|
18
|
+
| 2 | 🔍 搜索记忆 - 语义搜索 |
|
|
19
|
+
| 3 | 💾 存储记忆 - 手动添加 |
|
|
20
|
+
| 4 | 🧹 清理记忆 - 清理 ROT |
|
|
21
|
+
| 5 | 🔄 同步检查 - 冲突检测 |
|
|
22
|
+
| 6 | ⏰ 衰减分析 - 时间衰减 |
|
|
23
|
+
| 7 | 🔗 知识图谱 - 实体关系 |
|
|
24
|
+
|
|
25
|
+
## 核心目录
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
_omp/ # OpenMemory Plus 核心目录
|
|
29
|
+
├── commands/
|
|
30
|
+
│ ├── memory.md # 主命令入口
|
|
31
|
+
│ └── memory-actions/ # 7 个子动作
|
|
32
|
+
├── skills/
|
|
33
|
+
│ └── memory-extraction/ # 自动提取 Skill
|
|
34
|
+
└── .memory/ # 项目级记忆
|
|
35
|
+
├── project.yaml # 项目配置 (SSOT)
|
|
36
|
+
└── *.md # 上下文文件
|
|
37
|
+
```
|
|
13
38
|
|
|
14
39
|
## 双层记忆架构
|
|
15
40
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
用户级 (openmemory MCP):
|
|
22
|
-
- 用户偏好 - 跨项目通用
|
|
23
|
-
- 用户技能 - 个人能力
|
|
24
|
-
- 对话上下文 - 历史记忆
|
|
41
|
+
| 系统 | 存储位置 | 用途 |
|
|
42
|
+
|------|----------|------|
|
|
43
|
+
| 项目级 | `_omp/.memory/` | 项目配置、技术决策、变更记录 |
|
|
44
|
+
| 用户级 | `openmemory` MCP | 用户偏好、技能、跨项目上下文 |
|
|
25
45
|
|
|
26
46
|
## 自动行为
|
|
27
47
|
|
|
28
|
-
|
|
29
|
-
1. 搜索 openmemory 获取用户上下文
|
|
30
|
-
2. 加载
|
|
48
|
+
### 对话开始时
|
|
49
|
+
1. 搜索 `openmemory` 获取用户上下文
|
|
50
|
+
2. 加载 `_omp/.memory/project.yaml` 获取项目配置
|
|
31
51
|
3. 融合上下文提供个性化响应
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
### 对话结束时
|
|
34
54
|
1. 检测有价值信息
|
|
35
55
|
2. 按分类规则路由存储
|
|
36
|
-
3. 项目级 →
|
|
37
|
-
4. 用户级 → openmemory
|
|
56
|
+
3. 项目级 → `_omp/.memory/`
|
|
57
|
+
4. 用户级 → `openmemory`
|
|
38
58
|
|
|
39
59
|
## MCP 工具
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
| 工具 | 用途 |
|
|
62
|
+
|------|------|
|
|
63
|
+
| `add_memories_openmemory` | 添加用户级记忆 |
|
|
64
|
+
| `search_memory_openmemory` | 语义搜索记忆 |
|
|
65
|
+
| `list_memories_openmemory` | 列出所有记忆 |
|
|
66
|
+
| `delete_memories_openmemory` | 删除指定记忆 |
|
|
45
67
|
|
|
46
68
|
## 分类规则
|
|
47
69
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
| 信息类型 | 存储位置 | 示例 |
|
|
71
|
+
|----------|----------|------|
|
|
72
|
+
| 项目配置 | `_omp/.memory/` | 部署 URL、路径 |
|
|
73
|
+
| 技术决策 | `_omp/.memory/` | 框架选择、架构 |
|
|
74
|
+
| 用户偏好 | `openmemory` | 语言、风格 |
|
|
75
|
+
| 用户技能 | `openmemory` | 熟悉的技术栈 |
|
|
52
76
|
|
|
53
|
-
详细规则见
|
|
77
|
+
详细规则见 `.cursor/skills/memory-extraction/SKILL.md`
|
|
54
78
|
|
|
55
79
|
---
|
|
56
|
-
|
|
80
|
+
*由 OpenMemory Plus CLI 生成 | https://github.com/Alenryuichi/openmemory-plus*
|
|
57
81
|
|
|
@@ -4,40 +4,60 @@
|
|
|
4
4
|
|
|
5
5
|
## 快速使用
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**只需记住一个命令:**
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/memory
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
输入后会显示菜单,选择数字或用自然语言描述需求:
|
|
14
|
+
|
|
15
|
+
| 选项 | 说明 |
|
|
8
16
|
|------|------|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
17
|
+
| 1 | 📋 查看状态 - 详细记忆状态 |
|
|
18
|
+
| 2 | 🔍 搜索记忆 - 语义搜索 |
|
|
19
|
+
| 3 | 💾 存储记忆 - 手动添加 |
|
|
20
|
+
| 4 | 🧹 清理记忆 - 清理 ROT |
|
|
21
|
+
| 5 | 🔄 同步检查 - 冲突检测 |
|
|
22
|
+
| 6 | ⏰ 衰减分析 - 时间衰减 |
|
|
23
|
+
| 7 | 🔗 知识图谱 - 实体关系 |
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
**示例:**
|
|
26
|
+
- 输入 `2` 或 "搜索部署配置"
|
|
27
|
+
- 输入 `4` 或 "清理过期的记忆"
|
|
28
|
+
|
|
29
|
+
## 核心目录
|
|
17
30
|
|
|
18
31
|
```
|
|
19
|
-
|
|
20
|
-
├──
|
|
21
|
-
│ ├──
|
|
22
|
-
│
|
|
23
|
-
|
|
24
|
-
└──
|
|
25
|
-
|
|
26
|
-
├──
|
|
27
|
-
└──
|
|
32
|
+
_omp/ # OpenMemory Plus 核心目录
|
|
33
|
+
├── commands/
|
|
34
|
+
│ ├── memory.md # 主命令入口
|
|
35
|
+
│ └── memory-actions/ # 7 个子动作
|
|
36
|
+
├── skills/
|
|
37
|
+
│ └── memory-extraction/ # 自动提取 Skill
|
|
38
|
+
└── .memory/ # 项目级记忆
|
|
39
|
+
├── project.yaml # 项目配置 (SSOT)
|
|
40
|
+
└── *.md # 上下文文件
|
|
28
41
|
```
|
|
29
42
|
|
|
43
|
+
## 双层记忆架构
|
|
44
|
+
|
|
45
|
+
| 系统 | 存储位置 | 用途 |
|
|
46
|
+
|------|----------|------|
|
|
47
|
+
| 项目级 | `_omp/.memory/` | 项目配置、技术决策、变更记录 |
|
|
48
|
+
| 用户级 | `openmemory` MCP | 用户偏好、技能、跨项目上下文 |
|
|
49
|
+
|
|
30
50
|
## 自动行为
|
|
31
51
|
|
|
32
52
|
### 对话开始时
|
|
33
53
|
1. 搜索 `openmemory` 获取用户上下文
|
|
34
|
-
2. 加载
|
|
54
|
+
2. 加载 `_omp/.memory/project.yaml` 获取项目配置
|
|
35
55
|
3. 融合上下文提供个性化响应
|
|
36
56
|
|
|
37
57
|
### 对话结束时
|
|
38
58
|
1. 检测有价值信息
|
|
39
59
|
2. 按分类规则路由存储
|
|
40
|
-
3. 项目级 →
|
|
60
|
+
3. 项目级 → `_omp/.memory/`
|
|
41
61
|
4. 用户级 → `openmemory`
|
|
42
62
|
|
|
43
63
|
## MCP 工具
|
|
@@ -53,13 +73,12 @@ Agent 记忆系统
|
|
|
53
73
|
|
|
54
74
|
| 信息类型 | 存储位置 | 示例 |
|
|
55
75
|
|----------|----------|------|
|
|
56
|
-
| 项目配置 |
|
|
57
|
-
| 技术决策 |
|
|
76
|
+
| 项目配置 | `_omp/.memory/` | 部署 URL、路径 |
|
|
77
|
+
| 技术决策 | `_omp/.memory/` | 框架选择、架构 |
|
|
58
78
|
| 用户偏好 | `openmemory` | 语言、风格 |
|
|
59
79
|
| 用户技能 | `openmemory` | 熟悉的技术栈 |
|
|
60
80
|
|
|
61
|
-
详细规则见 `.
|
|
81
|
+
详细规则见 `.gemini/skills/memory-extraction/SKILL.md`
|
|
62
82
|
|
|
63
83
|
---
|
|
64
84
|
*由 OpenMemory Plus CLI 生成 | https://github.com/Alenryuichi/openmemory-plus*
|
|
65
|
-
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# 清理记忆
|
|
2
|
+
|
|
3
|
+
清理过期、冗余或琐碎的记忆 (ROT)。
|
|
4
|
+
|
|
5
|
+
## 执行步骤
|
|
6
|
+
|
|
7
|
+
1. 调用 `list_memories_openmemory` 获取所有记忆
|
|
8
|
+
2. 分析衰减状态,识别 Cleanup 状态的记忆
|
|
9
|
+
3. 检测冗余和矛盾的记忆
|
|
10
|
+
4. 展示候选列表,询问用户确认
|
|
11
|
+
5. 执行删除
|
|
12
|
+
|
|
13
|
+
## ROT 判断标准
|
|
14
|
+
|
|
15
|
+
| 类型 | 定义 | 检测方法 |
|
|
16
|
+
|------|------|----------|
|
|
17
|
+
| **Redundant** (冗余) | 重复或相似的记忆 | 语义相似度 > 0.9 |
|
|
18
|
+
| **Outdated** (过时) | 超过 90 天未访问 | 衰减分数 < 0.3 |
|
|
19
|
+
| **Trivial** (琐碎) | 无实际价值 | 内容过短或通用 |
|
|
20
|
+
|
|
21
|
+
## 输出格式
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
🧹 清理候选记忆
|
|
25
|
+
|
|
26
|
+
以下记忆可能需要清理:
|
|
27
|
+
|
|
28
|
+
⚠️ Outdated (过时):
|
|
29
|
+
1. "旧项目使用 Webpack 4"
|
|
30
|
+
最后访问: 120天前 | 衰减分数: 0.15
|
|
31
|
+
|
|
32
|
+
⚠️ Redundant (冗余):
|
|
33
|
+
2. "偏好使用 npm" (与另一条冲突)
|
|
34
|
+
最后访问: 30天前
|
|
35
|
+
|
|
36
|
+
⚠️ Trivial (琐碎):
|
|
37
|
+
3. "ok"
|
|
38
|
+
创建时间: 60天前
|
|
39
|
+
|
|
40
|
+
确认删除?
|
|
41
|
+
- "全部删除" - 删除所有候选
|
|
42
|
+
- "删除 1,2" - 删除指定项
|
|
43
|
+
- "取消" - 不删除
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 安全机制
|
|
47
|
+
|
|
48
|
+
- 删除前必须用户确认
|
|
49
|
+
- 显示将被删除的内容预览
|
|
50
|
+
- 支持选择性删除
|
|
51
|
+
|
|
52
|
+
## 返回菜单
|
|
53
|
+
|
|
54
|
+
完成后提示: "还需要其他操作吗?输入 `/memory` 返回菜单"
|