[Mnemosyne] Add semantic search using holographic linker similarity #1223

Closed
opened 2026-04-11 20:13:32 +00:00 by Rockachopa · 2 comments
Owner

Problem

The Mnemosyne archive's search() method only does exact token matching — it counts how many query tokens appear verbatim in entry text. This misses semantically related entries that share meaning but use different words.

The HolographicLinker already computes Jaccard similarity between entries, but this power isn't exposed for search queries.

Proposed Enhancement

Add a semantic_search() method to MnemosyneArchive that:

  1. Tokenizes the query using the linker's tokenizer
  2. Scores each entry by Jaccard similarity between query tokens and entry tokens (not just hit counting)
  3. Ranks by link connectivity — entries with more inbound links (more "holographic") get a relevance boost
  4. Falls back gracefully — if no semantic matches above threshold, returns keyword matches

This makes the archive's holographic linking power available at query time, not just at ingestion time.

Acceptance Criteria

  • semantic_search(query, limit=10) method on MnemosyneArchive
  • Uses HolographicLinker's tokenizer and similarity scoring
  • Link-connectivity boost in ranking (entries with more back-links score higher)
  • Returns results sorted by combined relevance score
  • Tests covering semantic vs keyword search behavior
  • CLI updated: mnemosyne search --semantic flag
## Problem The Mnemosyne archive's `search()` method only does exact token matching — it counts how many query tokens appear verbatim in entry text. This misses semantically related entries that share meaning but use different words. The `HolographicLinker` already computes Jaccard similarity between entries, but this power isn't exposed for search queries. ## Proposed Enhancement Add a `semantic_search()` method to `MnemosyneArchive` that: 1. **Tokenizes the query** using the linker's tokenizer 2. **Scores each entry** by Jaccard similarity between query tokens and entry tokens (not just hit counting) 3. **Ranks by link connectivity** — entries with more inbound links (more "holographic") get a relevance boost 4. **Falls back gracefully** — if no semantic matches above threshold, returns keyword matches This makes the archive's holographic linking power available at query time, not just at ingestion time. ## Acceptance Criteria - [ ] `semantic_search(query, limit=10)` method on MnemosyneArchive - [ ] Uses HolographicLinker's tokenizer and similarity scoring - [ ] Link-connectivity boost in ranking (entries with more back-links score higher) - [ ] Returns results sorted by combined relevance score - [ ] Tests covering semantic vs keyword search behavior - [ ] CLI updated: `mnemosyne search --semantic` flag
claude self-assigned this 2026-04-11 20:14:40 +00:00
Author
Owner

Implementation submitted in PR #1224.

  • semantic_search() scores entries by Jaccard similarity + link connectivity boost + topic bonus
  • CLI: mnemosyne search --semantic for relevance-scored results
  • 5 new tests, all 22 passing
Implementation submitted in PR #1224. - `semantic_search()` scores entries by Jaccard similarity + link connectivity boost + topic bonus - CLI: `mnemosyne search --semantic` for relevance-scored results - 5 new tests, all 22 passing
Member

PR created: #1225

Added semantic_search(query, limit=10, threshold=0.05) to MnemosyneArchive. It uses HolographicLinker._tokenize() and Jaccard similarity to score entries, with a link-connectivity boost (entries with more inbound links rank higher). Falls back to search() if nothing clears the threshold. CLI updated with mnemosyne search --semantic. 5 new tests, all 22 pass.

PR created: #1225 Added `semantic_search(query, limit=10, threshold=0.05)` to `MnemosyneArchive`. It uses `HolographicLinker._tokenize()` and Jaccard similarity to score entries, with a link-connectivity boost (entries with more inbound links rank higher). Falls back to `search()` if nothing clears the threshold. CLI updated with `mnemosyne search --semantic`. 5 new tests, all 22 pass.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/the-nexus#1223