Member-only story
I Gave an AI Agent a Refactor Overnight. The Diff Was Almost Right.
What it missed, and how I describe tasks now when I won’t be there to answer its questions.
What made me most curious about AI agents was that they could keep working on something even when I wasn’t at my computer. For a long time I used these tools as a back-and-forth conversation: I’d ask something, review the answer, and if there was a mistake, explain it again. For the process to continue, I had to be there too.
English isn’t my first language, so I used AI to help translate, organize, and write the English sentences in this piece. The experiences and opinions are my own.
Leaving a task and checking the result later is a different habit. The agent looks through files, makes changes, runs tests, and tries to fix the errors it runs into. Instead of watching every step, I can move on to something else.
The first time this really worked for me was cleaning up repeated checks in an old project.
The same check had been written separately in several services. I needed to look at about 15–20 files, find where it was used, move the suitable ones into a shared method, and update the tests. It wasn’t hard work, but it needed attention. It would have been easy to skip a call site or miss the difference between two checks that looked alike.
In the evening, I gave the agent this task:


