Metrics are useful smoke alarms, but as optimization targets they are terrible. Agents don't "understand refactoring". They just learn to satisfy the tool.
Example:
cyclomatic complexity goes down, but locality and intent gets destroyed.
| Metric target | Agent "fix" | What got worse |
|---|---|---|
| Cyclomatic complexity ↓ | splits one readable method into 6 tiny methods | intent fragmented, call graph bigger |
| Coupling ↓ | hides deps in ctx[:payments] |
dependency contract invisible |