@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.
Files changed (61) hide show
  1. package/README.md +24 -4
  2. package/docs/architecture-decisions/adr-004-sidecar-over-native-ts.md +2 -2
  3. package/docs/architecture.md +11 -11
  4. package/docs/contributing.md +5 -5
  5. package/docs/implementation.md +17 -9
  6. package/docs/installation.md +101 -45
  7. package/docs/mathematics.md +15 -15
  8. package/docs/security.md +15 -16
  9. package/openclaw.plugin.json +1 -1
  10. package/package.json +4 -7
  11. package/packaging/README.md +35 -0
  12. package/packaging/homebrew/libravdbd.rb.tmpl +40 -0
  13. package/packaging/launchd/com.xdarkicex.libravdbd.plist +26 -0
  14. package/packaging/systemd/libravdbd.service +12 -0
  15. package/src/plugin-runtime.ts +1 -1
  16. package/src/sidecar.ts +53 -147
  17. package/scripts/build-sidecar.sh +0 -30
  18. package/scripts/postinstall.js +0 -169
  19. package/scripts/setup.sh +0 -20
  20. package/scripts/setup.ts +0 -505
  21. package/scripts/sidecar-release.d.ts +0 -4
  22. package/scripts/sidecar-release.js +0 -17
  23. package/sidecar/cmd/inspect_onnx/main.go +0 -105
  24. package/sidecar/compact/gate.go +0 -273
  25. package/sidecar/compact/gate_test.go +0 -85
  26. package/sidecar/compact/summarize.go +0 -345
  27. package/sidecar/compact/summarize_test.go +0 -319
  28. package/sidecar/compact/tokens.go +0 -11
  29. package/sidecar/config/config.go +0 -119
  30. package/sidecar/config/config_test.go +0 -75
  31. package/sidecar/embed/engine.go +0 -696
  32. package/sidecar/embed/engine_test.go +0 -349
  33. package/sidecar/embed/matryoshka.go +0 -93
  34. package/sidecar/embed/matryoshka_test.go +0 -150
  35. package/sidecar/embed/onnx_local.go +0 -319
  36. package/sidecar/embed/onnx_local_test.go +0 -159
  37. package/sidecar/embed/profile_contract_test.go +0 -71
  38. package/sidecar/embed/profile_eval_test.go +0 -923
  39. package/sidecar/embed/profiles.go +0 -39
  40. package/sidecar/go.mod +0 -21
  41. package/sidecar/go.sum +0 -30
  42. package/sidecar/health/check.go +0 -33
  43. package/sidecar/health/check_test.go +0 -55
  44. package/sidecar/main.go +0 -151
  45. package/sidecar/model/encoder.go +0 -222
  46. package/sidecar/model/registry.go +0 -262
  47. package/sidecar/model/registry_test.go +0 -102
  48. package/sidecar/model/seq2seq.go +0 -133
  49. package/sidecar/server/rpc.go +0 -343
  50. package/sidecar/server/rpc_test.go +0 -350
  51. package/sidecar/server/transport.go +0 -160
  52. package/sidecar/store/libravdb.go +0 -676
  53. package/sidecar/store/libravdb_test.go +0 -472
  54. package/sidecar/summarize/engine.go +0 -360
  55. package/sidecar/summarize/engine_test.go +0 -148
  56. package/sidecar/summarize/onnx_local.go +0 -494
  57. package/sidecar/summarize/onnx_local_test.go +0 -48
  58. package/sidecar/summarize/profiles.go +0 -52
  59. package/sidecar/summarize/tokenizer.go +0 -13
  60. package/sidecar/summarize/tokenizer_hf.go +0 -76
  61. 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 installer builds the Go sidecar, provisions the bundled embedding/runtime assets, optionally provisions the T5 summarizer, and fails fast if the sidecar cannot pass its startup health check.
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
- - `scripts/setup.ts` verifies SHA-256 checksums for downloaded sidecar/runtime/model assets
18
- - the sidecar installer downloads prebuilt sidecar release assets only from `github.com/xDarkicex/openclaw-memory-libravdb` releases
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 sidecar is running, stored turn/memory counts, the active ingestion gate threshold, and whether the abstractive summarizer is provisioned.
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: Sidecar Over Native TypeScript
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 sidecar with a narrow JSON-RPC transport boundary.
9
+ Implement the memory engine as a Go daemon with a narrow JSON-RPC transport boundary.
10
10
 
11
11
  ## Alternatives Considered
12
12
 
@@ -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 sidecar startup + RPC client"]
15
- Sidecar["Go sidecar process"]
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
- - sidecar supervision and endpoint discovery: [`src/sidecar.ts`](../src/sidecar.ts)
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 starts the
64
- sidecar if it is not already running.
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 sidecar loads eligible non-summary turns from `session:<sessionId>`
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
- | Sidecar unavailable on first RPC use | `getRpc()` rejects when lazy startup or health check fails | That hook fails or falls back, but plugin registration itself does not crash eagerly |
148
- | Sidecar connection closes mid-session | `SidecarSupervisor` retries with exponential backoff until retry budget is exhausted, then enters degraded mode | Memory becomes unavailable until restart succeeds |
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 startup and health gate: [`src/plugin-runtime.ts`](../src/plugin-runtime.ts)
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 sidecar performs exactly two searches:
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 sidecar computes `GatingSignals` with [`compact.ComputeGating`](../sidecar/compact/gate.go)
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
@@ -3,7 +3,7 @@
3
3
  ## Prerequisites
4
4
 
5
5
  - Node.js `>= 22`
6
- - Go `>= 1.22` for development and local fallback builds
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 sidecar tests:
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 Sidecar Build
32
+ ## Local Daemon Build
33
33
 
34
34
  ```bash
35
- bash scripts/build-sidecar.sh
35
+ bash scripts/build-daemon.sh
36
36
  ```
37
37
 
38
- This creates `.sidecar-bin/libravdb-sidecar` and copies locally available bundled assets into `.sidecar-bin/`.
38
+ This creates `.daemon-bin/libravdbd` and copies locally available bundled assets into `.daemon-bin/`.
39
39
 
40
40
  ## Gating Invariants
41
41
 
@@ -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 Sidecar Emits Its Endpoint on stdout
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 sidecar prints its runtime endpoint to stdout on startup instead of binding
79
- to a fixed path known in advance.
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
- - fixed Unix socket paths create collision risk across concurrent runs
84
- - temporary per-process endpoints avoid stale socket cleanup problems
85
- - Windows already requires a dynamic TCP fallback
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
- The host watches stdout, captures the endpoint, and then establishes the
88
- JSON-RPC transport.
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 sidecar fails repeatedly, the plugin enters degraded mode instead of
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:
@@ -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 | Dev/fallback build only; not required when prebuilt release assets exist |
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 | Windows uses TCP loopback instead of Unix sockets |
15
- | Architecture | `arm64`, `x64` | Match published release assets | Current release matrix builds five sidecar targets |
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 prebuilt-first. End users should not normally need Go.
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
- - sidecar binary: `7.7M`
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 sidecar and reading
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
- Expected successful install shape on a published release:
124
+ The plugin package installs as normal OpenClaw source without daemon bootstrap hooks.
125
125
 
126
- ```text
127
- [openclaw-memory-libravdb] Sidecar installed (prebuilt clawdb-sidecar-<platform>)
128
- [openclaw-memory-libravdb] Provisioning embedding model...
129
- [openclaw-memory-libravdb] Provisioning ONNX runtime...
130
- [openclaw-memory-libravdb] Provisioning summarizer model... (optional)
131
- [openclaw-memory-libravdb] Verifying sidecar health...
132
- [openclaw-memory-libravdb] Setup complete.
133
- Installed plugin: libravdb-memory
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
- If the host also activates the plugin into the exclusive memory slot during the
137
- same flow, output should additionally include a line like:
149
+ Then verify:
138
150
 
139
- ```text
140
- Exclusive slot "memory" switched from "memory-core" to "libravdb-memory".
151
+ ```bash
152
+ systemctl --user status libravdbd.service
153
+ openclaw memory status
141
154
  ```
142
155
 
143
- That slot-takeover line is the proof that OpenClaw is no longer using the stock
144
- memory provider.
156
+ ### Homebrew / macOS
145
157
 
146
- Development fallback shape when a prebuilt sidecar asset is not available:
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
- ```text
149
- [openclaw-memory-libravdb] Prebuilt binary unavailable. Attempting local go build...
150
- [openclaw-memory-libravdb] This requires Go >= 1.22: https://go.dev/dl/
151
- [openclaw-memory-libravdb] Sidecar installed (local build)
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
- Published users should rarely see the fallback path. If they do, the plugin
156
- version likely has not published sidecar release assets for that platform yet.
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 Go sidecar booted and answered JSON-RPC `health`.
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
- node scripts/setup.ts
258
+ bash scripts/build-daemon.sh
220
259
  ```
221
260
 
222
- Optional direct dev build:
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
- bash scripts/build-sidecar.sh
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
- This produces a local sidecar in `.sidecar-bin/` and copies any locally available model/runtime assets there for testing.
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
- ### Sidecar fails to start
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
- - local Go fallback unavailable and no prebuilt asset for the requested version
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 sidecar is down, rerun:
302
+ If the daemon is down, start it and verify the configured endpoint:
247
303
 
248
304
  ```bash
249
- node scripts/setup.ts
305
+ libravdbd serve
250
306
  ```
251
307
 
252
- ### Model download fails
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 release asset is corrupt
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 sidecar advertises a loopback TCP endpoint instead of a Unix socket. This is expected. The plugin’s transport layer already handles the fallback.
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
- ### Local fallback path
324
+ ### Published daemon requirement
271
325
 
272
- If the installer logs that it is attempting a local `go build`, the prebuilt release asset was not available for the plugin version being installed. For published tags this should be unusual; for branch or unreleased work it is expected.
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`.
@@ -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+\operatorname{acc}(d))}{\log\left(1+\max_{d'\in\mathcal{V}}\operatorname{acc}(d')\right)}
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
- \operatorname{sim}(q,d)=\varphi(q)^\top \varphi(d)
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)=\operatorname{top\text{-}k_1}_{d\in\mathcal{V}}\ \operatorname{sim}(q,d)
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 \operatorname{sim}(q,d)\ge \theta_1\}
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 = \operatorname{KeyExt}(q)
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 \operatorname{terms}(d)|}{|K|}\in[0,1]
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(\operatorname{sim}(q,d), 0)\cdot\left(1+\kappa\cdot M_{norm}(K,d)\right)
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)=\operatorname{top\text{-}k_2}_{d\in\mathcal{C}_1(q)}\ S_{final}(d)
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(\operatorname{sim}(q,d),0)\in[0,1]
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
- \operatorname{Proj}(\mathcal{V}, q)=\mathcal{C}_2(q)\cup\mathcal{C}_{hop}^{*}(q)
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 \operatorname{Proj}(\mathcal{V}, q)
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}} \operatorname{toks}(d)
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 $\operatorname{Proj}(\mathcal{V}, q)$ are injected in descending
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}} \operatorname{toks}(d)\le\tau_{\mathcal{V}}
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)} \operatorname{toks}(d)\le\tau
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
- This repository uses both `postinstall` and `openclaw.setup`. That is a real
20
- security-sensitive surface in the OpenClaw ecosystem and should be evaluated
21
- explicitly rather than hand-waved away.
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
- - [`scripts/postinstall.js`](../scripts/postinstall.js) installs the sidecar
26
- binary using a prebuilt-first strategy with a local Go fallback
27
- - [`scripts/setup.ts`](../scripts/setup.ts) provisions model/runtime assets and
28
- verifies them before they are accepted
29
- - required downloaded assets are SHA-256 checked before use
30
- - an asset that exists but fails verification is deleted and re-downloaded
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 current installer fetches from these classes of sources only:
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
- - GitHub release assets for prebuilt sidecar binaries
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 sidecar exposes deletion and flush primitives. That matters operationally for:
79
+ The daemon exposes deletion and flush primitives. That matters operationally for:
81
80
 
82
81
  - user-requested memory removal
83
82
  - namespace cleanup
@@ -2,7 +2,7 @@
2
2
  "id": "libravdb-memory",
3
3
  "name": "LibraVDB Memory",
4
4
  "description": "Persistent vector memory with three-tier hybrid scoring",
5
- "version": "1.3.3",
5
+ "version": "1.3.7",
6
6
  "kind": "memory",
7
7
  "configSchema": {
8
8
  "type": "object",