feat(#53): real local neural embedder for recall = local (offline semantic) - #54
Open
veltri-23 wants to merge 1 commit into
Open
feat(#53): real local neural embedder for recall = local (offline semantic)#54veltri-23 wants to merge 1 commit into
veltri-23 wants to merge 1 commit into
Conversation
This was referenced Jul 21, 2026
veltri-23
added a commit
that referenced
this pull request
Jul 21, 2026
…nxruntime-web approach) (#69) * feat(#53): real local neural embedder for recall = local (offline semantic) * fix(#54): direct onnxruntime-web dep + lazy import + tsc clean * feat(#53): real local neural embedder via node sidecar recall = local now runs genuine offline semantic recall. Root cause of the prior blocker (PR #54): forcing onnxruntime-web in-process gives Bun an empty execution-provider list ("Unsupported device: cpu"), and the transformers web build has no fs under Bun. Only the transformers *node* build + onnxruntime-node under real Node produces vectors — so the Bun CLI shells out to a `node` sidecar (embed-worker.mjs) for embeddings and stays on the fast path. - embed-worker.mjs: node sidecar, stdin texts -> stdout MiniLM vectors, model cached under the guard home, offline after first pull. - recall-local.ts: rewritten to embed via the sidecar; rips out the broken onnxruntime-web override. Degrades to [] / no-embedding on any failure. - Per-backend warn threshold: cosine on short commands lands ~0.3, so the Jaccard-calibrated 0.5 never fires. localRecallWarnThreshold=0.25 (calibration knob documented). runtime uses adapter.warnThreshold ?? global. - Hook wired to async recallAdvisory on the allow path for local/embed, so a paraphrase-level warning fires live where the sync lexical hot path can't. - transformers moved to optionalDependencies; onnxruntime-web dep dropped. - Tests: recall-local.test.ts ported to the Embedder injection API (11 pass); new recall-local-realmodel.test.ts drives the REAL model — a zero-shared-token paraphrase recalls the incident above threshold where lexical scores 0 (2 pass), skips honestly if the model can't load. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#53): harden hook advisory — cheap mode gate + crash-proof close Testing the real CLI hook surfaced two issues on the allow path: 1. Double-close crash: close() was called in both the try and the catch, and IncidentStore.close(true) throws on a locked handle — the second throw (from the catch) escaped and killed the hook with exit 1. Enforcement must never crash. Now closes exactly once in `finally` with a swallowed error. 2. Per-hook cost: every allow-path hook opened the incident store before checking the mode. Now gates on the config mode first (one existsSync + small TOML read); lexical/off/no-config returns before any SQLite I/O. Verified end to end through `bun src/cli.ts hook`: local mode + a seeded incident + a zero-shared-token paraphrase prints the recall advisory (exit 0); unrelated commands and the default lexical path stay silent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(#53): isolate recall from hook enforcement * fix: keep CLI usable without local recall deps * fix(#69): bound local embed worker execution * fix(#53): calibrate local recall warning threshold * fix: harden embedding worker trust boundary * test(#69): align live model gate with secure worker protocol * chore: normalize PR 69 changed lines * test(#69): make optional dependency smoke portable * fix(#69): prefilter local recall false positives * test(#69): exercise optional recall after prefilter * test(#69): use relative GNU tar destination * test: isolate situational guards from checkout state * fix(#69): emit one recall warning per hook --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
PR #54 vibebloat: feat(#53): real local neural embedder for recall = local (offline semantic)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.