@max-null/dsh-memory 0.1.0 → 0.1.1
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/README.md +6 -7
- package/dist/index.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install @max-null/dsh-memory
|
|
|
25
25
|
## 提供的服务与工具
|
|
26
26
|
|
|
27
27
|
- **服务** `ctx.memory`:`remember` / `list` / `search` / `forget` / `setStatus`
|
|
28
|
-
- **工具**:`memory_save`、`memory_list`、`memory_search`、`memory_forget`
|
|
28
|
+
- **工具**:`memory_save`、`memory_list`、`memory_search`、`memory_confirm`、`memory_forget`
|
|
29
29
|
- **注入**:`tool:memory` 指引 section + `memory:recall` 召回 context(`auto` 记忆,带 `[memory:<id>]` 来源标记)
|
|
30
30
|
|
|
31
31
|
## 两层存储(global / project)
|
|
@@ -42,14 +42,13 @@ npm install @max-null/dsh-memory
|
|
|
42
42
|
## 使用流程(人工确认闸门)
|
|
43
43
|
|
|
44
44
|
```
|
|
45
|
-
模型 memory_save
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
memory_forget → 随时删除
|
|
45
|
+
模型 memory_save → status: suggested(只是建议,未生效)
|
|
46
|
+
人 memory_confirm → status: auto(生效,自动进入每轮的 recall context)
|
|
47
|
+
memory_search → 随时按关键词召回任意状态的记忆
|
|
48
|
+
memory_forget → 随时删除
|
|
50
49
|
```
|
|
51
50
|
|
|
52
|
-
模型**永远不能自我提升**一条记忆——`memory_save` 只写 `suggested
|
|
51
|
+
模型**永远不能自我提升**一条记忆——`memory_save` 只写 `suggested`,只有人在明确要求时(`memory_confirm`)才能让它生效。这保证了记忆不是黑盒:人随时能看、能改、能删。
|
|
53
52
|
|
|
54
53
|
## 为什么明文 + BM25,而不是向量检索
|
|
55
54
|
|
package/dist/index.js
CHANGED
|
@@ -153,4 +153,19 @@ export async function apply(ctx, config) {
|
|
|
153
153
|
},
|
|
154
154
|
presentCall: args => present('Forget memory', 'other', args.id),
|
|
155
155
|
}));
|
|
156
|
+
ctx.tools.register(defineTool({
|
|
157
|
+
name: 'memory_confirm',
|
|
158
|
+
description: 'Confirm a suggested memory so it becomes effective (`auto`). Only call this when the human explicitly asks to confirm a memory; never self-promote a suggestion.',
|
|
159
|
+
parameters: {
|
|
160
|
+
id: { type: 'string', required: true, description: 'Exact memory id from memory_list.' },
|
|
161
|
+
},
|
|
162
|
+
output: {
|
|
163
|
+
schema: RECORD_SCHEMA,
|
|
164
|
+
render: (_args, value) => renderJson(value),
|
|
165
|
+
},
|
|
166
|
+
execute(args, _exec) {
|
|
167
|
+
return memory.setStatus(args.id, 'auto').then(recordValue);
|
|
168
|
+
},
|
|
169
|
+
presentCall: args => present('Confirm memory', 'other', args.id),
|
|
170
|
+
}));
|
|
156
171
|
}
|
package/package.json
CHANGED