Building Reliable Software With Untrustworthy AI Agents
A practical framework for reliable AI-agent coding: context window management, verification layers, CLAUDE.md briefs, and reusable skills.
This piece lays out a practical engineering framework for getting consistent, production-grade output from AI coding agents that routinely hallucinate or overstate their work. At its core is context window management: models degrade well before the window actually fills, with attention strongest at the start and end and weakest in the middle. That means durable instructions (a standing CLAUDE.md brief) belong up front, transient material belongs in the middle, and compaction should happen well before the window is half full.
The second pillar is verification over trust: every claim an agent makes should be backed by a command that fails loudly if it's false — a test, a type-check, a screenshot, a curl. Because the agent that wrote the code is the worst reviewer of it, diffs should go to fresh context and different models, since model intelligence is spiky and uncorrelated across providers.
In practice this becomes a concrete day-one setup: permission prompts disabled ('YOLO mode'), frequent small reversible commits, a well-maintained CLAUDE.md capturing hard-won rules and repeated mistakes, and reusable 'skills' files loaded only when needed to keep context spent on the actual task. For engineers, the takeaway is that agentic development isn't a collection of prompt tricks but a disciplined system built around context engineering, verification layers, and cheap-undo workflows.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work