{"kind":"Skill","metadata":{"namespace":"community","name":"tag-duplicate-prs-issues","version":"0.1.0"},"spec":{"description":"Use gitcrawl to search duplicate OpenClaw PRs/issues, group related work in prtags, and sync duplicate state to GitHub.","files":{"SKILL.md":"---\nname: tag-duplicate-prs-issues\ndescription: Use gitcrawl to search duplicate OpenClaw PRs/issues, group related work in prtags, and sync duplicate state to GitHub.\n---\n\n# Tag Duplicate PRs and Issues\n\nUse this skill when a maintainer needs to decide whether a pull request or issue is a duplicate of existing work.\n\nThis skill is for maintainer triage and grouping.\nIt is not for reviewing the implementation quality of a PR.\n\n## Required Setup\n\nDo not write duplicate groups or annotations until this setup is complete.\nRead-only discovery can still proceed with `gitcrawl` and live `gh`.\n\n### Companion Skills\n\nUse `$gitcrawl` first for local candidate discovery.\nUse the `prtags` skill from the `prtags` repo at `skills/prtags/SKILL.md` when it is available.\n\n### Install the CLIs\n\nInstall `prtags` from its latest GitHub release.\nDo not rely on an old local build unless the maintainer explicitly wants to test unreleased behavior.\n\n`prtags` CLI install path:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/dutifuldev/prtags/main/scripts/install-prtags.sh | bash -s -- --bin-dir \"$HOME/.local/bin\"\n```\n\n### Authenticate prtags\n\n`prtags` should be logged in with the maintainer's own GitHub account through OAuth device flow.\nDo not use a shared maintainer token for interactive triage.\n\n```bash\nprtags auth login\nprtags auth status\n```\n\nThe expected outcome is that `prtags` stores the logged-in maintainer identity locally and uses that account for authenticated writes.\n\n## Missing-Setup Rule\n\nDo not require an up-front preflight before starting the workflow.\nProceed with the normal steps until you actually need a tool or account state.\n\nAs soon as you discover that `prtags` is missing or not logged in at the write step, stop immediately.\nDo not continue in a partial write mode after that point.\n\nIf `prtags` is missing, ask the user to run:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/dutifuldev/prtags/main/scripts/install-prtags.sh | bash -s -- --bin-dir \"$HOME/.local/bin\"\n```\n\nIf `prtags auth status` shows that the user is not logged in, ask the user to run:\n\n```bash\nprtags auth login\n```\n\nResume only after the missing tool or login state has been fixed.\n\n## Read-Path Default\n\nFor candidate discovery in this workflow, use `gitcrawl` first.\nTreat it as the local history and clustering layer for related issues, duplicate attempts, and closed threads.\n\nUse live `gh` or `gh api` for the target thread and for any candidate before making an actionable judgment.\nUse live GitHub when `gitcrawl` is missing or stale for a concrete reason, such as:\n\n- the target or candidate is not present yet\n- the local data is clearly stale or incomplete for the decision you need to make\n- `gitcrawl` errors, times out, or lacks the needed neighbor/search data\n\nWhen you fall back to live GitHub search, note that you did so and why.\n\nIf a later `prtags` target-level write fails because its own mirror has not caught up, stop and report that the curation backend is missing the target object instead of forcing a fallback write.\n\n## Goal\n\nFor each target PR or issue:\n\n1. gather duplicate evidence\n2. decide whether it is a real duplicate\n3. create or reuse one `prtags` group for that duplicate cluster\n4. save the maintainer judgment in `prtags`\n5. rely on normal `prtags` group writes to drive GitHub comment sync when that integration is configured\n\n## Tool Roles\n\nUse the tools with these boundaries:\n\n- `gitcrawl` is candidate generation and historical context\n  - use it first for local title/body search, neighbors, clusters, and closed-thread discovery\n  - treat every candidate as a lead until live GitHub confirms it\n- `gh` is live GitHub truth\n  - use it for target state, body, comments, reviews, files, linked issues, and current open/closed/merged status\n  - use `gh search` only when `gitcrawl` is stale, missing data, or cannot express the needed query\n- `prtags` is the maintainer curation layer\n  - use it to create or reuse one duplicate group\n  - use it to save the duplicate status, confidence, rationale, and group summary\n  - use it as the source of truth for the GitHub-facing group comment\n\n## Working Rules\n\n- Do not call something a duplicate only because the titles are similar.\n- Do not call something a duplicate only because the same files changed.\n- A duplicate cluster should be based on the same user-facing problem, the same intent, and substantially overlapping implementation or investigation context.\n\n## One-Group Rule\n\nTreat duplicate groups as exclusive.\nA PR or issue should belong to at most one duplicate group at a time.\n\nThat means:\n\n- before creating a new group, search for an existing group that already represents the same duplicate story\n- if the target already appears to belong to a different duplicate group, stop and resolve that conflict first\n- do not create a second group for the same target just because the wording is slightly different\n- if two plausible existing groups overlap and you cannot safely merge the judgment, stop and ask the maintainer\n\nThis rule matters more than speed.\nThe skill should keep one coherent duplicate cluster per problem, not many near-duplicate clusters.\n\n## What A Good Duplicate Group Represents\n\nA duplicate group should describe the underlying problem and the intended fix direction.\nDo not group items only because they share a keyword.\n\nGood group shape:\n\n- same user-facing bug or same maintainer-facing task\n- same subsystem or code surface\n- same intended change direction\n- same likely duplicate-resolution path\n\nBad group shape:\n\n- “all PRs that touch Slack”\n- “all issues mentioning retry”\n- “all auth-related items”\n\nThe group title should name the real problem.\nThe group description should summarize the intent and the code surface.\n\nExamples:\n\n- `gateway: startup regression from channel status bootstrap`\n- `whatsapp: QR preflight timeout handling`\n- `release: cross-OS validation handoff gaps`\n\n## Evidence Checklist\n\nBefore declaring a duplicate, gather evidence from at least two categories.\n`gitcrawl` neighbors, search hits, and cluster membership count as candidate generation, not as enough proof by themselves.\n\nFor PRs:\n\n- same or nearly same problem statement\n- same changed files or overlapping file ranges\n- same fix direction\n- same subsystem and failure mode\n- same linked issue or same user-visible symptom\n\nFor issues:\n\n- same user-visible problem\n- same reproduction story or same failure mode\n- same likely fix area\n- same PRs already linked or discussed\n- same maintainers already steering toward the same duplicate grouping\n\nIf you only have wording similarity, that is not enough.\n\n## Step 1: Read The Target\n\nStart by reading the target itself.\nUse live GitHub for current target state.\n\nFor a PR:\n\n```bash\ngh pr view \u003cnumber\u003e --json number,title,state,mergedAt,body,closingIssuesReferences,files,comments,reviews,statusCheckRollup\n```\n\nFor an issue:\n\n```bash\ngh issue view \u003cnumber\u003e --json number,title,state,body,comments,closedAt\n```\n\nRecord:\n\n- target type and number\n- title\n- problem statement\n- proposed intent\n- subsystem\n- whether it is open, closed, or merged\n- whether there is already a likely duplicate thread mentioned by humans\n\n## Step 2: Search Broadly With Gitcrawl\n\nUse `gitcrawl` first because it is the local OpenClaw history and clustering source.\nDo not switch to broad live GitHub search unless `gitcrawl` is missing data, stale, or failing.\n\nStart with the target and nearby threads:\n\n```bash\ngitcrawl threads openclaw/openclaw --numbers \u003cissue-or-pr-number\u003e --include-closed --json\ngitcrawl neighbors openclaw/openclaw --number \u003cissue-or-pr-number\u003e --limit 20 --json\n```\n\nThen search key phrases and subsystem terms:\n\n```bash\ngitcrawl search openclaw/openclaw --query \"\u003ckey phrase from title or body\u003e\" --mode hybrid --limit 20 --json\ngitcrawl search openclaw/openclaw --query \"\u003csubsystem or error phrase\u003e\" --mode hybrid --limit 20 --json\n```\n\nInspect likely clusters:\n\n```bash\ngitcrawl cluster-detail openclaw/openclaw --id \u003ccluster-id\u003e --member-limit 20 --body-chars 280 --json\n```\n\nFor PRs, verify likely code overlap with live file data:\n\n```bash\ngh pr view \u003ccandidate-pr\u003e --json number,title,state,mergedAt,files,body,comments,reviews\n```\n\nFor issues, verify likely duplicate issue state and comments live:\n\n```bash\ngh issue view \u003ccandidate-issue\u003e --json number,title,state,body,comments,closedAt\n```\n\n## Step 3: Use Live GitHub Search For Gaps\n\nUse targeted live GitHub search after `gitcrawl` when:\n\n- the target is too new for the local store\n- comments or reviews matter and the local store lacks them\n- the exact phrase did not appear in local results but the issue/PR is current enough that GitHub should know it\n\n```bash\ngh search prs --repo openclaw/openclaw --match title,body --limit 50 -- \"\u003ckey phrase\u003e\"\ngh search issues --repo openclaw/openclaw --match title,body --limit 50 -- \"\u003ckey phrase\u003e\"\ngh search issues --repo openclaw/openclaw --match comments --limit 50 -- \"\u003cerror or maintainer phrase\u003e\"\n```\n\n## Step 4: Decide The Outcome\n\nChoose one of these outcomes:\n\n- `not_duplicate`\n- `duplicate_needs_judgment`\n- `duplicate_confirmed`\n\nUse `duplicate_confirmed` only when the evidence is strong enough that the maintainer could safely close or retag the duplicate item.\n\nUse `duplicate_needs_judgment` when:\n\n- the problem looks the same but the implementation goal differs\n- the code overlap is weak\n- the issue wording is ambiguous\n- there may be two valid duplicate group interpretations\n- the target appears to intersect two existing duplicate groups\n\n## Step 5: Reuse Or Create One prtags Group\n\nBefore creating a group, search `prtags` for an existing one.\n\nStart with text search over groups:\n\n```bash\nprtags search text -R openclaw/openclaw \"\u003cproblem phrase\u003e\" --types group --limit 10\nprtags search similar -R openclaw/openclaw \"\u003cproblem summary\u003e\" --types group --limit 10\nprtags group list -R openclaw/openclaw\n```\n\nInspect likely groups:\n\n```bash\nprtags group get \u003cgroup-id\u003e\nprtags group get \u003cgroup-id\u003e --include-metadata\n```\n\nReuse an existing group when:\n\n- it represents the same problem\n- it already contains clearly related members\n- adding the target would keep the group coherent\n\nDo not widen an existing group just because `gitcrawl` placed several PRs or issues near each other.\nConfirm that the actual implementation path and maintainer intent still match before adding the new member.\n\nCreate a new group only when no existing group clearly fits.\n\nCreate the group with a problem-based title and an intent-based description:\n\n```bash\nprtags group create -R openclaw/openclaw \\\n  --kind mixed \\\n  --title \"\u003cproblem-centered title\u003e\" \\\n  --description \"\u003csame intent, subsystem, and duplicate-resolution path\u003e\" \\\n  --status open\n```\n\nThen attach the target and any known duplicate members:\n\n```bash\nprtags group add-pr \u003cgroup-id\u003e \u003cpr-number\u003e\nprtags group add-issue \u003cgroup-id\u003e \u003cissue-number\u003e\n```\n\nIf a target appears to already belong to another duplicate group and you cannot safely reuse that group, stop.\nDo not create a second group.\n\n## Step 6: Ensure The Annotation Fields Exist\n\nUse `field ensure` so the skill is idempotent.\n\nRecommended target-level fields:\n\n```bash\nprtags field ensure -R openclaw/openclaw --name duplicate_status --scope pull_request --type enum --enum-values not_duplicate,candidate,confirmed --filterable\nprtags field ensure -R openclaw/openclaw --name duplicate_status --scope issue --type enum --enum-values not_duplicate,candidate,confirmed --filterable\nprtags field ensure -R openclaw/openclaw --name duplicate_confidence --scope pull_request --type enum --enum-values low,medium,high --filterable\nprtags field ensure -R openclaw/openclaw --name duplicate_confidence --scope issue --type enum --enum-values low,medium,high --filterable\nprtags field ensure -R openclaw/openclaw --name duplicate_rationale --scope pull_request --type text --searchable\nprtags field ensure -R openclaw/openclaw --name duplicate_rationale --scope issue --type text --searchable\n```\n\nRecommended group-level fields:\n\n```bash\nprtags field ensure -R openclaw/openclaw --name duplicate_confidence --scope group --type enum --enum-values low,medium,high --filterable\nprtags field ensure -R openclaw/openclaw --name duplicate_rationale --scope group --type text --searchable\nprtags field ensure -R openclaw/openclaw --name cluster_summary --scope group --type text --searchable\n```\n\n## Step 7: Save The Maintainer Judgment In prtags\n\nFor a PR:\n\n```bash\nprtags annotation pr set -R openclaw/openclaw \u003cpr-number\u003e \\\n  duplicate_status=confirmed \\\n  duplicate_confidence=high \\\n  duplicate_rationale=\"\u003csame problem, same fix direction, overlapping files and comments\u003e\"\n```\n\nFor an issue:\n\n```bash\nprtags annotation issue set -R openclaw/openclaw \u003cissue-number\u003e \\\n  duplicate_status=confirmed \\\n  duplicate_confidence=high \\\n  duplicate_rationale=\"\u003csame user-visible problem and same intended fix path\u003e\"\n```\n\nFor the group:\n\n```bash\nprtags annotation group set \u003cgroup-id\u003e \\\n  duplicate_confidence=high \\\n  cluster_summary=\"\u003cone-sentence problem summary\u003e\" \\\n  duplicate_rationale=\"\u003cwhy these items belong in one duplicate cluster\u003e\"\n```\n\nWhen the evidence is incomplete, set `duplicate_status=candidate` and lower the confidence.\n\nIf a per-PR or per-issue annotation write fails because `prtags` cannot resolve the target, do not force a fallback write path.\nKeep the group state you were able to write, report that the curation backend is still missing the target object, and defer the target-level annotation until `prtags` catches up.\n\n## Step 8: Let prtags Sync The Group Comment\n\nDo not tell the agent to create a GitHub comment directly.\n`prtags` owns the outbound GitHub comment as a derived projection of group state.\n\nIn the normal case, do not manually trigger comment sync.\nWhen comment sync is configured, group writes already enqueue the derived comment projection automatically.\n\nUse manual sync only as a repair or retry path:\n\n```bash\nprtags group sync-comments \u003cgroup-id\u003e\n```\n\nIf the maintainer needs to see which groups still need attention, use:\n\n```bash\nprtags group list-comment-sync-targets -R openclaw/openclaw\n```\n\nThe skill should treat the GitHub comment as a consequence of correct `prtags` group state.\nIt should not treat manual comment authoring as part of the normal duplicate workflow.\nIt should also not treat `sync-comments` as a required step for every duplicate decision.\n\n## Output Format\n\nReturn a short maintainer report with these sections:\n\n```text\nDecision: duplicate_confirmed | duplicate_needs_judgment | not_duplicate\nTarget: PR #\u003cn\u003e | Issue #\u003cn\u003e\nConfidence: high | medium | low\n\nEvidence:\n- ...\n- ...\n- ...\n\nprtags actions:\n- reused group \u003cgroup-id\u003e | created group \u003cgroup-id\u003e\n- added members: ...\n- annotations written: ...\n- comment sync: automatic if configured | manual repair triggered for \u003cgroup-id\u003e\n```\n\n## Stop Conditions\n\nStop and escalate instead of forcing a duplicate decision when:\n\n- the target appears to belong to two different duplicate groups\n- the duplicate grouping is unclear\n- the wording matches but the implementation goals differ\n- two PRs touch the same files for different reasons\n- two issues describe similar symptoms but likely different root causes\n\nThe maintainer should get one clean duplicate judgment or an explicit “needs judgment” result.\nDo not blur the line.\n","agents/openai.yaml":"interface:\n  display_name: \"Tag Duplicate PRs and Issues\"\n  short_description: \"Find duplicate PRs and issues with gitcrawl, group them in prtags, and let prtags sync the GitHub comment\"\n  default_prompt: \"Use $tag-duplicate-prs-issues to decide whether an OpenClaw PR or issue is a duplicate, gather candidates with gitcrawl, verify live state with GitHub, group related items in prtags, and save the duplicate judgment.\"\n"},"import":{"commit_sha":"424c6d0a5f4665b803ad6768d08b0be7659deaf4","imported_at":"2026-05-18T20:13:36Z","license_text":"MIT License\n\nCopyright (c) 2025 Peter Steinberger\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","owner":"openclaw","repo":"openclaw/openclaw","source_url":"https://github.com/openclaw/openclaw/tree/424c6d0a5f4665b803ad6768d08b0be7659deaf4/.agents/skills/tag-duplicate-prs-issues"}},"content_hash":[180,141,33,8,112,175,195,135,120,216,188,225,249,11,3,189,98,34,219,186,93,89,141,75,176,250,30,92,28,250,42,174],"trust_level":"unsigned","yanked":false}
