Series

Building a coding agent

9 posts, in reading order. Drafts are previews until they ship.

  1. 1 An agent loop is a while loop with good manners draft One agent turn, dissected: a plain while loop whose exits, hooks, and recovery paths are the actual engineering.
  2. 2 Your app calls a model in more places than you think draft Every LLM call site in a real agent, enumerated: which tier serves it, how it fails, and where its tokens land.
  3. 3 Your LLM provider is state, not architecture Provider choice is request-scoped state — one LanguageModel that re-resolves model, credential, and client per call.
  4. 4 Subscription OAuth is the hard half of multi-provider auth draft API keys are the easy case. Subscription OAuth — PKCE, refresh races, header shaping — behind the same port.
  5. 5 The model never reads your handler A tool schema is prompt surface — the descriptions and annotations are the only docs a model reads before it acts.
  6. 6 Most approval prompts should never render How a fast-tier LLM judge waves ordinary shell work through silently — and why the worst it can do is show a dialog.
  7. 7 The whole permission model is one folder draft A coding-agent sandbox with one primitive: read anywhere, write inside the folder — enforced in code, not in the prompt.
  8. 8 Error messages are prompt engineering now draft An agent's failure strings are read by the model that caused them — each should name what happened and the next move.
  9. 9 Your agent is a protocol, not an app draft One loop, one typed event stream, four renderers — why headless modes fall out of the architecture for free.