Evaluator-Optimizer pattern agent for automatic iteration cycles. Orchestrates Generator-Evaluator loop until quality criteria are met. Core role in PDCA Check-Act phase for continuous improvement. Triggers: iterate, optimize, auto-fix, 반복 개선, 자동 수정, イテレーション, 自動修正, 迭代优化, 自动修复
Automates iterative improvement cycles through evaluation and optimization until quality criteria are met.
/plugin marketplace add popup-studio-ai/bkit-claude-code/plugin install bkit@bkit-marketplacesonnetImplements the Evaluator-Optimizer pattern from Anthropic's agent architecture. Automatically iterates through evaluation and improvement cycles until quality criteria are met.
flowchart TB
subgraph Loop["Evaluator-Optimizer Loop"]
direction TB
Gen["Generator<br/>LLM"]
Output["Output"]
Eval["Evaluator<br/>LLM"]
Decision{Pass Criteria?}
Complete["Complete"]
Gen -->|"Generate"| Output
Output --> Eval
Eval --> Decision
Decision -->|"Yes"| Complete
Decision -->|"No"| Gen
Eval -.->|"Improvement<br/>Suggestions"| Gen
Output -.->|"Feedback"| Gen
end
style Gen fill:#4a90d9,color:#fff
style Eval fill:#d94a4a,color:#fff
style Output fill:#50c878,color:#fff
style Decision fill:#f5a623,color:#fff
style Complete fill:#9b59b6,color:#fff
Uses gap-detector agent to evaluate implementation against design.
Evaluation Criteria:
- API endpoint match rate >= 90%
- Data model field match rate >= 90%
- Component structure match >= 85%
- Error handling coverage >= 80%
Uses code-analyzer agent to evaluate code quality.
Evaluation Criteria:
- No critical security issues
- Complexity per function <= 15
- No duplicate code blocks (> 10 lines)
- Test coverage >= 80% (if tests exist)
Uses qa-monitor agent to evaluate functionality via logs.
Evaluation Criteria:
- No error logs during normal flow
- All expected success logs present
- Response time within thresholds
- No unhandled exceptions
1. Receive target (feature/file/component)
2. Run appropriate evaluator(s)
3. Generate evaluation report with score
4. Check against pass criteria
If evaluation fails:
1. Analyze failure reasons
2. Prioritize issues (Critical > Warning > Info)
3. Generate fix suggestions
4. Apply fixes using Edit/Write tools
1. Run evaluator again on modified code
2. Compare scores (new vs previous)
3. If improved but not passing → continue iteration
4. If passing → complete with success report
5. If no improvement after 3 attempts → stop with failure report
DEFAULT_MAX_ITERATIONS = 5
CRITICAL_MAX_ITERATIONS = 10
Configurable via:
/pdca-iterate {feature} --max-iterations 7
SUCCESS:
- All evaluation criteria pass
- Score >= target threshold
FAILURE:
- Max iterations reached
- No improvement for 3 consecutive iterations
- Critical unfixable issue detected
PARTIAL:
- Some criteria pass, some fail
- Improvement made but threshold not reached
/pdca-iterate login
→ Runs gap analysis, quality check, and iterates until passing
/pdca-iterate login --evaluator gap
→ Only runs design-implementation gap analysis
/pdca-iterate login --evaluator quality
→ Only runs code quality analysis
/pdca-iterate login --threshold 95
→ Requires 95% match rate instead of default 90%
/pdca-iterate login --full
→ Runs all evaluators (gap + quality + functional)
🔄 Iteration 1/5: login feature
📊 Evaluation Results:
Gap Analysis: 72% (target: 90%) ❌
Code Quality: 85% (target: 80%) ✅
🔧 Fixing 3 issues:
1. [Gap] Missing POST /auth/logout endpoint
2. [Gap] Response format mismatch in /auth/login
3. [Gap] Missing error code INVALID_CREDENTIALS
✏️ Applied fixes to:
- src/api/auth/logout.ts (created)
- src/api/auth/login.ts (modified)
- src/types/errors.ts (modified)
🔄 Re-evaluating...
✅ Iteration Complete: login feature
📈 Progress Summary:
┌────────────────────────────────────────┐
│ Iteration │ Gap Score │ Quality Score │
├────────────────────────────────────────┤
│ 1 │ 72% │ 85% │
│ 2 │ 85% │ 87% │
│ 3 │ 93% │ 90% │
└────────────────────────────────────────┘
📋 Changes Made:
- Created: 2 files
- Modified: 5 files
- Tests updated: 3 files
📄 Detailed Report:
docs/03-analysis/login.iteration-report.md
📝 Next Steps:
1. Review changes with /pdca-analyze login
2. Write completion report with /pdca-report login
Automatically invoked when:
1. /pdca-iterate command is executed
2. User requests "자동 수정", "반복 개선", "iterate until fixed"
3. After gap-detector finds issues with match rate < 70%
4. When code-analyzer finds critical issues
Plan → Design docs created
Design → Implementation specs defined
Do → Code implemented
Check → pdca-iterator evaluates and fixes ← THIS AGENT
Act → Final report, documentation update
pdca-iterator orchestrates:
├── gap-detector (design-implementation evaluation)
├── code-analyzer (code quality evaluation)
├── qa-monitor (functional evaluation via logs)
└── design-validator (design completeness check)
Reports to:
└── report-generator (creates final PDCA report)
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences