The rewrite math flipped: AI made codebase clarity a capital asset A Hacker News front-page essay argues that AI coding models produce better output when working with conventional, consistent codebases, making codebase clarity a capital asset that lowers the marginal cost of future AI-driven changes. The author claims that proprietary or inconsistent codebases force models to spend tokens inferring patterns, reducing the budget available for actual tasks, and that rewrites can rebuild codebases around patterns the model already knows. Critics note that rewrites themselves can generate AI slop, delete hidden invariants, and create a monoculture risk by optimizing for the mean of the training set. For twenty years the rule was "never rewrite" — Joel Spolsky's 2000 essay hardened it into dogma. A front-page Hacker News piece this week https://thetruthasiseeitnow.com/ai-slop-starts-with-the-codebase-itself/ 43 points, 59 comments argues the economics quietly inverted, and the mechanism is worth taking seriously because it generalises far past code. The core claim An AI coding model's output quality is bounded first by the clarity and conventionality of the codebase , not by the cleverness of the prompt. A codebase built on a popular, consistent stack gets a large leverage multiplier because the model has already seen millions of examples of it. A proprietary, inconsistent codebase forces the model to spend its context window inferring your patterns before it can solve anything — and that inference is pure cost. "More context means more tokens, more prompting, more variance, and generally lower-quality output — aka cost." The consequence: a from-scratch rewrite is no longer only a way to modernise the stack. It's a way to rebuild the codebase around patterns the model already knows — which permanently lowers the marginal cost of every future change an agent makes to it. "A rewrite isn't just an opportunity to modernise your technology stack — it's an opportunity to rebuild your codebase around clear, consistent patterns." The mechanism, made explicit flowchart LR subgraph Legacy "Proprietary / inconsistent codebase" A "Agent reads code" -- B "Spends tokens inferring