The Issue Deduplication System automatically identifies and manages duplicate GitHub issues in the claude-code repository. This document covers the /dedupe command, automated duplicate detection workflows, the auto-close mechanism for confirmed duplicates, and backfill capabilities for retroactive duplicate detection.
For issue lifecycle management and labeling, see Issue Triage System. For stale issue handling, see Stale Issue Management. For analytics tracking, see Event Logging & Analytics.
The deduplication system operates through two primary entry points: an on-demand /dedupe command and an automated GitHub Actions workflow triggered by issue creation.
Sources: .github/workflows/claude-dedupe-issues.yml1-85 .claude/commands/dedupe.md1-24 .github/workflows/auto-close-duplicates.yml1-32 .github/workflows/backfill-duplicate-comments.yml1-44
/dedupe CommandThe /dedupe command is a custom Claude Code command that implements a multi-agent orchestration pattern for duplicate detection. It accepts a GitHub issue URL and returns up to 3 likely duplicates.
The command is defined in .claude/commands/dedupe.md1-24 with restricted tool access limited to GitHub CLI operations and the comment script.
| Property | Value |
|---|---|
| Allowed Tools | Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(./scripts/comment-on-duplicates.sh:*) |
| Description | Find duplicate GitHub issues |
| Output Limit | Up to 3 duplicates |
Key implementation details from .claude/commands/dedupe.md8-17:
comment-on-duplicates.sh with up to 3 issue numbersSources: .claude/commands/dedupe.md1-24
The claude-dedupe-issues.yml workflow automatically runs whenever a new issue is opened, invoking the /dedupe command via the claude-code-action.
Configuration parameters from .github/workflows/claude-dedupe-issues.yml27-35:
| Parameter | Value |
|---|---|
| Action | anthropics/claude-code-action@v1 |
| Model | claude-sonnet-4-5-20250929 |
| Allowed Users | * (all users) |
| Prompt | /dedupe ${{ github.repository }}/issues/${{ github.event.issue.number }} |
| Timeout | 10 minutes |
Sources: .github/workflows/claude-dedupe-issues.yml1-85
The comment-on-duplicates.sh script validates inputs and posts a standardized duplicate comment to the target issue.
Validation logic from scripts/comment-on-duplicates.sh34-75:
Comment template from scripts/comment-on-duplicates.sh78-95:
Found N possible duplicate issues:
1. https://github.com/anthropics/claude-code/issues/456
2. https://github.com/anthropics/claude-code/issues/789
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with [Claude Code](https://claude.ai/code)
Sources: scripts/comment-on-duplicates.sh1-101
The workflow logs each duplicate comment event to Statsig for tracking and analysis.
Event structure from .github/workflows/claude-dedupe-issues.yml51-67:
Sources: .github/workflows/claude-dedupe-issues.yml37-84
The auto-close system automatically closes issues that have had duplicate comments for 3 days without author disagreement or new activity.
Sources: .github/workflows/auto-close-duplicates.yml1-32 scripts/auto-close-duplicates.ts1-278
The TypeScript script implements a multi-stage filtering process to ensure only appropriate issues are auto-closed.
Eligibility criteria from scripts/auto-close-duplicates.ts112-241:
| Check | Condition | Action |
|---|---|---|
| Issue age | Created >3 days ago | Only process if older than 3 days |
| Duplicate comment exists | Bot comment with "Found" and "possible duplicate" | Skip if no comment |
| Comment age | Duplicate comment >3 days old | Skip if comment is too recent |
| Post-comment activity | Any comments after duplicate comment | Skip if has activity |
| Author disagreement | Author added 👎 reaction to comment | Skip if author disagreed |
| Valid duplicate number | Can extract #123 or URL from comment | Skip if cannot extract |
Comment detection from scripts/auto-close-duplicates.ts164-172:
Author disagreement check from scripts/auto-close-duplicates.ts228-234:
Issue closure from scripts/auto-close-duplicates.ts66-96:
Sources: scripts/auto-close-duplicates.ts1-278
The script extracts the duplicate issue number from the comment body using two patterns.
Extraction logic from scripts/auto-close-duplicates.ts49-63:
Sources: scripts/auto-close-duplicates.ts49-63
The backfill system allows retroactive duplicate detection for historical issues that were created before the deduplication system was implemented.
Sources: .github/workflows/backfill-duplicate-comments.yml1-44 scripts/backfill-duplicate-comments.ts1-213
The backfill script accepts environment variables to control its behavior.
Environment variables from scripts/backfill-duplicate-comments.ts75-97:
| Variable | Purpose | Default |
|---|---|---|
| GITHUB_TOKEN | GitHub API authentication | Required |
| DRY_RUN | Set to "false" to actually trigger workflows | true (safety) |
| MAX_ISSUE_NUMBER | Upper bound for issue numbers to process | 4050 |
| MIN_ISSUE_NUMBER | Lower bound for issue numbers to process | 1 |
Workflow dispatch trigger from scripts/backfill-duplicate-comments.ts47-70:
Duplicate comment detection from scripts/backfill-duplicate-comments.ts160-177:
Rate limiting from scripts/backfill-duplicate-comments.ts201-202:
Sources: scripts/backfill-duplicate-comments.ts1-213
The deduplication system operates independently but coordinates with the issue triage system for label management.
Interaction points:
duplicate label when detecting obvious duplicates via search (.github/workflows/claude-issue-triage.yml70)duplicate label (scripts/auto-close-duplicates.ts80)stale and autoclose labels when human activity is detected (.github/workflows/claude-issue-triage.yml88-89), which can prevent auto-close of duplicates with recent engagementSources: .github/workflows/claude-issue-triage.yml1-107 scripts/auto-close-duplicates.ts1-278
The deduplication system implements multiple safety mechanisms to prevent false positives and incorrect closures.
| Mechanism | Implementation | Effect |
|---|---|---|
| 3-day grace period | Issues not closed until 3 days after duplicate comment | Allows author time to respond |
| Thumbs down reaction | Author can react 👎 to duplicate comment | Prevents auto-closure |
| Comment activity | Any comment after duplicate detection | Prevents auto-closure |
| Manual override | User can close/reopen issue | Overrides automation |
Sources: scripts/auto-close-duplicates.ts112-241 scripts/comment-on-duplicates.sh92-94
Sources: .claude/commands/dedupe.md10 scripts/comment-on-duplicates.sh34-75 scripts/auto-close-duplicates.ts149-241
The backfill script includes error handling for failed workflow triggers.
Error handling from scripts/backfill-duplicate-comments.ts183-199:
Sources: scripts/backfill-duplicate-comments.ts183-199
The /dedupe command uses 5 parallel search agents to maximize coverage while minimizing execution time.
Performance profile:
| Metric | Value |
|---|---|
| Search agents | 5 parallel |
| Search strategies | Diverse (keywords, errors, symptoms, platform, context) |
| Maximum duplicates | 3 |
| Workflow timeout | 10 minutes |
| Model | claude-sonnet-4-5-20250929 |
Sources: .claude/commands/dedupe.md12-13 .github/workflows/claude-dedupe-issues.yml16-35
The auto-close script implements pagination to handle large numbers of issues.
Pagination from scripts/auto-close-duplicates.ts118-141:
Refresh this wiki