Skip to content

feat: bridge per-agent SQLite memories to local memu #38

Description

@mfethe1

Problem

Each OpenClaw agent has its own SQLite memory store at ~/.openclaw/memory/<agent>.sqlite on mack. These are siloed — they are not searchable via local memu's hybrid/RAPTOR search, not federated to Railway, and not visible to other agents.

Current state

  • Files like ~/.openclaw/memory/mack.sqlite, ~/.openclaw/memory/lenny.sqlite etc. exist
  • Schema: individual per-agent key-value or structured fact records (exact schema TBD — needs investigation)
  • Local memu (localhost:8000) has no knowledge of these records
  • memory-learning engine writes new extractions to memu but legacy/existing SQLite records are untouched

Desired behavior

  1. One-time backfill: scan ~/.openclaw/memory/*.sqlite, convert each record to a memu MemoryRecord (fact/lesson/decision), POST to localhost:8000/memories with agent_id set to the source agent name
  2. Ongoing sync: watch for new rows in each SQLite (file mtime or last_rowid polling) and forward them
  3. Deduplication: use a source_id or external_id field to avoid double-importing on repeated runs

Files likely involved

  • New script: tools/sqlite_bridge.py (or memu/sqlite_agent_bridge.py)
  • Possibly new launchd plist: com.openclaw.sqlite-bridge
  • memu/api.py — confirm POST /memories accepts external_id for idempotent upserts

Investigation needed

  1. SSH to mack and inspect ~/.openclaw/memory/*.sqlite schema: sqlite3 ~/.openclaw/memory/mack.sqlite .schema
  2. Map SQLite columns → memu MemoryRecord fields
  3. Determine if memu API needs an external_id field for idempotency

Acceptance criteria

  • Backfill script runs without errors against existing SQLite files
  • Backfilled records appear in GET /memories?agent_id=mack
  • Backfilled records are searchable via /search/hybrid
  • No duplicate imports on repeated runs
  • (Optional) launchd watcher for ongoing sync

Metadata

Metadata

Assignees

No one assigned

    Labels

    SandcastleWork to be processed by sandcastle agent loopenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions