fix(memory): enforce Hindsight routes across recall, reflect, and retain - #40947
Open
jackroofan wants to merge 1 commit into
Open
fix(memory): enforce Hindsight routes across recall, reflect, and retain#40947jackroofan wants to merge 1 commit into
jackroofan wants to merge 1 commit into
Conversation
jackroofan
force-pushed
the
fix/hindsight-recall-routing
branch
from
June 7, 2026 16:42
057fa88 to
ee905c2
Compare
jackroofan
force-pushed
the
fix/hindsight-recall-routing
branch
from
July 10, 2026 17:24
ee905c2 to
563fc07
Compare
jackroofan
force-pushed
the
fix/hindsight-recall-routing
branch
from
July 21, 2026 11:55
563fc07 to
5e13b23
Compare
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.
Summary
hindsight_recall,hindsight_reflect, and retain taggingchat_ids> exact case-insensitivechat_names> case-insensitivekeywordsin the query/chat name; same-signal ties use configuration ordertag_groups, including exclusions, priority-first recall, deduplication, result caps, and one bounded type-broadening fallbackrecall_max_tokens, use routed filters, and fall back to routed recall when synthesis/tag-group support cannot provide an answerConfiguration contract
recall_routesaccepts either a JSON object or the JSON string emitted by the plugin config UI. A non-empty object enables routing. Each ordered named route may contain:chat_ids,chat_names,keywordstags,tags_match,exclude_tags,query_prefixpriority_tags,priority_tags_match,priority_query_prefixmin_results,max_resultsretain_tagsGlobal optional controls are:
recall_max_results(0means unlimited; a route can override it)recall_skip_low_signal_queriesrecall_low_signal_min_charsrecall_domain_signal_keywordsExisting configs remain unchanged when these settings are absent. If no route matches, existing global
recall_tags/recall_tags_matchbehavior is preserved.Behavior and fallback
tag_groupswhen supported.tag_groups, recall retries with positive tags and applies priority/exclusion checks client-side.priority_tagsresults are fetched first, merged without duplicates, then capped.min_resultspermits one retry without the configured type restriction while retaining the same route filters.retain_tagsare merged after global retain tags and before per-call tags.Scope
This refresh is rebuilt from current
origin/mainand contains only:plugins/memory/hindsight/__init__.pytests/plugins/memory/test_hindsight_provider.pyIt intentionally excludes Task Scope work, host-specific configuration/data, gateway changes, deployment scripts, and other product changes.
Tests
HERMES_HOME=<temp> python -m pytest tests/plugins/memory/test_hindsight_provider.py -q -o 'addopts='— 137 passedpython -m ruff check plugins/memory/hindsight/__init__.py tests/plugins/memory/test_hindsight_provider.py— passedpython -m py_compile plugins/memory/hindsight/__init__.py tests/plugins/memory/test_hindsight_provider.py— passedgit diff --check origin/main...HEAD— passedCoverage includes configuration parsing/schema exposure, signal precedence and config-order ties, no-match global fallback, prefetch routing before query truncation, positive/negative filters, fallback filtering, priority ordering, caps, bounded type broadening, reflect fallback, retain tagging, low-signal suppression, and safe service failure.
Risk
Mostly opt-in: route, retain, priority, fallback, cap, and low-signal behavior activate only when configured. The non-route reflect path now also passes the existing
recall_max_tokensvalue to Hindsight so reflect and recall share the configured token ceiling.