AIHarnessAI Agent AI Coding Agents Aren’t Magic. I Rebuilt One From Scratch in 3,292 Lines.
Rogerio Amorim
14 min read3 hours ago
--
Press enter or click to view image in full size
I wanted to understand what actually happens between “you” and “the model.” So I threw away every abstraction, wrote the agent loop by hand, and read every line until it made sense.
Let me guess what your day looks like.
You open your AI editor.
You describe a task in English.
The model writes code.
You read the diff, frown, and fix the same thing by hand.
You do it again next week, with a slightly different prompt.
Sound familiar?
Here’s the thing nobody tells you: the hard part was never the model. It was always the loop — the boring, invisible machinery that decides what the model can see, what it can touch, and what happens when it breaks.
Most AI coding tools hide that loop inside 50,000 lines of framework.…