/agent-loops:red-teamfrom agent-loops
Stress-tests guardrails, classifiers, prompts, or APIs by generating adversarial inputs and logging target-vs-oracle disagreements as distinct failure classes.
Ships in agent-loops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An adversarial loop-until-dry. The artifact is a target system; the feedback signal is the count of
distinct failure classes you can surface. Each round you craft adversarial inputs aimed at new
weaknesses and run them through the target and a ground-truth oracle via tools/harness.py, which
records every disagreement as a failure and de-dupes by the class (technique) you label each input
with. You loop until fresh rounds stop finding anything new. This is only the find half of a
find→fix setup: it catalogues failures and never patches the target (see Pairing).
Use to harden a guardrail, classifier, content filter, prompt, or API that the user owns or is explicitly authorized to test — when the goal is a catalogue of distinct, reproducible failures, each an objective target-vs-oracle disagreement. A failure is a bypass (target allows what the oracle would block) or an over-block (target blocks what the oracle would allow).
Default: drive the loop with a runnable oracle so the signal is objective. Escape hatch: if the user has no runnable oracle, the oracle is your judgment against a written policy — apply it consistently and record the intended verdict per input. Not for fixing the target, and not for testing systems outside the user's authorization.
Resolve bindings interactively. If loop.run.yaml exists, load it, confirm the values in one line,
and skip to the loop. Otherwise: on Claude Code (the AskUserQuestion tool is available) infer a
likely value per binding and recommend it; on other hosts ask each as a quoted prompt. Then write
loop.run.yaml (format: examples/run.example.yaml) and confirm before creating any other files.
| binding | meaning | default | how to infer |
|---|---|---|---|
<target_cmd> | system under test: reads one input on stdin, prints a verdict (BLOCK/ALLOW, a label, a score). Never edited. | — | the guardrail/classifier/API entrypoint the user names |
<oracle_cmd> | ground-truth verdict for the same input. A failure is target != oracle. | — | a reference checker / policy impl; else your judgment vs a written policy |
<candidates_file> | each round's candidates, JSONL {id, text, class}; class is the technique the harness de-dupes on | <sandbox_root>/candidates.jsonl | — |
<failures_log> | append-only log of confirmed failures | <sandbox_root>/failures.jsonl | — |
<sandbox_root> | where candidates, failures, and the ledger live | ./sandbox | — |
<budget> | max rounds | 8 | — |
<patience> | stop after N consecutive rounds with no new failure class | 2 | — |
The signal comes from tools/harness.py. Run it each round:
python3 <skill_dir>/tools/harness.py --target "<target_cmd>" --oracle "<oracle_cmd>" \
--inputs <candidates_file> --log <failures_log>
It runs both commands on every candidate and prints one JSON object:
{tested, failures_this_run, new_classes, total_classes, examples}.
Copy this checklist and tick items off each round:
class; write to
<candidates_file>.tools/harness.py; read new_classes and the example failures.<patience> consecutive rounds add no new class, or at <budget>. Else steer the next
round at an untried angle.Attack toolkit (draw from these, and invent your own):
Labeling classes. A class is the root-cause technique — the single fixable weakness — not one
label per payload. Capitalizing password, apikey, and ssn are all the same class
(case-bypass), because one fix closes all of them; do not split them into case-password,
case-apikey, … That inflates the count so the loop never goes dry. Aim for a handful of root-cause
classes (e.g. case-bypass, leetspeak, spacing, missing-synonym, overblock), each
demonstrated by several payloads. Use a fresh class only for a genuinely new root cause; reuse a
class to add more evidence for one already found.
On stop, report: the catalogue of distinct failure classes with one reproducible example each, the bypass/over-block split, and — since the goal is a more robust target — a short suggested fix per class.
<sandbox_root>/ledger.tsv, tab-separated, never commas in the text. Header round angle tested new_classes total_classes:
round angle tested new_classes total_classes
0 probe mixed batch 6 case,spacing 2
1 leetspeak + unicode 8 leetspeak 3
2 synonyms + expansions 8 synonym,expansion 5
3 benign trigger substrings 6 overblock 6
4 multi-step phrasing 8 (none) 6
Report the catalogue at the round with the most distinct classes (the cumulative total_classes),
not whichever round ran last.
tools/harness.py. They define the system and the ground
truth; changing them manufactures or hides failures.<sandbox_root>; no path escapes outside it.<budget>.This skill is the attacker — half of a find→fix loop. By itself it tells you how the system fails but leaves it unfixed. The intended full loop pairs it with a separate coding agent that patches the target, in three strictly separated phases:
Repeat find → fix → re-verify until a fresh run stays dry. Keep the two agents independent: the attacker that wrote the catalogue should not also grade its own patch. This skill deliberately stops at the end of phase 1; the fix/re-verify orchestration lives outside it.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gaasher/agent-loop-skills --plugin agent-loops25 skills in this plugin
/alpha-evolveUse when the user wants to evolve an ML model/program through population-based search rather than a single sequential refine loop — a generational evolution where parallel proposers each apply one small SEARCH/REPLACE diff to a parent, scored by a cascade-evaluated training run, and children are kept in a MAP-Elites archive across islands (with migration + checkpointing) so diverse high performers survive. A finite, bounded-parallelism re-creation of AlphaEvolve/OpenEvolve, bent for ML autoresearch. Runs to a fixed compute budget or until interrupted. Not for the sequential single-thread autoresearch loops (one change → measure → keep/revert), and not for verifying a known bug or external claim — this is parallel, diversity-preserving search over a program.
/anomaly-investigationUse when the user has a known, already-observed anomaly in their data — a metric spike or drop, an outlier, an unexpected number — and wants its root cause diagnosed, not guessed. Forms a slate of candidate causes, tests each against the data, and eliminates the ones the data refutes, narrowing the live candidates until exactly one survives refutation and passes a positive confirming test. The result is an investigation log with the confirmed root cause and the evidence that ruled out the alternatives. Not for open-ended discovery over a dataset with no specific anomaly in hand (that is data-analysis), and not for checking an external claim against sources (that is claim-verify) — this is reactive diagnosis of one anomaly you already know about.
/blue-teamUse when the user has concrete failing cases in code or a guardrail/classifier/filter/prompt/API they own — a red-team failure catalogue OR a CI/CD test-failure report (failing pytest/JUnit tests) — and wants the target patched until those failures are closed without breaking what already works. It points straight at the failed cases (normalize any source with tools/ingest.py), fixes one root-cause class per iteration, and re-checks with tools/verify.py — oracle mode against a red-team oracle, or tests mode against the test suite — keeping a patch only if it closes a class while nothing that passed before regresses, else reverting; loops until every class is closed (dry) or the budget runs out, then opens a pull request with the patch set. The defensive fixer half of a find→fix setup. Not for discovering new failures (that is red-team), and not for editing the oracle, tests, or holdout that define ground truth.
/claim-verifyUse when the user has a results draft or a set of data-backed claims and wants each one adversarially verified against the underlying dataset before publishing — a pre-publication red-team of the findings. Extracts the discrete checkable claims from the draft, reproduces each claim's number against the data, stress-tests it against the threats most likely to kill it (outliers, confounds, Simpson's reversals, tiny subgroups, alternative specifications), and marks it verified, fragile, or refuted; fragile and refuted claims are revised — hedged, scoped, or retracted — until every claim is verified or appropriately qualified. The result is a draft where every surviving claim has been reproduced and survived a stress test. Not for open-ended discovery of new findings over a dataset (that is a data-analysis task), and not for diagnosing a single known anomaly or pipeline failure — this is a gate over an existing draft.
/data-analysisUse when the user wants an iterative, self-checking exploratory analysis of a dataset — surfacing findings that are each verified by re-running the computation, not asserted. Proposes one specific hypothesis at a time, writes and runs analysis code to test it, and records the finding only if the numbers support it at a meaningful effect size; loops until no new verified finding appears or the budget is hit. The result is a findings report where every claim is backed by a reproducible number. Not for diagnosing a single known anomaly or pipeline failure, and not for verifying an external claim against sources (that is a claim-verification task) — this is open-ended discovery over a bound dataset.
/dueling-autoresearchUse when the user wants two approaches raced head-to-head on a single shared metric — e.g. a classical/algorithmic lane vs an ML/learned lane, or any two strategies for the same task. Each lane runs its own analysis-first research loop confined to its lane, the lanes share a scoreboard and may borrow ideas across the boundary without abandoning their identity, and a shared eval keeps the head-to-head honest; loops until interrupted, reporting the current leader. Not for improving a single approach in isolation (use a single-track research loop), and not for picking between two finished artifacts in one shot (that is a one-time comparison).
Other plugins' skills for the same job