Skip to content

Comments

feat(memory): P1 memory improvements — MMR, temporal decay, chunked compaction, compact skills#753

Merged
bug-ops merged 3 commits intomainfrom
epic/memory-p1
Feb 22, 2026
Merged

feat(memory): P1 memory improvements — MMR, temporal decay, chunked compaction, compact skills#753
bug-ops merged 3 commits intomainfrom
epic/memory-p1

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 22, 2026

Summary

Implements P1 improvements from epic #740:

Security

  • Removed filesystem path from compact skills prompt (prevents XML injection)
  • Added half_life_days=0 division-by-zero guard
  • Capped parallel LLM calls during compaction
  • Config validation for token_safety_margin

Test plan

  • 2473 tests pass, 9 skipped
  • Unit tests for MMR lambda extremes, temporal decay edge cases, compact prompt formatting
  • Chunked compaction: empty input, oversized messages, boundary splitting, error fallback
  • SkillPromptMode auto-threshold and forced config
  • cargo clippy --workspace -- -D warnings clean
  • cargo +nightly fmt --check clean

Closes #744, closes #745, closes #746, closes #747
Part of #740

… 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.
@github-actions github-actions bot added enhancement New feature or request size/XL documentation Improvements or additions to documentation skills SKILL.md system memory Persistence and memory rust core and removed enhancement New feature or request size/XL labels Feb 22, 2026
Add MMR re-ranking, temporal decay, chunked compaction, and compact
skills prompt mode to mdbook docs, configuration reference, and
crate READMEs.
@github-actions github-actions bot added enhancement New feature or request size/XL labels Feb 22, 2026
@bug-ops bug-ops merged commit e6ff6fd into main Feb 22, 2026
23 checks passed
@bug-ops bug-ops deleted the epic/memory-p1 branch February 22, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation enhancement New feature or request memory Persistence and memory rust size/XL skills SKILL.md system

Projects

None yet

1 participant