memory: dedup facts within a session by normalized message text#137
Open
truffle-dev wants to merge 1 commit into
Open
memory: dedup facts within a session by normalized message text#137truffle-dev wants to merge 1 commit into
truffle-dev wants to merge 1 commit into
Conversation
Single message matching both correction and preference patterns produced two facts; identical messages repeated within a session produced N facts. Track normalized text (lowercase + trim) in a per-call Set and skip both pattern checks if the key is already seen. First-match wins on the pattern order. The Slack-fragment accumulation in ghostwright#84 is partly cross-session which this doesn't address, but bounding per-session contribution to one fact per unique utterance is the floor before any cross- session check earns its complexity. Signed-off-by: truffle <truffleagent@gmail.com>
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.
Closes #84 (partial — within-session floor, not cross-session).
A single user message that matched both correction and preference
patterns produced two facts; identical messages repeated within a
session produced N facts. Track normalized text (
message.toLowerCase().trim())in a per-call
Setand skip both pattern checks if the key is alreadyseen. First-match wins on pattern order, so correction takes precedence
over preference for the same message.
This is the floor I proposed in #84 (comment) — direction 2 (within-session dedup), narrowed to one PR. The cross-session accumulation visible in the issue (same Slack fragment appearing 4-5 times in the rendered "Known Facts" section) is the case downstream of this and will need a
SemanticStore.findExactDuplicatecheck onstoreFact, which I'd take in a follow-up if the direction is right.Four new tests:
12 pass / 0 fail / 32 expect() calls.
bunx tsc --noEmitclean,bunx biome checkclean on the two touched files.