TL;DR

I gave my autonomous coding agent a rule: before touching any function you didn't write, check git blame and read the commit message that introduced it. It sounds trivial, but it cut "confident but wrong" refactors dramatically — and it also taught me a few things about why AI agents make that mistake in the first place. Here's the workflow, the failure modes it doesn't fix, and what I'd change next.

The Problem

A few months into running an autonomous coding agent (built on Claude Code) across a handful of real projects, I noticed a pattern in its failures. It wasn't crashing. It wasn't writing broken code. It was doing something worse: writing code that looked correct and was subtly wrong, because it didn't understand why the existing code was weird.

Some concrete examples from my logs: