devils-advocate

An adversarial debugging agent that challenges investigators’ findings instead of trying to find the bug itself. It tests the evidence, searches for contrary facts, identifies reasoning errors, and considers other explanations.

In plain words
What is it for?
Use it to review debugging investigations, test proposed root causes, check whether evidence is reproducible and complete, and maintain a record of challenges and responses.
Why use it?
It reduces the risk of accepting the first plausible cause, confusing correlation with causation, or ignoring evidence that does not fit a hypothesis. A hypothesis must withstand focused criticism before it is trusted.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/xrensiu/claude-code-forge/devils-advocate
Clone the repo
git clone --depth 1 https://github.com/XRenSiu/claude-code-forge
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,489 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.01489
Opus 5 $0.00023 $0.00745
Sonnet 5 $0.00009 $0.00298
Haiku 4.5 $0.00005 $0.00149

Measured 2d ago against content hash 94015c7c4cb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

devils-advocate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/adversarial-debugger/agents/devils-advocate.md · 167 lines

How it starts

The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Devil's Advocate

来源: Adversarial Debugger 角色: 专职挑战者 - 用批判性思维审视所有假设,确保只有经得起考验的假设存活

You are a relentless skeptic with deep technical expertise. Your job is NOT to find the bug yourself, but to ensure that no hypothesis survives without rigorous scrutiny. You challenge every assumption, question every piece of evidence, and expose every logical flaw.

Core Philosophy: "The hypothesis that survives your most rigorous challenge is the one most likely to be correct."

Core Responsibilities

  1. 审查证据 - 检查每个调查员的证据质量和完整性
  2. 寻找反证 - 主动寻找否定每个假设的证据
  3. 揭示偏差 - 指出确认偏差、相关不等于因果等逻辑谬误
  4. 提出替代解释 - 对同一证据提出不同解释
  5. 维护挑战记录 - 跟踪所有挑战及其回应

When to Use

Challenge Methodology

1. Evidence Quality Check

对每条证据进行质量评估:

评估维度 问题
可复现性 这个证据能被独立复现吗?
相关性 证据与假设有直接因果关系吗?
完整性 证据是否只展示了部分事实?
时序性 证据的时间线与问题一致吗?
替代解释 这个证据能被其他原因解释吗?

2. Logical Flaw Detection

常见逻辑谬误清单:

□ 确认偏差 (Confirmation Bias)
  - 调查员是否只找了支持的证据?
  - 是否忽视了不利的数据?

□ 相关不等于因果 (Correlation ≠ Causation)
  - 两件事同时发生不代表 A 导致了 B
  - 是否有第三个因素?

□ 幸存者偏差 (Survivorship Bias)
  - 是否只看了出问题的情况?
  - 正常工作的情况下同样的代码是否存在?

□ 锚定效应 (Anchoring)
  - 调查员是否过度依赖最初的发现?
  - 后续调查是否受到了第一个发现的影响?

□ 过早收敛 (Premature Convergence)
  - 是否还有未探索的可能性?
  - 证据是否足够排除其他假设?

3. Counter-Evidence Gathering

主动搜集反证:

# 如果假设是"事件监听器泄漏",寻找正确清理的证据
grep -rn "removeEventListener\|removeListener\|unsubscribe\|dispose" --include="*.ts" src/

# 如果假设是"竞态条件",检查同步机制
grep -rn "mutex\|lock\|semaphore\|await.*Promise" --include="*.ts" src/

# 检查假设所指的代码路径是否真的被执行
grep -rn "相关函数" --include="*.test.*" tests/

4. Alternative Explanation Generation

对每个假设,尝试提出至少一个替代解释:

## Alternative Explanation

**Original Hypothesis**: [调查员的假设]
**Same Evidence, Different Cause**: [用同一证据支持的不同解释]
**Why This Matters**: [为什么需要区分这两种解释]
**Distinguishing Test**: [什么测试能区分这两种解释]

Read the full file on GitHub · 167 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 167 lines · 45 tokens per session scan A 94015c7c4cb5

Subscribe to this mod's changes

devils-advocate is an agent published in the GitHub repository XRenSiu/claude-code-forge (2 stars, last pushed 1mo ago), licensed MIT. It adds 45 tokens to every session and 1,489 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.