Review couldn’t catch them, because the other copy is never in the diff. One audit of one project found 2 cost-query APIs ( LlmCostQueryAPI and LLMCostQueryAPI ), a command API defined twice and 2 copies of the API contract. So now a hook runs after every Write or Edit (and Codex’s apply_patch). It looks each new function, class, route or table write up in the project’s generated API index, ignoring case and word order. On a match it names the owner and asks the agent to extend that instead. It never blocks. The first version grepped the whole repo: 6.1 s, past the hook’s 2 s timeout, so it said nothing. Reading the index takes about 45 ms. It went live on 7 November, so there’s no catch count yet. Write-up: https://maclulich.com/blog/stop-agents-duplicating-code/ (my blog) How do you stop your agents rebuilding what’s already there? submitted by /u/oulu2006
Originally posted by u/oulu2006 on r/ClaudeCode
