AI can rewrite open source code—but can it rewrite the license, too?
Maintainer used Claude Code to rewrite LGPL library as MIT-licensed in 5 days with 48x speed boost.
The open source community is grappling with a novel legal question after maintainer Dan Blanchard used Anthropic's Claude Code to completely rewrite the chardet Python library. Originally created by Mark Pilgrim in 2006 under the restrictive LGPL license, Blanchard overhauled the character encoding detection library in just five days, achieving a 48x performance boost and relicensing it under the more permissive MIT license. Blanchard wanted to fix the library's "license, speed, and accuracy" issues to get it added to Python's standard library.
Original author Mark Pilgrim immediately objected on GitHub, arguing this constitutes an illegitimate relicensing since Blanchard had "extensive exposure to the original codebase." Pilgrim contends that adding "a fancy code generator" doesn't grant additional rights and that the new version must maintain the LGPL license as a derivative work. This challenges traditional "clean room" reverse engineering concepts where human developers maintain strict separation from original code to avoid copyright infringement.
Blanchard defends his approach as an "AI clean room" implementation, citing JPlag similarity statistics showing only 1.29% structural similarity between version 7.0.0 and previous versions. He started with an empty repository, provided Claude Code with architectural specifications, and explicitly instructed the AI not to base anything on LGPL/GPL-licensed code. However, complicating factors include Claude's reliance on metadata files from previous versions and the fact that AI models are trained on public code including LGPL-licensed material.
The case highlights how AI coding assistants like Claude Code are disrupting traditional software development practices and legal frameworks. As AI becomes capable of rapidly rewriting entire codebases while potentially inheriting licensing restrictions from training data, the open source community needs new guidelines for what constitutes derivative work in the age of AI-assisted development.
- Dan Blanchard used Claude Code to rewrite chardet library in 5 days with 48x performance improvement
- Changed license from restrictive LGPL to permissive MIT, sparking legal challenge from original author Mark Pilgrim
- JPlag analysis shows only 1.29% structural similarity between AI-rewritten version and original codebase
Why It Matters
Sets precedent for AI-assisted code rewrites and licensing, potentially affecting thousands of open source projects and their maintainers.