Skip to content

Feature: infra-aware adversarial review + auto-scale prompts by diff size #24

@JohnnyVicious

Description

@JohnnyVicious

Motivation

Two related observations:

  1. The adversarial review prompt in plugins/opencode/prompts/adversarial-review.md is generic. For changes that touch infra (Terraform, K8s, CI config, Dockerfiles, migration scripts), the review is most valuable when the prompt explicitly primes the model for rollback plans, blast radius, ordering constraints, and operational risks.

  2. Review quality degrades on very small and very large diffs with a single fixed prompt: tiny diffs should get a lightweight focused review; 10k+ line diffs need explicit instructions to skim noisy hunks and focus on architectural concerns, not try to read every line.

Proposed behaviour

In buildReviewPrompt (plugins/opencode/scripts/lib/prompts.mjs):

  • Compute diffStat via the existing getDiffStat helper or git diff --numstat.
  • Classify: small (<100 LOC), medium (100–2000), large (2000–10000), xlarge (10000+).
  • Select a tier-appropriate prompt template from prompts/adversarial-review.<tier>.md (or append tier-specific instructions to the base template).
  • Detect infra changes by file extensions (.tf, .yaml in .github/workflows/, Dockerfile*, migration paths) and inject an <infra_focus> section when present.

Upstream reference

Derived from openai/codex-plugin-cc#6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions