Every coding agent shares the same skeleton — a loop that reasons, calls a tool, reads the result, and repeats. I wanted to understand that skeleton by building it rather than reaching for a framework, so harness-agent is a command-line coding agent written from scratch on top of pydantic-ai and OpenAI's models. You talk to it in a terminal; it reads and edits files, searches the web, and works through a task step by step.
Each turn runs a reason → act → observe loop, capped by an iteration budget so a confused agent can't spin forever. Output streams back token by token, and Ctrl+C cancels a turn cleanly even mid-tool. The part I cared about most is safety: every tool call passes an approval gate — strict, normal or yolo — that can prompt for a yes / no / always on each call, while a path block-list and a write allow-list mean the agent physically can't read your SSH keys or write outside the folders you sanctioned.
On top of that loop sit the pieces that make it usable on real work: it can hand a sub-task to a fully isolated subagent, summarise its own history when a session grows long so it never overflows the context window, load ‘skills’ (markdown playbooks) on demand, preserve a reasoning model's chain of thought across turns, and attach external MCP servers as extra tools. The whole conversation is saved as a resumable JSON session, and an event bus surfaces every step. It's a personal build, grown across several sprints and covered by unit and integration tests.