feat: bridge per-agent SQLite memories to local memu (#38) - #41
Merged
Conversation
Implements tools/sqlite_bridge.py — a bridge script that scans ~/.openclaw/memory/*.sqlite, converts each row to a memu MemoryRecord, and POSTs to localhost:8000/memories with agent_id set to the source agent name. Key design decisions: - memory_kind=evidence + idempotency_key=sqlite:<agent>:<rowid> for reliable dedup: same key + same content returns the existing record - Local state file tracks last imported rowid per SQLite file so only new rows are forwarded on incremental runs - Schema inspection at runtime: picks common column names (value/content, type/memory_type, created_at/timestamp) and falls back to serialising all non-null fields - Opens SQLite read-only via URI to avoid accidental writes - Identifier validation guards against unsafe table names - Supports --once (default) and --watch (continuous polling) modes Tests in tests/test_sqlite_bridge.py cover column detection, type mapping, row-to-payload conversion, SQLite reading, state persistence, mocked memu HTTP calls, single-file sync with dedup, and multi-file sweep. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mfethe1
deleted the
sandcastle/issue-38-feat-bridge-per-agent-sqlite-memories-to-local-memu
branch
May 6, 2026 17:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #38
Changes
tools/sqlite_bridge.py(427 lines) — scans~/.openclaw/memory/*.sqlite, runtime schema detection, read-only SQLite opens, POSTs to memu withidempotency_key=sqlite:<agent>:<rowid>,--once/--watchmodestools/__init__.py— package markertests/test_sqlite_bridge.py(553 lines) — 46 tests: column detection, type mapping, dedup, state persistence, mocked HTTP, multi-file sweep; 46 passed in 0.96sUsage on mack
🤖 Sandcastle agent