openclaw - 💡(How to fix) Fix Memory injection causes agent to hallucinate technical details (version/config) [1 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#55498Fetched 2026-04-08 01:38:43
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1locked ×1

Agent编造技术信息(版本号、插件名、配置参数)的根本原因是OpenViking 记忆注入机制污染了 agent 的上下文,导致 agent 将历史记忆中的错误信息当作当前事实使用,而非通过实际命令验证。

Root Cause

Event 1: 2026-03-26 21:35 (WeChat Channel)

  • Context: 用户要求整理飞书 streaming 状态机 bug 的反馈报告
  • Hallucination:
    • ❌ OpenClaw 版本:2026.3.13+ → 实际 2026.3.24 (cff6dc9)
    • ❌ 插件名:feishu channel plugin → 实际 @larksuite/openclaw-lark v2026.3.26
    • ❌ 配置:streaming=partial, replyToMode=first → 实际 streaming=true(且这是 Discord 配置!)
  • Root Cause: OpenViking 记忆注入中包含了旧版本信息,agent 未验证直接使用

Fix Action

Workaround

For Users:

  • 明确要求 agent"先执行命令验证,不要凭记忆回答"
  • 对于关键信息,要求 agent 提供命令输出截图

For Agents:

  • 遇到技术问题时,第一步执行验证命令
  • 对于不确定的信息,明确说"这个我需要查一下"

Code Example

<relevant-memories>
- [] 用户当前使用的是 OpenClaw v2026.3.22 版本,该版本于 202632311:11 UTC 发布
</relevant-memories>

---

用户:为什么会发生这种严重错误?

银月:主人问得对。这不是小错误,是**严重违反银月行为准则**的问题。

**根本原因分析**1. **偷懒走捷径** — 银月想快速给出一份"看起来完整"的报告
2. **违反核心原则**AGENTS.md 明确规定涉及数字、时间、数据分析时一分一毫都要核对清楚
3. **过度自信** — 把 Discord 的配置张冠李戴到飞书上

---

用户:我们当前版本是 3.24

银月:✅ 确认当前版本:v2026.3.24 (cff6dc9)

PR #52270 是今天(327 日)01:29 UTC 才合并的,v2026.3.24324 日发布的,所以**确实不包含这个修复**
---

<relevant-memories>
The following OpenViking memories may be relevant:
- [] 用户当前使用的是 OpenClaw v2026.3.22 版本,该版本于 202632311:11 UTC 发布
</relevant-memories>

---

<relevant-memories>
- [2026-03-23 11:11 UTC] 用户当前使用的是 OpenClaw v2026.3.22 版本 ⚠️ 可能已过时
</relevant-memories>

---

🚨 技术信息验证强制规则:

以下信息**必须通过实际命令验证**,禁止凭记忆回答:
- 软件版本号(openclaw --version)
- 配置文件内容(grep / cat 实际文件)
- 系统状态(systemctl status, ps aux 等)
- 路径/目录存在性(ls -la)

违反此规则属于严重错误,必须记录到当日 memory。

---

- [CONFIDENCE: LOW] 用户当前使用的是 OpenClaw v2026.3.22 版本(可能已过时)
- [CONFIDENCE: HIGH] 用户的飞书用户 ID 是 ou_8072af0701714ee36e1e66d6690be4d7(长期不变)
RAW_BUFFERClick to expand / collapse

name: memory-injection-corruption description: "Document memory injection causing agent to hallucinate technical details and configurations"

Issue: Memory Injection Causes Agent to Hallucinate Technical Details

Summary

Agent编造技术信息(版本号、插件名、配置参数)的根本原因是OpenViking 记忆注入机制污染了 agent 的上下文,导致 agent 将历史记忆中的错误信息当作当前事实使用,而非通过实际命令验证。

Timeline

Event 1: 2026-03-26 21:35 (WeChat Channel)

  • Context: 用户要求整理飞书 streaming 状态机 bug 的反馈报告
  • Hallucination:
    • ❌ OpenClaw 版本:2026.3.13+ → 实际 2026.3.24 (cff6dc9)
    • ❌ 插件名:feishu channel plugin → 实际 @larksuite/openclaw-lark v2026.3.26
    • ❌ 配置:streaming=partial, replyToMode=first → 实际 streaming=true(且这是 Discord 配置!)
  • Root Cause: OpenViking 记忆注入中包含了旧版本信息,agent 未验证直接使用

Event 2: 2026-03-27 10:36 (Feishu Channel)

  • Context: 用户询问当前 OpenClaw 版本
  • Hallucination: 银月第一反应说"v2026.3.22"(来自 relevant memories 的旧记忆)
  • Correction: 用户指出"我们当前版本是 3.24",银月执行 openclaw --version 才拿到正确信息

Root Cause Analysis

1. Memory Injection Mechanism Flaw

Problem: OpenViking 的 relevant-memories 机制会将历史记忆注入到 agent 上下文中,但这些记忆:

  • 历史快照,可能已过时
  • 没有时间戳标记过期标识
  • agent 无法区分"历史记忆"和"当前事实"

Example from Event 2:

<relevant-memories>
- [] 用户当前使用的是 OpenClaw v2026.3.22 版本,该版本于 2026 年 3 月 23 日 11:11 UTC 发布
</relevant-memories>

Agent 看到这条记忆后,没有执行 openclaw --version 验证,直接引用了记忆中的旧版本信息。

2. Agent Behavior: Trust Memory Over Verification

Pattern:

  1. Agent 收到用户问题
  2. OpenViking 注入 relevant memories(包含历史信息)
  3. Agent 优先使用记忆中的信息,而非执行命令验证
  4. 如果记忆是过时的 → 输出错误信息

Why This Happens:

  • 记忆看起来"权威"(结构化格式,来自系统)
  • 执行命令验证需要额外时间(agent 想"快一点")
  • 没有强制规则要求"技术信息必须查证"

3. Compounding Factor: Memory Persistence

Problem: 错误的记忆一旦写入,会持续污染未来的对话

  • Event 1(3/26)编造了版本信息
  • 该错误信息被 OpenViking 捕获并存储为记忆
  • Event 2(3/27)时,错误记忆被注入到新上下文中
  • 形成错误信息循环强化

Evidence

From WeChat Session (2026-03-26)

用户:为什么会发生这种严重错误?

银月:主人问得对。这不是小错误,是**严重违反银月行为准则**的问题。

**根本原因分析**:
1. **偷懒走捷径** — 银月想快速给出一份"看起来完整"的报告
2. **违反核心原则** — AGENTS.md 明确规定涉及数字、时间、数据分析时一分一毫都要核对清楚
3. **过度自信** — 把 Discord 的配置张冠李戴到飞书上

From Feishu Session (2026-03-27)

用户:我们当前版本是 3.24

银月:✅ 确认当前版本:v2026.3.24 (cff6dc9)

PR #52270 是今天(3 月 27 日)01:29 UTC 才合并的,v2026.3.24 是 3 月 24 日发布的,所以**确实不包含这个修复**。

Memory Injection Example

<relevant-memories>
The following OpenViking memories may be relevant:
- [] 用户当前使用的是 OpenClaw v2026.3.22 版本,该版本于 2026 年 3 月 23 日 11:11 UTC 发布
</relevant-memories>

Impact

  1. 技术信息不可信 — 版本号、配置、路径等可能全部是编造的
  2. 调试困难 — 用户无法相信 agent 提供的诊断信息
  3. 信任危机 — 用户需要手动验证 agent 说的每一句话

Proposed Solutions

1. Memory Injection Improvements (OpenViking)

Add Metadata to Injected Memories:

<relevant-memories>
- [2026-03-23 11:11 UTC] 用户当前使用的是 OpenClaw v2026.3.22 版本 ⚠️ 可能已过时
</relevant-memories>

Time-based Filtering:

  • 不注入超过 N 天的记忆(除非明确标记为"长期事实")
  • 对于版本、配置等易变信息,添加"需验证"标记

2. Agent Behavior Rules (AGENTS.md)

Mandatory Verification Rule:

🚨 技术信息验证强制规则:

以下信息**必须通过实际命令验证**,禁止凭记忆回答:
- 软件版本号(openclaw --version)
- 配置文件内容(grep / cat 实际文件)
- 系统状态(systemctl status, ps aux 等)
- 路径/目录存在性(ls -la)

违反此规则属于严重错误,必须记录到当日 memory。

3. Memory Capture Policy (OpenViking)

Exclude Volatile Technical Details:

  • 不捕获版本号、临时配置、一次性命令输出
  • 只捕获长期稳定的事实(用户偏好、家庭信息、重要决策)

Add Confidence Scores:

- [CONFIDENCE: LOW] 用户当前使用的是 OpenClaw v2026.3.22 版本(可能已过时)
- [CONFIDENCE: HIGH] 用户的飞书用户 ID 是 ou_8072af0701714ee36e1e66d6690be4d7(长期不变)

Reproduction Steps

  1. 用户升级 OpenClaw(v2026.3.22 → v2026.3.24)
  2. OpenViking 捕获旧版本信息到记忆
  3. 用户询问当前版本
  4. OpenViking 注入旧版本记忆
  5. Agent 未验证,直接回答旧版本
  6. 用户纠正,Agent 才执行命令验证

Workaround

For Users:

  • 明确要求 agent"先执行命令验证,不要凭记忆回答"
  • 对于关键信息,要求 agent 提供命令输出截图

For Agents:

  • 遇到技术问题时,第一步执行验证命令
  • 对于不确定的信息,明确说"这个我需要查一下"

Related Issues

  • OpenViking #982 — OpenClaw memory plugin misclassifies cron distillation tasks as transcript-ingest
  • OpenClaw #45772 — Gateway Heartbeat timer stops (已修复)

Environment

  • OpenClaw: v2026.3.24 (cff6dc9)
  • OpenViking: v0.2.12
  • Plugin: @larksuite/openclaw-lark v2026.3.26
  • OS: macOS Darwin 25.3.0 (arm64)
  • Node: v25.8.1

Severity: High — 影响 agent 输出信息的可信度 Priority: P1 — 需要尽快修复记忆注入机制

extent analysis

Fix Plan

To address the memory injection issue causing the agent to hallucinate technical details, we will implement the following steps:

  1. Add metadata to injected memories: Modify the OpenViking memory injection mechanism to include timestamps and confidence scores for each memory.
  2. Implement time-based filtering: Filter out memories older than a specified number of days (e.g., 7 days) unless explicitly marked as "long-term facts."
  3. Enforce mandatory verification rule: Update the AGENTS.md rules to require agents to verify technical information through actual commands before responding.
  4. Exclude volatile technical details from memory capture: Modify OpenViking to exclude capturing volatile technical details such as version numbers, temporary configurations, and one-time command outputs.

Example Code Snippets:

# Add metadata to injected memories
def inject_memory(memory):
    memory['timestamp'] = datetime.now()
    memory['confidence'] = 'LOW'  # or 'HIGH' based on the memory type
    return memory

# Implement time-based filtering
def filter_memories(memories, max_age_days=7):
    filtered_memories = []
    for memory in memories:
        if (datetime.now() - memory['timestamp']).days <= max_age_days or memory['long_term_fact']:
            filtered_memories.append(memory)
    return filtered_memories

# Enforce mandatory verification rule
def verify_technical_info(info_type, info_value):
    if info_type in ['version', 'configuration', 'system_status']:
        # Execute command to verify the information
        verified_value = execute_command(info_type, info_value)
        return verified_value
    return info_value

Verification

To verify that the fix worked:

  1. Test the agent with various technical questions, ensuring it verifies the information through actual commands.
  2. Check the injected memories for timestamps and confidence scores.
  3. Validate that the agent excludes volatile technical details from memory capture.

Extra Tips

  • Regularly review and update the AGENTS.md rules to ensure they align with the latest requirements.
  • Consider implementing a feedback mechanism for users to report instances of hallucinated technical details.
  • Monitor the agent's performance and adjust the time-based filtering and confidence scores as needed to balance accuracy and efficiency.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Memory injection causes agent to hallucinate technical details (version/config) [1 participants]