feat(memory): wire database into reader, writer, and bootstrap

- reader: list_memories() queries memory_meta; lookup_memories() uses FTS5 with
  fallback to JSON index substring search
- writer: write_memory() and append_memory() upsert to DB after every file write
- dirs: bootstrap() calls init_db() + migrate_from_files() on startup

Existing .md files remain the canonical store; SQLite is the search index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-05-18 15:23:49 +02:00
parent 45e6ec32ec
commit b9b0918d3a
3 changed files with 62 additions and 7 deletions
+4
View File
@@ -43,6 +43,10 @@ def bootstrap() -> None:
_create_if_missing(home / "memory" / "MEMORY_INDEX.md", _MEMORY_INDEX_TEMPLATE, 0o600)
_create_if_missing(home / "memory" / "user" / "profile.md", _USER_PROFILE_TEMPLATE, 0o600)
from pyra.memory.database import init_db, migrate_from_files
init_db()
migrate_from_files()
config = home / "config.yaml"
if config.exists():
safe_chmod(config, 0o600)