Summary
The current MemoryRecallPipeline (backend/tilo/services/memory/recall.py) uses keyword, salience, recency, and scope scoring. The _semantic_score() method exists but always returns None.
Adding real vector similarity would significantly improve memory recall quality for long-form text.
What to build
- Implement
_semantic_score() using a local embedding model (e.g. sentence-transformers)
- Store embeddings in the existing
Memory.embedding JSON column
- Compute cosine similarity at recall time
- Update the hybrid scoring weights when semantic score is available
The scoring with semantic:
score = semantic * 0.50 + keyword * 0.20 + salience * 0.15 + recency * 0.10 + scope * 0.05
Acceptance criteria
Resources
backend/tilo/services/memory/recall.py — the file to modify
backend/tilo/models/domain.py — Memory.embedding column (JSON)
- Existing test:
backend/tests/test_memory_lifecycle.py
Optional: make it configurable
Add a EMBEDDING_ENABLED=true flag in .env / config.py so users can opt in.
Summary
The current
MemoryRecallPipeline(backend/tilo/services/memory/recall.py) uses keyword, salience, recency, and scope scoring. The_semantic_score()method exists but always returnsNone.Adding real vector similarity would significantly improve memory recall quality for long-form text.
What to build
_semantic_score()using a local embedding model (e.g.sentence-transformers)Memory.embeddingJSON columnThe scoring with semantic:
Acceptance criteria
_semantic_score()returns a float when embeddings existNonewhen no embedding is stored (backward compatible)sentence-transformersadded as an optional dependency inpyproject.tomlbackend/tests/test_memory_lifecycle.pyResources
backend/tilo/services/memory/recall.py— the file to modifybackend/tilo/models/domain.py—Memory.embeddingcolumn (JSON)backend/tests/test_memory_lifecycle.pyOptional: make it configurable
Add a
EMBEDDING_ENABLED=trueflag in.env/config.pyso users can opt in.