Skip to content

fix(openclaw-plugin): thread recall rerank into search; mark keywordSearch no-op#5368

Open
Bartok9 wants to merge 1 commit into
mem0ai:mainfrom
Bartok9:fix/5351-recall-rerank-keywordsearch
Open

fix(openclaw-plugin): thread recall rerank into search; mark keywordSearch no-op#5368
Bartok9 wants to merge 1 commit into
mem0ai:mainfrom
Bartok9:fix/5351-recall-rerank-keywordsearch

Conversation

@Bartok9
Copy link
Copy Markdown
Contributor

@Bartok9 Bartok9 commented Jun 4, 2026

Summary

  • @mem0/openclaw-mem0 documented skills.recall.rerank and skills.recall.keywordSearch (defaulted true) but neither was ever threaded into a search call.
  • This PR makes rerank actually reach the Mem0 search payload (platform-only) and marks keywordSearch as a documented no-op so the config no longer misleads.

Motivation

Closes #5351.

Users who set rerank: true expecting Mem0 Platform Advanced Retrieval reranking got only the plugin's local rankMemories() + budgetMemories() ordering — the key was inert. keywordSearch was likewise inert because Mem0 v3 removed keyword search from the search API entirely.

Root cause: recall.ts and index.ts buildSearchOptions built searchOpts with only user_id/top_k/threshold/source (comment: "v3.0.0: reranking removed"), and PlatformProvider.search never forwarded rerank to the SDK — even though mem0-ts SearchMemoryOptions still declares rerank?: boolean and camelToSnakeKeys forwards it to POST /v3/memories/search/.

Fix

  • rerank (option 1 — thread it through):
    • openclaw/recall.ts — thread recallConfig.rerank into searchOpts.
    • openclaw/index.ts buildSearchOptions — thread recallCfg.rerank (this is the shared builder used by the memory_search tool, so the tool path is fixed too).
    • openclaw/providers.tsPlatformProvider.search forwards rerank to the SDK; providerToBackend.search passes it through when requested.
    • Platform-only by design: OSSProvider.search selects fields explicitly and safely ignores rerank (the OSS SDK has no reranker).
  • keywordSearch (option 2 — mark no-op): v3 removed keyword search from the search API, so there is nothing to thread. Marked @deprecated no-op in types.ts, openclaw.plugin.json schema, and README.md so users aren't misled.

Verification

  • cd openclaw && pnpm test (vitest) — added 2 cases in tests/providers.test.ts:
    • forwards rerank to provider.search when opts.rerank is true
    • omits rerank when opts.rerank is falsy
  • Existing providerToBackend — search assertions updated for the new (optional) field.
  • Type-checked the changed files; rerank?: boolean added to both SearchOptions definitions (types.ts provider-facing and backend/base.ts already had it).

Did NOT change

  • OSS-mode search behavior — OSSProvider.search continues to ignore rerank (intentional; no OSS reranker).
  • Default semantics for keywordSearch beyond marking it inert/deprecated.

…earch no-op

Closes mem0ai#5351

Problem: The @mem0/openclaw-mem0 plugin documents skills.recall.rerank
and skills.recall.keywordSearch (defaulted true) but neither was ever
threaded into a search call. Users enabling rerank got only the plugin's
local rankMemories()/budgetMemories() ordering, never Mem0 Platform
Advanced Retrieval reranking. The keys were inert.

Root cause: recall.ts and index.ts buildSearchOptions built searchOpts
with only user_id/top_k/threshold/source (comment: 'v3.0.0 reranking
removed'). PlatformProvider.search never forwarded rerank to the SDK,
even though mem0-ts SearchMemoryOptions still supports rerank and
camelToSnakeKeys forwards it to POST /v3/memories/search/.

Fix:
- rerank: thread recallConfig.rerank through recall.ts searchOpts and
  index.ts buildSearchOptions; forward it in PlatformProvider.search and
  providerToBackend.search. Platform-only by design; OSSProvider.search
  picks fields explicitly and safely ignores it (the OSS SDK has no
  reranker). Both the auto-recall path and the memory_search tool path
  (which uses buildSearchOptions) now honour the key.
- keywordSearch: Mem0 v3 removed keyword search from the search API, so
  there is nothing to thread. Marked @deprecated no-op in types.ts, with
  matching schema + README descriptions so users aren't misled.

Tests: 2 new providers.test.ts cases assert rerank is forwarded only
when truthy and omitted otherwise.

Author: Bartok9 <danielrpike9@gmail.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.

openclaw plugin: skills.recall.rerank / keywordSearch config keys are inert (never sent to search)

1 participant