Persistent memory: checkpoints and episodes; 4B local support default - #418
Merged
Merged
Conversation
… block in the system prompt; one rewrite prompt replaces extraction and consolidation, the similarity recall and the per-turn badge are gone
… a flight that is still going on
…e old 2B default over; the 2B cannot follow the memory rewrite prompt
…he new plan default; a specific model can be picked again in Settings
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.
Reworks persistent memory around checkpoints and episodes, and moves the model defaults after a benchmark against the real subscription models. Sits on top of #417.
Memory
Two kinds of memory, kept apart because they age differently:
Writes happen at checkpoints: every 25 user turns or 20 minutes, at session end (unload, reset, 30 minutes idle), and through
memory_remember. One support call gets the stored facts, the episode so far and the new messages, and returns the whole list plus the episode. This replaces both the extraction prompt and the separate consolidation pass.Reads no longer search. Every fact (capped at 40, newest first) and the recent episodes go into the system prompt as one block that only changes at a checkpoint, so the provider's prompt cache covers it. The per-turn similarity recall, the two tuned thresholds and the "N memories recalled" line are gone. Embeddings stay for deduplication,
memory_forgetand the memory tab search. The client shows "Memory: N facts and M sessions loaded" once at session start.Old
session_summaryrows are read as episodes, no data migration.Model defaults
Benchmarked all subscription models on the real pipeline (bench and findings under
evals/, gitignored):conversation_deploymentso everyone follows the new plan default (gpt-4.1-mini, set on the backend). A specific model can be picked again in Settings.The cloud support default (deepseek-v4.1-flash) and the chat default (gpt-4.1-mini) are backend lane changes, in a separate backend branch.
Tests
Full suite green. New:
tests/test_memory_checkpoint.py(checkpoints, episodes, the block, the fact cap);tests/test_migration_321_to_322.pygains the 4B move and the chat unpin.test_memory_recall_gate.pyandtest_memory_placement.pyare removed with the code they covered.