Accept ADR 0005: local embeddings for semantic search #45

Merged
svc-agent-writer merged 2 commits from docs/adr-0005-local-embeddings into main 2026-10-31 13:27:51 +00:00

Closes #42. Part of #9.

Summary

  • ADR 0005 decides on local embeddings for semantic search.
    • The model is bge-small-en-v1.5, int8 ONNX, pinned by Hugging Face revision and sha256, and baked into the image.
    • An embedder thread in sync is the only writer. It uses one core at most and resumes a backfill.
    • Schema v4 adds an embeddings table at 1.5 KB per message.
    • mail_search gains semantic and hybrid modes and similar_to, with a NumPy scan up to about 200,000 messages.
    • An absent [embed] section means off.
  • ADR 0003 §6 now says embeddings are local. An off-host provider needs its own amendment and owner consent.
  • README and CLAUDE.md: the roadmap lines name ADR 0005.

Evidence

A benchmark spike ran on 2026-11-01 on this workstation, one core, ONNX Runtime 1.31:

  • The int8 model embeds one message per run at about 13 messages/s, with a peak RSS of 157 MB.
  • Its vectors are within cosine 0.994 of fp32.
  • Batching made it slower and larger: at batch 8, 8 messages/s and 371 MB.

The ADR expects 3 to 6 messages/s on an amd64 VPS core. The figures are in the ADR's context table.

Not in this PR

  • The code: #43 (the embedder) and #44 (the search modes).
  • Attachment text and the MCP Apps panel. Each gets its own decision.

🤖 Generated with Claude Code

Closes #42. Part of #9. ## Summary - **ADR 0005** decides on local embeddings for semantic search. - The model is `bge-small-en-v1.5`, int8 ONNX, pinned by Hugging Face revision and sha256, and baked into the image. - An embedder thread in `sync` is the only writer. It uses one core at most and resumes a backfill. - Schema v4 adds an `embeddings` table at 1.5 KB per message. - `mail_search` gains `semantic` and `hybrid` modes and `similar_to`, with a NumPy scan up to about 200,000 messages. - An absent `[embed]` section means off. - **ADR 0003 §6** now says embeddings are local. An off-host provider needs its own amendment and owner consent. - **README and CLAUDE.md:** the roadmap lines name ADR 0005. ## Evidence A benchmark spike ran on 2026-11-01 on this workstation, one core, ONNX Runtime 1.31: - The int8 model embeds one message per run at about 13 messages/s, with a peak RSS of 157 MB. - Its vectors are within cosine 0.994 of fp32. - Batching made it slower and larger: at batch 8, 8 messages/s and 371 MB. The ADR expects 3 to 6 messages/s on an amd64 VPS core. The figures are in the ADR's context table. ## Not in this PR - The code: #43 (the embedder) and #44 (the search modes). - Attachment text and the MCP Apps panel. Each gets its own decision. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Embeddings run on the host with a pinned int8 bge-small-en-v1.5, so no message or query text leaves it. ADR 0003 §6 now points here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.