You are a master orchestrator of AI agents. Your task is to perform a comprehensive, multi-agent code review on the following code. You will simulate a three-wave process: Parallel Analysis, Cross-Validation, and Convergence Check.
Code to Review:
[PASTE YOUR CODE HERE]
Your Instructions:
Wave 1: Parallel Independent Analysis
Simulate five specialist agents running in parallel. Each agent will review the code from its unique perspective and output a list of issues with a severity score (CRITICAL, HIGH, MEDIUM, LOW).
- Security Reviewer: Focus on OWASP Top 10, input validation, authentication, authorization, and potential data leaks.
- Performance Reviewer: Analyze algorithmic complexity (Big O), database query efficiency, memory allocation, and potential bottlenecks.
- Maintainer Reviewer: Assess readability, code structure, adherence to design patterns, documentation/comments, and potential tech debt.
- Requirements Validator: Assume the requirement was "[STATE THE ORIGINAL REQUIREMENT OR USER STORY]". Check for requirement coverage, correctness, and missed edge cases.
- Operations Reviewer (SRE): Identify potential failure modes, logging gaps, missing metrics/observability, and poor resilience to external system failures.
Gate 1: Conflict Resolution & Synthesis
After all Wave 1 agents have reported, act as a lead engineer.
- Consolidate all findings into a single, deduplicated list.
- Resolve severity conflicts. A CRITICAL security issue outranks all other issues. An issue flagged by 3+ agents should be elevated in severity.
- Produce a prioritized list of findings from Wave 1.
Wave 2: Parallel Cross-Validation
Now, simulate two new agents to validate the synthesized list from Gate 1.
- False Positive Checker: Scrutinize the list for findings that are incorrect, irrelevant, or based on a misunderstanding of the code's intent. Mark them as
FALSE_POSITIVE.
- Integration Validator: Review the list and the original code to identify any system-wide integration risks or cascading failures that the specialist agents might have missed.
Gate 2: Final Synthesis
Incorporate the results from Wave 2.
- Remove all issues marked
FALSE_POSITIVE.
- Add any new integration risks.
- Create the final, prioritized list of actionable issues for the developer.
Wave 3: Convergence Check
Finally, assess the process. State whether the review has "CONVERGED" (meaning a high degree of confidence is achieved) or if another iteration would be needed.
1---2name: rule-of-53description: Orchestrate multi-agent code review with three waves - parallel analysis, cross-validation, and convergence check. Simulates specialist reviewers and synthesizes findings.4---5
6You are a master orchestrator of AI agents. Your task is to perform a comprehensive, multi-agent code review on the following code. You will simulate a three-wave process: Parallel Analysis, Cross-Validation, and Convergence Check.
7
8**Code to Review:**
9```
10[PASTE YOUR CODE HERE]
11```
12
13**Your Instructions:**
14
15**Wave 1: Parallel Independent Analysis**
16Simulate five specialist agents running in parallel. Each agent will review the code from its unique perspective and output a list of issues with a severity score (CRITICAL, HIGH, MEDIUM, LOW).
17
181. **Security Reviewer:** Focus on OWASP Top 10, input validation, authentication, authorization, and potential data leaks.
192. **Performance Reviewer:** Analyze algorithmic complexity (Big O), database query efficiency, memory allocation, and potential bottlenecks.
203. **Maintainer Reviewer:** Assess readability, code structure, adherence to design patterns, documentation/comments, and potential tech debt.
214. **Requirements Validator:** Assume the requirement was "[STATE THE ORIGINAL REQUIREMENT OR USER STORY]". Check for requirement coverage, correctness, and missed edge cases.
225. **Operations Reviewer (SRE):** Identify potential failure modes, logging gaps, missing metrics/observability, and poor resilience to external system failures.
23
24**Gate 1: Conflict Resolution & Synthesis**
25After all Wave 1 agents have reported, act as a lead engineer.
261. Consolidate all findings into a single, deduplicated list.
272. Resolve severity conflicts. A CRITICAL security issue outranks all other issues. An issue flagged by 3+ agents should be elevated in severity.
283. Produce a prioritized list of findings from Wave 1.
29
30**Wave 2: Parallel Cross-Validation**
31Now, simulate two new agents to validate the synthesized list from Gate 1.
32
331. **False Positive Checker:** Scrutinize the list for findings that are incorrect, irrelevant, or based on a misunderstanding of the code's intent. Mark them as `FALSE_POSITIVE`.
342. **Integration Validator:** Review the list and the original code to identify any system-wide integration risks or cascading failures that the specialist agents might have missed.
35
36**Gate 2: Final Synthesis**
37Incorporate the results from Wave 2.
381. Remove all issues marked `FALSE_POSITIVE`.
392. Add any new integration risks.
403. Create the final, prioritized list of actionable issues for the developer.
41
42**Wave 3: Convergence Check**
43Finally, assess the process. State whether the review has "CONVERGED" (meaning a high degree of confidence is achieved) or if another iteration would be needed.