@bamdra/bamdra-memory-vector 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 +30 -3
- package/README.zh-CN.md +79 -0
- package/dist/index.js +9 -4
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bamdra-memory-vector
|
|
2
2
|
|
|
3
|
-
`bamdra-memory-vector` is the
|
|
3
|
+
`bamdra-memory-vector` is the semantic retrieval plugin for the Bamdra OpenClaw suite.
|
|
4
4
|
|
|
5
5
|
It adds lightweight vector-style recall on top of `bamdra-openclaw-memory` without turning the whole stack into a heavy external vector-database deployment.
|
|
6
6
|
|
|
@@ -27,11 +27,38 @@ The repository currently looks small because the first public version is intenti
|
|
|
27
27
|
|
|
28
28
|
## Current Runtime Model
|
|
29
29
|
|
|
30
|
-
- Markdown root:
|
|
31
|
-
`~/.openclaw/memory/vector/markdown/`
|
|
30
|
+
- private Markdown root:
|
|
31
|
+
`~/.openclaw/memory/vector/markdown/private/`
|
|
32
|
+
- shared Markdown root:
|
|
33
|
+
`~/.openclaw/memory/vector/markdown/shared/`
|
|
32
34
|
- local index:
|
|
33
35
|
`~/.openclaw/memory/vector/index.json`
|
|
34
36
|
|
|
37
|
+
`markdownRoot` is still supported as a legacy base path, but the recommended production setup is to set `privateMarkdownRoot` and `sharedMarkdownRoot` explicitly.
|
|
38
|
+
|
|
39
|
+
## Best Practice: Obsidian-Friendly Layout
|
|
40
|
+
|
|
41
|
+
The plugin now supports separate roots for private memory and shared knowledge. That makes it practical to point Markdown storage at an Obsidian vault, iCloud Drive folder, Git-synced repo, or Syncthing workspace while keeping the local vector index in `~/.openclaw`.
|
|
42
|
+
|
|
43
|
+
Recommended example:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"privateMarkdownRoot": "~/Documents/Obsidian/MyVault/openclaw/private",
|
|
49
|
+
"sharedMarkdownRoot": "~/Documents/Obsidian/MyVault/openclaw/shared",
|
|
50
|
+
"indexPath": "~/.openclaw/memory/vector/index.json",
|
|
51
|
+
"dimensions": 64
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This gives you:
|
|
56
|
+
|
|
57
|
+
- a private vault area for user-specific memory
|
|
58
|
+
- a shared vault area for team or household knowledge
|
|
59
|
+
- Markdown files that can be edited on any synced device
|
|
60
|
+
- a local index that OpenClaw can rebuild without exposing other users' data
|
|
61
|
+
|
|
35
62
|
This first version exposes a lightweight local vector-style index interface and keeps the integration surface ready for later LanceDB-backed evolution.
|
|
36
63
|
|
|
37
64
|
## Product Positioning
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# bamdra-memory-vector
|
|
2
|
+
|
|
3
|
+
`bamdra-memory-vector` 是 Bamdra OpenClaw 套件中的语义召回插件,而且它也可以独立运行。
|
|
4
|
+
|
|
5
|
+
## 它做什么
|
|
6
|
+
|
|
7
|
+
- 把记忆内容以 Markdown 可读形式写入本地
|
|
8
|
+
- 建立轻量的本地语义索引
|
|
9
|
+
- 按当前用户边界限制检索范围
|
|
10
|
+
- 为长程记忆回捞提供 Top-K 语义召回
|
|
11
|
+
- 保持私有记忆与共享知识分离
|
|
12
|
+
|
|
13
|
+
## 开源内容说明
|
|
14
|
+
|
|
15
|
+
当前开源版的实际源码已经包含在这个仓库里。
|
|
16
|
+
|
|
17
|
+
- 源码入口:
|
|
18
|
+
[src/index.ts](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-memory-vector/src/index.ts)
|
|
19
|
+
- 插件清单:
|
|
20
|
+
[openclaw.plugin.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-memory-vector/openclaw.plugin.json)
|
|
21
|
+
- 包元数据:
|
|
22
|
+
[package.json](/Users/wood/workspace/macmini-openclaw/openclaw-enhanced/bamdra-memory-vector/package.json)
|
|
23
|
+
|
|
24
|
+
仓库目前看起来比较轻,是因为首个公开版本刻意保持为紧凑、单入口插件。
|
|
25
|
+
|
|
26
|
+
## 当前运行模型
|
|
27
|
+
|
|
28
|
+
- 私有 Markdown 根目录:
|
|
29
|
+
`~/.openclaw/memory/vector/markdown/private/`
|
|
30
|
+
- 共享 Markdown 根目录:
|
|
31
|
+
`~/.openclaw/memory/vector/markdown/shared/`
|
|
32
|
+
- 本地索引:
|
|
33
|
+
`~/.openclaw/memory/vector/index.json`
|
|
34
|
+
|
|
35
|
+
这一版提供的是轻量本地向量式索引接口,同时为后续 LanceDB 演进保留接入面。
|
|
36
|
+
|
|
37
|
+
`markdownRoot` 仍然保留兼容,但更推荐在正式环境里显式设置 `privateMarkdownRoot` 和 `sharedMarkdownRoot`。
|
|
38
|
+
|
|
39
|
+
## 最佳实践:兼容 Obsidian 的双库布局
|
|
40
|
+
|
|
41
|
+
插件现在支持把私有记忆和共享知识分别落到两个 Markdown 根目录。这意味着你可以把 Markdown 指向 Obsidian 仓库、iCloud Drive、Git 同步目录或者 Syncthing 目录,而把本地索引仍然保留在 `~/.openclaw` 下面。
|
|
42
|
+
|
|
43
|
+
推荐配置示例:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"privateMarkdownRoot": "~/Documents/Obsidian/MyVault/openclaw/private",
|
|
49
|
+
"sharedMarkdownRoot": "~/Documents/Obsidian/MyVault/openclaw/shared",
|
|
50
|
+
"indexPath": "~/.openclaw/memory/vector/index.json",
|
|
51
|
+
"dimensions": 64
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
这样做的好处是:
|
|
56
|
+
|
|
57
|
+
- 私有记忆和共享知识库天然分开
|
|
58
|
+
- Markdown 文件可以在任何同步设备上直接编辑
|
|
59
|
+
- OpenClaw 继续使用本地索引,不依赖远端向量服务
|
|
60
|
+
- 更适合把 Obsidian 作为长期知识库编辑入口
|
|
61
|
+
|
|
62
|
+
## 产品定位
|
|
63
|
+
|
|
64
|
+
`bamdra-memory-vector` 不是用来替代 `bamdra-openclaw-memory` 的。
|
|
65
|
+
|
|
66
|
+
- `bamdra-openclaw-memory` 更强调连续性
|
|
67
|
+
- `bamdra-memory-vector` 更强调召回增强
|
|
68
|
+
|
|
69
|
+
两者组合后的价值是:
|
|
70
|
+
|
|
71
|
+
- 更强的长会话连续性
|
|
72
|
+
- Markdown 可读、可维护的记忆载体
|
|
73
|
+
- 不依赖重型基础设施的轻量语义召回
|
|
74
|
+
|
|
75
|
+
## 构建
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pnpm run bundle
|
|
79
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,8 @@ var LocalVectorIndex = class {
|
|
|
35
35
|
constructor(inputConfig) {
|
|
36
36
|
this.config = normalizeConfig(inputConfig);
|
|
37
37
|
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(this.config.indexPath), { recursive: true });
|
|
38
|
-
(0, import_node_fs.mkdirSync)(this.config.
|
|
38
|
+
(0, import_node_fs.mkdirSync)(this.config.privateMarkdownRoot, { recursive: true });
|
|
39
|
+
(0, import_node_fs.mkdirSync)(this.config.sharedMarkdownRoot, { recursive: true });
|
|
39
40
|
this.load();
|
|
40
41
|
}
|
|
41
42
|
upsert(args) {
|
|
@@ -54,7 +55,8 @@ ${args.text}`, this.config.dimensions),
|
|
|
54
55
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
55
56
|
};
|
|
56
57
|
this.records.set(id, record);
|
|
57
|
-
const
|
|
58
|
+
const markdownRoot = args.userId == null ? this.config.sharedMarkdownRoot : this.config.privateMarkdownRoot;
|
|
59
|
+
const markdownPath = (0, import_node_path.join)(markdownRoot, args.sourcePath);
|
|
58
60
|
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(markdownPath), { recursive: true });
|
|
59
61
|
(0, import_node_fs.writeFileSync)(markdownPath, `# ${args.title}
|
|
60
62
|
|
|
@@ -69,7 +71,7 @@ ${args.text}
|
|
|
69
71
|
if (args.userId == null) {
|
|
70
72
|
return record.userId == null;
|
|
71
73
|
}
|
|
72
|
-
return record.userId === args.userId;
|
|
74
|
+
return record.userId === args.userId || record.userId == null;
|
|
73
75
|
}).map((record) => ({
|
|
74
76
|
id: record.id,
|
|
75
77
|
userId: record.userId,
|
|
@@ -148,9 +150,12 @@ function exposeVectorApi(runtime) {
|
|
|
148
150
|
}
|
|
149
151
|
function normalizeConfig(input) {
|
|
150
152
|
const root = (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "memory", "vector");
|
|
153
|
+
const markdownRoot = input?.markdownRoot ?? (0, import_node_path.join)(root, "markdown");
|
|
151
154
|
return {
|
|
152
155
|
enabled: input?.enabled ?? true,
|
|
153
|
-
markdownRoot
|
|
156
|
+
markdownRoot,
|
|
157
|
+
privateMarkdownRoot: input?.privateMarkdownRoot ?? (0, import_node_path.join)(markdownRoot, "private"),
|
|
158
|
+
sharedMarkdownRoot: input?.sharedMarkdownRoot ?? (0, import_node_path.join)(markdownRoot, "shared"),
|
|
154
159
|
indexPath: input?.indexPath ?? (0, import_node_path.join)(root, "index.json"),
|
|
155
160
|
dimensions: input?.dimensions ?? 64
|
|
156
161
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamdra/bamdra-memory-vector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Lightweight local semantic retrieval enhancement for the Bamdra OpenClaw memory suite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.bamdra.com",
|
|
@@ -31,10 +31,6 @@
|
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=22"
|
|
33
33
|
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"bundle": "node ../bamdra-openclaw-memory/scripts/run-local-bin.mjs tsup",
|
|
36
|
-
"prepublishOnly": "pnpm run bundle"
|
|
37
|
-
},
|
|
38
34
|
"openclaw": {
|
|
39
35
|
"id": "bamdra-memory-vector",
|
|
40
36
|
"type": "tool",
|
|
@@ -55,5 +51,8 @@
|
|
|
55
51
|
"dependencies": {},
|
|
56
52
|
"devDependencies": {
|
|
57
53
|
"@types/node": "^24.5.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"bundle": "node ../bamdra-openclaw-memory/scripts/run-local-bin.mjs tsup"
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
}
|