npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capybearista/opencode-adversarial-review

v1.0.0

Published

Adversarial code review plugin

Readme

opencode-adversarial-review

Why?

Provides an adversarial code review agent that challenges implementation approach and design choices, not just finding bugs. Uses a clean-context subagent so the review is unbiased by conversation history.

Philosophy: Extending OpenCode

OpenCode is designed to be highly extensible. This plugin hooks into the OpenCode lifecycle to provide additional functionality seamlessly into your workflows. This plugin is modeled after the Codex CLI's adversarial review system, focusing on "breaking confidence" rather than validating changes.

Architecture

graph TB
    subgraph Host [OpenCode Host]
        User([User]) -->|/adversarial-review| Command[Command Template]
    end

    subgraph Injection [Context Injection]
        direction LR
        Command -->|!git status| S[Status]
        Command -->|!git log| L[Commits]
        Command -->|!git diff| D[Diff Summary]
        Command -->|!cat| U[Untracked]
    end

    subgraph Adversary [Adversarial Subagent]
        direction TB
        Reviewer{Adversarial Reviewer}
        S & L & D & U --> Reviewer
        
        Reviewer -->|Self-Collect| Tools[Explorer Tools]
        Tools -->|Source Code| Reviewer
    end

    Reviewer -->|Structured JSON| User

    classDef host fill:#bbf,stroke:#333,stroke-width:2px;
    classDef collection fill:#dfd,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef adversary fill:#f9f,stroke:#333,stroke-width:2px;
    
    class Host host;
    class Collection collection;
    class Adversary adversary;

The plugin uses a stateless subagent architecture. When the command is invoked, a deterministic shell script collects git metadata (diff stat, untracked files, recent commits) and injects it into a fresh subagent session. This ensures the review is unbiased by the primary agent's conversation history.

Features

  • Adversarial Persona: A specialized subagent prompted to find reasons not to ship, prioritizing auth gaps, race conditions, and data loss.
  • Dynamic Context Collection: Automatically switches between full-inline diff (for 1-2 files) and high-level stat (for larger changes).
  • Subagent Self-Collection: The subagent uses whitelisted git and file tools to "pull" the specific file contents it needs based on the initial diff summary.
  • Structured JSON Output: Returns findings with severity, file locations, confidence scores, and concrete recommendations.
  • Configurable Scope: Support for --base <ref>, --scope branch, and --scope working-tree.

Install

Add the plugin to opencode.json or opencode.jsonc:

{
  "plugin": ["@capybearista/opencode-adversarial-review"]
}

You can also install it through the CLI:

opencode plugin -g @capybearista/opencode-adversarial-review    # global install
opencode plugin @capybearista/opencode-adversarial-review    # project-local install

Usage

Run a review on your current working tree changes:

/adversarial-review

Arguments

| Argument | Values | Description | | :--- | :--- | :--- | | --scope | auto, working-tree, branch | The range of changes to review. Defaults to auto. | | --base | <git-ref> | The base reference (branch or commit) to compare against when using branch scope. |

  • auto: Reviews using the broadest context the provided information supports.
  • working-tree: Reviews staged and unstaged changes against HEAD.
  • branch: Reviews all changes on the current branch since it diverged from the upstream or main branch.
  • focus ...: Any trailing text is treated as a focus area for the review.

Examples

Force review of only working tree changes (ignoring branch history):

/adversarial-review --scope working-tree

Review all changes on the current branch (automatically finds the fork point):

/adversarial-review --scope branch

Review a specific branch against its fork point from main:

/adversarial-review --base main

Review with a specific focus area:

/adversarial-review --base main focus on race conditions in the auth middleware

Configuration

| Property | Type | Description | | :--- | :--- | :--- | | agent.adversarial-review.model | string | The model to use for the subagent (defaults to openai/gpt-5.4). | | agent.adversarial-review.temperature | number | Sampling temperature (defaults to 0.1 for deterministic review). | | command.adversarial-review.template | string | The shell-injected template used to gather git context. |

This plugin requires no manual configuration out of the box, but you can override the subagent model in your local opencode.json.

Permissions & Security

This plugin is designed with a "least privilege" security model. The adversarial subagent is strictly sandboxed to prevent accidental or malicious modifications to your codebase:

  • Edit: Explicitly denied (edit: deny).
  • Bash: Restricted to a read-only whitelist of 12 Git patterns (e.g., git diff, git log, git status). All other shell commands are blocked.
  • Read/Grep/Glob: Allowed (read-only) to enable code inspection.
  • Network: Web fetch and search are disabled to ensure the review remains focused on the files at hand.

Troubleshooting

  • "No changes to review": Ensure you have staged or unstaged changes, or use --base to review a committed branch.
  • Model timeouts: Large diffs may require a model with a larger context window or more time. The subagent is whitelisted to read files if the diff stat is too long to include.
  • Git errors: Ensure you are running within a git repository. The command relies on git being available in your PATH.

Contributing

This package lives in the opencode-plugins monorepo.

  • Run bun run build, bun run typecheck, bun run lint, and bun test before opening a PR.
  • Keep the plugin focused on the adversarial code review function.
  • Prefer small, direct changes.

Please open an issue or check for existing ones before creating a pull request.

License

MPL-2.0