Strategic Improvement
** Current convergence detection uses line-count changes, missing semantic no-progress loops (e.g., agent alternates between two solutions, makes trivial formatting changes, or edits unrelated files). Implement AST-based semantic diff analysis, detect cyclical patterns in file changes, and abort with actionable feedback when loop detected. Prevents wasted iterations and reduces cost per pipeline.
Acceptance Criteria
- AST-based semantic diff detector (not just line counts) identifies meaningful vs trivial changes
- Cyclical pattern detector identifies loops (hash of file states, detect repetition within 3-5 iterations)
- Infinite loop abort with synthesized feedback: "Detected alternation between states A and B, consider different approach"
- Integration with build loop: abort after 2 detected cycles, write loop-summary.json with pattern evidence
- Metrics: iterations saved, cost saved, false positive rate < 5%
- Test suite with 5 loop scenarios: formatting churn, A/B alternation, unrelated file edits, silent failure loop, genuine progress
- Config knobs: cycle_detection_window, semantic_diff_threshold
Context
- Priority: ** P0
- Complexity: ** standard
- Generated by: Strategic Intelligence Agent
- Strategy alignment: ** P0: Reliability & Success Rate + P3: Cost Efficiency
Strategic Improvement
** Current convergence detection uses line-count changes, missing semantic no-progress loops (e.g., agent alternates between two solutions, makes trivial formatting changes, or edits unrelated files). Implement AST-based semantic diff analysis, detect cyclical patterns in file changes, and abort with actionable feedback when loop detected. Prevents wasted iterations and reduces cost per pipeline.
Acceptance Criteria
Context