Clean up duplicate GitHub issues for a Feature. Finds issues with duplicate titles and closes all except the first created issue.
Detects and closes duplicate GitHub issues for an Epic, keeping only the first created issue and linking duplicates to it. Use this after multiple syncs created duplicate issues or when you notice duplicate titles in your Epic.
/plugin marketplace add anton-abyzov/specweave/plugin install sw-github@specweaveCRITICAL: This command detects and closes duplicate GitHub issues created by multiple syncs.
/sw-github:cleanup-duplicates <epic-id> [--dry-run]
Duplicate Detection & Cleanup:
/sw-github:cleanup-duplicates FS-031 --dry-run
Output:
š Scanning for duplicates in Epic FS-031...
Found 25 total issues
Detected 10 duplicate groups:
š Group 1: "[FS-031] External Tool Status Synchronization"
- #250 (KEEP) - Created 2025-11-10
- #255 (CLOSE) - Created 2025-11-11 - DUPLICATE
- #260 (CLOSE) - Created 2025-11-12 - DUPLICATE
š Group 2: "[FS-031] Multi-Project GitHub Sync"
- #251 (KEEP) - Created 2025-11-10
- #256 (CLOSE) - Created 2025-11-11 - DUPLICATE
...
ā
Dry run complete!
Total issues: 25
Duplicate groups: 10
Issues to close: 15
ā ļø This was a DRY RUN - no changes made.
Run without --dry-run to actually close duplicates.
/sw-github:cleanup-duplicates FS-031
Output:
š Scanning for duplicates in Epic FS-031...
Found 25 total issues
Detected 10 duplicate groups
ā ļø CONFIRM: Close 15 duplicate issues? [y/N]
> y
šļø Closing duplicates...
ā
Closed #255 (duplicate of #250)
ā
Closed #256 (duplicate of #251)
ā
Closed #260 (duplicate of #250)
...
š Updating Epic README frontmatter...
ā
Updated frontmatter with correct issue numbers
ā
Cleanup complete!
Closed: 15 duplicates
Kept: 10 original issues
<epic-id> - Epic ID (e.g., FS-031 or just 031)--dry-run - Preview changes without actually closing issues (optional)ā Confirmation prompt: Asks before closing issues (unless --dry-run) ā Dry run mode: Preview changes safely ā Keeps oldest issue: Preserves the first created issue ā Adds closure comment: Links to the original issue ā Updates metadata: Fixes Epic README frontmatter
Closed issues:
Example comment on closed duplicate:
Duplicate of #250
This issue was automatically closed by SpecWeave cleanup because it is a duplicate.
The original issue (#250) contains the same content and should be used for tracking instead.
š¤ Auto-closed by SpecWeave Duplicate Cleanup
gh) installed and authenticated.specweave/docs/internal/specs/FS-XXX-name/Use this command when:
Example warning that triggers this:
ā ļø WARNING: 10 duplicate(s) detected!
Run cleanup command to resolve:
/sw-github:cleanup-duplicates FS-031
"No duplicates found":
"GitHub CLI not authenticated":
gh auth login"Could not find Epic folder":
ls .specweave/docs/internal/specs/FS-031-epic-name/"Error closing issue":
gh auth statusgh repo viewDuplicate Detection Logic:
Why lowest number?:
/sw-github:sync - Sync Feature to GitHub (with duplicate detection)/sw:validate - Validate increment completenessgh issue list - View all issues (GitHub CLI)File: plugins/specweave-github/lib/duplicate-detector.ts
Class: DuplicateDetector
Algorithm (3-phase protection):
For manual cleanup:
After cleanup:
gh issue list --search "[FS-031]"/sw-github:sync (should show no duplicates)ā SAFE TO USE: This command is idempotent and safe to run multiple times.