Skip to content

feat(embed): candle-backed semantic embeddings behind an embeddings feature#21

Merged
Ghost-Frame merged 1 commit into
mainfrom
feat/candle-embeddings
Jul 6, 2026
Merged

feat(embed): candle-backed semantic embeddings behind an embeddings feature#21
Ghost-Frame merged 1 commit into
mainfrom
feat/candle-embeddings

Conversation

@Ghost-Frame

Copy link
Copy Markdown
Owner

A2 Phase 2: the semantic-selection scaffold gets a real engine.

New crate frameshift-embed-candle -- CandleEmbedder loads sentence-transformers/all-MiniLM-L6-v2 (~23 MB) through hf-hub (download on first use, mmap-cached thereafter), tokenizes with truncation at BERT's 512-token window, mean-pools and L2-normalizes into 384-dim unit vectors implementing the orchestrator's Embedder trait. Degenerate inputs and inference failures return an empty vector, which the scorer already treats as "no semantic signal".

Wiring -- select_rich gains a _with_embedder variant; the CLI select command, MCP frameshift_select, and the daemon evaluation loop consume the embedder behind an off-by-default embeddings cargo feature. The daemon and MCP server load the model once per process (OnceLock); a failed load is remembered and selection degrades to lexical ranking with a warning. Default builds compile none of the ML stack into shipped binaries.

Verification -- clippy -D warnings green with all features on; unit tests for pooling math; the ignored end-to-end test was run locally against the real downloaded model: 384-dim output confirmed, related text out-scores unrelated text for a borrow-checker task hint.

Audit note -- the candle tree adds one informational advisory: paste (RUSTSEC-2024-0436, unmaintained build-time proc-macro), same class as the existing proc-macro-error ignore; non-blocking in CI.

🤖 Generated with Claude Code

…eature

New frameshift-embed-candle crate: CandleEmbedder loads
sentence-transformers/all-MiniLM-L6-v2 via hf-hub (download on first
use, mmap thereafter), tokenizes with truncation at BERT's window,
mean-pools and L2-normalizes into unit vectors implementing the
orchestrator's Embedder trait. Degenerate inputs and inference failures
return an empty vector (no semantic signal), never an error.

Wiring: select_rich gains a _with_embedder variant; the CLI select
command, MCP frameshift_select, and the daemon evaluation loop all use
the embedder behind an off-by-default 'embeddings' cargo feature, with
a process-wide once-loaded model in the daemon and MCP server. Model
load failure degrades to lexical-only ranking with a warning.

Verified end to end: the ignored model test downloads the real model
and confirms related text out-scores unrelated text.
@Ghost-Frame
Ghost-Frame merged commit b21a935 into main Jul 6, 2026
5 checks passed
@Ghost-Frame
Ghost-Frame deleted the feat/candle-embeddings branch July 6, 2026 16:49
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