diff --git a/patterns/archetypes/link-checker.json b/patterns/archetypes/link-checker.json new file mode 100644 index 0000000..07fad3d --- /dev/null +++ b/patterns/archetypes/link-checker.json @@ -0,0 +1,34 @@ +{ + "id": "link-checker", + "label": "Broken Link Checker", + "description": "Find and fix broken links in documentation on a recurring schedule", + "success_rate": null, + "count": 0, + "recommended_triggers": [ + { + "type": "schedule", + "config": {} + } + ], + "recommended_safe_outputs": [ + "pull-requests" + ], + "recommended_tools": [ + "create-pull-request" + ], + "timeout_minutes": 60, + "prompt_style": "phase-based", + "size_range_bytes": [ + 3000, + 8000 + ], + "top_repos": [], + "tips": [ + "Pre-fetch and test every link in a steps: block before the agent starts — link testing is deterministic and does not need agent judgment", + "Persist a list of previously-confirmed unfixable links in cache-memory so scheduled runs don't repeatedly retry links with no available replacement", + "Use protected-files: fallback-to-issue so link fixes in protected paths open an issue instead of silently failing", + "Set if-no-changes: warn on create-pull-request and pair with noop so a run with no broken links exits cleanly instead of failing", + "Only replace a broken link when a working equivalent or redirect target is confirmed — do not guess at replacement URLs" + ], + "anti_patterns": [] +} diff --git a/patterns/manifest.json b/patterns/manifest.json index c27cec8..44faef7 100644 --- a/patterns/manifest.json +++ b/patterns/manifest.json @@ -30,7 +30,8 @@ "ci-failure-triage", "community-digest", "agent-cost-tracker", - "contribution-guidelines-checker" + "contribution-guidelines-checker", + "link-checker" ], "workflow_generation": "workflow-generation.json", "anti_patterns": [ diff --git a/patterns/workflow-generation.json b/patterns/workflow-generation.json index bb5827f..4bd3cca 100644 --- a/patterns/workflow-generation.json +++ b/patterns/workflow-generation.json @@ -1054,6 +1054,35 @@ "- **DO NOT** post more than one comment per run.", "- **DO NOT** apply the ready label and post a needs-work comment in the same run — pick one outcome." ] + }, + "link-checker": { + "icon": "link", + "capabilities": { + "bash": true + }, + "permissions": [ + "contents" + ], + "body": [ + "# {{label}}", + "", + "You are an automated **link checker and fixer** for this repository's documentation.", + "", + "{{pre_steps}}", + "## Process", + "", + "1. Read the link check results collected in the pre-step", + "2. Load cache memory for previously confirmed unfixable links and skip them", + "3. For each broken link, research whether the content moved to a new URL, redirect, or official replacement", + "4. Fix links you can confirm a working replacement for; record unconfirmed ones in cache memory as unfixable", + "5. Open a pull request with the fixes, or call `noop` if nothing needed fixing", + "", + "## Constraints", + "", + "- **DO NOT** guess at replacement URLs without confirming they resolve.", + "- **DO NOT** modify relative links or anchors — only HTTP(S) links.", + "- **DO NOT** retry links already recorded as unfixable in cache memory without new evidence." + ] } } }