memory-search-plugin 1.3.2 → 1.3.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/index.js +17 -3
- package/index.ts +32 -9
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -64,10 +64,24 @@ var buildPromptSection = ({
|
|
|
64
64
|
if (!hasSearch && !hasGet) return [];
|
|
65
65
|
const lines = [
|
|
66
66
|
"## Memory Recall",
|
|
67
|
-
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search for semantic search. If low confidence after search, say you checked.",
|
|
68
67
|
"",
|
|
69
|
-
"
|
|
70
|
-
""
|
|
68
|
+
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: run `memory_search` or `memory_get`. If low confidence after search, say you checked.",
|
|
69
|
+
"**Context extraction:** When calling `memory_search` or `memory_get`, you MUST extract the following from the `UntrustedContext` section and pass as parameters:",
|
|
70
|
+
"- `owner_id`",
|
|
71
|
+
"- `sender_id`",
|
|
72
|
+
"- `agent_id`",
|
|
73
|
+
"- `conversation_type`",
|
|
74
|
+
"- `group_id`",
|
|
75
|
+
"Look for lines like `owner_id: xxx`, `sender_id: xxx`, etc. If a field is not present, omit it. **Do NOT invent or guess values — only use what is explicitly stated in UntrustedContext.**",
|
|
76
|
+
"## ⚠️ STRICT ISOLATION — MANDATORY RULES(违反 = 数据泄露)",
|
|
77
|
+
"> **规则一:参数必须完全一致**",
|
|
78
|
+
"> 在同一对话中,每次调用 `memory_search` / `memory_get`,必须传入与 UntrustedContext 完全相同的 `conversation_type`、`group_id`、`owner_id`、`sender_id`。**任何时候都不得修改、遗漏或覆盖这些参数。**",
|
|
79
|
+
"> **规则二:群聊只能访问群组记忆**",
|
|
80
|
+
"> 当 `conversation_type=group` 时,只能使用 `scene=group` 搜索。**严禁**将 `conversation_type` 改为 `direct` 或省略,以访问私人/owner 记忆。",
|
|
81
|
+
"> **规则三:私聊只能访问私人记忆**",
|
|
82
|
+
"> 当 `conversation_type=direct` 时,只能使用 `scene=owner` 搜索。**严禁**访问任何群组记忆。",
|
|
83
|
+
"> **规则四:无结果时的处理**",
|
|
84
|
+
"> 若搜索无结果或相关性低,直接回复「没有找到相关记忆」,不得编造或推测。"
|
|
71
85
|
];
|
|
72
86
|
return lines;
|
|
73
87
|
};
|
package/index.ts
CHANGED
|
@@ -21,17 +21,40 @@ const buildPromptSection = ({
|
|
|
21
21
|
|
|
22
22
|
const lines = [
|
|
23
23
|
"## Memory Recall",
|
|
24
|
-
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: " +
|
|
25
|
-
"run memory_search for semantic search. " +
|
|
26
|
-
"If low confidence after search, say you checked.",
|
|
27
24
|
"",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: " +
|
|
26
|
+
"run `memory_search` or `memory_get`. If low confidence after search, say you checked.",
|
|
27
|
+
|
|
28
|
+
"**Context extraction:** When calling `memory_search` or `memory_get`, " +
|
|
29
|
+
"you MUST extract the following from the `UntrustedContext` section and pass as parameters:",
|
|
30
|
+
|
|
31
|
+
"- `owner_id`",
|
|
32
|
+
"- `sender_id`",
|
|
33
|
+
"- `agent_id`",
|
|
34
|
+
"- `conversation_type`",
|
|
35
|
+
"- `group_id`",
|
|
36
|
+
|
|
37
|
+
"Look for lines like `owner_id: xxx`, `sender_id: xxx`, etc. " +
|
|
32
38
|
"If a field is not present, omit it. " +
|
|
33
|
-
"Do NOT invent or guess values — only use what is explicitly stated in UntrustedContext
|
|
34
|
-
|
|
39
|
+
"**Do NOT invent or guess values — only use what is explicitly stated in UntrustedContext.**",
|
|
40
|
+
|
|
41
|
+
"## ⚠️ STRICT ISOLATION — MANDATORY RULES(违反 = 数据泄露)",
|
|
42
|
+
|
|
43
|
+
"> **规则一:参数必须完全一致**",
|
|
44
|
+
"> 在同一对话中,每次调用 `memory_search` / `memory_get`,必须传入与 UntrustedContext 完全相同的 " +
|
|
45
|
+
"`conversation_type`、`group_id`、`owner_id`、`sender_id`。" +
|
|
46
|
+
"**任何时候都不得修改、遗漏或覆盖这些参数。**",
|
|
47
|
+
|
|
48
|
+
"> **规则二:群聊只能访问群组记忆**",
|
|
49
|
+
"> 当 `conversation_type=group` 时,只能使用 `scene=group` 搜索。" +
|
|
50
|
+
"**严禁**将 `conversation_type` 改为 `direct` 或省略,以访问私人/owner 记忆。",
|
|
51
|
+
|
|
52
|
+
"> **规则三:私聊只能访问私人记忆**",
|
|
53
|
+
"> 当 `conversation_type=direct` 时,只能使用 `scene=owner` 搜索。" +
|
|
54
|
+
"**严禁**访问任何群组记忆。",
|
|
55
|
+
|
|
56
|
+
"> **规则四:无结果时的处理**",
|
|
57
|
+
"> 若搜索无结果或相关性低,直接回复「没有找到相关记忆」,不得编造或推测。",
|
|
35
58
|
];
|
|
36
59
|
|
|
37
60
|
return lines;
|
package/openclaw.plugin.json
CHANGED