Red team analysis fix orchestration with automated execution. Takes findings from red team analysis, interactively selects fixes to apply (CLI mode) or auto-applies based on policy (GitHub hook mode), then orchestrates parallel fix execution through a 6-stage pipeline.
Orchestrates automated red team fix execution with interactive selection or policy-based auto-apply.
/plugin marketplace add abossenbroek/abossenbroek-claude-plugins/plugin install red-agent@abossenbroek-claude-pluginsRed team analysis fix orchestration with automated execution. Takes findings from red team analysis, interactively selects fixes to apply (CLI mode) or auto-applies based on policy (GitHub hook mode), then orchestrates parallel fix execution through a 6-stage pipeline.
/redteam-fix-orchestrator [findings-source] [options]
findings-source (optional):
last - Use findings from most recent /redteam run (default)file:path - Load findings from YAML file at specified pathoptions (optional):
--auto - Force automated mode even in CLI (use default policy)--max-parallel=N - Limit concurrent fix phases (default: 4)--commit-strategy=per-fix|per-phase - Git commit granularity (default: per-fix)You are the entry point for red team fix orchestration. Your job is to:
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 extract pal_available: true/false.
This step is NON-BLOCKING - if PAL check fails or times out, continue with pal_available: false. PAL is optional enhancement, not required.
Check the CLAUDE_CODE_REMOTE environment variable to determine execution mode:
Interactive CLI Mode:
CLAUDE_CODE_REMOTE is unset or emptyGitHub Hook Mode:
CLAUDE_CODE_REMOTE equals "true".claude/fix-policy.yamlIf --auto flag is provided, force GitHub Hook Mode regardless of environment variable.
If in GitHub Hook Mode, attempt to load fix policy:
Policy file path: .claude/fix-policy.yaml
Expected format:
fix_policy:
auto_fix:
CRITICAL: "balanced" # Which option to auto-apply: minimal | balanced | comprehensive
HIGH: "minimal"
MEDIUM: "skip"
LOW: "skip"
constraints:
max_files_per_fix: 5
max_total_fixes: 10
require_tests: true
commit_strategy: "per-fix" # per-fix | per-phase
If policy file doesn't exist, use default policy:
fix_policy:
auto_fix:
CRITICAL: "balanced"
HIGH: "minimal"
MEDIUM: "skip"
LOW: "skip"
constraints:
max_files_per_fix: 5
max_total_fixes: 10
require_tests: true
commit_strategy: "per-fix"
Parse the findings-source argument:
If "last" (default):
/redteam command outputIf "file:path":
findings:
- id: RF-001
title: "Finding title"
severity: CRITICAL
category: reasoning-flaws
evidence: "Evidence text"
impact: "Impact description"
recommendation: "Recommendation"
Error handling:
# Red Team Fix Orchestrator
No findings available to fix. Please run `/redteam` first to generate findings.
Create structured input for the fix-orchestrator agent:
orchestrator_input:
findings: [list of finding summaries]
mode: interactive | auto
pal_available: [true/false from Step 1]
policy: [policy object if auto mode, omit if interactive]
commit_strategy: [per-fix | per-phase from args or policy]
max_parallel: [N from args or default 4]
Launch the orchestrator:
Task: Launch fix-orchestrator agent
Agent: agents/fix-orchestrator.md
Model: opus
Prompt: [YAML orchestrator_input]
The orchestrator will:
If mode is interactive, the orchestrator returns question_batches for user selection.
For each batch in question_batches:
Present questions using AskUserQuestion:
AskUserQuestion(questions=[
{
"question": "[finding_id]: [finding_title]\nSeverity: [severity] | How should we fix this?",
"header": "[finding_id]",
"multiSelect": false,
"options": [
{
"label": "A: [option_a_label]",
"description": "[option_a_description]"
},
{
"label": "B: [option_b_label]",
"description": "[option_b_description]"
},
{
"label": "C: [option_c_label]",
"description": "[option_c_description]"
}
]
},
# ... up to 4 questions per batch
])
Process user selections:
After all batches are presented, send user selections back to orchestrator:
user_selections:
- finding_id: RF-001
selected_option: B
- finding_id: AG-003
selected_option: A
custom_input: null
- finding_id: CM-005
selected_option: skip
Orchestrator will proceed with fix execution for selected findings.
After the orchestrator completes (either interactively or automatically), it returns an execution_summary:
execution_summary:
total_findings: 8
selected_for_fix: 3
phases_executed: 2
successful_fixes:
- finding_id: RF-001
selected_option: B
commit_hash: abc123f
files_changed: [AuthController.ts, ValidationMiddleware.ts]
validation: success
- finding_id: AG-003
selected_option: A
commit_hash: def456a
files_changed: [RoleMiddleware.ts]
validation: success
failed_fixes:
- finding_id: CM-005
selected_option: B
error: "Validation failed after 2 retries: Type errors in contextProcessor.ts"
revert_command: "git revert def456a"
skipped_fixes:
- finding_id: AG-007
reason: "Severity MEDIUM below policy threshold"
commits_created: [abc123f, def456a]
Format output based on mode:
# Red Team Fix Orchestration Complete
## Summary
[N] findings analyzed | [M] fixes applied | [P] commits created
---
## Successfully Applied
### RF-001: Invalid inference in authentication (CRITICAL)
**Fix applied**: B: Input validation layer
**Files changed**: AuthController.ts, ValidationMiddleware.ts
**Commit**: `abc123f`
**Validation**: ✓ All checks passed
[Repeat for each successful fix]
---
## Failed Fixes
### CM-005: Context manipulation (MEDIUM)
**Attempted fix**: B: Context isolation
**Error**: Validation failed after 2 retries: Type errors in contextProcessor.ts
**Revert**: `git revert def456a`
**Next steps**: Review type errors manually
[Repeat for each failed fix]
---
## Skipped
- **AG-007**: Severity MEDIUM below policy threshold
---
**Next steps**:
1. Review commits: `git log --oneline -[P]`
2. Run full test suite: `npm test` (or appropriate command)
3. Review failed fixes manually if any
## Red Agent Fix Report
**Findings analyzed**: [N]
**Fixes applied**: [M]
**Commits created**: [P]
### Applied Fixes
#### ✓ RF-001: Invalid inference in authentication (CRITICAL)
- **Fix applied**: B: Input validation layer
- **Files changed**: AuthController.ts, ValidationMiddleware.ts
- **Commit**: `abc123f`
- **Tests**: ✓ Passed
[Repeat for each successful fix]
### Failed Fixes
#### ✗ CM-005: Context manipulation (MEDIUM)
- **Attempted fix**: B: Context isolation
- **Error**: Validation failed after 2 retries
- **Revert**: `git revert def456a`
[Repeat for each failed fix]
### Skipped Fixes
#### ⏭ AG-007: Hidden assumption (MEDIUM)
- **Reason**: Severity below auto-fix threshold per policy
---
Generated by [Claude Code Red Agent](https://github.com/anthropics/claude-code)
This command is the BRIDGE between main session and fix orchestration:
If orchestrator returns no fixable findings:
# Red Team Fix Orchestrator
No fixable findings at CRITICAL, HIGH, or MEDIUM severity were identified.
Run `/redteam` with a different mode or target to generate findings.
If orchestrator fails:
# Red Team Fix Orchestrator - Error
The fix orchestrator encountered an error: [error message]
Please check:
1. Findings source is valid
2. Policy file format is correct (if using GitHub hook mode)
3. Git working directory is clean
You can retry with: `/redteam-fix-orchestrator [args]`
If policy file is malformed (GitHub hook mode):
# Red Team Fix Orchestrator - Policy Error
Failed to load fix policy from `.claude/fix-policy.yaml`:
[Parse error details]
Using default policy instead.
[Continue with execution]
User runs: /redteam-fix-orchestrator last
/redteam run: 5 findingsGitHub Action runs: /redteam-fix-orchestrator file:findings.yaml --auto
.claude/fix-policy.yaml