---
name: clean-up-duplicates
description: "Use when someone asks to find, review or merge duplicate contacts or companies, or says a record appears twice."
---

Source: https://atome.sh/skills/clean-up-duplicates/

# Clean up duplicates

Use this to clean up duplicate companies and contacts.

1. Decide what is duplicated: companies or contacts. If the user named a record ("Acme", "Jean Dupont"), look for that one. Otherwise review the whole workspace.
2. Run find_duplicates. It returns each group with its reason (same domain, same email, same name) and the record it suggests to keep.
3. For each group, open the records with read_record and check that they really are the same: the same domain or the same person, not two branches or two people who share a name.
4. Preview with merge_duplicates and dry_run set, and tell the user what would move to the surviving record.
5. Merge only the groups the user confirms, one at a time. The merge waits for an approval before it runs.
6. Report what was merged, which record was kept and what was left alone.

Rules:
- Never merge on a name alone. Two people with the same name at different companies are not duplicates.
- Never merge a group the user did not confirm, even if you are sure.
- Review at most five groups at a time, so the user can follow.
