feat(memory): P1 memory improvements — MMR, temporal decay, chunked compaction, compact skills#753
Merged
feat(memory): P1 memory improvements — MMR, temporal decay, chunked compaction, compact skills#753
Conversation
… compact skills prompt, adaptive compaction - Temporal decay (#745): apply exp(-λ·age_days) score attenuation in SemanticMemory::recall() with configurable half-life (default 30 days); reads timestamps via new SqliteStore::message_timestamps() - MMR re-ranking (#744): greedy Maximal Marginal Relevance post-processing for result diversity; reads raw vectors via new EmbeddingStore::get_vectors(); configurable lambda (default 0.7) - Compact skills prompt (#747): format_skills_prompt_compact() produces single-line XML tags; SkillPromptMode (full/compact/auto) auto-selects compact when context budget < 8192 tokens - Adaptive chunked compaction (#746): summarize_messages() splits history into ~4K token chunks, summarizes in parallel via join_all, consolidates into single summary
Remove filesystem path from compact skills prompt (SEC-001), add half_life_days=0 guard, cap compaction concurrency with buffer_unordered(4), validate token_safety_margin, add comprehensive tests for all P1 features.
Add MMR re-ranking, temporal decay, chunked compaction, and compact skills prompt mode to mdbook docs, configuration reference, and crate READMEs.
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
Implements P1 improvements from epic #740:
memory.semantic.mmr_enabled/mmr_lambdascore * exp(-λ·age)with configurable half-life.memory.semantic.temporal_decay_enabled/temporal_decay_half_life_daysbuffer_unordered(4)concurrency cap, final consolidation passSkillPromptModeenum (full/compact/auto) reduces skill prompt tokens by >70% for small-context models. Auto-selects compact below 8192 token budgetSecurity
half_life_days=0division-by-zero guardtoken_safety_marginTest plan
cargo clippy --workspace -- -D warningscleancargo +nightly fmt --checkcleanCloses #744, closes #745, closes #746, closes #747
Part of #740