Clean up duplicate Azure DevOps work items for a Feature. Finds work items with duplicate titles and closes all except the first created item.
Detects and closes duplicate Azure DevOps work items for a Feature, keeping only the oldest item. Use this after multiple syncs created duplicates to clean up your work item list.
/plugin marketplace add anton-abyzov/specweave/plugin install sw-ado@specweaveCRITICAL: This command detects and closes duplicate ADO work items created by multiple syncs.
/sw-ado:cleanup-duplicates <feature-id> [--dry-run]
Duplicate Detection & Cleanup:
/sw-ado:cleanup-duplicates FS-031 --dry-run
Output:
Scanning for duplicates in Feature FS-031...
Found 25 total work items
Detected 10 duplicate groups:
Group 1: "[FS-031] External Tool Status Synchronization"
- #1250 (KEEP) - Created 2025-11-10
- #1255 (CLOSE) - Created 2025-11-11 - DUPLICATE
- #1260 (CLOSE) - Created 2025-11-12 - DUPLICATE
Group 2: "[FS-031] Multi-Project ADO Sync"
- #1251 (KEEP) - Created 2025-11-10
- #1256 (CLOSE) - Created 2025-11-11 - DUPLICATE
...
Dry run complete!
Total work items: 25
Duplicate groups: 10
Work items to close: 15
This was a DRY RUN - no changes made.
Run without --dry-run to actually close duplicates.
/sw-ado:cleanup-duplicates FS-031
Output:
Scanning for duplicates in Feature FS-031...
Found 25 total work items
Detected 10 duplicate groups
CONFIRM: Close 15 duplicate work items? [y/N]
> y
Closing duplicates...
Closed #1255 (duplicate of #1250)
Closed #1256 (duplicate of #1251)
Closed #1260 (duplicate of #1250)
...
Updating Feature README frontmatter...
Updated frontmatter with correct work item IDs
Cleanup complete!
Closed: 15 duplicates
Kept: 10 original work items
<feature-id> - Feature ID (e.g., FS-031 or just 031)--dry-run - Preview changes without actually closing work items (optional)Closed work items:
Example comment on closed duplicate:
## Duplicate of #1250
This work item was automatically closed by SpecWeave cleanup because it is a duplicate.
The original work item (#1250) contains the same content and should be used for tracking instead.
Auto-closed by SpecWeave Duplicate Cleanup
AZURE_DEVOPS_PAT)AZURE_DEVOPS_ORG)AZURE_DEVOPS_PROJECT).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-ado:cleanup-duplicates FS-031
Duplicate Detection Logic:
Why lowest ID?:
/sw-ado:sync - Sync Feature to ADO (with duplicate detection)/sw-ado:reconcile - Reconcile work item states/sw:validate - Validate increment completenessFile: plugins/specweave-ado/lib/ado-duplicate-detector.ts
Class: AdoDuplicateDetector
Algorithm (3-phase protection):
For manual cleanup:
After cleanup:
/sw-ado:sync (should show no duplicates)SAFE TO USE: This command is idempotent and safe to run multiple times.