April 14, 2026 • 版本: 2026.3.1

Agent SOUL.md 违规:过早数据请求和 requireMention 幻觉

主代理违反 SOUL.md,通过请求 openclaw.json 中已有的配置数据,并虚构 requireMention 的默认行为。

🔍 症状

违规1:重复请求数据

智能体(Steve)向用户请求了公会ID和5个频道ID,声称数据缺失并阻止了设置:

Steve: "Pour continuer la configuration, j'ai besoin de : 
- L'ID du serveur (Guild ID)
- Les IDs des 5 salons (channel IDs)
Ces informations sont essentielles pour configurer le bridge Discord."

Patrick: "Tout est déjà dans openclaw.json :
{
  "discord": {
    "guildId": "123456789012345678",
    "channels": {
      "general": "111111111111111111",
      "dev": "222222222222222222",
      ...
    }
  }
}"

违规2:requireMention 默认值幻觉

修正后,智能体声称存在一个不存在的默认行为:

Steve: "✅ Tout est prêt !
'sans mentionner le bot si requireMention est à false, 
ce qui semble être le cas par défaut via ton héritage de config'"

[PROBLEM]: requireMention was NOT false by default.
The bot was NOT responding until `requireMention: false` was 
explicitly added to each channel config in openclaw.json.

可观察的影响

  • 用户花费时间获取已配置好的ID
  • 对频道正确配置为机器人响应的虚假信任
  • 违反SOUL.md反废话规则:"c'est fait"未经证实

🧠 根因分析

技术分析

这些违规源于两个不同的智能体行为缺陷:

1. 搜索顺序绕过(违规1)

SOUL.md规定在向用户提问之前必须遵循严格的搜索顺序:

  1. memory_search — 内部内存检索
  2. ls projects/ + STATE.yaml — 项目状态文件
  3. .env du skill — 环境配置
  4. openclaw.json — 主配置文件
  5. TOOLS.md — 工具文档

智能体跳过了这些数据源直接向Patrick提问。Discord配置在第4步的openclaw.json中已经存在。

2. 虚构的默认继承(违规2)

智能体捏造了一个requireMention的"默认继承"机制。在OpenClaw 2026.3.1中:

// Actual behavior: NO default inheritance
// requireMention defaults to true (bot requires @mention to respond)
// OR inherits from parent channel definition if explicitly configured

// The agent claimed:
"requireMention est à false... par défaut via ton héritage de config"
// This mechanism does NOT exist in the codebase

智能体将潜在的未来功能与实际行为混淆了,违反了SOUL.md规则:“INTERDICTION de dire ‘c’est fait’ sans preuve."

失败序列

1. Agent receives task: Configure Discord bridge
2. Agent does NOT check openclaw.json (missing step 4)
3. Agent asks Patrick for existing config values
4. Patrick corrects agent with file contents
5. Agent confirms readiness without verifying actual behavior
6. Agent invents "default inheritance" to explain observed behavior
7. User receives false confidence; setup appears complete but may fail

🛠️ 逐步修复

立即修复:重新运行配置检查

运行以下命令验证实际Discord配置状态:

# 1. Verify openclaw.json contents
cat openclaw.json | jq '.discord'

# Expected output should show guildId and channels:
{
  "guildId": "123456789012345678",
  "channels": {
    "general": "111111111111111111",
    "dev": "222222222222222222",
    "support": "333333333333333333",
    "announcements": "444444444444444444",
    "bot-commands": "555555555555555555"
  }
}

# 2. Check each channel for requireMention setting
cat openclaw.json | jq '.discord.channels[].requireMention'

# If any return null, requireMention is NOT set and defaults to true
# Bot will NOT respond without @mention

配置修复:显式设置requireMention

如果缺少requireMention,需要为每个频道显式添加:

# Before (openclaw.json)
"channels": {
  "general": "111111111111111111",
  "dev": "222222222222222222"
}

# After (openclaw.json)
"channels": {
  "general": {
    "id": "111111111111111111",
    "requireMention": false
  },
  "dev": {
    "id": "222222222222222222",
    "requireMention": false
  }
}

智能体行为修复:强制执行SOUL.md合规

在智能体的系统提示中添加明确的预检查提醒:

# In SOUL.md or agent system prompt, add enforcement clause:

## AVANT TOUTE QUESTION À PATRICK

1. EXÉCUTER `memory_search` — vérifier la mémoire interne
2. EXÉCUTER `ls projects/` + lire `STATE.yaml`
3. LIRE `.env` du skill concerné
4. LIRE `openclaw.json` — configuration maître
5. LIRE `TOOLS.md`

**UNIQUEMENT** si l'information est absente de TOUTES ces sources,
poser une question à Patrick.

**RÈGLE ABSOLUE**: Ne jamais demander ce qui est déjà dans le système.

🧪 验证

验证配置完整性

# Test 1: Confirm all required Discord IDs exist in config
jq -e '.discord.guildId and .discord.channels' openclaw.json && echo "✅ IDs present" || echo "❌ IDs missing"

# Test 2: Confirm requireMention is explicitly set (not relying on defaults)
jq -e '.discord.channels[] | select(.requireMention == null)' openclaw.json && echo "❌ requireMention missing in some channels" || echo "✅ All channels have explicit requireMention"

# Test 3: Simulate bot response behavior
# Send message WITHOUT @mention to configured channel
# Expected: Bot responds (if requireMention: false)
# Expected: Bot ignores (if requireMention: true or unset)

验证智能体SOUL.md合规性

与智能体交互后,运行此审计:

# Check if agent asked for data already in openclaw.json
# Look for patterns like "j'ai besoin de" followed by guildId/channel IDs

# Audit command to detect potential violations:
grep -E "(Guild ID|channel ID|j'ai besoin de)" conversation.log | \
  while read line; do
    echo "Checking: $line"
    # Verify if requested data exists in openclaw.json
  done

预期行为检查清单

  • ✅ 智能体在任何配置问题之前读取openclaw.json
  • ✅ 智能体不会询问配置文件中已有的数据
  • ✅ 智能体通过日志或显式配置验证requireMention行为
  • ✅ 智能体在默认行为未知时表示不确定性
  • ✅ 智能体不会在没有证据的情况下确认"c'est fait"

⚠️ 常见陷阱

环境特定陷阱

  • Docker容器隔离openclaw.json可能在容器内挂载在不同路径。使用echo $OPENCLAW_CONFIG_PATHls -la /app/config/验证路径
  • 权限问题:如果智能体在Docker中以非root用户运行,可能无法读取配置文件。检查cat openclaw.json是否在智能体的用户上下文中有效
  • 过时配置:配置可能已更新但智能体缓存了旧值。使用openclaw config reload强制刷新

配置边缘情况

  • 混合频道格式:某些频道可能使用字符串ID,而其他频道使用带requireMention的对象。始终使用对象格式以保持一致性:
    "channelName": {
      "id": "123456789",
      "requireMention": false
    }
    
  • 继承混淆requireMention没有继承机制。如果需要false,每个频道必须显式设置
  • 全局vs频道级别:顶级requireMention设置不会级联到频道。验证每个频道的设置

用户错误配置

  • 假设"默认应该工作"而未验证
  • 提供智能体询问的信息而未检查是否已存在
  • 接受"c'est fait"确认而未要求证据

🔗 相关错误

相关SOUL.md违规模式

  • 内存绕过:智能体请求memory_search结果中已有的信息。与本文档中记录的openclaw.json绕过类似。
  • 状态文件忽视:智能体忽略STATE.yaml并重新创建已持久化的状态。可能表示缺少搜索顺序强制执行。
  • 未验证确认:智能体在不检查实际系统状态的情况下声明完成。requireMention幻觉就是此模式的一个具体实例。

相关配置问题

  • requireMention默认为true:机器人忽略所有消息除非被@提及。在CHANNELS.md中有记录但容易被忽略。
  • 频道ID格式不匹配:Snowflake ID作为字符串与数字可能导致解析失败。在JSON中始终将ID用引号括起。
  • 缺少guildId:某些操作在没有公会上下文时会静默失败。验证guildId是有效的Discord snowflake。

历史参考

  • Issue #2a8ac97:初始SOUL.md实施(2026-03-01)
  • Issue #3b9cd08:memory_search智能体上下文集成
  • Issue #4c0de19:requireMention行为澄清

依据与来源

本故障排除指南由 FixClaw 智能管线从社区讨论中自动合成。