# Phase 6: Convergence Check **Purpose:** The loop doesn't run forever. It runs until it converges. **TS Module:** `src/tier2-primitives/loops/convergence-check.ts` ## What It Does Detects when to stop the loop: 1. **Max iterations** reached → hard stop 2. **Diminishing returns** → improvement delta below threshold for N iterations 3. **Quality plateau** → quality score flat for N iterations and already acceptable 4. **Target achieved** → quality and success rate both above 0.95 ## Signals | Signal | Meaning | Action | |--------|---------|--------| | `continuing` | Loop should keep running | Let it run | | `diminishing_returns` | Delta below threshold | Exit — more iterations won't help | | `quality_plateau` | Quality flat and acceptable | Exit with current state | | `target_achieved` | Quality > 0.95 and success > 0.95 | Exit — goal fully met | ## Key Rules - Set `convergenceThreshold` based on task difficulty (0.05 for standard, 0.02 for precise) - In the rubric engine, convergence is replaced by rubric-guided exit conditions - A plateau with low quality signals "restart approach" — not "exit successful"