Skip to content

feat: backfill-embeddings and touch-on-search for dream health#48

Merged
MichielDean merged 1 commit into
mainfrom
feat/dream-health
May 11, 2026
Merged

feat: backfill-embeddings and touch-on-search for dream health#48
MichielDean merged 1 commit into
mainfrom
feat/dream-health

Conversation

@MichielDean
Copy link
Copy Markdown
Owner

Summary

Three pathologies caused the dream to produce only boosts (193 boosted, 0 decayed/merged/invalidated):

  1. Embedding gap: 444/680 active memories lack embeddings, making them invisible to the dream's merge detection (ConsolidateDuplicates only queries memories with embeddings). Without embeddings, duplicate pairs can't be found, so MergedCount stays at 0.

  2. Stale access tracking: 307/680 memories have never been accessed (accessed_at IS NULL). Search and list CLI commands don't update access_count/accessed_at, so the dream's boost logic (threshold 5) and staleness detection work on incomplete data.

  3. Grace period: All memories are <30 days old, so the decay grace period means nothing qualifies for decay yet. This resolves naturally as the DB ages.

Changes

  • backfill-embeddings CLI command: Finds memories without embeddings, generates them via Ollama/nomic-embed-text, and stores them. Supports --dry-run and --batch-size flags for progress reporting.
  • Touch on search/list: searchCmd and listCmd now call TouchBatch on returned memories, updating their accessed_at and access_count.
  • openStoreWithVec(): New helper that opens the store with vec0 enabled (needed for backfill to store embeddings in the vec table).

Testing

All existing tests pass. Dream tests, store tests, and CLI tests all green.

…ealth

Three pathologies caused the dream to produce only boosts:
1. 444/680 memories lack embeddings, making them invisible to merge detection
2. Search/list never touch memories, so access_count never updates for the
   307 never-accessed memories — making boost/decay/staleness detection unreliable
3. All memories are <30 days old, so decay never activates (grace period)

Fix 1: backfill-embeddings CLI command generates embeddings for memories that
lack them, unblocking merge detection in the dream's light phase.

Fix 2: Touch on search and list CLI commands updates access_count and
accessed_at, giving the dream accurate data for boost and staleness decisions.

The age/grace period issue will resolve naturally as the database ages.
@MichielDean MichielDean merged commit 19d1e93 into main May 11, 2026
0 of 4 checks passed
@MichielDean MichielDean deleted the feat/dream-health branch May 11, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant