Repository navigation
0.2 (4/4): fold near-identical memories, across sessions, reversibly - #16
Merged
Merged
Conversation
Word-based detection with guards (numbers, negation, order of shared words, same category and scope, unconfirmed only, one session). A folded memory keeps its own row and evidence and points at its survivor, so undo is exact and forget removes everything it brought. Migration 4 adds merged_into and merge_vetoes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014dGcvUc3LqzKojYnqVGCjK
…rds in the core Merge main (decay, digest, plugins) into the twins branch. - find_twins no longer requires both memories to rest on the same single session; duplicates of a fact mostly come from different sessions. A memory with any assistant-proposed evidence stays ineligible. - Numbers and negation must agree for every pair, whatever function scores it, so a replaced similarity cannot merge past those guards. - plugins: second hook, similarity, used by tidy. - Docs and tests follow. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014dGcvUc3LqzKojYnqVGCjK
Yanir-R
marked this pull request as ready for review
November 16, 2026 09:28
This was referenced Nov 17, 2026
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.
Requested by Yanir · project thread
What changed
One thing: folding near-identical unconfirmed memories into one. Split out of #12. It was on hold because the first version compared only memories from the same session and found nothing on a real store; duplicates of a fact mostly come from different sessions, so it now compares across sessions.
twins: word-based detection, pure functions. Only unconfirmed memories of one category and scope are compared, and none that rest on an assistant's proposal. The shared words must appear in the same order. Matching is against one anchor per group, never chained.find_twins, not only in the built-in scorer.store: migration 4 addsmerged_into,merged_atandmerge_vetoes. A folded memory keeps its own row and evidence, soforgetleaves nothing behind andundois exact. An un-merged pair is never proposed again.tidy: the plan lists merges and archives;--only merge|archive,--threshold.personakit mergeslists what is folded;personakit undo <id>reverses one.plugins: a second hook,similarity, used bytidy. Policy stays in the core.Why
The same fact gets extracted again in later sessions with slightly different wording. Folding those keeps what assistants are served short, without deleting anything and without touching the owner's decisions.
How to verify
Also run end to end through the CLI on an invented store: plan, apply, list, undo, and the un-merged pair is not proposed again. 2,500 synthetic memories are planned in about 2 seconds.
Limits, stated in the README: detection compares words, not meaning, so paraphrases are left alone.
Note for existing stores: opening a store with this version upgrades its schema, and earlier versions will then refuse to open it. Back up the store file first.
Checklist
git commit -s), see CONTRIBUTING.md (owner is exempt; commits are not signed off on the owner's behalf)docs/ARCHITECTURE.md🤖 Generated with Claude Code
https://claude.ai/code/session_014dGcvUc3LqzKojYnqVGCjK