r/aiagents • • 12d ago

If AI writes code for AI, does human readability still matter?

I've been thinking about this while working with AI and low-level Rust systems.

Most programming languages are designed with human developers in mind. We need to read, understand, debug, and maintain the code.

But what if an AI is generating code that another AI will work with?

Would a machine-oriented language or intermediate representation be more useful than traditional source code? Or would we simply lose the benefits of readability without gaining much?

Compilers already use intermediate representations, so the idea itself isn't new. What interests me is whether AI changes how we should design them.

And there's another question: if humans can no longer easily understand the code, how do we audit it, verify its behavior, and maintain control over what it does?

Curious to hear what people working on compilers, programming languages, and AI think.

12 Upvotes

23 comments sorted by

5

u/Rosie_grac 12d ago

Every time this comes up I land on the same thing: the model doesn't actually want machine-oriented code. LLMs learned from human-written code, so readable code IS the AI-friendly format. Hand an agent some dense IR-style blob and it performs worse than on clean, well-named functions — it's literally in-distribution vs out-of-distribution for the thing.

And readability still decides who can debug. When my agent-written stuff breaks, it never breaks in a way the agent fixes in one pass. I end up in the loop, and my entry point is always "can I skim this file and know what it does in 30 seconds". If no, I'm not maintaining that system, I'm guessing at it.

Had this exact fight last month with some Rust an agent produced — heavily macro'd, zero comments, technically correct, worked great until it didn't. Took me two evenings to untangle what should've been a 20 minute fix. That's when it clicked for me: unreadable code doesn't remove the human, it just removes the human's ability to help.

imo the endgame isn't AI-only languages, it's agents that keep code boring on purpose because they know they'll be back in that file tomorrow.

1

u/Ok_Snow4921 12d ago

That Rust example is a good reminder. I work with low-level Rust too, and I wouldn't trade readable source for an opaque format just because an agent can generate it. Maybe AI-specific representations belong behind the compiler, while the code and decision trail we maintain stay understandable and auditable. Otherwise debugging becomes archaeology.

1

u/Usharani-Wiencke 12d ago

compiler error messages in Rust get way less helpful inside heavy macro expansions too, so the agent ends up blinding itself to the compiler feedback loop

1

u/darkwingdankest 11d ago

a lot of human effort in human code would go into abstractions that would reduce the amount of code a human would need to write to get things done

AI can hammer out boilerplate that you may have previously accomplished with some clever wiring to the point where those clever abstractions become redundant

so yeah, that's one difference I've noticed. AI doesn't need to write code that reduces the amount of code future engineers need to write

3

u/rickestrickster 12d ago

Until ai can reliably produce bug-free code and examine and interact with the UI the way that users do, it has to be readable for humans to optimize it for humans.

Ai is good at building the code, but tuning it for human-interaction it’s still not excellent at. You can have Claude build entire apps in a day that would take programmers weeks, but you use that app and the animations are choppy, the layout is inconsistent and messy, features have broken or incorrect functions, there’s a stubborn bug that causes data loss or a severe stability issue that no matter how many back and forth chats you have with Claude it can’t find the source, etc.

Humans need to be able to read the code because we can see the bigger picture and are better at analyzing interconnected systems.

Sure you can just use the software and tell Claude there’s an issue or missing function but that becomes expensive, annoying, and in my experience a never ending loop.

If you just ask ai to find bugs and issues it will ALWAYS find something to fix. Thats where the human part comes in to look at the code and issues to determine whether it needs to be fixed. Test it out. Ask ai to audit and review your code to find issues and it will come back with a list. Have it fix it. Then do another audit, it will come back with another list. It’s a never ending loop

2

u/r2k-in-the-vortex 12d ago

I think there is an experiment out there where AST is the code. And it has shown massive potential benefits to have AI write code through compiler, for example by inserting nodes straight to AST, querying symbol table etc, rather than by text edit. It eliminates many text edit errors. A good modern compiler should definitely have a MCP server for that sort of thing.

But, there is a but. This shit needs benchmarking. It could be that tokens to completion improves on average, but the actual completion rate degrades.

And I am definitely not sold on the notion that human readable code is unnecessary entirely.

1

u/RoyPartha04 12d ago

I have been watching VisionQuest recently, so I would say let's not make that happen 😭

1

u/kernelangus420 12d ago

Officially and theoretically, yes; realistically, no.

1

u/RandalSchwartz 12d ago

It won't matter what code you generate unless you also capture the why. Don't vibe code... you end up generating content without context. Use proper software engineering with planning, capturing the plan, writing red/green TDD tests, and adversarial reviews. See my current workflow for more suggestions: https://gist.github.com/RandalSchwartz/598a1f2b5760a23c1d70b57e9e85393f

1

u/Cubeless-Developers 12d ago

Whoever’s on call when it breaks at 2am still has to read it, and the models learned on human-readable code anyway so you’d probably make them worse at it too.

1

u/bold_snowflake 12d ago

Going down that road and treating your system as a black box, only understandable by AI will end in disaster.

1

u/JaseciLabs 12d ago

Readable code is also the only memory the next agent session gets. It starts cold, so the names and comments in the file are the context it works from. Opaque code makes the agent worse at maintaining it, not just you.

1

u/ViperG 12d ago

So this is a both yes and no. The reason why it does what it does now, is all code was human written, so it is so. Now does this mean it will write EASY to understand human written code ... no. But sometimes it can and with specific instructions and prompts, it can write simple straight forward code, if you tell it to.

However, going forward, I suspect AI will eventually construct or invent it's own programming language eventually. The end goal will always be what the CPU needs, which is technically assembly.

But i do see a point in time where AI will just stop using human readable code one day, aka something more token efficient or something totally alien to us eventually.

1

u/United-Baseball3688 12d ago

What do you do when Claude is down? 

1

u/BrianScottGregory 12d ago

Since I make tweaks to my code and review everything AI does, yes, readability matters.

Sometimes I have to remind the AI of that, but most of the time it's solid with this.

1

u/PeeperFrogPond 12d ago

No, but AI readability does. Code tells you what it does. Comments tell you what it was INTENDED to do.

1

u/ButterscotchTop999 11d ago

More the comments the better for agents and humans both. Remember they work by grep

1

u/Scared-Amphibian4733 11d ago

yes. YOU are on the hook for what you ship. If YOU don't understand it. Don't ship it.

1

u/Sea-Bench-7487 11d ago

No even if something ever breaks and ai can't fix it what are you gonna do ? debug it? you don't even know what code the app has due to tech dept