Multi-model review chain coordinating Claude Opus 4.6, GPT-5.1-Codex, and GLM-4.6v for maximum code quality
Advanced multi-model orchestration algorithm that coordinates 3 specialized AI models in a review chain for maximum code quality and consensus-driven outputs.
The Three AI Orchestrator implements a sophisticated workflow where three AI models collaborate:
┌─────────────────────────────────────────────────────────┐
│ 3-AI ORCHESTRATOR │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ │
│ │ Claude Opus │──►│ GPT Codex │──►│ GLM-4.6v │ │
│ │ (Plan & │ │ (Review & │ │ (Final │ │
│ │ Code) │ │ Verify) │ │ Check) │ │
│ └──────────────┘ └──────────────┘ └────────────┘ │
│ │ │ │ │
│ └───────────────────┴──────────────────┘ │
│ Consensus Check │
│ │
│ ✅ Pass → Return Result │
│ ❌ Fail → Iterate with Feedback │
└─────────────────────────────────────────────────────────┘Provider: V98Store
Priority: 1 (First to execute)
Strengths:
Responsibilities:
Provider: V98Store
Priority: 2 (Reviews Opus output)
Strengths:
Responsibilities:
Provider: V98Store
Priority: 3 (Final validation)
Strengths:
Responsibilities:
from core.orchestrator.three_ai_orchestrator import ThreeAIOrchestrator
orchestrator = ThreeAIOrchestrator()
result = orchestrator.execute({
"request": "Create a Python function to parse JSON with error handling",
"max_iterations": 3
})
if result.status == "success" and result.data['consensus']:
print(f"✅ All 3 AIs agreed!")
print(result.data['result'])
else:
print(f"⚠️ Partial consensus or no agreement")
print(f"Reviews: {result.data['reviews']}")result = orchestrator.execute({
"request": "Design a REST API for blog posts",
"context": {
"requirements": [
"User authentication",
"CRUD for posts",
"Comments support"
],
"tech_stack": "FastAPI + PostgreSQL"
},
"max_iterations": 2
})# Custom iteration handling
result = orchestrator.execute({
"request": "Optimize this database query",
"context": {
"current_query": "SELECT * FROM users WHERE ...",
"performance_target": "< 100ms"
},
"max_iterations": 5 # Allow more refinement
})
# Check individual reviews
opus_review = result.data['reviews']['opus']
codex_review = result.data['reviews']['codex']
glm_review = result.data['reviews']['glm']
print(f"Opus confidence: {opus_review['confidence']:.0%}")
print(f"Codex issues found: {len(codex_review['issues'])}")
print(f"GLM approved: {glm_review['approved']}")START
↓
Iteration 1:
[1] Opus: Plans and codes
[2] Codex: Reviews for errors
[3] GLM: Final validation
↓
Consensus Check:
✅ All approved? → RETURN SUCCESS
❌ Not approved? → Collect feedback
↓
Iteration 2:
[1] Opus: Refines with feedback
[2] Codex: Re-reviews
[3] GLM: Re-validates
↓
... (repeat up to max_iterations)
↓
END{
"status": "success" | "partial" | "error",
"data": {
"result": "Final output from Opus",
"consensus": True | False,
"iterations": 2,
"reviews": {
"opus": {
"ai_role": "primary_lead",
"model": "claude-opus-4.6",
"approved": True,
"confidence": 0.95,
"issues": [],
"suggestions": [],
"insights": ["..."],
"processing_time": 3.2
},
"codex": {...},
"glm": {...}
},
"total_time": 8.5
}
}When code must be bug-free and production-ready.
result = orchestrator.execute({
"request": "Create a secure payment processing function"
})When multiple perspectives improve design quality.
result = orchestrator.execute({
"request": "Design microservices architecture for e-commerce"
})When reviewing complex or security-critical code.
result = orchestrator.execute({
"request": "Review this authentication implementation",
"context": {"code": existing_code}
})When root cause is unclear.
result = orchestrator.execute({
"request": "Debug this memory leak",
"context": {"symptoms": [...], "code": buggy_code}
})simple_tasks = {"max_iterations": 2} # Quick tasks
complex_tasks = {"max_iterations": 5} # Complex problems
critical_tasks = {"max_iterations": 3} # Balance quality/time# Good
result = orchestrator.execute({
"request": "Optimize database query",
"context": {
"current_performance": "2s",
"target": "< 100ms",
"database": "PostgreSQL 14",
"table_size": "10M rows"
}
})
# Bad
result = orchestrator.execute({
"request": "Make it faster"
})result = orchestrator.execute({...})
if not result.data.get('consensus'):
# Extract common themes from reviews
all_issues = (
result.data['reviews']['codex']['issues'] +
result.data['reviews']['glm']['issues']
)
# Address issues manually or re-runtotal_time = result.data['total_time']
iterations = result.data['iterations']
avg_time_per_iteration = total_time / iterations
if avg_time_per_iteration > 10:
print("⚠️ Slow performance, consider:")
print(" - Reducing max_tokens")
print(" - Using simpler models for simple tasks")
print(" - Caching similar requests")| Metric | Value |
|---|---|
| Avg time per iteration | 5-10s |
| Typical iterations | 1-2 |
| Consensus rate (quality tasks) | 85% |
| False negative rate | <5% |
| Issue | Solution |
|---|---|
| No consensus after max iterations | Increase max_iterations or simplify request |
| All AIs reject | Request may be ambiguous, add more context |
| Slow performance | Reduce max_tokens, use fewer iterations |
| API errors | Check V98 connection, verify API key |
D:\Antigravity\Dive AI\core\orchestrator\three_ai_orchestrator.py
v1.0 - Initial release with 3-model consensus workflow
20ba150
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.