Ai generated code is legacy code. But on the flip side ai is useful for onboarding, learning, rubber ducking, verifying assumptions, diagnosing, troubleshooting and all these produce no permanent legacy code.