Skip to content

fix(auto-recall): respect recall.maxResultsDefault config instead of hardcoding 10#1541

Open
octo-patch wants to merge 1 commit intoMemTensor:mainfrom
octo-patch:fix/issue-1514-auto-recall-max-results-config
Open

fix(auto-recall): respect recall.maxResultsDefault config instead of hardcoding 10#1541
octo-patch wants to merge 1 commit intoMemTensor:mainfrom
octo-patch:fix/issue-1514-auto-recall-max-results-config

Conversation

@octo-patch
Copy link
Copy Markdown
Contributor

Fixes #1514

Problem

The auto-recall before_prompt_build hook hardcodes maxResults: 10 for both local and Hub memory searches, ignoring the user-configured recall.maxResultsDefault value. This means users who set a lower limit (e.g. 3 or 5) to reduce token consumption still get up to 10+10 candidates fetched on every turn.

Solution

Read ctx.config?.recall?.maxResultsDefault ?? DEFAULTS.maxResultsDefault (default: 6) and use it for both the local engine search and Hub search calls.

const arMaxResults = ctx.config?.recall?.maxResultsDefault ?? DEFAULTS.maxResultsDefault;
const arLocalP = engine.search({ query, maxResults: arMaxResults, ... });
const arHubP = ctx.config?.sharing?.enabled
  ? hubSearchMemories(store, ctx, { query, maxResults: arMaxResults, ... })
  ...

Testing

  • Configured recall.maxResultsDefault: 3 in plugin config; verified auto-recall now fetches at most 3 results from local search instead of 10.
  • Default behavior (no config set) uses DEFAULTS.maxResultsDefault (6), unchanged from existing behavior intent.

…hardcoding 10

Auto-recall was hardcoding maxResults: 10 for both local and Hub searches,
ignoring the user-configured recall.maxResultsDefault value. This caused
unexpectedly high token consumption for users who had set a lower limit.

Now reads ctx.config?.recall?.maxResultsDefault ?? DEFAULTS.maxResultsDefault
(default 6) for both local and Hub search calls in the before_prompt_build hook.

Fixes MemTensor#1514

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-recall hardcodes maxResults: 10, ignoring recall.maxResultsDefault config

1 participant