feat(memory): bundle #533 + #549 — facet guard, length limits, concise extraction#1530
Open
ZaynJarvis wants to merge 3 commits intomainfrom
Open
feat(memory): bundle #533 + #549 — facet guard, length limits, concise extraction#1530ZaynJarvis wants to merge 3 commits intomainfrom
ZaynJarvis wants to merge 3 commits intomainfrom
Conversation
- Add 'skip' decision: reject merging memories with different facets even if they share the same category, preventing semantic dilution - Add hard character limits: abstract ≤80, overview ≤200, content ≤300 - Change merge strategy from accumulate-all to condensed snapshot: conflicts resolved by keeping newer version only - Bump template version from 1.0.0 to 2.0.0 Motivation: without facet checking, the merge prompt would combine unrelated facts (e.g. 'Python code style' + 'food preferences') into a single bloated memory just because both were categorized as 'preferences'. Without length limits, merged memories grew unbounded (some exceeding 1000+ chars), causing embedding dilution and low retrieval precision in downstream vector search.
…eval - Prompt (memory_extraction.yaml): - Add explicit length targets for abstract (~50-80 chars) and content (2-4 sentences) - Add good/bad examples showing concise vs verbose memory patterns - Guide LLM to split multi-topic memories into separate atomic items - Emphasize fact-dense 'sticky note' style over narrative expansion - Vectorization (memory_extractor.py): - Use abstract instead of content for embedding generation - Shorter text produces more discriminative vectors, improving retrieval precision - Reduces score clustering (e.g., 0.18-0.21 all similar) by focusing embeddings Background: In production, extracted memories averaged 500-2000 chars per item, causing: 1. Embedding vector dilution — any query fuzzy-matches long content 2. Poor score discrimination — relevant and irrelevant items score similarly 3. Context bloat — 5 injected memories could exceed 5000 chars per turn After this change, new memories will be shorter and more atomic, and vector search will match on focused abstract text rather than diluted content.
…lish examples Addresses review feedback on top of the cherry-picked #549 commit: - Remove the BAD/GOOD content example blocks — they duplicate the Few-shot Examples section immediately below them (ZaynJarvis's inline comment on #549). - Restore English values in the L0 bullet examples; the Chinese values introduced by #549 would bias `output_language: auto` for non-Chinese users (yangxinxin-7's inline comment on #549). Keeps the substantive contribution from #549: the length targets (~50-80 chars / 3-5 bullets / 2-4 sentences) and the vectorize-on- abstract switch in memory_extractor.py. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
This was referenced Apr 17, 2026
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.
Cherry-picked bundle of two in-flight prompt-quality PRs from @lishixiang0705. Original commits preserved — authorship is unchanged; my only new commit is a fixup addressing the inline review feedback.
Commits
memory_merge_bundle.yamlWhat each piece does
#533 — memory_merge_bundle.yaml v1 → v2
decision: skipadded.#549 — memory_extraction.yaml + memory_extractor.py
set_vectorize(abstract or content)— shorter, keyword-dense text produces more discriminative embeddings.Fixup — addresses inline review on #549
output_language: autofor non-Chinese users (@yangxinxin-7's point).Memory-quality effect
Pending eval. Will run retrieval precision / embedding score-spread numbers before merge.
Not in this PR
The queue stall fix from #951 is kept standalone — see its own companion PR (unrelated code path).
Test plan
yaml.safe_load