Check for existing similar issues before creating a new one

#2 · closed · 1 comments

View on GitHub ↗

Serhioromano

**User's request:** > let ai also first check if issue like this already created **Context:** Currently, the `/ri` command flow goes straight to analyzing the user's message and creating a new GitHub issue. There's no step that checks whether a similar issue already exists on the target repository. This means users can accidentally create duplicate issues. **Expected behavior:** Before creating a new issue, the AI should: 1. Search the target repo for existing open issues that might match the same topic 2. If a similar issue is found, inform the user and suggest linking or closing the flow 3. Only create a new issue if no duplicate is found **Use case:** A user runs `/ri` to report a bug, but a different user (or even the same user) has already reported the same problem. Instead of creating a duplicate, the AI should notice the existing issue and point the user to it, or ask if they want to add additional context to the existing one.

Comments

Serhioromano

Implemented duplicate issue detection. **Changes:** - `src/index.ts`: Added step 4 to the subagent task — before creating a new issue, the subagent extracts keywords and runs `gh search issues` to find existing similar issues. If matches are found, it reports them instead of creating. Updated notification handling to distinguish "issue created" from "duplicates found". - `src/subagent.ts`: Updated `close` handler to treat exit code 0 with no issue URL as a successful completion (duplicate found) rather than an error. - `README.md`: Updated "Basic issue report" flow and "How It Works" section to reflect the new duplicate check. - `CHANGELOG.md`: Added entry under [Unreleased].