Per Joshua Kerievsky...
Traditional CPD tools (jscpd, PMD) catch only identical duplication. Agent-based detection catches subtle semantic duplication — same logic, different access patterns — that CPD misses entirely. A hybrid approach captures both while keeping token spend predictable.
Approach
Layer 1 — Static (always-on, zero token cost): run jscpd or PMD CPD on every PR diff as a pre-filter.
Layer 2 — Agent-based (bounded): scope to the bounded context of changed files only. PR diff → identify touched modules → agent scans those modules’ recent changes for semantic equivalence.
Tasks
• Select static tool (jscpd vs. PMD CPD) and add to PR GitHub Action
• Define bounded context scoping logic for agent trigger
• Implement agent scan on changed files + immediate module neighbors
• Output findings typed as pure/subtle with consolidation suggestions
• Decide: soft signal (PR comment, human acknowledges) vs. hard gate — recommend soft per human-accountability principle
Notes
Fills GitClear-style detection gap without commercial dependency. Aligns with feature-branch placement already established for signal destruction problem.
Per Joshua Kerievsky...
Traditional CPD tools (jscpd, PMD) catch only identical duplication. Agent-based detection catches subtle semantic duplication — same logic, different access patterns — that CPD misses entirely. A hybrid approach captures both while keeping token spend predictable.
Approach
Layer 1 — Static (always-on, zero token cost): run jscpd or PMD CPD on every PR diff as a pre-filter.
Layer 2 — Agent-based (bounded): scope to the bounded context of changed files only. PR diff → identify touched modules → agent scans those modules’ recent changes for semantic equivalence.
Tasks
• Select static tool (jscpd vs. PMD CPD) and add to PR GitHub Action
• Define bounded context scoping logic for agent trigger
• Implement agent scan on changed files + immediate module neighbors
• Output findings typed as pure/subtle with consolidation suggestions
• Decide: soft signal (PR comment, human acknowledges) vs. hard gate — recommend soft per human-accountability principle
Notes
Fills GitClear-style detection gap without commercial dependency. Aligns with feature-branch placement already established for signal destruction problem.