Skip to content

Persistent memory: checkpoints and episodes; 4B local support default - #418

Merged
Shackless merged 4 commits into
developfrom
feat/memory-episodes
Sep 17, 2026
Merged

Shackless merged 4 commits into
developfrom
feat/memory-episodes

Conversation

@Shackless

Copy link
Copy Markdown
Contributor

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:

  • Facts are timeless and rewritten as a whole. A newer statement replaces an older one that contradicts it, so "sold the Aurora, bought a Freelancer" leaves one fact, not two.
  • Episodes are one entry per session: what happened, what was memorable, what is still open. The three most recent within 30 days go into the system prompt with their age, so "where were we?" names the current mission and can bring up an older moment. An episode with nothing memorable and nothing open is dropped, so a session of pure commands leaves no log.

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_forget and the memory tab search. The client shows "Memory: N facts and M sessions loaded" once at session start.

Old session_summary rows are read as episodes, no data migration.

Model defaults

Benchmarked all subscription models on the real pipeline (bench and findings under evals/, gitignored):

  • Local support model → Qwen3.5-4B. On 19 conversations the bundled 2B returned nothing usable in 17 (score 0.35); the 4B scores 0.93, level with the cloud models, at the same speed. The 3.2.2 migration moves the old 2B default over; a model the user picked stays. The 2B stays selectable.
  • Chat model unpinned on upgrade. The 3.2.2 migration empties a pinned conversation_deployment so 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.py gains the 4B move and the chat unpin. test_memory_recall_gate.py and test_memory_placement.py are removed with the code they covered.

… block in the system prompt; one rewrite prompt replaces extraction and consolidation, the similarity recall and the per-turn badge are gone
…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
@Shackless
Shackless merged commit 749abe0 into develop Sep 17, 2026
2 checks passed
@Shackless
Shackless deleted the feat/memory-episodes branch September 17, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant