I don't read the code my agents write. Step 1 of what makes that hold:
The code compiled and didn't work. I couldn't fix it myself; I asked the agent, and another error surfaced. What stopped them: the type checker at its strictest, before the agent writes a line. In TypeScript: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes.
In Birgitta Böckeler's grid of guides and sensors, the type checker is a computational sensor: a program answers true or false, the same every time. It holds without your attention. The series' map: https://lesecretairedefernand.co/en/tech/mapping-your-attention-to-free-it/
The details, flag by flag. strict is the floor: no implicit any, null and undefined checked, catch variables typed unknown. Every flag after it closes a gap strict leaves open.
noUncheckedIndexedAccess: arr[i] and record[key] are T | undefined. The agent has to handle the missing case instead of assuming it is there. It turns a whole family of runtime errors into compile errors the agent must fix.
exactOptionalPropertyTypes: an optional property may be absent, not set to undefined. noPropertyAccessFromIndexSignature: a key that may not exist is read with brackets, so it shows in the code.
Then the flags for what an agent leaves behind: noUnusedLocals, noUnusedParameters, noImplicitReturns, noFallthroughCasesInSwitch, noImplicitOverride, allowUnreachableCode false.
If you want an example, here is the tsconfig of one of my tools: https://github.com/lbdremy/phax/blob/1a159147956a9d73c189cf7073622a8fb8742d8a/tsconfig.json
One step a day of the harness I put around my agents, in the order I added them.