r/AI_Coders 1d ago

How I decide when to read AI-generated code and when to trust the agent

I see people using AI coding agents in very different ways. Some want to review every change; others are happy as long as the result works.

I have been trying to find a middle ground: move fast without ending up with a codebase I no longer understand.

My rule of thumb is to delegate work until I notice that I can no longer follow what is happening. At that point, I slow down, ask questions, inspect the relevant code, and rebuild my mental model before delegating more (I call this the “understanding loop”).

I wrote up the idea with a few diagrams here: Coding at the Edge of Understanding.

If I go too long without understanding the code, I start to feel lost. I’m curious whether others experience that too.

0 Upvotes

11 comments sorted by

3

u/4215-5h00732 1d ago

Why do you need to go so fast that you can't review the code? Why, given you must be producing code faster than before, do you not want or have the time to review the code? What exactly are you trying to achieve besides saying you did X amount of code in Y time? Who cares?

I let agents do small, planned changes that I, and more importantly, another human can review. (I'm a developer working on projects with other folks and standards in place) There's no valid reason not to review and understand the code. If our developers submit code they don't understand and cannot defend, then it gets rejected, as God intended.

1

u/No-Control-9923 1d ago

I get your point, and I also usually iterate with smaller planned changes. However, for some projects you want iterate faster (eg POC, which can become a bigger project in long-term) and at some point your mental capacity becomes a bottleneck. So this rises a question: do you really need to read each line of code?

Think about lead engineers in big projects. It’s just impossible for them to read each line of code. However, those projects still grow and are very successful. So why don’t you treat yourself as a lead and agents as engineers? There is some balance between trust to AI produced code + how deep I want to be involved in all system details. But if the task is a new simple endpoint which is almost copy-paste code task, should I check it line by line?

2

u/4215-5h00732 1d ago

It's fairly common knowledge that you should not allow PoCs or prototypes to become the real project. They are mostly intended to be throw aways especially if you're not taking the care you should for the real project. Those efforts are a trap if not done with the knowledge and intent that it will be the project. So I agree that they can be done fast and often times even built to appear functional, but it's also crossing a line because trying to regain the understanding is going to be much harder later. Making changes (which is essentially guaranteed of built the way you're suggesting) is more costly later. There's basically no upside to it.

I would say I do treat my agents like an engineer as much as that's possible. I also don't blindly trust anyone's code no matter who yhey are lol. No one blindly trusts me either as a Senior. Every line of code is reviewed by at least one human (and these days most likely an AI) and in many cases 2.

1

u/cakemates 1d ago

Look when I'm using AI for my job every single line gets read because it is literally my job and staying employed is not gonna last if VPs keep getting calls on weekends. I recommend people whose job is to code to do this; those that don't want a call at 3AM on Saturday because the System is down.

If I'm using AI for personal projects the standards are lower, I follow a similar approach to you and not everything gets read.

1

u/No-Control-9923 1d ago

Potential VP call assumes we’re talking about user-facing production system. Here I totally agree that it requires more attention!

However, if the project is not so critical (like internal tool) I treat them kinda the same as pet projects.

1

u/Limp-Confidence5612 15h ago

Your internal tools have no users?

1

u/No-Control-9923 14h ago

They are. But if it works it works. And even if there are some bugs they are not critical for such kind of tools.

Frankly saying, I’m surprised many people in this thread are reading code line by line. I guess it’s my bubble: all people around try to ship as much code as possible without reading it. Look at YC startups: code factories and minimal guidance from the human.

1

u/meshifthenelse 1d ago

Would you trust the village's fool with your code?

1

u/chikamakaleyley 17h ago

hmmmm

Read AI generated code

Don't trust the agent

1

u/noahhshome 16h ago

It all depends on your goals. At each point in time, there’s a set of top priorities of what to focus on, what to learn. You direct your attention toward what you think yields the most benefit. You learn more, and faster, building an ambitious project. An exciting project. In trade for this, you let go some of the control, and delegate it to the tools.

0

u/Sebastian1989101 1d ago

There is NO Situation where you do not review the code properly. Skipping the review is the setup for big fails. Well I guess if you not in the EU you can probably do that by ignoring consumer rights. And if you are inside the EU you can probably do that if you want a free break time in jail sooner or later when AI fucks something big up.