Problem
lib/opentrust/semantic.ts currently uses a simple character-code hashing function to generate "embeddings," which provides no meaningful semantic similarity. The sqlite-vec dependency is installed but underutilized because the vectors it stores aren't semantically meaningful.
Proposed Solution
Integrate a real embedding model for semantic search:
Option A: Local ONNX Model (Preferred)
- Use a small model like
all-MiniLM-L6-v2 via onnxruntime-node
- ~80MB model file, runs locally with no API dependency
- Maintains the local-first philosophy
Option B: API-Based Embeddings
- Use OpenAI, Cohere, or Anthropic embeddings API
- Smaller bundle, but adds external dependency and latency
- Requires API key configuration
Acceptance Criteria
🤖 Generated with Claude Code
Problem
lib/opentrust/semantic.tscurrently uses a simple character-code hashing function to generate "embeddings," which provides no meaningful semantic similarity. Thesqlite-vecdependency is installed but underutilized because the vectors it stores aren't semantically meaningful.Proposed Solution
Integrate a real embedding model for semantic search:
Option A: Local ONNX Model (Preferred)
all-MiniLM-L6-v2viaonnxruntime-nodeOption B: API-Based Embeddings
Acceptance Criteria
embedText()produces semantically meaningful vectorssearchSemanticFallback()returns relevant results ranked by similaritysqlite-veccolumn configurationscripts/index-semantic.tsrebuilds the index with real embeddings🤖 Generated with Claude Code