fix: dedup punctuation + ingest model server startup (#305, #337)#361
Merged
Conversation
1. dedup.py: replace str.split() with re.findall(r'\w+', ...) in _word_overlap() so punctuation is stripped before Jaccard comparison. "Austin," vs "Austin" was 0% match, now correctly 100%. 2. cli.py: add ensure_server_running() call at the top of _run_ingest() so ingest subprocesses use the shared model server instead of falling back to loading Qwen3-Embedding-0.6B (~1.5GB) locally. The encoding gate and prediction error are UNCHANGED — this just ensures the model server is alive before the gate needs it. Sacred parameters verified unchanged. encoding_gate.py and stop.py verified untouched. 5-model consensus: 4/5 APPROVE (1 API timeout) Closes #305, closes #337
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.
Summary
_word_overlap()Jaccard tokenization usesstr.split()which keeps punctuation attached ("Austin," != "Austin"). Fixed withre.findall(r'\w+', ...)._run_ingest()incli.py) never callsensure_server_running(), so the encoding gate's PE computation falls back to loading the full Qwen3 model (~1.5GB) locally. Fixed by addingensure_server_running()call at the top of_run_ingest().Files changed
truememory/ingest/dedup.py—re.findalltokenization, module-levelimport re, removed redundant local importtruememory/ingest/cli.py—ensure_server_running()call in_run_ingest()Files NOT changed (intentionally)
truememory/ingest/encoding_gate.py— PE computation fully preserved, gate weights unchangedtruememory/ingest/hooks/stop.py— Popen untouched, spawn_gate untouchedWhat this does NOT do
Test evidence
Risk
\w+strips ALL non-word chars including hyphens in hyphenated words. Jaccard is a coarse heuristic — this is acceptable.ensure_server_running()may add ~1-2 seconds if it needs to start the model server. This is a one-time cost that saves 10-30 seconds of local model loading. Wrapped in try/except so failure is non-fatal.Closes #305, closes #337