Add duplicate-issue detection before creating deferred-finding issues
Summary
When deferred findings from a PR review are turned into GitHub issues, there is no check for pre-existing issues covering the same topic. This can produce duplicate issues, especially when the same codebase concern surfaces across multiple review cycles.
Current Behavior
pr-review(Step 8) creates issues for deferred findings directly viagh issue createwith no duplicate check.pr-review-validate(Step 6) recommends/mach10:issue-createfor deferred items, andissue-createitself also performs no duplicate check before drafting.
In both paths, if an open (or recently closed) issue already covers the same concern, a duplicate is silently created.
Proposed Behavior
Before creating an issue for a deferred finding, search existing issues for potential duplicates:
gh issue list --search "<keywords>" --state all --json number,title,state,url
If likely duplicates are found, present them to the user with options:
- Proceed -- create the new issue anyway
- Link -- add a comment to the existing issue referencing the new finding/PR instead
- Skip -- do not create an issue for this finding
Acceptance Criteria
pr-reviewStep 8 checks for existing issues before creating each deferred-finding issueissue-createchecks for existing issues between drafting and user approval (Step 2 and Step 3)- When potential duplicates are found, the user is shown issue number, title, and state, and can choose to proceed, link, or skip
- The check is advisory -- the user can always override and create the issue
Technical Notes
- Relevant files:
commands/pr-review.md(Step 8),commands/issue-create.md(between Steps 2-3) - Use
gh issue list --search "..." --state all --json number,title,state,urlfor keyword-based search - Extract 2-3 key terms from the proposed issue title as search keywords
pr-review-validatedelegates toissue-create, so fixingissue-createcovers that path
Independent Assessment
Current State
Two code paths create issues without duplicate checks:
pr-reviewStep 8: Creates issues inline for deferred findings viagh issue create-- no search beforehand.issue-create: 5-step workflow (gather, draft, review, create, confirm) -- no duplicate check between drafting (Step 2) and approval (Step 3).pr-review-validateStep 6 delegates toissue-create, so fixing that command covers this path automatically.
gh issue list --search is not used anywhere in the codebase today.
Observations
- Well-scoped: Two files to modify (
commands/issue-create.md,commands/pr-review.md), no new files or sync points. - Established patterns: The
AskUserQuestioninteraction for presenting discovered items and letting the user choose (Proceed/Link/Skip) follows the same structure as branch selection inissue-implement. - Batch UX consideration: In
pr-reviewStep 8, multiple deferred items could each trigger a duplicate check, creating sequential prompts. Consider batching: run all searches upfront, then present a summary of which items have potential duplicates before creating any issues. - Search noise:
--state allmay surface old closed issues. A--limit 5cap (as noted in Technical Notes) keeps the list manageable; the advisory nature ensures no harm from false matches. - "Link" action: The comment posted to an existing issue should reference both the PR and the specific finding, following the existing pattern of cross-referencing between PRs and issues.
Scope Estimate
Small -- roughly 15-20 lines of new instruction in each of the two command files. No architectural changes, no new sync points to track.
Implementation Plan: Duplicate Issue Detection
Overview
Add duplicate-issue detection before creating GitHub issues in two code paths: issue-create (interactive) and pr-review Step 8 (deferred findings). The approach uses inline instructions in each command file with no new agents or files -- lightweight, minimal, and trusting Claude's judgment.
Stage 1: Add duplicate detection to issue-create.md
What it accomplishes: Prevents duplicate issue creation in the primary issue-creation workflow by searching for existing issues after the user approves the draft but before creation.
Files modified:
commands/issue-create.md
Changes:
- Insert a new Step 4 (Check for Duplicates) between the current Step 3 (Review) and Step 4 (Create)
- The new step searches with
gh issue list --search "<keywords>" --state all --json number,title,state,url - Judgment-based handling: proceed silently if no match; act autonomously if clearly a duplicate (comment on/edit existing issue); prompt user via
AskUserQuestiononly when ambiguous - Renumber existing Step 4 (Create) to Step 5, Step 5 (Confirm) to Step 6
Dependencies: None
Stage 2: Add duplicate detection to pr-review.md Step 8
What it accomplishes: Prevents duplicate issue creation when deferred review findings are turned into GitHub issues.
Files modified:
commands/pr-review.md
Changes:
- Add per-item duplicate detection before each
gh issue createcall in the deferred-items loop - Claude searches for existing issues, judges similarity, and handles duplicates autonomously (no additional user confirmation loop -- Claude has sufficient context from the review)
- Reports actions taken (skipped duplicates, linked to existing issues) in CLI output
Dependencies: None (independent of Stage 1)
Stage 3: Convention note and version bump
What it accomplishes: Documents the duplicate-detection convention for future issue-creation code paths and bumps the plugin version.
Files modified:
CLAUDE.md(add "Duplicate issue detection" bullet to Writing Commands sync conventions).claude-plugin/plugin.json(version bump)
Dependencies: Stages 1 and 2 (convention note references both implementation sites)
This comment will guide staged implementation via /mach10:issue-implement.
Stage 1 Progress: Duplicate detection in issue-create
Commit: 395ae0f — Add duplicate-issue detection to issue-create command
Changes
- Inserted new Step 4: Check for Duplicates in
commands/issue-create.mdbetween Review (Step 3) and Create (now Step 5) - Three-tier handling: no matches (proceed silently), clear duplicates (link autonomously via
gh issue comment), ambiguous matches (prompt user with Proceed/Link/Skip viaAskUserQuestion) - Closed issues are flagged prominently when presenting ambiguous matches
- Renumbered existing Steps 4-5 to Steps 5-6
Notes
- Follows established
AskUserQuestionpatterns from CLAUDE.md conventions - Explicit
gh issue commentsyntax provided for both autonomous and user-directed linking paths - No
modelfield added to frontmatter — left as pre-existing design choice since the command doesn't require deep reasoning at the level of reviews/planning
Stage 2 Progress: Duplicate detection in pr-review Step 8
Commit: a6d09e0 — Add duplicate-issue detection to pr-review deferred items
Changes
- Added per-item duplicate detection to
commands/pr-review.mdStep 8 before eachgh issue createcall - Keyword-based search via
gh issue list --searchwith--state all --limit 5 - Three-path handling: no results (proceed), clear open duplicate (skip and link via
gh issue comment), ambiguous match (create with "Potentially related" note) - Link comments use PR-enriched format: "Related finding from PR #N review:
" - Closed-issue guard: near-identical closed issues treated as ambiguous (do not block creation)
- End-of-step summary block reports all outcomes: Created, Skipped (duplicate), Created (with overlap note), Skipped (not selected)
Notes
- Fully autonomous — no user prompts during duplicate detection (Claude judges from review context)
- Follows the same
gh issue list --searchpattern established in stage 1 (issue-create.md) - Independent of stage 1 as planned
Stage 3 Progress: Convention note and version bump
Commit: a746ce3 — Add duplicate-detection sync convention and bump version to 1.3.0
Changes
- Added Duplicate-issue detection sync convention bullet to
CLAUDE.md(Writing Commands section), documenting that the search pattern (gh issue list --search) and keyword-extraction approach are duplicated betweencommands/issue-create.md(Step 4) andcommands/pr-review.md(Step 8) - Bumped plugin version from
1.2.1to1.3.0in.claude-plugin/plugin.json
Notes
- Follows the established sync convention format (bold name, duplication sites, "any change must be applied to both locations")
- Minor version bump chosen since duplicate-issue detection is new functionality spanning all three stages
- All three stages of the implementation plan are now complete