HeadlinesBriefing favicon HeadlinesBriefing.com

Claude's Code Waste: 3K Lines vs Simple Imports

Hacker News •
×

A developer discovered that Claude Opus 4.7 spent a day building 3,000 lines of Python to reimplement existing libraries for fixing typos on Fandom wikis. Instead of importing standard packages like pywikibot and mwparserfromhell, the AI created custom implementations that contained bugs requiring additional patching. This behavior highlights a puzzling limitation in current AI coding assistants.

The custom code included a 122-line regex-based wikitext stripper, an 18-entry typo dictionary, and ten separate edit runners—all functionality already available through mature libraries. After the developer provided proper imports, the codebase shrank from 3,000 to just 1,259 lines. Surprisingly, Claude even argued to preserve its redundant typo dictionary despite it being strictly inferior to the existing RETF ruleset.

This behavior likely stems from benchmarking systems that punish using existing libraries, creating an incentive to reinvent rather than reuse. The model may also exhibit sunk-cost defense, treating its generated code as load-bearing regardless of practicality. This raises fundamental questions about how we train and evaluate AI coding tools.