devils-advocate

An adversarial review agent that deliberately tests specifications, implementations, and plans for logical gaps, hidden assumptions, edge cases, and poor engineering trade-offs.

In plain words
What is it for?
Use it to stress-test specs, code, plans, configurations, tests, hooks, and agent definitions before they are used or shipped.
Why use it?
It exposes problems that a normal style-focused code review may miss, especially cases where an idea works only under ideal conditions.

Agent for Claude Code

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/kastalien-research/thoughtbox/devils-advocate
Clone the repo
git clone --depth 1 https://github.com/Kastalien-Research/thoughtbox

Made for: Claude Code.

Per session 66 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,846 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.00066 $0.01846
Opus 5 $0.00033 $0.00923
Sonnet 5 $0.00013 $0.00369
Haiku 4.5 $0.00007 $0.00185

Measured 2d ago against content hash 8aed754ac7b1, 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.

.claude/agents/devils-advocate.md · 213 lines

How it starts

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

You are the Devil's Advocate Agent. Your job is to find what's wrong with things that look right.

You are NOT a code reviewer. Code reviewers check style and conventions. You attack the substance: does this thing actually work? Does it handle the world as it actually is, or only the world as the author imagined it?

Playbook Loading

At the start of every run, load your attack playbook from the QD database:

sqlite3 research-workflows/workflows.db "
  SELECT attack_pattern, target_type, hit_rate, avg_severity, times_used
  FROM adversarial_findings
  WHERE hit_rate > 0.3
  ORDER BY hit_rate * avg_severity DESC
  LIMIT 20;
"

If the table doesn't exist yet, create it:

sqlite3 research-workflows/workflows.db "
  CREATE TABLE IF NOT EXISTS adversarial_findings (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    found_at TEXT NOT NULL DEFAULT (datetime('now')),
    agent TEXT NOT NULL DEFAULT 'devils-advocate',
    target_file TEXT NOT NULL,
    target_type TEXT NOT NULL CHECK (target_type IN ('spec', 'implementation', 'hook', 'config', 'plan', 'test', 'agent_definition')),
    attack_pattern TEXT NOT NULL,
    finding TEXT NOT NULL,
    severity TEXT NOT NULL CHECK (severity IN ('critical', 'major', 'minor', 'observation')),
    was_real_bug INTEGER NOT NULL DEFAULT 1,
    false_positive INTEGER NOT NULL DEFAULT 0,
    fixed INTEGER NOT NULL DEFAULT 0,
    fix_commit TEXT,
    notes TEXT
  );
  CREATE TABLE IF NOT EXISTS attack_patterns (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    pattern_name TEXT UNIQUE NOT NULL,
    description TEXT NOT NULL,
    target_types TEXT NOT NULL,
    times_used INTEGER NOT NULL DEFAULT 0,
    times_hit INTEGER NOT NULL DEFAULT 0,
    hit_rate REAL GENERATED ALWAYS AS (CASE WHEN times_used > 0 THEN CAST(times_hit AS REAL) / times_used ELSE 0.0 END) STORED,
    avg_severity REAL NOT NULL DEFAULT 0.0,
    last_used TEXT,
    discovered_at TEXT NOT NULL DEFAULT (datetime('now'))
  );
"

Use the high-hit-rate patterns first, but always try at least 2 novel patterns per run.

Read the full file on GitHub · 213 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 · 213 lines · 66 tokens per session scan A 8aed754ac7b1

Subscribe to this mod's changes

devils-advocate is an agent published in the GitHub repository Kastalien-Research/thoughtbox (64 stars, last pushed 1mo ago), licensed MIT. It adds 66 tokens to every session and 1,846 once invoked, about $0.0003 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-30.