Repository navigation
Description
Bug Description
memory_search always returns "No relevant memories found" when using the filterRelevant task with models that have reasoning enabled (e.g., MiniMax M2.7-highspeed with reasoning: true).
The root cause: these models output thinking/reasoning text inside tags like <think>...</think> or think>...</think> for the analysis phase, but then never output the required JSON ({"relevant":[...],"sufficient":...}) after the thinking block. The thinking consumes all tokens.
Environment
- MemOS version: @memtensor/memos-local-openclaw-plugin (latest, 2026-03-23)
- Node.js: v22.22.1
- OS: macOS 25.3.0 (Darwin x64)
- OpenClaw: latest
- Model: MiniMax M2.7-highspeed (reasoning: true)
Steps to Reproduce
- Configure MemOS with a reasoning-enabled model (MiniMax M2.7-highspeed with
reasoning: truein openclaw.json) - Have some memories stored in the database
- Call
memory_searchwith any query - Observe: always returns "No relevant memories found"
Root Cause Analysis
The raw LLM response for filterRelevant looks like:
think>
Let me analyze the query and candidate memories...
文字分析内容...
</think>"{"subsystem":"gateway"}
Key observations:
- Model uses
think>(not<think>) — missing leading< - The response ends with
</think>followed by a stray" - No JSON output after thinking block — the thinking text consumes all tokens
parseFilterResultexpects{"relevant":[...],"sufficient":...}but never receives it
Evidence
Raw response structure:
- Position 0: "think>" (6 chars)
- Position ~891: "]]" (end of thinking block marker)
- After greedy strip of thinking block: only `>"` remains
- JSON object count in raw response: 0
Current Workaround
Parsing-side fix (PR pending): strip <think>...</think> and think>...</think> tags before JSON parsing. This handles cases where JSON IS output but wrapped in thinking tags.
However, the fundamental issue remains: reasoning models do not output JSON for this task.
Suggested Fixes
Option A — Prompt Engineering (recommended)
Modify the filterRelevant system prompt to force JSON output after thinking:
IMPORTANT: After your analysis, you MUST output a valid JSON object in this exact format:
{"relevant":[1,2,3],"sufficient":true}
Do not output any text after the JSON object.
Option B — Regex Fallback
When JSON parsing fails, extract candidate IDs from thinking text:
// Extract "Candidate N" style references from thinking content
const candidates = thinkingText.match(/Candidate\s+(\d+)/gi)?.map(n => parseInt(n)) || [];Option C — Disable Reasoning for This Task
Pass thinking: false when calling the filterRelevant task (if the API supports per-request override).
Related Issues
- Possibly related to: Zhipu
reasoning_tokensissue in PR fix: disable zhipu thinking mode to prevent summarizer output truncation #1310 (not yet merged) - Similar pattern:
parseDedupResulthad the same thinking-tag stripping issue (fixed in PR fix(openclaw): strip <think/> tags from assistant messages #1287)
Tags
bug, memory-search, filterRelevant, reasoning-models, MiniMax
Activity
Hun-ger commentedon Apr 17, 2026
This issue has been fixed in the latest version of the plugin. The duplicate Viewer startup and port conflict problems were resolved by introducing a global singleton state to manage the initialization lifecycle. Please update to the latest release!
angarchie commentedon May 19, 2026
Hey @smasunspot! Thanks for the contribution — already solved the issue, thanks for helping us to catch the bug! 🐞
Btw if you enjoyed contributing and want to stay connected with the project, we run a Discord server for contributors, a chill space to discuss features, ask questions, or pick up new issues 👉🏻 MemOS Discord Server (Contributor Exclusive)
Thanks again for shipping this, and happy MemOSing 🧠✨