Embed every mirrored message locally with a pinned model #46
No reviewers
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp!46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/embedder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #43. Part of #9. Decision: ADR 0005 (#45).
Summary
scripts/fetch_model.pydownloadsbge-small-en-v1.5int8 ONNX and its tokenizer fromXenova/bge-small-en-v1.5at the pinned revision./opt/mailmind/modelowned by root.make modelfetches the same files intolocal/modelfor the tests.[embed]config:model_dir,batch,pause_seconds,poll_seconds. With the section absent, nothing loads the model.embeddings(message_id, model, vec)table holds one L2-normalised float32 vector per message, 1.5 KB each. AnAFTER DELETEtrigger onmessagesdrops the vector in the same transaction, whichever path deletes the row.embed.py.OnnxEmbedder: one ONNX thread, truncation at 512 tokens, CLS output, one message per run.EmbedWorker, a thread insyncnext to the assessor. Each round it copies vectors by Message-ID, then embeds the newest rows that have no vector from the current model. A stop takes effect between rounds, and the next tick resumes.mail_statusshowsembed: offorembed: model=…, andembedded=Nper account.mailmind checkloads the model and embeds one string.sync --onceruns one embed tick.config.example.toml.The search side (
mail_searchmodes, api memory limits) is #44.Image
The amd64 image grows from 264 MB to 477 MB:
huggingface_hubandhf_xet: about 15 MB. They are dependencies oftokenizersthat the service never calls.ADR 0005 estimated 145 MB. I'll correct the figure in #45.
Inside the amd64 image, the model embeds three test strings. The invoice query scores 0.689 against the payment text and 0.412 against the unrelated text.
Test plan
make check: 122 passed, mypy strict clean, pip-audit clean.With
make model, three tests run against the real model:from_configloads the model;checkembeds one string.Without the model, those three skip.
Fake-model tests cover:
The store upgrade test now starts from a file without the v4 table and trigger.
🤖 Generated with Claude Code