openclaw-cortex-memory 0.1.0-Alpha.3 → 0.1.0-Alpha.31

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.
Files changed (110) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +296 -203
  3. package/SIGNATURE.md +7 -0
  4. package/SKILL.md +92 -268
  5. package/dist/index.d.ts +100 -22
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1249 -1252
  8. package/dist/index.js.map +1 -1
  9. package/dist/openclaw.plugin.json +501 -16
  10. package/dist/src/dedup/three_stage_deduplicator.d.ts +25 -0
  11. package/dist/src/dedup/three_stage_deduplicator.d.ts.map +1 -0
  12. package/dist/src/dedup/three_stage_deduplicator.js +224 -0
  13. package/dist/src/dedup/three_stage_deduplicator.js.map +1 -0
  14. package/dist/src/engine/memory_engine.d.ts +6 -1
  15. package/dist/src/engine/memory_engine.d.ts.map +1 -1
  16. package/dist/src/engine/ts_engine.d.ts +242 -0
  17. package/dist/src/engine/ts_engine.d.ts.map +1 -1
  18. package/dist/src/engine/ts_engine.js +1468 -52
  19. package/dist/src/engine/ts_engine.js.map +1 -1
  20. package/dist/src/engine/types.d.ts +29 -0
  21. package/dist/src/engine/types.d.ts.map +1 -1
  22. package/dist/src/graph/ontology.d.ts +125 -0
  23. package/dist/src/graph/ontology.d.ts.map +1 -0
  24. package/dist/src/graph/ontology.js +1237 -0
  25. package/dist/src/graph/ontology.js.map +1 -0
  26. package/dist/src/net/http_post.d.ts +17 -0
  27. package/dist/src/net/http_post.d.ts.map +1 -0
  28. package/dist/src/net/http_post.js +56 -0
  29. package/dist/src/net/http_post.js.map +1 -0
  30. package/dist/src/quality/llm_output_validator.d.ts +66 -0
  31. package/dist/src/quality/llm_output_validator.d.ts.map +1 -0
  32. package/dist/src/quality/llm_output_validator.js +659 -0
  33. package/dist/src/quality/llm_output_validator.js.map +1 -0
  34. package/dist/src/reflect/reflector.d.ts +7 -0
  35. package/dist/src/reflect/reflector.d.ts.map +1 -1
  36. package/dist/src/reflect/reflector.js +352 -8
  37. package/dist/src/reflect/reflector.js.map +1 -1
  38. package/dist/src/rules/rule_store.d.ts.map +1 -1
  39. package/dist/src/rules/rule_store.js +75 -16
  40. package/dist/src/rules/rule_store.js.map +1 -1
  41. package/dist/src/session/session_end.d.ts +33 -0
  42. package/dist/src/session/session_end.d.ts.map +1 -1
  43. package/dist/src/session/session_end.js +67 -64
  44. package/dist/src/session/session_end.js.map +1 -1
  45. package/dist/src/store/archive_store.d.ts +136 -0
  46. package/dist/src/store/archive_store.d.ts.map +1 -0
  47. package/dist/src/store/archive_store.js +635 -0
  48. package/dist/src/store/archive_store.js.map +1 -0
  49. package/dist/src/store/embedding_utils.d.ts +32 -0
  50. package/dist/src/store/embedding_utils.d.ts.map +1 -0
  51. package/dist/src/store/embedding_utils.js +173 -0
  52. package/dist/src/store/embedding_utils.js.map +1 -0
  53. package/dist/src/store/graph_memory_store.d.ts +114 -0
  54. package/dist/src/store/graph_memory_store.d.ts.map +1 -0
  55. package/dist/src/store/graph_memory_store.js +841 -0
  56. package/dist/src/store/graph_memory_store.js.map +1 -0
  57. package/dist/src/store/read_store.d.ts +89 -0
  58. package/dist/src/store/read_store.d.ts.map +1 -1
  59. package/dist/src/store/read_store.js +2459 -28
  60. package/dist/src/store/read_store.js.map +1 -1
  61. package/dist/src/store/vector_store.d.ts +45 -0
  62. package/dist/src/store/vector_store.d.ts.map +1 -0
  63. package/dist/src/store/vector_store.js +202 -0
  64. package/dist/src/store/vector_store.js.map +1 -0
  65. package/dist/src/store/write_store.d.ts +54 -0
  66. package/dist/src/store/write_store.d.ts.map +1 -1
  67. package/dist/src/store/write_store.js +284 -6
  68. package/dist/src/store/write_store.js.map +1 -1
  69. package/dist/src/sync/session_sync.d.ts +119 -2
  70. package/dist/src/sync/session_sync.d.ts.map +1 -1
  71. package/dist/src/sync/session_sync.js +2377 -31
  72. package/dist/src/sync/session_sync.js.map +1 -1
  73. package/dist/src/utils/runtime_env.d.ts +4 -0
  74. package/dist/src/utils/runtime_env.d.ts.map +1 -0
  75. package/dist/src/utils/runtime_env.js +51 -0
  76. package/dist/src/utils/runtime_env.js.map +1 -0
  77. package/dist/src/wiki/wiki_linter.d.ts +25 -0
  78. package/dist/src/wiki/wiki_linter.d.ts.map +1 -0
  79. package/dist/src/wiki/wiki_linter.js +268 -0
  80. package/dist/src/wiki/wiki_linter.js.map +1 -0
  81. package/dist/src/wiki/wiki_logger.d.ts +10 -0
  82. package/dist/src/wiki/wiki_logger.d.ts.map +1 -0
  83. package/dist/src/wiki/wiki_logger.js +78 -0
  84. package/dist/src/wiki/wiki_logger.js.map +1 -0
  85. package/dist/src/wiki/wiki_maintainer.d.ts +36 -0
  86. package/dist/src/wiki/wiki_maintainer.d.ts.map +1 -0
  87. package/dist/src/wiki/wiki_maintainer.js +38 -0
  88. package/dist/src/wiki/wiki_maintainer.js.map +1 -0
  89. package/dist/src/wiki/wiki_projector.d.ts +33 -0
  90. package/dist/src/wiki/wiki_projector.d.ts.map +1 -0
  91. package/dist/src/wiki/wiki_projector.js +633 -0
  92. package/dist/src/wiki/wiki_projector.js.map +1 -0
  93. package/dist/src/wiki/wiki_queue.d.ts +29 -0
  94. package/dist/src/wiki/wiki_queue.d.ts.map +1 -0
  95. package/dist/src/wiki/wiki_queue.js +137 -0
  96. package/dist/src/wiki/wiki_queue.js.map +1 -0
  97. package/openclaw.plugin.json +501 -16
  98. package/package.json +58 -7
  99. package/schema/graph.schema.yaml +330 -0
  100. package/scripts/cli.js +19 -14
  101. package/scripts/repair-memory.js +321 -0
  102. package/scripts/uninstall.js +22 -5
  103. package/skills/cortex-memory/SKILL.md +49 -0
  104. package/skills/cortex-memory/references/agent-manual.md +115 -0
  105. package/skills/cortex-memory/references/configuration.md +92 -0
  106. package/skills/cortex-memory/references/publish-checklist.md +46 -0
  107. package/skills/cortex-memory/references/system-prompt-template.md +27 -0
  108. package/skills/cortex-memory/references/tools.md +181 -0
  109. package/skills/cortex-memory/scripts/smoke-check.ps1 +56 -0
  110. package/index.ts +0 -2142
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-cortex-memory",
3
- "version": "0.1.0-Alpha.3",
3
+ "version": "0.1.0-Alpha.31",
4
4
  "description": "Long-term memory system for OpenClaw AI Agent",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,9 +9,21 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc && node -e \"require('fs').copyFileSync('openclaw.plugin.json','dist/openclaw.plugin.json')\"",
12
+ "typecheck": "tsc --noEmit",
13
+ "check:version": "node scripts/check-version.js",
14
+ "test:compat": "node scripts/compat-regression.js",
15
+ "test:model": "node scripts/model-regression.js",
16
+ "test:graph": "node scripts/graph-eval.js",
17
+ "test:graph-quality": "node scripts/graph-quality-eval.js",
18
+ "test:graph-quality-zh": "node scripts/graph-quality-eval.js --gold eval/graph_quality_gold.zh.jsonl --pred eval/graph_quality_predictions.zh.sample.jsonl --thresholds eval/graph_quality_thresholds.json",
19
+ "test:m1-ingest-regression": "node scripts/m1-ingest-regression.js",
20
+ "test:m5-cross-store": "node scripts/m5-cross-store-regression.js",
21
+ "test:lengthnorm": "node scripts/lengthnorm-regression.js",
22
+ "test:all": "npm run test:compat && npm run test:model && npm run test:graph && npm run test:graph-quality && npm run test:graph-quality-zh && npm run test:lengthnorm",
23
+ "release:check": "node scripts/release-pipeline.js",
12
24
  "dev": "tsc --watch",
13
- "prepublishOnly": "npm run build",
14
- "postinstall": "node scripts/install.js"
25
+ "prepack": "npm run build",
26
+ "prepublishOnly": "npm run check:version && npm run build && npm run test:all"
15
27
  },
16
28
  "keywords": [
17
29
  "openclaw",
@@ -20,34 +32,73 @@
20
32
  "agent",
21
33
  "rag"
22
34
  ],
23
- "author": "",
35
+ "author": "deki18",
24
36
  "license": "MIT",
25
37
  "dependencies": {
26
38
  "undici": "^6.21.0"
27
39
  },
40
+ "optionalDependencies": {
41
+ "@lancedb/lancedb": "^0.22.0"
42
+ },
28
43
  "devDependencies": {
29
44
  "@types/node": "^22.19.15",
30
45
  "typescript": "^5.7.2"
31
46
  },
32
47
  "peerDependencies": {
33
- "openclaw": ">=2026.3.8"
48
+ "openclaw": ">=2026.4.5"
34
49
  },
35
50
  "engines": {
36
51
  "node": ">=22.0.0"
37
52
  },
38
53
  "files": [
39
54
  "dist/",
40
- "index.ts",
41
55
  "scripts/cli.js",
42
56
  "scripts/install.js",
43
57
  "scripts/uninstall.js",
58
+ "scripts/repair-memory.js",
59
+ "schema/",
44
60
  "openclaw.plugin.json",
45
- "SKILL.md"
61
+ "SIGNATURE.md",
62
+ "SKILL.md",
63
+ "skills/cortex-memory/"
46
64
  ],
47
65
  "openclaw": {
48
66
  "plugin": true,
49
67
  "requiresPython": false,
50
68
  "cli": "cortex-memory",
69
+ "requires": {
70
+ "credentials": true,
71
+ "network": true,
72
+ "env": [
73
+ "EMBEDDING_API_KEY",
74
+ "LLM_API_KEY",
75
+ "RERANKER_API_KEY"
76
+ ],
77
+ "config": [
78
+ "embedding.apiKey",
79
+ "llm.apiKey",
80
+ "reranker.apiKey",
81
+ "embedding.baseURL",
82
+ "llm.baseURL",
83
+ "reranker.baseURL"
84
+ ],
85
+ "externalEndpoints": [
86
+ "embedding API endpoint (OpenAI-compatible /embeddings)",
87
+ "LLM API endpoint (OpenAI-compatible /chat/completions)",
88
+ "reranker API endpoint (/rerank)"
89
+ ]
90
+ },
91
+ "build": {
92
+ "openclawVersion": "2026.4.5",
93
+ "pluginSdkVersion": "2026.4.5"
94
+ },
95
+ "install": {
96
+ "minHostVersion": ">=2026.4.5"
97
+ },
98
+ "compat": {
99
+ "pluginApi": ">=2026.4.5",
100
+ "minGatewayVersion": "2026.4.5"
101
+ },
51
102
  "extensions": [
52
103
  "./dist/index.js"
53
104
  ]
@@ -0,0 +1,330 @@
1
+ {
2
+ "eventTypes": [
3
+ "decision",
4
+ "issue",
5
+ "fix",
6
+ "preference",
7
+ "plan",
8
+ "risk",
9
+ "insight",
10
+ "action_item",
11
+ "conversation_summary",
12
+ "constraint",
13
+ "requirement",
14
+ "milestone",
15
+ "blocker",
16
+ "dependency",
17
+ "assumption",
18
+ "retrospective",
19
+ "follow_up"
20
+ ],
21
+ "eventTypeAliases": {
22
+ "problem": "issue",
23
+ "error": "issue",
24
+ "bug": "issue",
25
+ "solution": "fix",
26
+ "workaround": "fix",
27
+ "todo": "action_item",
28
+ "next_step": "action_item",
29
+ "limitation": "constraint",
30
+ "guardrail": "constraint",
31
+ "spec": "requirement",
32
+ "acceptance_criteria": "requirement",
33
+ "deadline": "milestone",
34
+ "target": "milestone",
35
+ "roadblock": "blocker",
36
+ "stuck": "blocker",
37
+ "depends_on": "dependency",
38
+ "upstream": "dependency",
39
+ "hypothesis": "assumption",
40
+ "lesson": "retrospective",
41
+ "postmortem": "retrospective",
42
+ "followup": "follow_up",
43
+ "next_action": "follow_up"
44
+ },
45
+ "entityTypes": [
46
+ "Person",
47
+ "FamilyMember",
48
+ "Friend",
49
+ "Team",
50
+ "Project",
51
+ "Task",
52
+ "Plan",
53
+ "Milestone",
54
+ "Location",
55
+ "Event",
56
+ "Schedule",
57
+ "Habit",
58
+ "HealthItem",
59
+ "FinanceItem",
60
+ "Issue",
61
+ "Fix",
62
+ "Decision",
63
+ "Action",
64
+ "Risk",
65
+ "Blocker",
66
+ "Assumption",
67
+ "Concept",
68
+ "Resource",
69
+ "Document",
70
+ "ConfigFile",
71
+ "Preference",
72
+ "Case",
73
+ "Pattern",
74
+ "Date"
75
+ ],
76
+ "entityAliases": {
77
+ "OpenClaw": ["openclaw", "插件", "该项目", "本项目"],
78
+ "FamilyMember": ["家人", "家庭成员", "亲人"],
79
+ "Friend": ["朋友", "好友"],
80
+ "Team": ["团队", "小组", "组", "班组"],
81
+ "Location": ["地点", "位置", "住址", "地址"],
82
+ "Event": ["活动", "事情", "事项"],
83
+ "Schedule": ["日程", "安排", "计划表"],
84
+ "Habit": ["习惯", "作息"],
85
+ "HealthItem": ["健康", "体检", "药物", "锻炼"],
86
+ "FinanceItem": ["账单", "支出", "收入", "预算"],
87
+ "Plan": ["计划", "方案", "路线图"],
88
+ "Preference": ["偏好", "习惯选择"],
89
+ "Document": ["文档", "说明文档", "手册", "wiki", "README", "PRD", "方案文档"],
90
+ "Resource": ["资源", "物品", "物件", "设备", "工具", "素材", "资产"],
91
+ "ConfigFile": ["配置文件", "config", "配置"],
92
+ "Decision": ["决策", "决定", "拍板"],
93
+ "Action": ["动作", "操作", "执行"],
94
+ "Risk": ["风险", "隐患"],
95
+ "Blocker": ["阻塞", "卡点", "障碍"],
96
+ "Assumption": ["假设", "前提"],
97
+ "Concept": ["概念", "术语"],
98
+ "Case": ["案例", "case"],
99
+ "Pattern": ["模式", "pattern"],
100
+ "Date": ["日期", "时间", "时间点"],
101
+ "Person": ["我", "自己", "本人", "同事", "客户", "用户", "姓名", "名字", "人名", "成员", "联系人"],
102
+ "Project": ["项目", "工程", "项目线"],
103
+ "Task": ["任务", "待办", "todo", "工单", "事项"],
104
+ "Milestone": ["里程碑", "节点"],
105
+ "Issue": ["问题", "故障", "报错"],
106
+ "Fix": ["修复", "解决方案"]
107
+ },
108
+ "relationTypes": [
109
+ "depends_on",
110
+ "blocks",
111
+ "unblocks",
112
+ "causes",
113
+ "impacts",
114
+ "resolves",
115
+ "encountered_bug",
116
+ "solved_with",
117
+ "uses_tech",
118
+ "integrates_with",
119
+ "migrates_to",
120
+ "replaced_by",
121
+ "has_subtask",
122
+ "belongs_to",
123
+ "owned_by",
124
+ "implements",
125
+ "requires",
126
+ "plans_to",
127
+ "planned_for",
128
+ "scheduled_for",
129
+ "references",
130
+ "documents",
131
+ "defined_in",
132
+ "configured_in",
133
+ "supports",
134
+ "conflicts_with",
135
+ "duplicates",
136
+ "supersedes",
137
+ "assigned_to",
138
+ "reviewed_by",
139
+ "approved_by",
140
+ "rejected_by",
141
+ "reported_by",
142
+ "lives_in",
143
+ "cares_for",
144
+ "pays_for",
145
+ "prefers",
146
+ "has_spouse",
147
+ "has_child",
148
+ "birthday_on",
149
+ "anniversary_on"
150
+ ],
151
+ "relationTypeAliases": {
152
+ "dependency": "depends_on",
153
+ "blocked_by": "blocks",
154
+ "unblock": "unblocks",
155
+ "impact": "impacts",
156
+ "plan_to": "plans_to",
157
+ "plan_for": "planned_for",
158
+ "schedule_for": "scheduled_for",
159
+ "located_in": "lives_in",
160
+ "care_for": "cares_for",
161
+ "pay_for": "pays_for",
162
+ "support": "supports",
163
+ "conflict_with": "conflicts_with",
164
+ "use_tech": "uses_tech",
165
+ "tech_stack": "uses_tech",
166
+ "integrate_with": "integrates_with",
167
+ "migrate_to": "migrates_to",
168
+ "replace_by": "replaced_by",
169
+ "replace_with": "replaced_by",
170
+ "bug": "encountered_bug",
171
+ "bug_on": "encountered_bug",
172
+ "fix_with": "solved_with",
173
+ "solve_with": "solved_with",
174
+ "solved_by": "solved_with",
175
+ "subtask_of": "has_subtask",
176
+ "child_task": "has_subtask",
177
+ "documented_by": "documents",
178
+ "defined_by": "defined_in",
179
+ "config_in": "configured_in",
180
+ "duplicate_of": "duplicates",
181
+ "superseded_by": "supersedes",
182
+ "assign_to": "assigned_to",
183
+ "review_by": "reviewed_by",
184
+ "approve_by": "approved_by",
185
+ "reject_by": "rejected_by",
186
+ "report_by": "reported_by",
187
+ "依赖于": "depends_on",
188
+ "依赖": "depends_on",
189
+ "取决于": "depends_on",
190
+ "阻塞": "blocks",
191
+ "卡住": "blocks",
192
+ "解除阻塞": "unblocks",
193
+ "导致": "causes",
194
+ "引起": "causes",
195
+ "影响": "impacts",
196
+ "解决": "resolves",
197
+ "修复": "resolves",
198
+ "遇到报错": "encountered_bug",
199
+ "通过": "solved_with",
200
+ "使用技术": "uses_tech",
201
+ "集成": "integrates_with",
202
+ "迁移到": "migrates_to",
203
+ "被替代": "replaced_by",
204
+ "子任务": "has_subtask",
205
+ "属于": "belongs_to",
206
+ "归属": "belongs_to",
207
+ "负责": "owned_by",
208
+ "由": "owned_by",
209
+ "实现": "implements",
210
+ "需要": "requires",
211
+ "计划做": "plans_to",
212
+ "打算": "plans_to",
213
+ "计划于": "planned_for",
214
+ "安排在": "scheduled_for",
215
+ "约在": "scheduled_for",
216
+ "参考": "references",
217
+ "引用": "references",
218
+ "记录": "documents",
219
+ "定义于": "defined_in",
220
+ "配置于": "configured_in",
221
+ "支持": "supports",
222
+ "冲突": "conflicts_with",
223
+ "矛盾": "conflicts_with",
224
+ "重复": "duplicates",
225
+ "取代": "supersedes",
226
+ "分配给": "assigned_to",
227
+ "评审": "reviewed_by",
228
+ "批准": "approved_by",
229
+ "拒绝": "rejected_by",
230
+ "报告": "reported_by",
231
+ "住在": "lives_in",
232
+ "居住在": "lives_in",
233
+ "照顾": "cares_for",
234
+ "看护": "cares_for",
235
+ "支付": "pays_for",
236
+ "付款": "pays_for",
237
+ "偏好": "prefers",
238
+ "更喜欢": "prefers",
239
+ "配偶": "has_spouse",
240
+ "孩子": "has_child",
241
+ "生日": "birthday_on",
242
+ "纪念日": "anniversary_on",
243
+ "belongs": "belongs_to",
244
+ "owner_of": "owned_by",
245
+ "refer_to": "references",
246
+ "preference_for": "prefers",
247
+ "implement": "implements",
248
+ "need": "requires",
249
+ "technology": "uses_tech",
250
+ "encountered_issue": "encountered_bug",
251
+ "spouse": "has_spouse",
252
+ "wife_of": "has_spouse",
253
+ "husband_of": "has_spouse",
254
+ "child_of": "has_child",
255
+ "parent_of": "has_child",
256
+ "birthday": "birthday_on",
257
+ "born_on": "birthday_on",
258
+ "anniversary": "anniversary_on",
259
+ "married_on": "anniversary_on"
260
+ },
261
+ "relationRules": [
262
+ { "type": "depends_on", "fromTypes": ["Task", "Plan", "Milestone", "Issue"], "toTypes": ["Task", "Plan", "Milestone", "Issue", "Resource"], "allowSelfLoop": false },
263
+ { "type": "blocks", "fromTypes": ["Issue", "Task", "Risk", "Blocker"], "toTypes": ["Task", "Plan", "Milestone"], "allowSelfLoop": false },
264
+ { "type": "unblocks", "fromTypes": ["Fix", "Action", "Decision"], "toTypes": ["Task", "Issue", "Blocker"], "allowSelfLoop": false },
265
+ { "type": "causes", "fromTypes": ["Issue", "Risk", "Assumption"], "toTypes": ["Issue", "Risk", "Blocker"], "allowSelfLoop": false },
266
+ { "type": "impacts", "fromTypes": ["Issue", "Risk", "Task", "Project", "Event"], "toTypes": ["Task", "Project", "Issue", "Milestone", "Event"], "allowSelfLoop": false },
267
+ { "type": "resolves", "fromTypes": ["Fix", "Decision", "Action"], "toTypes": ["Issue", "Blocker", "Risk"], "allowSelfLoop": false },
268
+ { "type": "encountered_bug", "fromTypes": ["Project", "Task", "Action"], "toTypes": ["Issue", "Blocker"], "allowSelfLoop": false },
269
+ { "type": "solved_with", "fromTypes": ["Issue", "Blocker", "Task"], "toTypes": ["Fix", "Action", "Decision", "Resource", "Document"], "allowSelfLoop": false },
270
+ { "type": "uses_tech", "fromTypes": ["Project", "Task", "Fix", "Action"], "toTypes": ["Resource", "Document", "ConfigFile", "Project"], "allowSelfLoop": false },
271
+ { "type": "integrates_with", "fromTypes": ["Project", "Task", "Resource"], "toTypes": ["Project", "Resource"], "allowSelfLoop": false },
272
+ { "type": "migrates_to", "fromTypes": ["Project", "Task", "Resource", "ConfigFile"], "toTypes": ["Project", "Resource", "ConfigFile"], "allowSelfLoop": false },
273
+ { "type": "replaced_by", "fromTypes": ["Project", "Task", "Resource", "Fix"], "toTypes": ["Project", "Task", "Resource", "Fix"], "allowSelfLoop": false },
274
+ { "type": "has_subtask", "fromTypes": ["Project", "Plan", "Milestone", "Task"], "toTypes": ["Task"], "allowSelfLoop": false },
275
+ { "type": "belongs_to", "fromTypes": ["Task", "Issue", "Fix", "Decision", "Document"], "toTypes": ["Project", "Plan", "Milestone", "Event"], "allowSelfLoop": false },
276
+ { "type": "owned_by", "fromTypes": ["Task", "Plan", "Project", "Issue", "Resource"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
277
+ { "type": "implements", "fromTypes": ["Task", "Fix", "Project", "Document"], "toTypes": ["Plan", "Milestone", "Concept"], "allowSelfLoop": false },
278
+ { "type": "requires", "fromTypes": ["Task", "Fix", "Project", "Issue", "Plan"], "toTypes": ["Task", "Resource", "Document", "ConfigFile", "Date"], "allowSelfLoop": false },
279
+ { "type": "planned_for", "fromTypes": ["Task", "Plan", "Milestone"], "toTypes": ["Date", "Schedule", "Milestone"], "allowSelfLoop": false },
280
+ { "type": "scheduled_for", "fromTypes": ["Task", "Event", "Plan"], "toTypes": ["Date", "Schedule"], "allowSelfLoop": false },
281
+ { "type": "references", "fromTypes": ["Task", "Issue", "Fix", "Document", "Project"], "toTypes": ["Document", "Resource", "ConfigFile"], "allowSelfLoop": false },
282
+ { "type": "documents", "fromTypes": ["Document", "Project", "Task"], "toTypes": ["Issue", "Fix", "Decision", "Event", "Case", "Pattern"], "allowSelfLoop": false },
283
+ { "type": "defined_in", "fromTypes": ["Task", "Issue", "Fix", "Pattern", "Case"], "toTypes": ["Document", "ConfigFile"], "allowSelfLoop": false },
284
+ { "type": "configured_in", "fromTypes": ["Task", "Fix", "Resource", "Project"], "toTypes": ["ConfigFile", "Document"], "allowSelfLoop": false },
285
+ { "type": "supports", "fromTypes": ["Resource", "Project", "Task", "Fix"], "toTypes": ["Task", "Project", "Issue", "Fix"], "allowSelfLoop": false },
286
+ { "type": "conflicts_with", "fromTypes": ["Task", "Plan", "Resource", "ConfigFile", "Issue"], "toTypes": ["Task", "Plan", "Resource", "ConfigFile", "Issue"], "allowSelfLoop": false },
287
+ { "type": "duplicates", "fromTypes": ["Issue", "Task", "Fix", "Document"], "toTypes": ["Issue", "Task", "Fix", "Document"], "allowSelfLoop": false },
288
+ { "type": "supersedes", "fromTypes": ["Fix", "Decision", "Document", "Plan", "Task"], "toTypes": ["Fix", "Decision", "Document", "Plan", "Task"], "allowSelfLoop": false },
289
+ { "type": "assigned_to", "fromTypes": ["Task", "Issue", "Fix", "Action"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
290
+ { "type": "reviewed_by", "fromTypes": ["Fix", "Task", "Document", "Decision"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
291
+ { "type": "approved_by", "fromTypes": ["Fix", "Task", "Document", "Decision"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
292
+ { "type": "rejected_by", "fromTypes": ["Fix", "Task", "Document", "Decision"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
293
+ { "type": "reported_by", "fromTypes": ["Issue", "Risk", "Blocker"], "toTypes": ["Person", "Team"], "allowSelfLoop": false },
294
+ { "type": "lives_in", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Location"], "allowSelfLoop": false },
295
+ { "type": "cares_for", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Person", "FamilyMember"], "allowSelfLoop": false },
296
+ { "type": "pays_for", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Person", "FamilyMember", "FinanceItem"], "allowSelfLoop": false },
297
+ { "type": "prefers", "fromTypes": ["Person", "Team"], "toTypes": ["Preference", "Resource", "Project", "Location", "Pattern"], "allowSelfLoop": false },
298
+ { "type": "has_spouse", "fromTypes": ["Person"], "toTypes": ["Person", "FamilyMember"], "allowSelfLoop": false },
299
+ { "type": "has_child", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Person", "FamilyMember"], "allowSelfLoop": false },
300
+ { "type": "birthday_on", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Date"], "allowSelfLoop": false },
301
+ { "type": "anniversary_on", "fromTypes": ["Person", "FamilyMember"], "toTypes": ["Date"], "allowSelfLoop": false }
302
+ ],
303
+ "highValueRelationTypes": [
304
+ "depends_on",
305
+ "blocks",
306
+ "unblocks",
307
+ "causes",
308
+ "impacts",
309
+ "resolves",
310
+ "encountered_bug",
311
+ "solved_with",
312
+ "uses_tech",
313
+ "integrates_with",
314
+ "migrates_to",
315
+ "replaced_by",
316
+ "has_subtask",
317
+ "belongs_to",
318
+ "owned_by",
319
+ "implements",
320
+ "requires",
321
+ "planned_for",
322
+ "scheduled_for"
323
+ ],
324
+ "relatedToMaxRatio": 0,
325
+ "relatedToMaxAbsolute": 0,
326
+ "minRelationConfidence": 0.35,
327
+ "evidenceSpanRequired": true,
328
+ "endpointMentionRequired": true,
329
+ "defaultEntityType": "Concept"
330
+ }
package/scripts/cli.js CHANGED
@@ -2,16 +2,17 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- const { spawn } = require('child_process');
6
5
 
7
6
  const PLUGIN_NAME = 'openclaw-cortex-memory';
8
7
 
9
8
  function findOpenClawConfig() {
10
9
  const explicitConfigPath = process.env.OPENCLAW_CONFIG_PATH || '';
10
+ const stateDir = process.env.OPENCLAW_STATE_DIR || '';
11
11
  const basePath = process.env.OPENCLAW_BASE_PATH || '';
12
12
  const homePath = process.env.USERPROFILE || process.env.HOME || '';
13
13
  const possiblePaths = [
14
14
  explicitConfigPath,
15
+ stateDir ? path.join(stateDir, 'openclaw.json') : '',
15
16
  basePath ? path.join(basePath, 'openclaw.json') : '',
16
17
  path.join(process.cwd(), 'openclaw.json'),
17
18
  homePath ? path.join(homePath, '.openclaw', 'openclaw.json') : '',
@@ -53,7 +54,10 @@ function enablePlugin() {
53
54
  const configPath = findOpenClawConfig();
54
55
 
55
56
  if (!configPath) {
56
- const defaultPath = path.join(process.env.USERPROFILE || process.env.HOME || '', '.openclaw', 'openclaw.json');
57
+ const defaultPath = process.env.OPENCLAW_CONFIG_PATH
58
+ || (process.env.OPENCLAW_STATE_DIR ? path.join(process.env.OPENCLAW_STATE_DIR, 'openclaw.json') : '')
59
+ || (process.env.OPENCLAW_BASE_PATH ? path.join(process.env.OPENCLAW_BASE_PATH, 'openclaw.json') : '')
60
+ || path.join(process.env.USERPROFILE || process.env.HOME || '', '.openclaw', 'openclaw.json');
57
61
  console.log(`No config file found. Creating: ${defaultPath}`);
58
62
 
59
63
  const config = {
@@ -170,21 +174,22 @@ function getStatus() {
170
174
  }
171
175
 
172
176
  function runUninstall(args) {
173
- const uninstallScript = path.join(__dirname, 'uninstall.js');
174
-
175
- if (!fs.existsSync(uninstallScript)) {
177
+ const uninstallScriptPath = path.join(__dirname, 'uninstall.js');
178
+ if (!fs.existsSync(uninstallScriptPath)) {
176
179
  console.error('Uninstall script not found.');
177
180
  process.exit(1);
178
181
  }
179
-
180
- const child = spawn(process.execPath, [uninstallScript, 'uninstall', ...args], {
181
- stdio: 'inherit',
182
- cwd: process.cwd()
183
- });
184
-
185
- child.on('exit', (code) => {
186
- process.exit(code || 0);
187
- });
182
+ try {
183
+ const uninstallModule = require(uninstallScriptPath);
184
+ if (!uninstallModule || typeof uninstallModule.uninstall !== 'function') {
185
+ console.error('Invalid uninstall script export.');
186
+ process.exit(1);
187
+ }
188
+ uninstallModule.uninstall(args);
189
+ } catch (error) {
190
+ console.error(`Failed to run uninstall: ${error instanceof Error ? error.message : String(error)}`);
191
+ process.exit(1);
192
+ }
188
193
  }
189
194
 
190
195
  function showHelp() {