@icex-labs/openclaw-memory-engine 5.2.0 → 5.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.sh +63 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icex-labs/openclaw-memory-engine",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
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
@@ -384,22 +384,53 @@ except:
384
384
 
385
385
  echo " Agents found: $AGENTS"
386
386
 
387
- # Register main agent crons (shared across all agents using default workspace)
388
- register_cron "memory-reflect-daily" "0 9 * * *" "main" \
389
- "Run memory_reflect with window_days=7. If you notice patterns, store via archival_insert with tags=['reflection']. Do NOT output to main chat." \
390
- "Daily reflection: analyze memory patterns"
391
-
392
- register_cron "memory-consolidate-6h" "0 */6 * * *" "main" \
393
- "Read today's daily log. If it has content not in archival, run memory_consolidate. Then archival_stats. Do NOT output to main chat." \
394
- "Auto-consolidate daily logs every 6 hours"
395
-
396
- register_cron "memory-dedup-weekly" "0 4 * * 0" "main" \
397
- "Run archival_deduplicate with apply=true. Then archival_stats. Do NOT output to main chat." \
398
- "Weekly dedup: clean near-duplicate records"
399
-
400
- register_cron "memory-dashboard-daily" "30 9 * * *" "main" \
401
- "Run memory_dashboard to regenerate the HTML dashboard. Do NOT output to main chat." \
402
- "Daily dashboard refresh for main agent" 30000
387
+ # Register crons from JSON definition file (single source of truth)
388
+ CRON_JSON="$PLUGIN_DIR/extras/auto-consolidation-crons.json"
389
+ if [ -f "$CRON_JSON" ] && command -v python3 &>/dev/null; then
390
+ python3 -c "
391
+ import json, subprocess, sys
392
+
393
+ with open('$CRON_JSON') as f:
394
+ crons = json.load(f).get('crons', [])
395
+
396
+ existing = '''$EXISTING_CRONS'''
397
+ tz = '''$TZ_IANA'''
398
+
399
+ for c in crons:
400
+ name = c['id']
401
+ if name in existing:
402
+ print(f'⏭️ Cron \"{name}\" already exists')
403
+ continue
404
+ agent = c.get('agent', 'main')
405
+ cmd = [
406
+ 'openclaw', 'cron', 'add',
407
+ '--name', name,
408
+ '--cron', c['schedule'],
409
+ '--tz', tz,
410
+ '--agent', agent,
411
+ '--session', 'isolated',
412
+ '--model', c.get('model', 'anthropic/claude-sonnet-4-6'),
413
+ '--message', c['message'],
414
+ '--description', c.get('description', ''),
415
+ '--timeout', '60000',
416
+ ]
417
+ result = subprocess.run(cmd, capture_output=True, text=True)
418
+ if result.returncode == 0:
419
+ print(f'✅ Cron \"{name}\" ({agent}) registered')
420
+ else:
421
+ print(f'⚠️ Cron \"{name}\" failed (gateway not running?)')
422
+ " 2>/dev/null
423
+ else
424
+ echo "⚠️ Cron JSON not found or python3 missing — registering defaults manually"
425
+ register_cron "memory-reflect-daily" "0 9 * * *" "main" \
426
+ "Run memory_reflect. Do NOT output to main chat." "Daily reflection"
427
+ register_cron "memory-consolidate-6h" "0 */6 * * *" "main" \
428
+ "Run memory_consolidate on today's daily log. Do NOT output to main chat." "Auto-consolidate"
429
+ register_cron "memory-dedup-weekly" "0 4 * * 0" "main" \
430
+ "Run archival_deduplicate with apply=true. Do NOT output to main chat." "Weekly dedup"
431
+ register_cron "memory-dashboard-daily" "30 9 * * *" "main" \
432
+ "Run memory_dashboard. Do NOT output to main chat." "Dashboard refresh" 30000
433
+ fi
403
434
 
404
435
  # Register per-agent crons for agents with separate workspaces
405
436
  STAGGER=0
@@ -441,7 +472,22 @@ else
441
472
  echo "⚠️ openclaw CLI not found — skipping cron registration"
442
473
  fi
443
474
 
444
- # --- 9. Validate config ---
475
+ # --- 9. Track installed version ---
476
+ INSTALLED_VERSION=$(python3 -c "
477
+ import json
478
+ with open('$PLUGIN_DIR/package.json') as f: print(json.load(f).get('version','unknown'))
479
+ " 2>/dev/null || echo "unknown")
480
+ PREV_VERSION=""
481
+ VERSION_FILE="$MEMORY_DIR/.memory-engine-version"
482
+ [ -f "$VERSION_FILE" ] && PREV_VERSION=$(cat "$VERSION_FILE")
483
+ echo "$INSTALLED_VERSION" > "$VERSION_FILE"
484
+
485
+ if [ -n "$PREV_VERSION" ] && [ "$PREV_VERSION" != "$INSTALLED_VERSION" ]; then
486
+ echo ""
487
+ echo "📦 Upgraded: $PREV_VERSION → $INSTALLED_VERSION"
488
+ fi
489
+
490
+ # --- 10. Validate config ---
445
491
  echo ""
446
492
  if command -v openclaw &>/dev/null; then
447
493
  openclaw config validate 2>&1 && echo "✅ Config valid" || echo "❌ Config validation failed"