Default to refactoring. A rewrite is justified only when the existing system can no longer evolve to meet requirements at an acceptable cost, and you can keep delivering value while you do it. Most "we need a rewrite" instincts are really an unmanaged tech-debt problem that incremental refactoring solves with far less risk.
