feat(memory): write-time importance scoring for improved retrieval#2062
Merged
feat(memory): write-time importance scoring for improved retrieval#2062
Conversation
…2021) Add write-time importance scoring that combines marker detection, content density, and role-based weighting. Importance score blends into hybrid retrieval formula when enabled (default: disabled). Backward compatible via DEFAULT 0.5 for existing rows. - Schema migration 039: add importance_score column (REAL, default 0.5) - New module: compute_importance(content, role) -> f64 with 3-signal heuristic - Config: SemanticConfig.importance_enabled and importance_weight with validation - Recall: blend importance into final score, batch-increment access_count - Save path: compute importance at write time via save_message_with_metadata() - Bootstrap: wire importance settings from config - Tests: 23 new unit/integration tests covering edge cases, UTF-8 safety - UTF-8 fix: char_byte_boundary() helper for safe string slicing
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
Add write-time importance scoring for memory retrieval, combining marker detection, content density, and role-based weighting. Importance score blends into the hybrid retrieval formula when enabled (default: disabled).
Addresses issue #2021 (MemOS: A Memory OS for AI Systems).
Changes
importance_score REALcolumn with DEFAULT 0.5semantic/importance.rswith 3-signal heuristic scorerSemanticConfig.importance_enabledandimportance_weightwith validationaccess_countsave_message_with_metadata().with_importance_options()Key Features
char_byte_boundary()helperTest Coverage
Pre-commit Checks
cargo +nightly fmt --checkcargo clippy --workspace --features full -- -D warningsCloses #2021