feat(openclaw-plugin): add topic-judge pre-filter to skip auto-recall on topic continuation#1379
Open
duoyidavid-eng wants to merge 1 commit intoMemTensor:mainfrom
Open
Conversation
977a4a9 to
a28b435
Compare
… on topic continuation Add a lightweight LLM-based pre-filter before auto-recall search to avoid unnecessary embedding + vector search + LLM filter calls when the user is continuing the current conversation. - Extract topicJudgePreFilter() as a standalone function returning 'skip'|'proceed' - Configurable via recall.topicJudgeRounds (default: 4, set 0 to disable) - Uses existing Summarizer.judgeNewTopic() (already implemented in all providers) - Graceful fallback: too-few-lines → skip; LLM error → proceed with recall - Only 1 small LLM call (max_tokens=10) vs full search pipeline saved on SAME
a28b435 to
57aaafd
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.
Problem
The
before_agent_startauto-recall hook fires on every user message, triggering embedding + vector search + LLM filter calls even when the user is simply continuing the current conversation (follow-up questions, "ok", typos, error feedback). This wastes API calls and adds latency on every turn.Solution
Add a topic-judge pre-filter using the existing
Summarizer.judgeNewTopic()method (already implemented in all providers), extracted as a standalonetopicJudgePreFilter()function for clean separation from the main recall logic.Flow:
Config
New option
recall.topicJudgeRounds(default: 4). Set to0to disable:{ "plugins": { "entries": { "memos-local-openclaw-plugin": { "config": { "recall": { "topicJudgeRounds": 4 } } } } } }04(default)N > 0Design decisions
topicJudgePreFilter()returning"skip" | "proceed"— no inline logic in the hookFiles changed
apps/memos-local-openclaw/index.ts— addtopicJudgePreFilter(), call it before searchapps/memos-local-openclaw/src/types.ts— addrecall.topicJudgeRoundstypeapps/memos-local-openclaw/src/config.ts— resolvetopicJudgeRoundswith default 4