Skip to main content

Adversarial

@hivemq/adversarialv2026.05.05.1· 26d agoMODELS
01README

Two-stage adversarial code review extension for swamp. Fans out across N configurable LLM backends as independent reviewers, then synthesises their findings via a separate judge agent.

How it works

  1. Reviewer (@hivemq/adversarial/reviewer) — runs a two-phase plan→review loop for each configured model in parallel and bundles the HTML outputs into a single reviewerBundle resource.
  2. Judge (@hivemq/adversarial/judge) — consumes the bundle, runs a consolidation pass, and emits a final judgeOutput resource.

Prompts are fetched from a promptsRepo you control at a pinned git sha, so prompt evolution is explicit and reproducible.

Quick start

Add both models and wire them with a workflow step:

swamp model add my-reviewer @hivemq/adversarial/reviewer
swamp model add my-judge @hivemq/adversarial/judge
steps:
  - name: review
    task:
      type: model_method
      modelIdOrName: my-reviewer
      methodName: run
      inputs:
        promptsRepo: "owner/prompts-repo"
  - name: judge
    task:
      type: model_method
      modelIdOrName: my-judge
      methodName: run
      inputs:
        promptsRepo: "owner/prompts-repo"
        reviewers: ${{ data.latest("my-reviewer", "main").attributes.outputs }}
    dependsOn:
      - step: review
        condition:
          type: succeeded

Reviewer inputs

Input Default Description
promptsRepo required owner/repo hosting the prompts directory
models [{id:"claude-code"}] LLM backends to fan out across (max 8)
changedFiles "" Pre-computed diff; when empty, computed via git diff
baseRef env GITHUB_BASE_REF Git ref used to compute diff
diffPaths ["extensions/models/"] Pathspec args for the git diff
promptsRef "v1.1.0" Git ref pinning the prompt snapshot
metadata optional PR metadata: title, url, baseRef, headRef, etc.

Security

All subprocess env vars are filtered through an allowlist (PATH, HOME, locale, and ANTHROPIC_*/CLAUDE_*/PI_* prefixes). Diff content is blockquote-prefixed before prompt injection to mitigate attacker-controlled diff escaping the block. Large diffs are passed via stdin. Agents are killed after a 5-minute timeout.

02Models3
@hivemq/adversarial/reviewerv2026.05.05.1adversarial/reviewer.ts
fn run(models: array, changedFiles: string, baseRef?: string, repoPath: string, promptsRef: string, promptsRepo: string, diffPaths: array)
Run N reviewers in parallel over the same diff and emit one HTML review per reviewer.
ArgumentTypeDescription
modelsarray
changedFilesstring
baseRef?string
repoPathstring
promptsRefstring
promptsRepostring
diffPathsarray

Resources

reviewerBundle(infinite)— All reviewer outputs from one run, bundled so the judge can consume the set in a single input.
@hivemq/adversarial/judgev2026.05.05.1adversarial/judge.ts
fn run(reviewers: array, repoPath: string, promptsRef: string, promptsRepo: string)
Judge N reviewer outputs and emit a single consolidated HTML review.
ArgumentTypeDescription
reviewersarray
repoPathstring
promptsRefstring
promptsRepostring

Resources

judgeOutput(infinite)— Synthesized HTML review across reviewers: dedup'd, verified, ranked.
@hivemq/adversarial/post-commentv2026.05.05.1adversarial/post_comment.ts
fn postComment(content: string, header?: string, commentPrefix?: string, prNumber?: string, repo?: string)
Post or update a GitHub PR comment. No-op unless running inside GitHub Actions (GITHUB_ACTIONS=true).
ArgumentTypeDescription
contentstring
header?string
commentPrefix?string
prNumber?string
repo?string
03Stats
B
83 / 100
Downloads
6
Archive size
30.1 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository0/2missing
04Platforms