openclaw - 💡(How to fix) Fix [Bug]: agent kb returns hallucinated answers / pseudo-tool calls while memory search returns correct docs result [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#57436Fetched 2026-04-08 01:49:41
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×2commented ×1mentioned ×1subscribed ×1

memory search returns the correct local-doc result for my kb agent, but openclaw agent --agent kb does not reliably use that result.

Instead, the live agent turn may:

  • return No reply from agent
  • emit pseudo tool syntax like [[memory_search]]
  • reference nonexistent files such as .openclaw\memory\_kb\search_results.json
  • hallucinate conflicting answers that do not match the actual top memory hit

This appears to be a live agent turn / tool-result handoff problem, not a memory index problem.

Root Cause

memory search returns the correct local-doc result for my kb agent, but openclaw agent --agent kb does not reliably use that result.

Instead, the live agent turn may:

  • return No reply from agent
  • emit pseudo tool syntax like [[memory_search]]
  • reference nonexistent files such as .openclaw\memory\_kb\search_results.json
  • hallucinate conflicting answers that do not match the actual top memory hit

This appears to be a live agent turn / tool-result handoff problem, not a memory index problem.

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary

memory search returns the correct local-doc result for my kb agent, but openclaw agent --agent kb does not reliably use that result.

Instead, the live agent turn may:

  • return No reply from agent
  • emit pseudo tool syntax like [[memory_search]]
  • reference nonexistent files such as .openclaw\memory\_kb\search_results.json
  • hallucinate conflicting answers that do not match the actual top memory hit

This appears to be a live agent turn / tool-result handoff problem, not a memory index problem.

Version

Reproduced on:

  • 2026.3.23-2
  • 2026.3.24
  • 2026.3.28

Environment

  • Windows 10
  • Gateway on loopback 127.0.0.1:18789
  • Chat model: ollama/qwen3.5:9b
  • Embedding model: qwen3-embedding:8b

Relevant agent config

{
  "id": "kb",
  "workspace": "D:\\AI\\AIHelpDoc\\openclaw-local\\workspace-kb",
  "model": "ollama/qwen3.5:9b",
  "memorySearch": {
    "enabled": true,
    "extraPaths": ["docs"],
    "provider": "ollama",
    "fallback": "none",
    "model": "qwen3-embedding:8b",
    "sync": { "watch": false }
  },
  "tools": {
    "profile": "minimal",
    "allow": ["memory_search", "memory_get", "read"]
  }
}

### Steps to reproduce

Repro
Put a canary doc in workspace-kb/docs/金丝雀问题.md with:
question: 1401中有几个人?
answer: 1401中有6个人。
Confirm backend search is correct:
openclaw memory search --agent kb "1401"

This correctly returns docs/金丝雀问题.md with 1401中有6个人。

Run the live agent turn:
openclaw agent --agent kb --timeout 60 -m "/new"
openclaw agent --agent kb --timeout 60 -m "1401中有几个人?如果找到了答案请附来源。"

### Expected behavior

Expected

The live agent should return:

1401中有6个人。来源:docs/金丝雀问题.md

### Actual behavior

Actual

Observed bad outcomes include:

No reply from agent
[[memory_search]]
[[read]] ...search_results.json
hallucinated answers like 19, 20, 23hallucinated source files like docs/1401_class_list.md
references to nonexistent intermediate files

### OpenClaw version

<2026.3.23><2026.3.24><2026.3.28>

### Operating system

Windows 10

### Install method

curl -fsSL https://openclaw.ai/install.sh | bash

### Model

ollama/qwen3.5:9b

### Provider / routing chain

OpenClaw CLI -> OpenClaw Gateway (127.0.0.1:18789) -> local Ollama -> qwen3.5:9b Memory search path: OpenClaw memory backend -> qwen3-embedding:8b

### Additional provider/model setup details

Why this looks wrong

The backend memory search is correct, but the live agent turn does not reliably consume that result and instead leaks pseudo tool syntax or fabricates a different answer.

This suggests a problem in:

live agent turn execution
tool-result handoff
reply delivery / completion state synchronization

### Logs, screenshots, and evidence

```shell

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To address the live agent turn issue, we need to modify the memorySearch configuration and ensure proper tool-result handoff. Here are the steps:

  • Update the memorySearch configuration to include the output field:
"memorySearch": {
  "enabled": true,
  "extraPaths": ["docs"],
  "provider": "ollama",
  "fallback": "none",
  "model": "qwen3-embedding:8b",
  "sync": { "watch": false },
  "output": "search_results.json"
}
  • Modify the tools configuration to include the memory_search tool with the correct output file:
"tools": {
  "profile": "minimal",
  "allow": ["memory_search", "memory_get", "read"],
  "memory_search": {
    "output": "search_results.json"
  }
}
  • Ensure that the search_results.json file is properly generated and accessible by the live agent turn.

Verification

To verify the fix, run the live agent turn again with the updated configuration:

openclaw agent --agent kb --timeout 60 -m "/new"
openclaw agent --agent kb --timeout 60 -m "1401中有几个人?如果找到了答案请附来源。"

The expected output should be:

1401中有6个人。来源:docs/金丝雀问题.md

Extra Tips

  • Make sure to restart the OpenClaw Gateway and live agent after updating the configuration.
  • Verify that the search_results.json file is generated correctly and contains the expected results.
  • If issues persist, check the logs for any errors or warnings related to the memorySearch or tools configurations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected

The live agent should return:

1401中有6个人。来源:docs/金丝雀问题.md

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING