memory-lancedb-pro 1.0.0

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 ADDED
@@ -0,0 +1,489 @@
1
+ <div align="center">
2
+
3
+ # ๐Ÿง  memory-lancedb-pro
4
+
5
+ **Enhanced Long-Term Memory Plugin for [OpenClaw](https://github.com/openclaw/openclaw)**
6
+
7
+ Hybrid Retrieval (Vector + BM25) ยท Cross-Encoder Rerank ยท Multi-Scope Isolation ยท Management CLI
8
+
9
+ [![OpenClaw Plugin](https://img.shields.io/badge/OpenClaw-Plugin-blue)](https://github.com/openclaw/openclaw)
10
+ [![LanceDB](https://img.shields.io/badge/LanceDB-Vectorstore-orange)](https://lancedb.com)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
12
+
13
+ **English** | [็ฎ€ไฝ“ไธญๆ–‡](README_CN.md)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## ๐Ÿ“บ Video Tutorial
20
+
21
+ > **Watch the full walkthrough โ€” covers installation, configuration, and how hybrid retrieval works under the hood.**
22
+
23
+ [![YouTube Video](https://img.shields.io/badge/YouTube-Watch%20Now-red?style=for-the-badge&logo=youtube)](https://youtu.be/MtukF1C8epQ)
24
+ ๐Ÿ”— **https://youtu.be/MtukF1C8epQ**
25
+
26
+ [![Bilibili Video](https://img.shields.io/badge/Bilibili-็ซ‹ๅณ่ง‚็œ‹-00A1D6?style=for-the-badge&logo=bilibili&logoColor=white)](https://www.bilibili.com/video/BV1zUf2BGEgn/)
27
+ ๐Ÿ”— **https://www.bilibili.com/video/BV1zUf2BGEgn/**
28
+
29
+ ---
30
+
31
+ ## Why This Plugin?
32
+
33
+ The built-in `memory-lancedb` plugin in OpenClaw provides basic vector search. **memory-lancedb-pro** takes it much further:
34
+
35
+ | Feature | Built-in `memory-lancedb` | **memory-lancedb-pro** |
36
+ |---------|--------------------------|----------------------|
37
+ | Vector search | โœ… | โœ… |
38
+ | BM25 full-text search | โŒ | โœ… |
39
+ | Hybrid fusion (Vector + BM25) | โŒ | โœ… |
40
+ | Cross-encoder rerank (Jina / custom endpoint) | โŒ | โœ… |
41
+ | Recency boost | โŒ | โœ… |
42
+ | Time decay | โŒ | โœ… |
43
+ | Length normalization | โŒ | โœ… |
44
+ | MMR diversity | โŒ | โœ… |
45
+ | Multi-scope isolation | โŒ | โœ… |
46
+ | Noise filtering | โŒ | โœ… |
47
+ | Adaptive retrieval | โŒ | โœ… |
48
+ | Management CLI | โŒ | โœ… |
49
+ | Session memory | โŒ | โœ… |
50
+ | Task-aware embeddings | โŒ | โœ… |
51
+ | Any OpenAI-compatible embedding | Limited | โœ… (OpenAI, Gemini, Jina, Ollama, etc.) |
52
+
53
+ ---
54
+
55
+ ## Architecture
56
+
57
+ ```
58
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
59
+ โ”‚ index.ts (Entry Point) โ”‚
60
+ โ”‚ Plugin Registration ยท Config Parsing ยท Lifecycle Hooks โ”‚
61
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
62
+ โ”‚ โ”‚ โ”‚ โ”‚
63
+ โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
64
+ โ”‚ store โ”‚ โ”‚embedderโ”‚ โ”‚retrieverโ”‚ โ”‚ scopes โ”‚
65
+ โ”‚ .ts โ”‚ โ”‚ .ts โ”‚ โ”‚ .ts โ”‚ โ”‚ .ts โ”‚
66
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
67
+ โ”‚ โ”‚
68
+ โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
69
+ โ”‚migrate โ”‚ โ”‚noise-filter.ts โ”‚
70
+ โ”‚ .ts โ”‚ โ”‚adaptive- โ”‚
71
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚retrieval.ts โ”‚
72
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
73
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
74
+ โ”‚ tools.ts โ”‚ โ”‚ cli.ts โ”‚
75
+ โ”‚ (Agent API) โ”‚ โ”‚ (CLI) โ”‚
76
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
77
+ ```
78
+
79
+ ### File Reference
80
+
81
+ | File | Purpose |
82
+ |------|---------|
83
+ | `index.ts` | Plugin entry point. Registers with OpenClaw Plugin API, parses config, mounts `before_agent_start` (auto-recall), `agent_end` (auto-capture), and `command:new` (session memory) hooks |
84
+ | `openclaw.plugin.json` | Plugin metadata + full JSON Schema config declaration (with `uiHints`) |
85
+ | `package.json` | NPM package info. Depends on `@lancedb/lancedb`, `openai`, `@sinclair/typebox` |
86
+ | `cli.ts` | CLI commands: `memory list/search/stats/delete/delete-bulk/export/import/reembed/migrate` |
87
+ | `src/store.ts` | LanceDB storage layer. Table creation / FTS indexing / Vector search / BM25 search / CRUD / bulk delete / stats |
88
+ | `src/embedder.ts` | Embedding abstraction. Compatible with any OpenAI-API provider (OpenAI, Gemini, Jina, Ollama, etc.). Supports task-aware embedding (`taskQuery`/`taskPassage`) |
89
+ | `src/retriever.ts` | Hybrid retrieval engine. Vector + BM25 โ†’ RRF fusion โ†’ Jina Cross-Encoder Rerank โ†’ Recency Boost โ†’ Importance Weight โ†’ Length Norm โ†’ Time Decay โ†’ Hard Min Score โ†’ Noise Filter โ†’ MMR Diversity |
90
+ | `src/scopes.ts` | Multi-scope access control. Supports `global`, `agent:<id>`, `custom:<name>`, `project:<id>`, `user:<id>` |
91
+ | `src/tools.ts` | Agent tool definitions: `memory_recall`, `memory_store`, `memory_forget` (core) + `memory_stats`, `memory_list` (management) |
92
+ | `src/noise-filter.ts` | Noise filter. Filters out agent refusals, meta-questions, greetings, and low-quality content |
93
+ | `src/adaptive-retrieval.ts` | Adaptive retrieval. Determines whether a query needs memory retrieval (skips greetings, slash commands, simple confirmations, emoji) |
94
+ | `src/migrate.ts` | Migration tool. Migrates data from the built-in `memory-lancedb` plugin to Pro |
95
+
96
+ ---
97
+
98
+ ## Core Features
99
+
100
+ ### 1. Hybrid Retrieval
101
+
102
+ ```
103
+ Query โ†’ embedQuery() โ”€โ”
104
+ โ”œโ”€โ†’ RRF Fusion โ†’ Rerank โ†’ Recency Boost โ†’ Importance Weight โ†’ Filter
105
+ Query โ†’ BM25 FTS โ”€โ”€โ”€โ”€โ”€โ”˜
106
+ ```
107
+
108
+ - **Vector Search**: Semantic similarity via LanceDB ANN (cosine distance)
109
+ - **BM25 Full-Text Search**: Exact keyword matching via LanceDB FTS index
110
+ - **Fusion Strategy**: Vector score as base, BM25 hits get a 15% boost (tuned beyond traditional RRF)
111
+ - **Configurable Weights**: `vectorWeight`, `bm25Weight`, `minScore`
112
+
113
+ ### 2. Cross-Encoder Reranking
114
+
115
+ - **Reranker API**: Jina, SiliconFlow, Pinecone, or any compatible endpoint (5s timeout protection)
116
+ - **Hybrid Scoring**: 60% cross-encoder score + 40% original fused score
117
+ - **Graceful Degradation**: Falls back to cosine similarity reranking on API failure
118
+
119
+ ### 3. Multi-Stage Scoring Pipeline
120
+
121
+ | Stage | Formula | Effect |
122
+ |-------|---------|--------|
123
+ | **Recency Boost** | `exp(-ageDays / halfLife) * weight` | Newer memories score higher (default: 14-day half-life, 0.10 weight) |
124
+ | **Importance Weight** | `score *= (0.7 + 0.3 * importance)` | importance=1.0 โ†’ ร—1.0, importance=0.5 โ†’ ร—0.85 |
125
+ | **Length Normalization** | `score *= 1 / (1 + 0.5 * log2(len/anchor))` | Prevents long entries from dominating (anchor: 500 chars) |
126
+ | **Time Decay** | `score *= 0.5 + 0.5 * exp(-ageDays / halfLife)` | Old entries gradually lose weight, floor at 0.5ร— (60-day half-life) |
127
+ | **Hard Min Score** | Discard if `score < threshold` | Removes irrelevant results (default: 0.35) |
128
+ | **MMR Diversity** | Cosine similarity > 0.85 โ†’ demoted | Prevents near-duplicate results |
129
+
130
+ ### 4. Multi-Scope Isolation
131
+
132
+ - **Built-in Scopes**: `global`, `agent:<id>`, `custom:<name>`, `project:<id>`, `user:<id>`
133
+ - **Agent-Level Access Control**: Configure per-agent scope access via `scopes.agentAccess`
134
+ - **Default Behavior**: Each agent accesses `global` + its own `agent:<id>` scope
135
+
136
+ ### 5. Adaptive Retrieval
137
+
138
+ - Skips queries that don't need memory (greetings, slash commands, simple confirmations, emoji)
139
+ - Forces retrieval for memory-related keywords ("remember", "previously", "last time", etc.)
140
+ - CJK-aware thresholds (Chinese: 6 chars vs English: 15 chars)
141
+
142
+ ### 6. Noise Filtering
143
+
144
+ Filters out low-quality content at both auto-capture and tool-store stages:
145
+ - Agent refusal responses ("I don't have any information")
146
+ - Meta-questions ("do you remember")
147
+ - Greetings ("hi", "hello", "HEARTBEAT")
148
+
149
+ ### 7. Session Memory
150
+
151
+ - Triggered on `/new` command โ€” saves previous session summary to LanceDB
152
+ - Disabled by default (OpenClaw already has native `.jsonl` session persistence)
153
+ - Configurable message count (default: 15)
154
+
155
+ ### 8. Auto-Capture & Auto-Recall
156
+
157
+ - **Auto-Capture** (`agent_end` hook): Extracts preference/fact/decision/entity from conversations, deduplicates, stores up to 3 per turn
158
+ - **Auto-Recall** (`before_agent_start` hook): Injects `<relevant-memories>` context (up to 3 entries)
159
+
160
+ ---
161
+
162
+ ## Installation
163
+
164
+ ### What is the โ€œOpenClaw workspaceโ€?
165
+
166
+ In OpenClaw, the **agent workspace** is the agentโ€™s working directory (default: `~/.openclaw/workspace`).
167
+ According to the docs, the workspace is the **default cwd**, and **relative paths are resolved against the workspace** (unless you use an absolute path).
168
+
169
+ > Note: OpenClaw configuration typically lives under `~/.openclaw/openclaw.json` (separate from the workspace).
170
+
171
+ **Common mistake:** cloning the plugin somewhere else, while keeping `plugins.load.paths: ["plugins/memory-lancedb-pro"]` (a **relative path**). In that case OpenClaw will look for `plugins/memory-lancedb-pro` under your **workspace** and fail to load it.
172
+
173
+ ### Option A (recommended): clone into `plugins/` under your workspace
174
+
175
+ ```bash
176
+ # 1) Go to your OpenClaw workspace (default: ~/.openclaw/workspace)
177
+ # (You can override it via agents.defaults.workspace.)
178
+ cd /path/to/your/openclaw/workspace
179
+
180
+ # 2) Clone the plugin into workspace/plugins/
181
+ git clone https://github.com/win4r/memory-lancedb-pro.git plugins/memory-lancedb-pro
182
+
183
+ # 3) Install dependencies
184
+ cd plugins/memory-lancedb-pro
185
+ npm install
186
+ ```
187
+
188
+ Then reference it with a relative path in your OpenClaw config:
189
+
190
+ ```json
191
+ {
192
+ "plugins": {
193
+ "load": {
194
+ "paths": ["plugins/memory-lancedb-pro"]
195
+ },
196
+ "entries": {
197
+ "memory-lancedb-pro": {
198
+ "enabled": true,
199
+ "config": {
200
+ "embedding": {
201
+ "apiKey": "${JINA_API_KEY}",
202
+ "model": "jina-embeddings-v5-text-small",
203
+ "baseURL": "https://api.jina.ai/v1",
204
+ "dimensions": 1024,
205
+ "taskQuery": "retrieval.query",
206
+ "taskPassage": "retrieval.passage",
207
+ "normalized": true
208
+ }
209
+ }
210
+ }
211
+ },
212
+ "slots": {
213
+ "memory": "memory-lancedb-pro"
214
+ }
215
+ }
216
+ }
217
+ ```
218
+
219
+ ### Option B: clone anywhere, but use an absolute path
220
+
221
+ ```json
222
+ {
223
+ "plugins": {
224
+ "load": {
225
+ "paths": ["/absolute/path/to/memory-lancedb-pro"]
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ ### Restart
232
+
233
+ ```bash
234
+ openclaw gateway restart
235
+ ```
236
+
237
+ > **Note:** If you previously used the built-in `memory-lancedb`, disable it when enabling this plugin. Only one memory plugin can be active at a time.
238
+
239
+ ### Verify installation (recommended)
240
+
241
+ 1) Confirm the plugin is discoverable/loaded:
242
+
243
+ ```bash
244
+ openclaw plugins list
245
+ openclaw plugins info memory-lancedb-pro
246
+ ```
247
+
248
+ 2) If anything looks wrong, run the built-in diagnostics:
249
+
250
+ ```bash
251
+ openclaw plugins doctor
252
+ ```
253
+
254
+ 3) Confirm the memory slot points to this plugin:
255
+
256
+ ```bash
257
+ # Look for: plugins.slots.memory = "memory-lancedb-pro"
258
+ openclaw config get plugins.slots.memory
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Configuration
264
+
265
+ <details>
266
+ <summary><strong>Full Configuration Example (click to expand)</strong></summary>
267
+
268
+ ```json
269
+ {
270
+ "embedding": {
271
+ "apiKey": "${JINA_API_KEY}",
272
+ "model": "jina-embeddings-v5-text-small",
273
+ "baseURL": "https://api.jina.ai/v1",
274
+ "dimensions": 1024,
275
+ "taskQuery": "retrieval.query",
276
+ "taskPassage": "retrieval.passage",
277
+ "normalized": true
278
+ },
279
+ "dbPath": "~/.openclaw/memory/lancedb-pro",
280
+ "autoCapture": true,
281
+ "autoRecall": true,
282
+ "retrieval": {
283
+ "mode": "hybrid",
284
+ "vectorWeight": 0.7,
285
+ "bm25Weight": 0.3,
286
+ "minScore": 0.3,
287
+ "rerank": "cross-encoder",
288
+ "rerankApiKey": "jina_xxx",
289
+ "rerankModel": "jina-reranker-v2-base-multilingual",
290
+ "rerankEndpoint": "https://api.jina.ai/v1/rerank",
291
+ "rerankProvider": "jina",
292
+ "candidatePoolSize": 20,
293
+ "recencyHalfLifeDays": 14,
294
+ "recencyWeight": 0.1,
295
+ "filterNoise": true,
296
+ "lengthNormAnchor": 500,
297
+ "hardMinScore": 0.35,
298
+ "timeDecayHalfLifeDays": 60
299
+ },
300
+ "enableManagementTools": false,
301
+ "scopes": {
302
+ "default": "global",
303
+ "definitions": {
304
+ "global": { "description": "Shared knowledge" },
305
+ "agent:discord-bot": { "description": "Discord bot private" }
306
+ },
307
+ "agentAccess": {
308
+ "discord-bot": ["global", "agent:discord-bot"]
309
+ }
310
+ },
311
+ "sessionMemory": {
312
+ "enabled": false,
313
+ "messageCount": 15
314
+ }
315
+ }
316
+ ```
317
+
318
+ </details>
319
+
320
+ ### Embedding Providers
321
+
322
+ This plugin works with **any OpenAI-compatible embedding API**:
323
+
324
+ | Provider | Model | Base URL | Dimensions |
325
+ |----------|-------|----------|------------|
326
+ | **Jina** (recommended) | `jina-embeddings-v5-text-small` | `https://api.jina.ai/v1` | 1024 |
327
+ | **OpenAI** | `text-embedding-3-small` | `https://api.openai.com/v1` | 1536 |
328
+ | **Google Gemini** | `gemini-embedding-001` | `https://generativelanguage.googleapis.com/v1beta/openai/` | 3072 |
329
+ | **Ollama** (local) | `nomic-embed-text` | `http://localhost:11434/v1` | 768 |
330
+
331
+ ### Rerank Providers
332
+
333
+ Cross-encoder reranking supports multiple providers via `rerankProvider`:
334
+
335
+ | Provider | `rerankProvider` | Endpoint | Example Model |
336
+ |----------|-----------------|----------|---------------|
337
+ | **Jina** (default) | `jina` | `https://api.jina.ai/v1/rerank` | `jina-reranker-v2-base-multilingual` |
338
+ | **SiliconFlow** (free tier available) | `siliconflow` | `https://api.siliconflow.com/v1/rerank` | `BAAI/bge-reranker-v2-m3`, `Qwen/Qwen3-Reranker-8B` |
339
+ | **Pinecone** | `pinecone` | `https://api.pinecone.io/rerank` | `bge-reranker-v2-m3` |
340
+
341
+ <details>
342
+ <summary><strong>SiliconFlow Example</strong></summary>
343
+
344
+ ```json
345
+ {
346
+ "retrieval": {
347
+ "rerank": "cross-encoder",
348
+ "rerankProvider": "siliconflow",
349
+ "rerankEndpoint": "https://api.siliconflow.com/v1/rerank",
350
+ "rerankApiKey": "sk-xxx",
351
+ "rerankModel": "BAAI/bge-reranker-v2-m3"
352
+ }
353
+ }
354
+ ```
355
+
356
+ </details>
357
+
358
+ <details>
359
+ <summary><strong>Pinecone Example</strong></summary>
360
+
361
+ ```json
362
+ {
363
+ "retrieval": {
364
+ "rerank": "cross-encoder",
365
+ "rerankProvider": "pinecone",
366
+ "rerankEndpoint": "https://api.pinecone.io/rerank",
367
+ "rerankApiKey": "pcsk_xxx",
368
+ "rerankModel": "bge-reranker-v2-m3"
369
+ }
370
+ }
371
+ ```
372
+
373
+ </details>
374
+
375
+ ---
376
+
377
+ ## CLI Commands
378
+
379
+ ```bash
380
+ # List memories
381
+ openclaw memory list [--scope global] [--category fact] [--limit 20] [--json]
382
+
383
+ # Search memories
384
+ openclaw memory search "query" [--scope global] [--limit 10] [--json]
385
+
386
+ # View statistics
387
+ openclaw memory stats [--scope global] [--json]
388
+
389
+ # Delete a memory by ID (supports 8+ char prefix)
390
+ openclaw memory delete <id>
391
+
392
+ # Bulk delete with filters
393
+ openclaw memory delete-bulk --scope global [--before 2025-01-01] [--dry-run]
394
+
395
+ # Export / Import
396
+ openclaw memory export [--scope global] [--output memories.json]
397
+ openclaw memory import memories.json [--scope global] [--dry-run]
398
+
399
+ # Re-embed all entries with a new model
400
+ openclaw memory reembed --source-db /path/to/old-db [--batch-size 32] [--skip-existing]
401
+
402
+ # Migrate from built-in memory-lancedb
403
+ openclaw memory migrate check [--source /path]
404
+ openclaw memory migrate run [--source /path] [--dry-run] [--skip-existing]
405
+ openclaw memory migrate verify [--source /path]
406
+ ```
407
+
408
+ ---
409
+
410
+ ## Custom Commands (e.g. `/lesson`)
411
+
412
+ This plugin provides the core memory tools (`memory_store`, `memory_recall`, `memory_forget`, `memory_update`). You can define custom slash commands in your Agent's system prompt to create convenient shortcuts.
413
+
414
+ ### Example: `/lesson` command
415
+
416
+ Add this to your `CLAUDE.md`, `AGENTS.md`, or system prompt:
417
+
418
+ ```markdown
419
+ ## /lesson command
420
+ When the user sends `/lesson <content>`:
421
+ 1. Use memory_store to save as category=fact (the raw knowledge)
422
+ 2. Use memory_store to save as category=decision (actionable takeaway)
423
+ 3. Confirm what was saved
424
+ ```
425
+
426
+ ### Example: `/remember` command
427
+
428
+ ```markdown
429
+ ## /remember command
430
+ When the user sends `/remember <content>`:
431
+ 1. Use memory_store to save with appropriate category and importance
432
+ 2. Confirm with the stored memory ID
433
+ ```
434
+
435
+ ### Built-in Tools Reference
436
+
437
+ | Tool | Description |
438
+ |------|-------------|
439
+ | `memory_store` | Store a memory (supports category, importance, scope) |
440
+ | `memory_recall` | Search memories (hybrid vector + BM25 retrieval) |
441
+ | `memory_forget` | Delete a memory by ID or search query |
442
+ | `memory_update` | Update an existing memory in-place |
443
+
444
+ > **Note**: These tools are registered automatically when the plugin loads. Custom commands like `/lesson` are not built into the plugin โ€” they are defined at the Agent/system-prompt level and simply call these tools.
445
+
446
+ ---
447
+
448
+ ## Database Schema
449
+
450
+ LanceDB table `memories`:
451
+
452
+ | Field | Type | Description |
453
+ |-------|------|-------------|
454
+ | `id` | string (UUID) | Primary key |
455
+ | `text` | string | Memory text (FTS indexed) |
456
+ | `vector` | float[] | Embedding vector |
457
+ | `category` | string | `preference` / `fact` / `decision` / `entity` / `other` |
458
+ | `scope` | string | Scope identifier (e.g., `global`, `agent:main`) |
459
+ | `importance` | float | Importance score 0โ€“1 |
460
+ | `timestamp` | int64 | Creation timestamp (ms) |
461
+ | `metadata` | string (JSON) | Extended metadata |
462
+
463
+ ---
464
+
465
+ ## Dependencies
466
+
467
+ | Package | Purpose |
468
+ |---------|---------|
469
+ | `@lancedb/lancedb` โ‰ฅ0.26.2 | Vector database (ANN + FTS) |
470
+ | `openai` โ‰ฅ6.21.0 | OpenAI-compatible Embedding API client |
471
+ | `@sinclair/typebox` 0.34.48 | JSON Schema type definitions (tool parameters) |
472
+
473
+ ---
474
+
475
+ ## License
476
+
477
+ MIT
478
+
479
+ ---
480
+
481
+ ## Buy Me a Coffee
482
+
483
+ [!["Buy Me A Coffee"](https://storage.ko-fi.com/cdn/kofi2.png?v=3)](https://ko-fi.com/aila)
484
+
485
+ ## My WeChat Group and My WeChat QR Code
486
+
487
+ <img src="https://github.com/win4r/AISuperDomain/assets/42172631/d6dcfd1a-60fa-4b6f-9d5e-1482150a7d95" width="186" height="300">
488
+ <img src="https://github.com/win4r/AISuperDomain/assets/42172631/7568cf78-c8ba-4182-aa96-d524d903f2bc" width="214.8" height="291">
489
+ <img src="https://github.com/win4r/AISuperDomain/assets/42172631/fefe535c-8153-4046-bfb4-e65eacbf7a33" width="207" height="281">