@icex-labs/openclaw-memory-engine 5.0.1 → 5.0.3

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 (3) hide show
  1. package/README.md +38 -4
  2. package/package.json +1 -1
  3. package/setup.sh +19 -0
package/README.md CHANGED
@@ -210,6 +210,38 @@ Falls back to keyword-only without OpenAI key. Cost: ~$0.001/session.
210
210
 
211
211
  ---
212
212
 
213
+ ## Classification (v5.0)
214
+
215
+ Entity and importance classification is **embedding-based** — no hardcoded keywords, works with any language.
216
+
217
+ ```
218
+ With OPENAI_API_KEY (recommended):
219
+ 15 entity anchors (health, finance, immigration, legal, vehicles, ...)
220
+ 4 importance anchors (critical / high / medium / low)
221
+ Anchor embeddings computed once, cached to classifier-anchors.json
222
+ → Language-agnostic: Japanese, French, Korean, Chinese, English all work
223
+
224
+ Without OPENAI_API_KEY (fallback):
225
+ Format-based heuristics:
226
+ $amounts → finance (importance 7)
227
+ URLs/code → technology
228
+ Dates → importance 6
229
+ Short messages → low importance
230
+ Long messages → high importance
231
+ → Basic but functional, no API cost
232
+ ```
233
+
234
+ Real results on 2,751 records:
235
+
236
+ | Metric | Before (regex v4) | After (embedding v5) |
237
+ |--------|-------------------|---------------------|
238
+ | "general" entities | 45% | **29%** |
239
+ | flat importance=5 | 71% | **39%** |
240
+ | Languages supported | English + Chinese | **any** |
241
+ | Hardcoded keywords | 100+ | **zero** |
242
+
243
+ ---
244
+
213
245
  ## Self-Healing
214
246
 
215
247
  | Issue | Auto-fix |
@@ -217,8 +249,9 @@ Falls back to keyword-only without OpenAI key. Cost: ~$0.001/session.
217
249
  | Missing embeddings | Batch backfill on restart (all workspaces) |
218
250
  | Agent forgets to save | Hooks capture everything passively |
219
251
  | Duplicate facts | 60s dedup + keyword overlap + weekly cron |
220
- | Flat importance scores | `memory_quality` pass after migration |
221
- | General entity labels | `memory_quality` re-classifies with 50+ patterns |
252
+ | Flat importance scores | Embedding-based re-rating via `memory_quality` |
253
+ | General entity labels | Embedding-based re-classification via `memory_quality` |
254
+ | No API key | Format-based fallback classifier (basic but functional) |
222
255
 
223
256
  ---
224
257
 
@@ -284,8 +317,9 @@ memory-engine/
284
317
  │ ├── backup.js # Export / import
285
318
  │ ├── store-sqlite.js # SQLite backend (FTS5)
286
319
  │ ├── dashboard.js # HTML dashboard generator
287
- │ ├── quality.js # Data quality: entity + importance + graph
288
- └── auto-capture.js # Passive hooks: message archival
320
+ │ ├── classifier.js # Embedding-based entity + importance classification
321
+ ├── quality.js # Data quality pass (uses classifier)
322
+ │ └── auto-capture.js # Passive hooks: message → archival (uses classifier)
289
323
  ├── extras/
290
324
  │ ├── memory-maintenance.sh
291
325
  │ ├── migrate-legacy.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icex-labs/openclaw-memory-engine",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "MemGPT-style hierarchical memory plugin for OpenClaw — core memory block + archival storage with semantic search",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/setup.sh CHANGED
@@ -149,6 +149,25 @@ if command -v node &>/dev/null && [ -f "$PLUGIN_DIR/extras/migrate-legacy.mjs" ]
149
149
  fi
150
150
  fi
151
151
 
152
+ # --- 3c. Upgrade: run v5.0 embedding classification if not done yet ---
153
+ if [ -f "$MEMORY_DIR/archival.jsonl" ] && [ ! -f "$MEMORY_DIR/classifier-anchors.json" ]; then
154
+ archival_count=$(wc -l < "$MEMORY_DIR/archival.jsonl" | tr -d ' ')
155
+ if [ "$archival_count" -gt 0 ]; then
156
+ echo ""
157
+ echo "📊 Upgrade detected: running v5.0 embedding-based classification..."
158
+ echo " This replaces keyword-based entity/importance with semantic classification."
159
+ if command -v openclaw &>/dev/null; then
160
+ # Use the agent to run memory_quality (needs gateway running)
161
+ openclaw agent --agent main -m "memory_quality" --timeout 120 2>&1 | tail -3 || {
162
+ echo "⚠️ Quality pass via agent failed (gateway may not be running)."
163
+ echo " Run manually after restart: openclaw agent -m 'memory_quality'"
164
+ }
165
+ else
166
+ echo "⚠️ openclaw CLI not found. Run after install: openclaw agent -m 'memory_quality'"
167
+ fi
168
+ fi
169
+ fi
170
+
152
171
  # --- 4. Install memory-maintenance.sh ---
153
172
  SCRIPTS_DIR="$WORKSPACE/scripts"
154
173
  mkdir -p "$SCRIPTS_DIR"