find-duplicates.txt
Here's my code: <paste>

Find near-duplicates — blocks doing the same job with small
variations. This happens when I ask for similar things in separate
conversations.

For each cluster:
- What they have in common and how they differ.
- Whether they should genuinely be one function, or whether the
  differences mean they should stay separate.
- If they should merge, show me the merged version and every call site
  that changes.

Be honest when the answer is "leave them alone". Two similar functions
are often better than one with four flags.

The premature-abstraction failure is real. A shared function with a boolean parameter that changes half its behaviour is worse than the duplication it replaced.