Mastering Intelligent Grouping and Labeling for PRs/Issues

389545 89574 Updated: 2026-07-12 18:48:24

"Tag Duplicate PRs and Issues" is a GitHub workflow skill designed to assist maintainers with triage. It identifies duplicate PRs or issues by searching a local archive via `gitcrawl`, uses the `prtags` tool to create or reuse issue groupings, and synchronizes the maintainer's assessment back to GitHub. This skill focuses on determining whether a PR or issue duplicates existing work, rather than reviewing the quality of a PR's implementation.

Install
npx skills add https://github.com/openclaw/openclaw --skill tag-duplicate-prs-issues
Skill Details readonly

1. Skill Overview

This skill is invoked when maintainers need to judge whether a given PR or Issue duplicates existing work items. It combines three dedicated tools to deliver an end-to-end duplicate detection and labeling workflow:
gitcrawl: Local candidate discovery and historical context layer, used for title/body keyword search, related adjacent thread lookup, semantic duplicate cluster identification, and retrieval of closed threads.
gh (GitHub CLI): Real-time GitHub source of truth, used to fetch target runtime status, message bodies, comment threads, review records, modified files, linked Issues, and current open/closed/merged state values.
prtags: Maintainer curation layer, used to create or reuse duplicate clusters, persist duplicate status, confidence scores, judgment rationales and cluster summary text, and act as the single source of truth for cluster-related comment rendering on GitHub.

2. Core Functional Capabilities

1. Tool Boundaries & Responsibilities

Tool Responsibility
gitcrawl Candidate generation and historical context lookup — prioritized for local title/body search, adjacent thread retrieval, cluster identification and closed thread discovery
gh Real-time GitHub source of truth — fetches target state, body text, comments, review records, file changes, linked Issues, and live open/closed/merged status
prtags Maintainer curation layer — creates or reuses duplicate clusters, stores duplicate status, confidence levels, rationales and cluster summaries, and serves as the source of truth for GitHub cluster comment rendering

2. Strict Duplicate Judgment Thresholds

The skill will not mark items as duplicates solely based on similar titles or overlapping modified files. A valid duplicate cluster must satisfy all three core dimensions below:
 
Identical end-user-facing problem
 
Identical core functional intent
 
Substantially overlapping implementation or investigation context
Before confirming a duplicate classification, evidence must be collected from a minimum of two distinct categories listed below:
Evidence Category PR Scenario Issue Scenario
Problem Statement Identical or nearly identical problem descriptions Matching user-visible functional defects
Code / Files Identical modified files or overlapping file scope Matching root fix code regions
Fix Direction Identical remediation logic and implementation paths Corresponding PRs linked or discussed within the thread
Subsystem Same subsystem and failure mode patterns Maintainers have already tagged the item to the same cluster
Associations Identical linked Issues or user-visible error symptoms Matching reproduction steps and failure workflows
Verbal phrasing similarity alone is insufficient to confirm duplication.

3. One-Group Mutual Exclusivity Rule

Duplicate clusters are mutually exclusive. Any single PR or Issue may belong to at most one duplicate cluster at any given time:
  1. Search for existing clusters that represent the exact same duplicate problem story before creating a new cluster.
  2. If the target item appears to already belong to another existing cluster, halt execution and resolve the conflicting cluster assignment first.
  3. Do not generate a second separate cluster for the same target merely due to minor wording differences.
  4. If two plausible existing clusters overlap and cannot be safely merged for a unified judgment, stop the workflow and escalate to maintainers for manual review.
This rule takes priority over processing speed — every single problem thread must map to one coherent duplicate cluster, rather than multiple loosely related near-duplicate groups.

4. Valid vs Overly Broad Duplicate Cluster Shapes

Valid Well-Structured Clusters

  • Identical end-user software bugs or identical maintainer backend tasks
  • Matching target subsystems and code surface interfaces
  • Identical expected code change and remediation directions
  • Consistent standardized resolution workflows for duplicate defects

Overly Broad Low-Quality Clusters (Prohibited)

  • "All PRs modifying Slack integration logic"
  • "All Issues mentioning retry logic failures"
  • "All entries related to authentication flows"
Cluster titles must name the concrete real-world problem, and cluster descriptions must summarize core functional intent and relevant code surfaces.

5. Standard 8-Step Workflow

Step 1: Pull Target Metadata
Use gh pr view or gh issue view to fetch real-time live state of the target thread.
 
Record the following attributes: item type / numeric ID, title, problem statement, proposed functional intent, affected subsystem, open/closed/merged status, and any manual user mentions of potential duplicate threads.
Step 2: Execute Broad Local Search via Gitcrawl
```bash
gitcrawl threads openclaw/openclaw --numbers <num> --include-closed --json
gitcrawl neighbors openclaw/openclaw --number <num> --limit 20 --json
gitcrawl search openclaw/openclaw --query "<phrase>" --mode hybrid --limit 20 --json
gitcrawl cluster-detail openclaw/openclaw --id <id> --member-limit 20 --body-chars 280 --json
Do not fall back to broad live GitHub API searches until local gitcrawl archives are incomplete, stale, or return failed results.
Step 3: Live GitHub Search for Missing Archive Context
Only invoke live GitHub search under the following conditions:
  1. The target thread is too recent to exist within local offline archives
  2. Critical comment or review content is absent from local stored records
  3. Exact keyword phrases cannot be matched in local archives, and the target Issue/PR is newly created
Step 4: Render Final Classification Verdict
  • not_duplicate: The target item is not a duplicate of any existing work
  • duplicate_needs_judgment: Additional manual maintainer review is required to confirm duplication
  • duplicate_confirmed: Duplication is fully verified (only used when supporting evidence is sufficiently robust to allow maintainers to safely close or re-label the duplicate thread)
 
Step 5: Reuse or Create a New prtags Cluster
First scan existing clusters via these commands:
 
prtags search text, prtags search similar, prtags group list
  • Reuse an existing cluster: If the cluster represents the identical problem and already contains clearly related member threads
  • Create a new cluster: Only when no existing cluster provides an exact match; assign a problem-focused title and intent-based cluster description
     
    If the target item appears to belong to a separate incompatible cluster and safe cross-cluster reuse is impossible, halt workflow execution.
 
Step 6: Ensure Annotation Fields Exist (Idempotent Operation)
Target-level persistent fields:
 
duplicate_status (enum: not_duplicate, candidate, confirmed)
 
duplicate_confidence (enum: low, medium, high)
 
duplicate_rationale (free-form text)
Cluster-level persistent fields:
 
duplicate_confidence, duplicate_rationale, cluster_summary
Step 7: Persist Maintainer Verdict in prtags Storage
Run the following commands to save classification results for each target item:
 
prtags annotation pr set or prtags annotation issue set
 
If supporting evidence is incomplete, set duplicate_status=candidate and lower the assigned confidence score.
 
If write operations fail (prtags cannot parse the target thread reference), do not force fallback write paths.
Step 8: Trigger Automated Cluster Comment Synchronization via prtags
 
Do not manually create raw GitHub comments directly — prtags treats GitHub comment content as a derived projection of cluster state.
 
All cluster write operations automatically enqueue derived comment projection tasks when comment synchronization is enabled in config.
 
Manually run this command only for remediation or retry workflows:
 
prtags group sync-comments

III. Primary Applicable Use Cases

  1. Daily Maintainer Issue/PR Triage
     
    Deliver a systematic evidence collection and standardized decision-making workflow when maintainers need to judge whether a PR or Issue duplicates existing work items.
  2. Duplicate Issue/PR Detection & Cluster Management
     
    Leverage gitcrawl’s semantic cluster identification and prtags grouping capabilities to organize related work items into consistent coherent duplicate clusters.
  3. Persistence & Synchronization of Maintainer Judgments
     
    Store all maintainer duplicate classifications, confidence scores and supporting rationales within prtags, with automatic synchronization of cluster status comments to GitHub.
  4. Conflict Detection & Workflow Escalation
     
    Halt automated processing and escalate to manual review when the target item appears to belong to two conflicting clusters, cluster boundaries are ambiguous, wording matches exist with divergent implementation goals, or two PRs modify identical files for unrelated root causes — avoid forcing arbitrary duplicate verdicts.

IV. Pre-Flight Setup & Prerequisites

Installation & Authentication

  1. Install prtags CLI tool:
curl -fsSL https://raw.githubusercontent.com/dutifuldev/prtags/main/scripts/install-prtags.sh | bash -s -- --bin-dir "$HOME/.local/bin"
  1. Authenticate prtags using a maintainer’s personal GitHub account via OAuth device flow:
 
prtags auth login
prtags auth status
Missing Dependency Rule: Do not run pre-flight validation checks before executing the full workflow. Complete all standard steps until tool or account state is actually required. Immediately stop all workflow execution if prtags is missing or unauthenticated when write operations are triggered.

V. Cross-Skill Collaboration Matrix

Skill / Tool Collaboration Logic
$gitcrawl Prioritized layer for local candidate thread discovery
prtags Curator layer, documented in skills/prtags/SKILL.md
gh Real-time GitHub live data source of truth

VI. Standard Output Format

Return a concise maintainer summary report containing the following fixed sections:
Decision: duplicate_confirmed | duplicate_needs_judgment | not_duplicate
Target: PR #<number> | Issue #<number>
Confidence: high | medium | low
Evidence:
- [Supporting evidence point 1]
- [Supporting evidence point 2]
prtags actions:
- reused group / created group
- added members: [list of thread IDs]
- annotations written: [field list]
- comment sync: automatic if configured | manual repair triggered for [target]

VII. Critical Governing Principles

  1. Never mark items as duplicates based solely on title similarity
  2. Never mark items as duplicates based solely on overlapping modified files
  3. One-Group Mutual Exclusivity Rule: Each target thread may belong to a maximum of one duplicate cluster at any time
  4. Evidence Threshold Mandate: Evidence from at least two distinct categories must be collected before confirming a duplicate classification
  5. Verbal phrasing similarity alone does not constitute valid duplication proof
  6. prtags owns all GitHub cluster comment logic: Raw manual GitHub comment creation is prohibited
  7. Halt and escalate on conflicting cluster assignments: Do not force ambiguous duplicate verdicts
  8. Immediate termination on missing prerequisites: Do not continue workflow execution in partial write mode

VIII. Summary

Tag Duplicate PRs and Issues is a maintainer-focused intelligent grouping and labeling skill for duplicate PR/Issue detection. It combines gitcrawl for offline local candidate discovery, gh for live GitHub real-time validation, and prtags as the dedicated curation layer to systematically judge duplication between new threads and existing work items, then persist all maintainer judgments and synchronize status comments to GitHub. It enforces strict multi-category evidence thresholds, mutual exclusive single-cluster rules, and escalation workflows for conflicting assignments instead of arbitrary forced verdicts, guaranteeing consistent cluster quality and fully traceable decision records. This skill is built for OpenClaw core maintainers to efficiently manage duplicate PR and Issue workloads during daily repository triage cycles.