@icex-labs/openclaw-memory-engine 3.5.2 → 3.5.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 (2) hide show
  1. package/package.json +1 -1
  2. package/setup.sh +61 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icex-labs/openclaw-memory-engine",
3
- "version": "3.5.2",
3
+ "version": "3.5.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
@@ -321,7 +321,7 @@ else
321
321
  echo "⚠️ AGENTS.md not found — create it with memory instructions"
322
322
  fi
323
323
 
324
- # --- 8. Register cron jobs ---
324
+ # --- 8. Register cron jobs (for all agents with workspaces) ---
325
325
  if command -v openclaw &>/dev/null; then
326
326
  EXISTING_CRONS=$(openclaw cron list --json 2>/dev/null | python3 -c "import sys,json; data=json.load(sys.stdin); print(' '.join(j.get('name','') for j in (data if isinstance(data,list) else data.get('jobs',[]))))" 2>/dev/null || echo "")
327
327
 
@@ -339,7 +339,7 @@ except:
339
339
  " 2>/dev/null || echo "UTC")
340
340
 
341
341
  register_cron() {
342
- local name="$1" cron="$2" msg="$3" desc="$4" timeout="${5:-60000}"
342
+ local name="$1" cron="$2" agent="$3" msg="$4" desc="$5" timeout="${6:-60000}"
343
343
  if echo "$EXISTING_CRONS" | grep -q "$name"; then
344
344
  echo "⏭️ Cron '$name' already exists"
345
345
  return
@@ -348,30 +348,82 @@ except:
348
348
  --name "$name" \
349
349
  --cron "$cron" \
350
350
  --tz "$TZ_IANA" \
351
- --agent main \
351
+ --agent "$agent" \
352
352
  --session isolated \
353
353
  --model "anthropic/claude-sonnet-4-6" \
354
354
  --message "$msg" \
355
355
  --description "$desc" \
356
356
  --timeout "$timeout" \
357
- >/dev/null 2>&1 && echo "✅ Cron '$name' registered" || echo "⚠️ Cron '$name' failed (gateway not running?)"
357
+ >/dev/null 2>&1 && echo "✅ Cron '$name' ($agent) registered" || echo "⚠️ Cron '$name' failed (gateway not running?)"
358
358
  }
359
359
 
360
- register_cron "memory-reflect-daily" "0 9 * * *" \
360
+ # Discover all agents from openclaw.json
361
+ AGENTS=$(python3 -c "
362
+ import json, os
363
+ try:
364
+ with open(os.path.expanduser('$CONFIG')) as f:
365
+ cfg = json.load(f)
366
+ agents = [a['id'] for a in cfg.get('agents',{}).get('list',[])]
367
+ print(' '.join(agents) if agents else 'main')
368
+ except:
369
+ print('main')
370
+ " 2>/dev/null || echo "main")
371
+
372
+ echo " Agents found: $AGENTS"
373
+
374
+ # Register main agent crons (shared across all agents using default workspace)
375
+ register_cron "memory-reflect-daily" "0 9 * * *" "main" \
361
376
  "Run memory_reflect with window_days=7. If you notice patterns, store via archival_insert with tags=['reflection']. Do NOT output to main chat." \
362
377
  "Daily reflection: analyze memory patterns"
363
378
 
364
- register_cron "memory-consolidate-6h" "0 */6 * * *" \
379
+ register_cron "memory-consolidate-6h" "0 */6 * * *" "main" \
365
380
  "Read today's daily log. If it has content not in archival, run memory_consolidate. Then archival_stats. Do NOT output to main chat." \
366
381
  "Auto-consolidate daily logs every 6 hours"
367
382
 
368
- register_cron "memory-dedup-weekly" "0 4 * * 0" \
383
+ register_cron "memory-dedup-weekly" "0 4 * * 0" "main" \
369
384
  "Run archival_deduplicate with apply=true. Then archival_stats. Do NOT output to main chat." \
370
385
  "Weekly dedup: clean near-duplicate records"
371
386
 
372
- register_cron "memory-dashboard-daily" "30 9 * * *" \
387
+ register_cron "memory-dashboard-daily" "30 9 * * *" "main" \
373
388
  "Run memory_dashboard to regenerate the HTML dashboard. Do NOT output to main chat." \
374
- "Daily dashboard refresh" 30000
389
+ "Daily dashboard refresh for main agent" 30000
390
+
391
+ # Register per-agent crons for agents with separate workspaces
392
+ STAGGER=0
393
+ for agent_id in $AGENTS; do
394
+ # Skip main (already registered above)
395
+ [ "$agent_id" = "main" ] && continue
396
+
397
+ # Check if this agent has its own workspace
398
+ HAS_OWN_WS=$(python3 -c "
399
+ import json, os
400
+ try:
401
+ with open(os.path.expanduser('$CONFIG')) as f:
402
+ cfg = json.load(f)
403
+ default_ws = cfg.get('agents',{}).get('defaults',{}).get('workspace','')
404
+ for a in cfg.get('agents',{}).get('list',[]):
405
+ if a['id'] == '$agent_id' and a.get('workspace','') and a.get('workspace','') != default_ws:
406
+ print('yes')
407
+ break
408
+ else:
409
+ print('no')
410
+ except:
411
+ print('no')
412
+ " 2>/dev/null || echo "no")
413
+
414
+ if [ "$HAS_OWN_WS" = "yes" ]; then
415
+ STAGGER=$((STAGGER + 5))
416
+ register_cron "${agent_id}-memory-dashboard" "$((30 + STAGGER)) 9 * * *" "$agent_id" \
417
+ "Run memory_dashboard to regenerate the HTML dashboard. Do NOT output to main chat." \
418
+ "Daily dashboard refresh for $agent_id agent" 30000
419
+
420
+ register_cron "${agent_id}-memory-consolidate" "30 */6 * * *" "$agent_id" \
421
+ "Read today's daily log. If it has content not in archival, run memory_consolidate. Then archival_stats. Do NOT output to main chat." \
422
+ "Auto-consolidate daily logs for $agent_id" 60000
423
+
424
+ echo " ✅ Per-agent crons registered for: $agent_id"
425
+ fi
426
+ done
375
427
  else
376
428
  echo "⚠️ openclaw CLI not found — skipping cron registration"
377
429
  fi