feat: let recall choose which of two disagreeing hits comes first - #15
Merged
Merged
Conversation
A decision reversed weeks later and the reversal both match the same search, and recall printed them by BM25 with no date, so the stale one could lead. `recall --policy` now picks the order: `latest` (default, newest first), `relevance` (the old order; every line is dated so the agent can decide), or a `module:function` of your own. Also settable with GITMEMORY_POLICY. Nothing is deleted, and `index.search` is unchanged, so bench/ still measures plain BM25. `Hit` carries the turn's `ts`, read through `index.when`. USAGE.md documents the options and a validity-window rule as a custom policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… drops Review (Gemini 3.1 Pro + Claude, both agreeing) found plain `latest` breaks the README's own story: after compaction drops "don't add a retry loop", the agent proposes one, and that newer proposal, like a captured earlier recall, outranks the rule. The default is now `latest-user`: the user's own words newest first (derive's prose admission rule, so tool results do not count), then the rest newest first. `latest` stays as the strict option. Also: a custom policy that keeps nothing says so instead of printing silence, and one that returns None or raises is an error, not a traceback. README's recall row no longer says "best first". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 tasks done
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.
Why
If a decision is reversed weeks later, the original and the reversal both match the same search.
recalllisted them by BM25 score with no date, so the stale decision could come first, and the agent would act on it with no hint of a conflict.What
gitmemory recall --policydecides which hit comes first. Nothing is deleted.latest-user(default)latestrelevancemodule:functionlist[Hit]tolist[Hit]--policyorGITMEMORY_POLICY; the flag wins.recallline now shows the turn's UTC date.Hitgainedts, andindex.when(hit)parses it.index.searchis unchanged, sobench/still measures plain BM25.docs/USAGE.mdhas a new section, "When memories disagree". It shows a validity window ("ignore everything before date X") written as a custom policy.Behaviour change
recallnow lists the user's own words newest first by default. To get the old order, pass--policy relevance.Review (Gemini 3.1 Pro + Claude)
latestas the default let the agent's newer, mistaken proposal (and captured recall output) outrank the user's rule, which breaks the README demo. The founder pickedlatest-useras the default. Also fixed: a policy that drops every hit is reported instead of printing nothing, a policy that crashes gives an error instead of a traceback, and the README recall row no longer says "best first".b.tsmay not exist" (it's in_DDL); "bad policy gives a traceback" (maincatchesValueError).Known ceiling
latestreorders only the top-khits, so a reversal that ranks below them can't win. That's documented and noted in the code. The upgrade is to search a wider pool than is shown.Tests
tests/test_index.py:latestand comes second underrelevancemodule:functionOverlaps in docs with #14 (recall skill); whichever merges second needs a rebase.
🤖 Generated with Claude Code