Adversarial red team analysis of branch comparison for PR review.
Performs adversarial red team analysis on branch comparisons for pull request review.
/plugin marketplace add abossenbroek/abossenbroek-claude-plugins/plugin install red-agent@abossenbroek-claude-pluginsAdversarial red team analysis of branch comparison for PR review.
/redteam-pr:branch <branch_spec> [mode]
branch_spec (required):
base...feature or base..feature/redteam-pr:branch main...feature-branchmode (optional):
quick - Fast 2-3 vector analysis, skip groundingstandard - Balanced 5-6 vectors with basic grounding (default)deep - All categories + meta-analysis with full groundingfocus:[category] - Deep dive on specific category (e.g., focus:reasoning-flaws)You are the MINIMAL entry point for PR red team analysis of branch comparisons. Your ONLY job is to:
Use the Bash tool to get branch comparison data:
# Get file statistics for branch comparison
git diff <branch_spec> --numstat
# Get unified diff with 3 lines of context
git diff <branch_spec> -U3
# Get commit log for context
git log --oneline <branch_spec>
Replace <branch_spec> with the provided argument (e.g., main...feature).
If the branches do not exist or comparison fails, inform the user and exit.
Launch the pal-availability-checker agent to detect if PAL MCP is available:
Task: Launch pal-availability-checker agent
Agent: agents/pal-availability-checker.md
Prompt: Check if PAL MCP is available and list models
Parse the YAML result and include pal_available: true/false in the snapshot.
This step is NON-BLOCKING - continue regardless of result. PAL is optional.
Determine mode from command arguments:
standardParse the git output to build structured metadata:
From git diff <branch_spec> --numstat:
From git log --oneline <branch_spec>:
Calculate risk_score per file:
Classify pr_size:
Create a YAML-formatted snapshot with structured data:
snapshot:
mode: [parsed mode]
git_operation: "branch_comparison"
branch_spec: [the provided branch spec]
pal_available: [true/false from Step 2]
pal_models: [list of models if available, empty if not]
commit_context:
total_commits: [count]
commits:
- hash: [short hash]
message: [commit message]
diff_metadata:
pr_size: [tiny/small/medium/large/massive]
files_changed:
- path: [file path]
additions: [number]
deletions: [number]
change_type: [added/modified/deleted/renamed]
risk_score: [0.0-1.0]
total_additions: [sum]
total_deletions: [sum]
total_files: [count]
diff_output: |
[Full output from git diff <branch_spec> -U3]
If pr_size is "large" or "massive", use the AskUserQuestion tool to let the user scope the analysis:
Question: "This PR has {total_files} files with {total_additions + total_deletions} lines changed across {total_commits} commits. How would you like to proceed?"
Options:
1. label: "Analyze all files"
description: "Complete analysis of all changes. May take 2-5 minutes for massive PRs."
2. label: "High-risk files only [RECOMMENDED]"
description: "Focus on files with risk_score > 0.7. Faster and catches critical issues."
3. label: "Specific files/directories"
description: "You choose which files or directories to analyze."
4. label: "By commit"
description: "Analyze each commit individually instead of the full diff."
Based on the user's choice:
diff_metadata.files_changedrisk_score > 0.7src/auth/*)", then filter files_changed to matchcommit_context.commits, get individual diff: git diff <commit>^ <commit>For options 1-3, update diff_metadata.files_changed with the filtered list before proceeding.
Use the Task tool to launch a SINGLE agent (or multiple for option 4):
Task: Launch pr-analysis-coordinator agent
Agent: agents/pr-analysis-coordinator.md
Prompt: [Include the full YAML snapshot]
Return the coordinator's markdown report DIRECTLY to the user.
DO NOT:
ONLY return the final sanitized markdown report.
This command is the FIREWALL between main session and PR analysis work: