← All posts
Personal Blog  ·  Essay
Essay · AI · Programming

The code AI writes won't be for you.

Clean code, design patterns, readable names. Those are ergonomics for a human brain with seven slots of working memory. The AI doesn't have that brain. So why is it still writing code for it?

Every coding convention we cherish is a workaround for a human limitation.

Descriptive variable names exist because you can't hold r12 and customerLifetimeValue in your head with equal ease. Comments exist because re-deriving intent is expensive for a tired person at 2 AM. Design patterns exist so a stranger can recognize the shape of a solution without reading every line. Indentation, modularity, single-responsibility: all of it is bandwidth management for wetware.

An AI that writes and maintains its own code has none of those constraints. It reads the whole file in one shot. It re-derives intent instantly. It doesn't get tired, doesn't onboard, doesn't forget. So the moment we stop asking it to write code for humans, it will optimize for something else entirely.

  • Humans optimize for: readability, maintainability, onboarding speed
  • AI optimizes for: tokens, latency, raw performance, self-consistency
  • These two objective functions do not point in the same direction

Binary search, five ways

Exhibit A

Same problem, same correctness guarantee. The only thing that changes is how many tokens the model has to emit and re-ingest to keep working with it. Watch what "wins" when the audience is a machine.

// approx. tokens to generate + the cost to re-read on every edit ↓
Rust · idiomatic ~96 tokens
pub fn binary_search(arr: &[i32], target: i32) -> Option<usize> {
    let mut low = 0usize;
    let mut high = arr.len();
    while low < high {
        let mid = low + (high - low) / 2;
        match arr[mid].cmp(&target) {
            Ordering::Equal   => return Some(mid),
            Ordering::Less    => low  = mid + 1,
            Ordering::Greater => high = mid,
        }
    }
    None
}
JavaScript · readable ~78 tokens
function binarySearch(arr, target) {
  let low = 0, high = arr.length - 1;
  while (low <= high) {
    const mid = (low + high) >> 1;
    if (arr[mid] === target) return mid;
    if (arr[mid] < target) low = mid + 1;
    else high = mid - 1;
  }
  return -1;
}
C · terse ~58 tokens
int bs(int*a,int n,int t){int l=0,h=n-1;
while(l<=h){int m=(l+h)/2;
if(a[m]==t)return m;
a[m]<t?(l=m+1):(h=m-1);}return -1;}
★ "Machine dialect" · golfed C ~34 tokens
/* no names, no spaces, no mercy */
int f(int*a,int n,int t){int l=0,h=n-1,m;while(l<=h)(a[m=l+h>>1]==t)?return m:a[m]<t?l=m+1:(h=m-1);return-1;}
x86-64 assembly ~140 tokens
; fastest at runtime, expensive to emit/maintain
bs: xor   eax, eax        ; low = 0
    lea   ecx, [rsi-1]    ; high = n-1
.L: cmp   eax, ecx
    jg    .none
    lea   edx, [rax+rcx]
    sar   edx, 1          ; mid
    ... ; (full listing omitted)

The least-token version wins. It is also the one no human will ever willingly read.

Tokens are the new lines of code

Exhibit B

For an AI, every token is real cost: money to generate, latency to produce, and (critically) context budget to re-read on every future edit. Optimize that objective and the leaderboard inverts everything we teach junior engineers.

Golfed C
34
Terse C
58
JS readable
78
Rust idiomatic
96
x86-64 asm
140

Notice the trap: assembly is fastest at runtime but most expensive in tokens, so a token-minimizing AI won't reach for it either. It lands somewhere genuinely alien. A dense, abbreviated, comment-free dialect that's near-optimal on its cost function and illegible on ours. Not C, not Rust, not assembly. A pidgin optimized for one reader: itself.

  • FEWER TOKENS → cheaper generation, lower latency
  • FEWER TOKENS → smaller context footprint on every re-read
  • SELF-CONSISTENT → the model only needs it to be parseable, not you
  • RUNTIME PERF → it'll still profile and specialize hot paths, just not for legibility

The downside nobody prices in

Exhibit C

Offload enough of the writing and the code in your product becomes a thing only the AI can read, edit, and reason about. That's fine right up until the moment it isn't.

▲ failure modes

Auditing dies. A security reviewer, a regulator, or a new hire opens the file and finds f(int*a,int n,int t). Good luck certifying that for medical, aviation, or financial use.

Debugging becomes interrogation. When the model is down or wrong, no human can drop into the stack and reason about it. You can only ask the oracle and hope.

Lock-in goes total. Code that only one model lineage can comfortably maintain is code you can't migrate, fork, or escape. The "maintainer" is now a vendor.

We've seen this movie in miniature: minified JS, obfuscated binaries, write-only Perl. The difference is scale and intent. This time the entire codebase trends toward write-only, and it's the default output, not an edge case.

Readability was never free

We just stopped seeing the bill. Clean code is a tax we pay so humans can stay in the loop. An AI optimizing purely for tokens and performance will quietly stop paying that tax, and the savings look great on a dashboard right up until you need a human to understand what shipped.

The fix isn't nostalgia. It's making human-legibility an explicit objective, not a side effect we assume we'll get for free. If we want code we can investigate, we have to ask for it (and probably pay the tokens to keep it). Otherwise the most efficient language in the world will also be the one none of us can speak.

Efficient. Performant. Readable. Pick two. The AI already picked the first two for you.

Comments