feat(memory): MemScene consolidation, compress_context tool, A-MAC admission control#2355
Merged
feat(memory): MemScene consolidation, compress_context tool, A-MAC admission control#2355
Conversation
…mission control Implements three memory improvements based on research papers: - EverMemOS (#2332): brain-inspired engram lifecycle with MemCell→MemScene consolidation. New SQLite tables (migration 049), background scene consolidation loop decoupled from tier promotion, cosine-similarity clustering, LLM-generated label/profile per scene, scene members excluded from regular recall results. - Focus (#2218): agent-invokable compress_context native tool. Knowledge block in ContextBuilder survives compaction. AtomicBool concurrency guard prevents double-compression. Index-based message removal. CompressionStrategy::Autonomous variant with compress_provider config. - A-MAC (#2317): write-time admission gate on memory_save path. Five-factor scoring (future_utility, factual_confidence, semantic_novelty, temporal_recency, content_type_prior) with normalized weights. Fast path skips LLM call when heuristic score exceeds threshold+margin. remember() return type changed to Result<Option<MessageId>>. Wired in AppBuilder. Admission decisions logged via AuditLogger. All new LLM-calling subsystems expose *_provider config fields. New [memory.admission] and [memory.tiers] scene fields added to config. Migration step added for remember() call-site changes. Closes #2332 Closes #2218 Closes #2317
14f7c16 to
e167496
Compare
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 three research-backed memory improvements:
MemScenerecords (migration 049). Scene members excluded from regular recall via MessageKind filter. LLM-generated label/profile per scene, label truncated to 100 chars.ContextBuildersurvives compaction.AtomicBoolconcurrency guard.CompressionStrategy::Autonomousvariant.memory_savepath. 5-factor scoring with normalized weights. Fast path skips LLM when heuristic score exceeds threshold+margin.remember()return type changed toResult<Option<MessageId>>(breaking, pre-v1.0.0). Wired inAppBuilder, decisions logged viaAuditLogger.All new LLM-calling subsystems expose
*_providerconfig fields. New[memory.admission]and[memory.tiers]scene fields added to config.New config
Breaking changes
remember()returnsResult<Option<MessageId>>(wasResult<MessageId>) — all call sites updatedremember_with_parts()returnsResult<(Option<MessageId>, bool)>— all call sites updatedTest plan
cargo nextest run --workspace --features full --lib --binspasses (7074 tests)[memory.admission]in testing.toml and verify A-MAC gate logs admission decisionsstrategy = "autonomous"and callcompress_contextmanuallyscene_enabled = true(log:scene consolidation: starting sweep)Follow-up
Closes #2332
Closes #2218
Closes #2317