@xdarkicex/openclaw-memory-libravdb 1.3.5 → 1.3.7
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 +24 -4
- package/docs/architecture-decisions/adr-004-sidecar-over-native-ts.md +2 -2
- package/docs/architecture.md +11 -11
- package/docs/contributing.md +5 -5
- package/docs/implementation.md +17 -9
- package/docs/installation.md +101 -45
- package/docs/mathematics.md +15 -15
- package/docs/security.md +15 -16
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -7
- package/packaging/README.md +35 -0
- package/packaging/homebrew/libravdbd.rb.tmpl +40 -0
- package/packaging/launchd/com.xdarkicex.libravdbd.plist +26 -0
- package/packaging/systemd/libravdbd.service +12 -0
- package/src/plugin-runtime.ts +1 -1
- package/src/sidecar.ts +53 -147
- package/scripts/build-sidecar.sh +0 -30
- package/scripts/postinstall.js +0 -169
- package/scripts/setup.sh +0 -20
- package/scripts/setup.ts +0 -505
- package/scripts/sidecar-release.d.ts +0 -4
- package/scripts/sidecar-release.js +0 -17
- package/sidecar/cmd/inspect_onnx/main.go +0 -105
- package/sidecar/compact/gate.go +0 -273
- package/sidecar/compact/gate_test.go +0 -85
- package/sidecar/compact/summarize.go +0 -345
- package/sidecar/compact/summarize_test.go +0 -319
- package/sidecar/compact/tokens.go +0 -11
- package/sidecar/config/config.go +0 -119
- package/sidecar/config/config_test.go +0 -75
- package/sidecar/embed/engine.go +0 -696
- package/sidecar/embed/engine_test.go +0 -349
- package/sidecar/embed/matryoshka.go +0 -93
- package/sidecar/embed/matryoshka_test.go +0 -150
- package/sidecar/embed/onnx_local.go +0 -319
- package/sidecar/embed/onnx_local_test.go +0 -159
- package/sidecar/embed/profile_contract_test.go +0 -71
- package/sidecar/embed/profile_eval_test.go +0 -923
- package/sidecar/embed/profiles.go +0 -39
- package/sidecar/go.mod +0 -21
- package/sidecar/go.sum +0 -30
- package/sidecar/health/check.go +0 -33
- package/sidecar/health/check_test.go +0 -55
- package/sidecar/main.go +0 -151
- package/sidecar/model/encoder.go +0 -222
- package/sidecar/model/registry.go +0 -262
- package/sidecar/model/registry_test.go +0 -102
- package/sidecar/model/seq2seq.go +0 -133
- package/sidecar/server/rpc.go +0 -343
- package/sidecar/server/rpc_test.go +0 -350
- package/sidecar/server/transport.go +0 -160
- package/sidecar/store/libravdb.go +0 -676
- package/sidecar/store/libravdb_test.go +0 -472
- package/sidecar/summarize/engine.go +0 -360
- package/sidecar/summarize/engine_test.go +0 -148
- package/sidecar/summarize/onnx_local.go +0 -494
- package/sidecar/summarize/onnx_local_test.go +0 -48
- package/sidecar/summarize/profiles.go +0 -52
- package/sidecar/summarize/tokenizer.go +0 -13
- package/sidecar/summarize/tokenizer_hf.go +0 -76
- package/sidecar/summarize/util.go +0 -13
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
openclaw plugins install @xdarkicex/openclaw-memory-libravdb
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The published plugin is connect-only. It does not spawn a local binary during install or at runtime. For durable memory, run a local `libravdbd` daemon separately and point the plugin at its endpoint.
|
|
10
10
|
|
|
11
11
|
Minimum host version:
|
|
12
12
|
|
|
@@ -14,11 +14,26 @@ Minimum host version:
|
|
|
14
14
|
|
|
15
15
|
Security note:
|
|
16
16
|
|
|
17
|
-
- `
|
|
18
|
-
- the
|
|
17
|
+
- the published plugin package contains no `postinstall`, no `openclaw.setup`, and no direct `child_process` usage
|
|
18
|
+
- the plugin only connects to a local `libravdbd` endpoint such as `unix:/Users/<you>/.clawdb/run/libravdb.sock` or `tcp:127.0.0.1:37421`
|
|
19
19
|
- after install, the plugin makes no required network calls for embedding or extractive compaction
|
|
20
20
|
- the only optional runtime network path is an explicitly configured remote summarizer endpoint such as `ollama-local`
|
|
21
21
|
|
|
22
|
+
## Daemon
|
|
23
|
+
|
|
24
|
+
Install and start `libravdbd` separately, then point the plugin at the running daemon if you do not want the default endpoint.
|
|
25
|
+
|
|
26
|
+
Default endpoints:
|
|
27
|
+
|
|
28
|
+
- macOS/Linux: `unix:$HOME/.clawdb/run/libravdb.sock`
|
|
29
|
+
- Windows: `tcp:127.0.0.1:37421`
|
|
30
|
+
|
|
31
|
+
Phase 2 packaging assets now live under [`packaging/`](./packaging):
|
|
32
|
+
|
|
33
|
+
- `packaging/systemd/libravdbd.service` for Linux user services
|
|
34
|
+
- `packaging/launchd/com.xdarkicex.libravdbd.plist` for macOS LaunchAgents
|
|
35
|
+
- `packaging/homebrew/libravdbd.rb.tmpl` as the source template for a generated Homebrew formula
|
|
36
|
+
|
|
22
37
|
## Activate
|
|
23
38
|
|
|
24
39
|
Add this to `~/.openclaw/openclaw.json`:
|
|
@@ -28,6 +43,11 @@ Add this to `~/.openclaw/openclaw.json`:
|
|
|
28
43
|
"plugins": {
|
|
29
44
|
"slots": {
|
|
30
45
|
"memory": "libravdb-memory"
|
|
46
|
+
},
|
|
47
|
+
"configs": {
|
|
48
|
+
"libravdb-memory": {
|
|
49
|
+
"sidecarPath": "unix:/Users/<you>/.clawdb/run/libravdb.sock"
|
|
50
|
+
}
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
}
|
|
@@ -43,4 +63,4 @@ Run:
|
|
|
43
63
|
openclaw memory status
|
|
44
64
|
```
|
|
45
65
|
|
|
46
|
-
Expected output includes a readable status table showing the
|
|
66
|
+
Expected output includes a readable status table showing the daemon is reachable, stored turn/memory counts, the active ingestion gate threshold, and whether the abstractive summarizer is provisioned.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ADR-004:
|
|
1
|
+
# ADR-004: Daemon Over Native TypeScript
|
|
2
2
|
|
|
3
3
|
## Context
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ The plugin requires local vector storage, ONNX inference, transport isolation, a
|
|
|
6
6
|
|
|
7
7
|
## Decision
|
|
8
8
|
|
|
9
|
-
Implement the memory engine as a Go
|
|
9
|
+
Implement the memory engine as a Go daemon with a narrow JSON-RPC transport boundary.
|
|
10
10
|
|
|
11
11
|
## Alternatives Considered
|
|
12
12
|
|
package/docs/architecture.md
CHANGED
|
@@ -11,8 +11,8 @@ flowchart LR
|
|
|
11
11
|
Host["OpenClaw host process\n(TypeScript plugin shell)"]
|
|
12
12
|
CE["Context engine factory\nbootstrap / ingest / assemble / compact"]
|
|
13
13
|
MPS["memoryPromptSection\nuser+global recall"]
|
|
14
|
-
Runtime["Plugin runtime\nlazy
|
|
15
|
-
Sidecar["Go
|
|
14
|
+
Runtime["Plugin runtime\nlazy daemon connect + RPC client"]
|
|
15
|
+
Sidecar["Go daemon process"]
|
|
16
16
|
RPC["JSON-RPC over newline-delimited frames\nUnix socket or TCP loopback on Windows"]
|
|
17
17
|
Store["LibraVDB store on disk"]
|
|
18
18
|
Session["session:<sessionId>"]
|
|
@@ -47,7 +47,7 @@ Implementation anchors:
|
|
|
47
47
|
|
|
48
48
|
- plugin entry: [`src/index.ts`](../src/index.ts)
|
|
49
49
|
- lazy runtime startup: [`src/plugin-runtime.ts`](../src/plugin-runtime.ts)
|
|
50
|
-
-
|
|
50
|
+
- daemon supervision and endpoint discovery: [`src/sidecar.ts`](../src/sidecar.ts)
|
|
51
51
|
- transport listener: [`sidecar/server/transport.go`](../sidecar/server/transport.go)
|
|
52
52
|
- RPC method table: [`sidecar/server/rpc.go`](../sidecar/server/rpc.go)
|
|
53
53
|
- store: [`sidecar/store/libravdb.go`](../sidecar/store/libravdb.go)
|
|
@@ -60,8 +60,8 @@ Implemented in [`src/context-engine.ts`](../src/context-engine.ts).
|
|
|
60
60
|
|
|
61
61
|
For every non-heartbeat message:
|
|
62
62
|
|
|
63
|
-
1. The host gets an RPC client from the plugin runtime. This lazily
|
|
64
|
-
|
|
63
|
+
1. The host gets an RPC client from the plugin runtime. This lazily connects to
|
|
64
|
+
the configured daemon endpoint when the plugin is first used.
|
|
65
65
|
2. The message is written to `session:<sessionId>` with `type: "turn"`.
|
|
66
66
|
3. If `message.role === "user"`, the same text is written to `turns:<userId>`.
|
|
67
67
|
4. The host calls `gating_scalar` with `{ userId, text }`.
|
|
@@ -120,7 +120,7 @@ and [`sidecar/compact/summarize.go`](../sidecar/compact/summarize.go).
|
|
|
120
120
|
When compaction is triggered:
|
|
121
121
|
|
|
122
122
|
1. the host calls `compact_session` with `{ sessionId, force, targetSize }`
|
|
123
|
-
2. the
|
|
123
|
+
2. the daemon loads eligible non-summary turns from `session:<sessionId>`
|
|
124
124
|
3. turns are sorted by `(ts, id)` and partitioned into deterministic
|
|
125
125
|
chronological clusters
|
|
126
126
|
4. each cluster is routed to:
|
|
@@ -144,8 +144,8 @@ from the original spec phrasing.
|
|
|
144
144
|
|
|
145
145
|
| Failure | Current behavior | User impact |
|
|
146
146
|
|---|---|---|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
147
|
+
| Daemon unavailable on first RPC use | `getRpc()` rejects when first connect or health check fails | That hook fails or falls back, but plugin registration itself does not crash eagerly |
|
|
148
|
+
| Daemon connection closes mid-session | `SidecarSupervisor` retries with exponential backoff until retry budget is exhausted, then enters degraded mode | Memory becomes unavailable until the daemon is reachable again |
|
|
149
149
|
| `memoryPromptSection` RPC failure | individual searches are caught and replaced with empty result sets | Prompt section becomes empty rather than crashing the run |
|
|
150
150
|
| `assemble` RPC failure | returns original messages, original token count, and empty `systemPromptAddition` | That turn gets no recall augmentation |
|
|
151
151
|
| `ingest` gating or durable insert failure | session write already happened; durable promotion is skipped | Session memory survives, durable memory may miss that turn |
|
|
@@ -156,7 +156,7 @@ from the original spec phrasing.
|
|
|
156
156
|
Relevant code:
|
|
157
157
|
|
|
158
158
|
- retry/degraded behavior: [`src/sidecar.ts`](../src/sidecar.ts)
|
|
159
|
-
- lazy
|
|
159
|
+
- lazy daemon connect and health gate: [`src/plugin-runtime.ts`](../src/plugin-runtime.ts)
|
|
160
160
|
- compaction routing and insert/delete ordering:
|
|
161
161
|
[`sidecar/compact/summarize.go`](../sidecar/compact/summarize.go)
|
|
162
162
|
|
|
@@ -166,10 +166,10 @@ The gating decision spans both layers:
|
|
|
166
166
|
|
|
167
167
|
1. `ingest` writes the user turn to `turns:<userId>`
|
|
168
168
|
2. the host calls `gating_scalar`
|
|
169
|
-
3. the Go
|
|
169
|
+
3. the Go daemon performs exactly two searches:
|
|
170
170
|
- `SearchText("turns:<userId>", text, 10, nil)`
|
|
171
171
|
- `SearchText("user:<userId>", text, 5, nil)`
|
|
172
|
-
4. the
|
|
172
|
+
4. the daemon computes `GatingSignals` with [`compact.ComputeGating`](../sidecar/compact/gate.go)
|
|
173
173
|
5. the host compares `g` to `ingestionGateThreshold`
|
|
174
174
|
6. on pass, the host writes the turn into `user:<userId>` with all gating
|
|
175
175
|
metadata fields
|
package/docs/contributing.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Prerequisites
|
|
4
4
|
|
|
5
5
|
- Node.js `>= 22`
|
|
6
|
-
- Go `>= 1.22` for development and
|
|
6
|
+
- Go `>= 1.22` for daemon development and release builds
|
|
7
7
|
- `pnpm`
|
|
8
8
|
- OpenClaw CLI for end-to-end plugin testing
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ Integration tests:
|
|
|
21
21
|
npm run test:integration
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Go
|
|
24
|
+
Go daemon tests:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
cd sidecar
|
|
@@ -29,13 +29,13 @@ env GOCACHE=/tmp/openclaw-memory-libravdb-gocache go test ./...
|
|
|
29
29
|
env GOCACHE=/tmp/openclaw-memory-libravdb-gocache go test -race ./...
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Local
|
|
32
|
+
## Local Daemon Build
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
bash scripts/build-
|
|
35
|
+
bash scripts/build-daemon.sh
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
This creates `.
|
|
38
|
+
This creates `.daemon-bin/libravdbd` and copies locally available bundled assets into `.daemon-bin/`.
|
|
39
39
|
|
|
40
40
|
## Gating Invariants
|
|
41
41
|
|
package/docs/implementation.md
CHANGED
|
@@ -70,29 +70,37 @@ Important boundary:
|
|
|
70
70
|
- prompt-budget fitting uses a separate host-side chars-per-token heuristic in
|
|
71
71
|
[`src/tokens.ts`](../src/tokens.ts)
|
|
72
72
|
|
|
73
|
-
## Why the
|
|
73
|
+
## Why the Daemon Uses a Stable Endpoint
|
|
74
74
|
|
|
75
75
|
Implemented in [`sidecar/main.go`](../sidecar/main.go) and
|
|
76
76
|
[`src/sidecar.ts`](../src/sidecar.ts).
|
|
77
77
|
|
|
78
|
-
The
|
|
79
|
-
|
|
78
|
+
The daemon binds to a stable, predictable local endpoint instead of advertising
|
|
79
|
+
a per-process endpoint on stdout.
|
|
80
80
|
|
|
81
81
|
Why:
|
|
82
82
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
83
|
+
- the published plugin no longer spawns the process itself
|
|
84
|
+
- connect-only plugin startup needs a known endpoint contract
|
|
85
|
+
- user services such as `systemd --user`, launchd, and Homebrew service support
|
|
86
|
+
work better with a stable socket or loopback address
|
|
87
|
+
- Windows still uses a fixed loopback TCP endpoint because Unix sockets are not
|
|
88
|
+
the common user-service path there
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
Current defaults:
|
|
91
|
+
|
|
92
|
+
- macOS/Linux: `unix:$HOME/.clawdb/run/libravdb.sock`
|
|
93
|
+
- Windows: `tcp:127.0.0.1:37421`
|
|
94
|
+
|
|
95
|
+
The plugin resolves that configured endpoint and then establishes the JSON-RPC
|
|
96
|
+
transport.
|
|
89
97
|
|
|
90
98
|
## Why Degraded Mode Continues the Session
|
|
91
99
|
|
|
92
100
|
Implemented in [`src/sidecar.ts`](../src/sidecar.ts) and
|
|
93
101
|
[`src/context-engine.ts`](../src/context-engine.ts).
|
|
94
102
|
|
|
95
|
-
If the
|
|
103
|
+
If the daemon connection fails repeatedly, the plugin enters degraded mode instead of
|
|
96
104
|
failing the chat session.
|
|
97
105
|
|
|
98
106
|
Why:
|
package/docs/installation.md
CHANGED
|
@@ -8,13 +8,13 @@ This document is the full installation reference for `@xdarkicex/openclaw-memory
|
|
|
8
8
|
|---|---|---|---|
|
|
9
9
|
| Node.js | `22.0.0` | Latest LTS | Enforced in [`package.json`](../package.json) `engines.node` |
|
|
10
10
|
| OpenClaw | `2026.3.22` | Current stable | Pinned by [`package.json`](../package.json) `peerDependencies.openclaw`; this is the earliest local tag confirmed to expose `definePluginEntry`, `registerContextEngine`, `registerMemoryPromptSection`, and the plugin API shape this repo uses |
|
|
11
|
-
| Go | `1.22` | Latest stable |
|
|
11
|
+
| Go | `1.22` | Latest stable | Required only for local daemon development, not for normal plugin install |
|
|
12
12
|
| Disk | about `1 GB` free for default Nomic install | `2 GB+` if provisioning optional T5 and leaving room for DB growth | See Resource Requirements below |
|
|
13
13
|
| RAM | about `512 MB` for embed-only runtime | `1 GB+` if optional T5 summarizer is provisioned | Based on local RSS measurements below |
|
|
14
|
-
| OS | macOS, Linux, Windows | Current stable releases |
|
|
15
|
-
| Architecture | `arm64`, `x64` | Match published release assets | Current release matrix builds five
|
|
14
|
+
| OS | macOS, Linux, Windows | Current stable releases | Unix uses a local socket; Windows uses TCP loopback |
|
|
15
|
+
| Architecture | `arm64`, `x64` | Match published daemon release assets | Current release matrix builds five daemon targets |
|
|
16
16
|
|
|
17
|
-
The published install path is
|
|
17
|
+
The published plugin install path is scanner-clean and connect-only. End users should not need Go to install the OpenClaw plugin itself.
|
|
18
18
|
|
|
19
19
|
## Resource Requirements
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ build on `2026-03-29` or explicitly labeled as estimates.
|
|
|
25
25
|
|
|
26
26
|
Measured locally from this checkout:
|
|
27
27
|
|
|
28
|
-
-
|
|
28
|
+
- daemon binary: `7.7M`
|
|
29
29
|
- bundled Nomic model directory: `523M`
|
|
30
30
|
- bundled MiniLM fallback model directory: `87M`
|
|
31
31
|
- optional T5 summarizer directory: `371M`
|
|
@@ -55,7 +55,7 @@ as well.
|
|
|
55
55
|
|
|
56
56
|
### Memory
|
|
57
57
|
|
|
58
|
-
Measured locally on Apple M2, `2026-03-29`, by starting the
|
|
58
|
+
Measured locally on Apple M2, `2026-03-29`, by starting the daemon and reading
|
|
59
59
|
RSS after startup:
|
|
60
60
|
|
|
61
61
|
- idle RSS with Nomic embedding path loaded and no optional T5 summarizer:
|
|
@@ -121,39 +121,78 @@ extractive compaction. The only optional runtime network path is:
|
|
|
121
121
|
openclaw plugins install @xdarkicex/openclaw-memory-libravdb
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
The plugin package installs as normal OpenClaw source without daemon bootstrap hooks.
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
## Daemon Install
|
|
127
|
+
|
|
128
|
+
Install and start `libravdbd` separately for the same user account that runs OpenClaw. The daemon owns the local DB engine and listens on a local endpoint.
|
|
129
|
+
|
|
130
|
+
Default endpoints:
|
|
131
|
+
|
|
132
|
+
- macOS/Linux: `unix:$HOME/.clawdb/run/libravdb.sock`
|
|
133
|
+
- Windows: `tcp:127.0.0.1:37421`
|
|
134
|
+
|
|
135
|
+
If you run the daemon on a different endpoint, set `plugins.configs.libravdb-memory.sidecarPath` in `~/.openclaw/openclaw.json`.
|
|
136
|
+
|
|
137
|
+
### Linux
|
|
138
|
+
|
|
139
|
+
Recommended layout:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
mkdir -p ~/.local/bin ~/.config/systemd/user
|
|
143
|
+
curl -L -o ~/.local/bin/libravdbd https://github.com/xDarkicex/openclaw-memory-libravdb/releases/download/vX.Y.Z/libravdbd-linux-amd64
|
|
144
|
+
chmod +x ~/.local/bin/libravdbd
|
|
145
|
+
cp packaging/systemd/libravdbd.service ~/.config/systemd/user/libravdbd.service
|
|
146
|
+
systemctl --user enable --now libravdbd.service
|
|
134
147
|
```
|
|
135
148
|
|
|
136
|
-
|
|
137
|
-
same flow, output should additionally include a line like:
|
|
149
|
+
Then verify:
|
|
138
150
|
|
|
139
|
-
```
|
|
140
|
-
|
|
151
|
+
```bash
|
|
152
|
+
systemctl --user status libravdbd.service
|
|
153
|
+
openclaw memory status
|
|
141
154
|
```
|
|
142
155
|
|
|
143
|
-
|
|
144
|
-
memory provider.
|
|
156
|
+
### Homebrew / macOS
|
|
145
157
|
|
|
146
|
-
|
|
158
|
+
The release workflow now generates a publish-ready `libravdbd.rb` formula asset from [`packaging/homebrew/libravdbd.rb.tmpl`](../packaging/homebrew/libravdbd.rb.tmpl). It is designed for GitHub release assets named:
|
|
147
159
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
- `libravdbd-darwin-arm64`
|
|
161
|
+
- `libravdbd-darwin-amd64`
|
|
162
|
+
- `libravdbd-linux-amd64`
|
|
163
|
+
- `libravdbd-linux-arm64`
|
|
164
|
+
|
|
165
|
+
If your GitHub Actions configuration includes:
|
|
166
|
+
|
|
167
|
+
- repository variable `HOMEBREW_TAP_REPO`, for example `xDarkicex/homebrew-openclaw-libravdb-memory`
|
|
168
|
+
- repository secret `HOMEBREW_TAP_TOKEN`
|
|
169
|
+
|
|
170
|
+
then tagged releases also push the generated formula into `Formula/libravdbd.rb` in that tap repository automatically.
|
|
171
|
+
|
|
172
|
+
Example:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"plugins": {
|
|
177
|
+
"slots": {
|
|
178
|
+
"memory": "libravdb-memory"
|
|
179
|
+
},
|
|
180
|
+
"configs": {
|
|
181
|
+
"libravdb-memory": {
|
|
182
|
+
"sidecarPath": "unix:/Users/<you>/.clawdb/run/libravdb.sock"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
153
187
|
```
|
|
154
188
|
|
|
155
|
-
|
|
156
|
-
|
|
189
|
+
## Expected Install Shape
|
|
190
|
+
|
|
191
|
+
Expected successful plugin install shape:
|
|
192
|
+
|
|
193
|
+
```text
|
|
194
|
+
Installed plugin: libravdb-memory
|
|
195
|
+
```
|
|
157
196
|
|
|
158
197
|
## Activation
|
|
159
198
|
|
|
@@ -205,7 +244,7 @@ Expected output shape:
|
|
|
205
244
|
|
|
206
245
|
Interpretation:
|
|
207
246
|
|
|
208
|
-
- `Sidecar=running` means the
|
|
247
|
+
- `Sidecar=running` means the local `libravdbd` daemon answered JSON-RPC `health`.
|
|
209
248
|
- `Gate threshold=0.35` confirms the default gating scalar boundary is active.
|
|
210
249
|
- `Abstractive model=not provisioned` is acceptable. The system degrades to extractive compaction.
|
|
211
250
|
|
|
@@ -216,26 +255,43 @@ For contributors working from a clone:
|
|
|
216
255
|
```bash
|
|
217
256
|
pnpm check
|
|
218
257
|
cd sidecar && env GOCACHE=/tmp/openclaw-memory-libravdb-gocache go test -race ./... && cd ..
|
|
219
|
-
|
|
258
|
+
bash scripts/build-daemon.sh
|
|
220
259
|
```
|
|
221
260
|
|
|
222
|
-
|
|
261
|
+
This produces a local daemon binary in `.daemon-bin/libravdbd` (or `.exe` on Windows) and copies any locally available model/runtime assets there for testing.
|
|
262
|
+
|
|
263
|
+
## User-Service Templates
|
|
264
|
+
|
|
265
|
+
Phase 2 packaging assets are included in-repo:
|
|
266
|
+
|
|
267
|
+
- Linux user service: [`packaging/systemd/libravdbd.service`](../packaging/systemd/libravdbd.service)
|
|
268
|
+
- macOS LaunchAgent: [`packaging/launchd/com.xdarkicex.libravdbd.plist`](../packaging/launchd/com.xdarkicex.libravdbd.plist)
|
|
269
|
+
|
|
270
|
+
Linux example:
|
|
223
271
|
|
|
224
272
|
```bash
|
|
225
|
-
|
|
273
|
+
mkdir -p ~/.config/systemd/user
|
|
274
|
+
cp packaging/systemd/libravdbd.service ~/.config/systemd/user/libravdbd.service
|
|
275
|
+
systemctl --user enable --now libravdbd.service
|
|
226
276
|
```
|
|
227
277
|
|
|
228
|
-
|
|
278
|
+
macOS example:
|
|
279
|
+
|
|
280
|
+
1. Copy `packaging/launchd/com.xdarkicex.libravdbd.plist`
|
|
281
|
+
2. Replace `__LIBRAVDBD_PATH__` and `__HOME__`
|
|
282
|
+
3. Save it to `~/Library/LaunchAgents/com.xdarkicex.libravdbd.plist`
|
|
283
|
+
4. Load it with `launchctl load ~/Library/LaunchAgents/com.xdarkicex.libravdbd.plist`
|
|
229
284
|
|
|
230
285
|
## Troubleshooting
|
|
231
286
|
|
|
232
|
-
###
|
|
287
|
+
### Daemon unavailable
|
|
233
288
|
|
|
234
289
|
Common causes:
|
|
235
290
|
|
|
236
291
|
- ONNX Runtime library missing or unpacked in the wrong place
|
|
237
292
|
- downloaded model file hash mismatch
|
|
238
|
-
-
|
|
293
|
+
- `libravdbd` not started for the current user
|
|
294
|
+
- plugin pointed at the wrong endpoint
|
|
239
295
|
|
|
240
296
|
Check:
|
|
241
297
|
|
|
@@ -243,21 +299,19 @@ Check:
|
|
|
243
299
|
openclaw memory status
|
|
244
300
|
```
|
|
245
301
|
|
|
246
|
-
If the
|
|
302
|
+
If the daemon is down, start it and verify the configured endpoint:
|
|
247
303
|
|
|
248
304
|
```bash
|
|
249
|
-
|
|
305
|
+
libravdbd serve
|
|
250
306
|
```
|
|
251
307
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
The setup script verifies hashes for required assets. A failed or partial download is deleted and retried on the next run. This is intentional. A model file that exists but fails hash verification is treated as corrupt.
|
|
308
|
+
On macOS/Linux, the default endpoint is `unix:$HOME/.clawdb/run/libravdb.sock`. On Windows, the default endpoint is `tcp:127.0.0.1:37421`.
|
|
255
309
|
|
|
256
310
|
### Hash mismatch
|
|
257
311
|
|
|
258
312
|
Hash mismatch means one of:
|
|
259
313
|
|
|
260
|
-
- the
|
|
314
|
+
- the daemon asset is corrupt
|
|
261
315
|
- the local cache is stale
|
|
262
316
|
- the expected checksum is wrong
|
|
263
317
|
|
|
@@ -265,8 +319,10 @@ Do not bypass this. Delete the asset and rerun setup, or republish the release w
|
|
|
265
319
|
|
|
266
320
|
### Windows behavior
|
|
267
321
|
|
|
268
|
-
On Windows the
|
|
322
|
+
On Windows the daemon uses a loopback TCP endpoint instead of a Unix socket. This is expected. The plugin’s transport layer already handles the fallback.
|
|
269
323
|
|
|
270
|
-
###
|
|
324
|
+
### Published daemon requirement
|
|
271
325
|
|
|
272
|
-
|
|
326
|
+
The daemon must come from a published `libravdbd` binary for the current platform.
|
|
327
|
+
If that download or checksum verification fails, setup stops instead of falling
|
|
328
|
+
back to a local `go build`.
|
package/docs/mathematics.md
CHANGED
|
@@ -444,7 +444,7 @@ r(d)=\exp\left(-\lambda_r\cdot \Delta t(d)\right)
|
|
|
444
444
|
$$
|
|
445
445
|
|
|
446
446
|
$$
|
|
447
|
-
f(d)=\frac{\log(1+\
|
|
447
|
+
f(d)=\frac{\log(1+\mathrm{acc}(d))}{\log\left(1+\max_{d'\in\mathcal{V}}\mathrm{acc}(d')\right)}
|
|
448
448
|
$$
|
|
449
449
|
|
|
450
450
|
$$
|
|
@@ -459,19 +459,19 @@ and authored authority without baking those concerns into the raw cosine term.
|
|
|
459
459
|
Pass 1 computes cosine similarity:
|
|
460
460
|
|
|
461
461
|
$$
|
|
462
|
-
\
|
|
462
|
+
\mathrm{sim}(q,d)=\varphi(q)^\top \varphi(d)
|
|
463
463
|
$$
|
|
464
464
|
|
|
465
465
|
and selects the coarse candidate set:
|
|
466
466
|
|
|
467
467
|
$$
|
|
468
|
-
\mathcal{C}_1(q)=\
|
|
468
|
+
\mathcal{C}_1(q)=\mathrm{TopK}_{d\in\mathcal{V}}\!\left(k_1,\mathrm{sim}(q,d)\right)
|
|
469
469
|
$$
|
|
470
470
|
|
|
471
471
|
with a hard similarity floor:
|
|
472
472
|
|
|
473
473
|
$$
|
|
474
|
-
\mathcal{C}_1(q)=\{d\in\mathcal{C}_1(q)\mid \
|
|
474
|
+
\mathcal{C}_1(q)=\{d\in\mathcal{C}_1(q)\mid \mathrm{sim}(q,d)\ge \theta_1\}
|
|
475
475
|
$$
|
|
476
476
|
|
|
477
477
|
The purpose of this pass is breadth with cheap semantic recall. Documents below
|
|
@@ -483,13 +483,13 @@ first pass must not admit semantically orthogonal noise into second-pass work.
|
|
|
483
483
|
Let the query keyword extractor return:
|
|
484
484
|
|
|
485
485
|
$$
|
|
486
|
-
K = \
|
|
486
|
+
K = \mathrm{KeyExt}(q)
|
|
487
487
|
$$
|
|
488
488
|
|
|
489
489
|
and define normalized keyword coverage:
|
|
490
490
|
|
|
491
491
|
$$
|
|
492
|
-
M_{norm}(K,d)=\frac{|K\cap \
|
|
492
|
+
M_{norm}(K,d)=\frac{|K\cap \mathrm{terms}(d)|}{|K|}\in[0,1]
|
|
493
493
|
$$
|
|
494
494
|
|
|
495
495
|
The proposed normalized second-pass score is:
|
|
@@ -497,7 +497,7 @@ The proposed normalized second-pass score is:
|
|
|
497
497
|
$$
|
|
498
498
|
S_{final}(d)=
|
|
499
499
|
\frac{
|
|
500
|
-
\omega(d)\cdot\max(\
|
|
500
|
+
\omega(d)\cdot\max(\mathrm{sim}(q,d), 0)\cdot\left(1+\kappa\cdot M_{norm}(K,d)\right)
|
|
501
501
|
}{
|
|
502
502
|
1+\kappa
|
|
503
503
|
}
|
|
@@ -515,7 +515,7 @@ truncating the result.
|
|
|
515
515
|
The second-pass candidate set is:
|
|
516
516
|
|
|
517
517
|
$$
|
|
518
|
-
\mathcal{C}_2(q)=\
|
|
518
|
+
\mathcal{C}_2(q)=\mathrm{TopK}_{d\in\mathcal{C}_1(q)}\!\left(k_2,S_{final}(d)\right)
|
|
519
519
|
$$
|
|
520
520
|
|
|
521
521
|
with:
|
|
@@ -529,7 +529,7 @@ $$
|
|
|
529
529
|
Let:
|
|
530
530
|
|
|
531
531
|
$$
|
|
532
|
-
s=\max(\
|
|
532
|
+
s=\max(\mathrm{sim}(q,d),0)\in[0,1]
|
|
533
533
|
$$
|
|
534
534
|
|
|
535
535
|
Then:
|
|
@@ -611,19 +611,19 @@ $$
|
|
|
611
611
|
Variant projection is:
|
|
612
612
|
|
|
613
613
|
$$
|
|
614
|
-
\
|
|
614
|
+
\mathrm{Proj}(\mathcal{V}, q)=\mathcal{C}_2(q)\cup\mathcal{C}_{hop}^{*}(q)
|
|
615
615
|
$$
|
|
616
616
|
|
|
617
617
|
Total injected soul context is:
|
|
618
618
|
|
|
619
619
|
$$
|
|
620
|
-
C_{soul}(q)=\mathcal{I}\cup \
|
|
620
|
+
C_{soul}(q)=\mathcal{I}\cup \mathrm{Proj}(\mathcal{V}, q)
|
|
621
621
|
$$
|
|
622
622
|
|
|
623
623
|
Let the total prompt budget be $\tau$. If the invariant set consumes:
|
|
624
624
|
|
|
625
625
|
$$
|
|
626
|
-
\tau_{\mathcal{I}}=\sum_{d\in\mathcal{I}} \
|
|
626
|
+
\tau_{\mathcal{I}}=\sum_{d\in\mathcal{I}} \mathrm{toks}(d)
|
|
627
627
|
$$
|
|
628
628
|
|
|
629
629
|
then the variant budget is:
|
|
@@ -632,11 +632,11 @@ $$
|
|
|
632
632
|
\tau_{\mathcal{V}}=\tau-\tau_{\mathcal{I}}
|
|
633
633
|
$$
|
|
634
634
|
|
|
635
|
-
Documents in $\
|
|
635
|
+
Documents in $\mathrm{Proj}(\mathcal{V}, q)$ are injected in descending
|
|
636
636
|
score order until:
|
|
637
637
|
|
|
638
638
|
$$
|
|
639
|
-
\sum_{d\in \text{injected}} \
|
|
639
|
+
\sum_{d\in \text{injected}} \mathrm{toks}(d)\le\tau_{\mathcal{V}}
|
|
640
640
|
$$
|
|
641
641
|
|
|
642
642
|
The merged score sequence is:
|
|
@@ -684,7 +684,7 @@ $$
|
|
|
684
684
|
4. Token budget respect:
|
|
685
685
|
|
|
686
686
|
$$
|
|
687
|
-
\sum_{d\in C_{soul}(q)} \
|
|
687
|
+
\sum_{d\in C_{soul}(q)} \mathrm{toks}(d)\le\tau
|
|
688
688
|
$$
|
|
689
689
|
|
|
690
690
|
with the invariant set never truncated
|
package/docs/security.md
CHANGED
|
@@ -16,26 +16,25 @@ The system is designed so a failure in one layer does not automatically collapse
|
|
|
16
16
|
|
|
17
17
|
## Supply Chain and Installer Trust Boundary
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
The published plugin package intentionally avoids install-time process execution.
|
|
20
|
+
That is a deliberate trust and distribution choice: the OpenClaw plugin is a
|
|
21
|
+
thin client, and the local `libravdbd` daemon is a separate operator-managed
|
|
22
|
+
component.
|
|
22
23
|
|
|
23
24
|
Current implementation facts:
|
|
24
25
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
26
|
+
- the published npm package has no `postinstall`
|
|
27
|
+
- the published plugin manifest does not register `openclaw.setup`
|
|
28
|
+
- the published plugin source contains no direct `child_process` usage
|
|
29
|
+
- the plugin connects only to a configured local endpoint such as
|
|
30
|
+
`unix:/Users/<you>/.clawdb/run/libravdb.sock` or `tcp:127.0.0.1:37421`
|
|
31
|
+
- daemon installation and lifecycle are explicit user or operator actions
|
|
31
32
|
|
|
32
|
-
The
|
|
33
|
+
The daemon distribution surface should be evaluated separately from the plugin
|
|
34
|
+
package. If you install `libravdbd` from release assets or another package
|
|
35
|
+
channel, validate that channel directly.
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
- ONNX Runtime release assets
|
|
36
|
-
- model artifacts explicitly referenced in `setup.ts`
|
|
37
|
-
|
|
38
|
-
After installation, the plugin is local-first:
|
|
37
|
+
After installation, the plugin remains local-first:
|
|
39
38
|
|
|
40
39
|
- no required network calls are made for embedding
|
|
41
40
|
- no required network calls are made for extractive compaction
|
|
@@ -77,7 +76,7 @@ It reduces risk; it does not create a trusted execution environment.
|
|
|
77
76
|
|
|
78
77
|
## Deletion and Data Protection
|
|
79
78
|
|
|
80
|
-
The
|
|
79
|
+
The daemon exposes deletion and flush primitives. That matters operationally for:
|
|
81
80
|
|
|
82
81
|
- user-requested memory removal
|
|
83
82
|
- namespace cleanup
|
package/openclaw.plugin.json
CHANGED