feat: SQLite-backed memory with brute-force cosine recall

- lyra.memory.remember(session_id, role, content) embeds and stores
- lyra.memory.recent(session_id, n) returns the last N from a session
- lyra.memory.recall(query, k, session_id=None) returns top-k by cosine
  similarity across the chosen scope (all sessions by default)
- Embeddings live in the exchanges.embedding BLOB column as float32 bytes
- Connection reopens automatically if LYRA_DB_PATH changes (test-friendly)
This commit is contained in:
Claude
2026-05-16 06:35:52 +00:00
parent 6a1255dfdb
commit 0ee5a9ce47
3 changed files with 215 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"httpx>=0.28.1",
"numpy>=2.4.5",
"openai>=2.37.0",
"python-dotenv>=1.2.2",
]