Building a Minimal Coding Agent From Scratch: Architecture Deep-Dive
nik-55 · reddit · 2026-10-01
To understand how coding agents work, the author built a minimal one from scratch, inspired by pi, with a detailed architecture write-up (link in comments).
Key design points:
- Agent loop: publishes events at checkpoints (turn start, message update, tool execution, etc.) that any consumer (TUI, CLI, RPC) can subscribe to; fully async, so aborts and steering messages are handled while the LLM is responding.
- Tools: read, write, edit and bash, with bubblewrap sandboxing for bash; tools use an operations interface so they can also run on a remote machine.
- Sessions: append-only JSONL where each entry stores its parent id, so one file holds multiple branches and rewinding just moves a pointer.
- TUI: written in TypeScript, spawning Python as a subprocess; the two communicate over stdin/stdout with JSON lines.
More from coding & agent
- "I told my AI tool to replace itself with a cheaper one" — dev celebrates friction-free agent swaps — yacineMTB · 2026-10-01
- Crosby Legal puts Devin on first response, cutting Sentry noise by 50% — graceisford · 2026-10-01
- Use Real Reddit Threads to Test Whether LLM Answers Preserve the Constraints That Matter — investigatormaker · 2026-10-01
- Developer live-builds an environment-aware agent harness plugin in public brainstorm — JnBrymn · 2026-10-01
- Latent Space talks OpenAI: Computer Use "180 degrees different", Decisions API shipped in a week — Latent Space · 2026-10-01
- DSPy's Flex lets optimizers rewrite your pipeline code, not just prompts — lateinteraction · 2026-10-01