fix: filter archived/dormant memories from semantic_recall() (#3) #7

Merged
cal merged 1 commits from ai/cognitive-memory-3 into main 2026-03-03 16:57:46 +00:00
Owner

Summary

  • semantic_recall() in embeddings.py was scoring all memories in _embeddings.json against the query vector with no decay filter, allowing archived/dormant memories (decay_score < 0.05) to surface via high semantic similarity
  • Applied the same THRESHOLD_DORMANT guard used by the keyword path in recall() — now consistent across both recall paths

What changed

embeddings.py

  • Added THRESHOLD_DORMANT to imports from common
  • In semantic_recall(), load _state.json and skip any memory whose decay_score < THRESHOLD_DORMANT before computing cosine similarity — avoids unnecessary computation for archived entries

Files changed

  • embeddings.py

Test results

No test suite. Changes verified by code review — the filter logic mirrors the existing guard in recall() exactly.

## Summary - `semantic_recall()` in `embeddings.py` was scoring all memories in `_embeddings.json` against the query vector with no decay filter, allowing archived/dormant memories (decay_score < 0.05) to surface via high semantic similarity - Applied the same `THRESHOLD_DORMANT` guard used by the keyword path in `recall()` — now consistent across both recall paths ## What changed **`embeddings.py`** - Added `THRESHOLD_DORMANT` to imports from `common` - In `semantic_recall()`, load `_state.json` and skip any memory whose `decay_score < THRESHOLD_DORMANT` before computing cosine similarity — avoids unnecessary computation for archived entries ## Files changed - `embeddings.py` ## Test results No test suite. Changes verified by code review — the filter logic mirrors the existing guard in `recall()` exactly.
cal added 1 commit 2026-03-03 05:07:16 +00:00
Apply THRESHOLD_DORMANT decay filter in semantic_recall() before
scoring, consistent with the keyword path in recall(). Memories
with decay_score < 0.05 are now excluded from semantic search,
preventing the decay system's intent from being bypassed via
high-similarity embedding matches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-03 05:31:26 +00:00
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-03 05:33:04 +00:00
cal merged commit 4784bc75b4 into main 2026-03-03 16:57:46 +00:00
cal deleted branch ai/cognitive-memory-3 2026-03-03 16:57:46 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/cognitive-memory#7
No description provided.