Repository navigation
Prefrontal recall: PR-topic queries and semantic relevance floor (0.4) - #63
Merged
Merged
Conversation
…nce-floor # Conflicts: # CHANGELOG.md
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.
Problem
On peaks-com/mono#10519 (pension-switcher drafts + sorting), "Other repositories in peaks-com" was full of unrelated peaks-ios facts, and Seen before / Decisions / Patterns returned scope facts that had nothing to do with the PR.
Causes:
min_scoresis passed, and codespy never passed it.Files: …). Those words appear in every repo of the org.seen_beforestarted with the scope id and package names, which every fact of that scope matches.decisionsandpatternsused no PR content at all ("<scope>: decisions, …").Changes
prefrontal/query.py)seen_before: the changed paths and symbols only.decisions/patterns: the topic, then their usual phrasing. The topic is shortened first, so the phrasing always survives the word cap.memory.prefrontal.recall.min_similarity(envMEMORY_RECALL_MIN_SIMILARITY, 0–1, default0.4,0= off).scores.semanticis set and at or above the floor.recall_memory) and toseen_before,decisionsandpatterns.context(reflect), the tool's local recall or reflect mode.MinScores(semantic=…), through a newCerebral.arecall(min_semantic=…)argument.Prefrontal[<task>] score section=… semantic=… kept=… repo=… text=….scores,remote_dropped,remote_scores, per-facetdropped, andremote_query.docs/memory.md),codespy.yaml, and CHANGELOG### Fixed(no version bump).Rollout
The default floor is
0.4, calibrated on mono#10519 with Cohere embed v4:Known limits:
MEMORY_RECALL_MIN_SIMILARITY=0restores the old behaviour.reach: org), or from other organisations (reach: bank), in CI logs. Run calibration where the logs aren't public.Tests
tests/test_prefrontal_relevance.py(25 tests): query shapes and fallbacks, per-facet filtering andmin_semantic,contextnever filtered, "What changed" built only from kept facts, remote filtering and section omission, topic-only remote query, floor0keeps everything, the rawrecall_memoryremote branch, and score records.recall_async(min_scores),MinScores.semantic,MemoryFact.scores/RecallScores.semantic.Cerebral.arecallpassesmin_scoresonly when the floor is above 0.The full suite has the same failures as before this change, none new. One example is
test_arecall_forwards_arguments, which still expects the bank to be calledcodespyinstead ofcodebase.