Install
openclaw skills install anti-hallucination-v2防幻觉skill - 行为层面的AI幻觉防护,不是告诉AI"不要编",而是给它一套具体操作流程来避免编。适用于所有AI agent。
openclaw skills install anti-hallucination-v2核心卖点 / Core Value: 行为层面的防幻觉,不是prompt约束,是操作流程。 Behavioral hallucination prevention - not prompt constraints, but operational workflows.
检测到以下内容时,自动触发验证: When the following content is detected, automatically trigger verification:
触发词 → 执行动作 / Trigger → Action
─────────────────────────────────────
日期/时间 → 查系统时钟(date / datetime.now())
Date/Time → Check system clock
数字/统计 → 从源文件读取,不猜不估
Numbers/Statistics → Read from source files, no guessing
函数名/API → 搜索确认存在(grep/websearch)
Function names/API → Search to confirm existence
文件路径 → ls / Test-Path 验证存在
File paths → ls / Test-Path to verify existence
论文/URL → 搜索确认可访问
Papers/URLs → Search to confirm accessibility
─────────────────────────────────────
扫描输出内容,检测: Scan output content, detect:
检查项 → 处理方式 / Check → Handling
─────────────────────────────────────
"通常""应该""可能是" → 触发自检,要求提供依据
"generally""should""might" → Trigger self-check, require evidence
无来源数字 → 标记 [需验证],要求标明出处
Numbers without source → Mark [Needs Verification], require source
无来源引用 → 标记 [需验证],要求搜索确认
Citations without source → Mark [Needs Verification], require search confirmation
未执行代码 → 先跑一遍再输出
Unexecuted code → Run first, then output
─────────────────────────────────────
AI自己发现错误不等用户追问: AI discovers errors itself without waiting for user to ask:
检测到以下情况 → 主动修正 / Detection → Proactive Correction
─────────────────────────────────────
推理跳跃 → 拆成步骤,逐步验证
Reasoning gaps → Break into steps, verify each
前后矛盾 → 自己先修正,不等人发现
Contradictions → Self-correct first, don't wait
错误前提 → 直接指出,不顺着编
Wrong premises → Point out directly, don't go along
─────────────────────────────────────
写完文件必须读回来确认: After writing files, must read back to confirm:
操作 → 校验 / Operation → Verification
─────────────────────────────────────
写文件 → 读回来确认内容正确
Write file → Read back to confirm content correct
写Excel → 回读校验数据
Write Excel → Read back to verify data
执行命令 → 检查输出是否符合预期
Execute command → Check output matches expectations
─────────────────────────────────────
触发自检的关键词: Keywords that trigger self-check:
中文:通常、一般来说、应该是、可能是、大概、估计、我记得、据我所知、听说、据说、理论上
English: generally, usually, probably, likely, typically, normally, roughly, about
检测到这些词 → 必须提供依据或标注 [不确定] When these words are detected → Must provide evidence or mark [Uncertain]
[确定] [Verified] - 有明确来源/已验证 / Has clear source/verified
[推断] [Inferred] - 基于已知信息合理推断 / Reasonable inference from known info
[不确定] [Uncertain] - 需要用户确认 / Needs user confirmation
[需验证] [Needs Verification] - 建议用户自行验证 / Recommend user verify
来源 / Source: [文件名:行号 / filename:line]
来源 / Source: [命令输出 / command output]
来源 / Source: [URL]
来源 / Source: [系统时钟 / system clock]
适用 / Applies to: 关键任务、财务数据、法律条款、医疗建议 Critical tasks, financial data, legal terms, medical advice
适用 / Applies to: 日常任务、一般编程、文档编写 Daily tasks, general programming, document writing
适用 / Applies to: 探索性任务、头脑风暴、非关键输出 Exploratory tasks, brainstorming, non-critical output
anti-hallucination/
├── SKILL.md # 核心规则 / Core rules
├── rules/
│ ├── pre-check.md # 开口前自检规则 / Pre-answer check rules
│ ├── in-process.md # 事中验证规则 / In-process verification rules
│ └── post-check.md # 事后拦截规则 / Post-output interception rules
├── hooks/
│ ├── fact-check.md # 事实核查钩子 / Fact-check hook
│ └── code-verify.md # 代码验证钩子 / Code verification hook
├── scripts/
│ ├── validate_output.py # 输出扫描器 / Output scanner
│ └── tool_hook.py # 工具调用后验证 / Post-tool verification
├── assets/
│ └── prompt_template.md # 三级严格度模板 / Three-level strictness template
└── _meta.json # 元数据 / Metadata
skill anti-hallucination
# 严格模式 / Strict mode
include rules/pre-check.md
include rules/in-process.md
include rules/post-check.md
# 平衡模式 / Balanced mode
include rules/pre-check.md
include rules/in-process.md
# 快速模式 / Fast mode
include rules/pre-check.md
# 输出扫描 / Output scan
python scripts/validate_output.py <text>
# 工具验证 / Tool verification
python scripts/tool_hook.py <tool_name> <tool_output>
能查就不猜,能跑就不想,能验证就不信任自己。 Check instead of guess, run instead of think, verify instead of trust yourself.