PI from Scratch
An article and companion website that walks through writing a minimal TypeScript coding agent, called nano-pi, from scratch, with source code that fills in as you read and a step-by-step execution trace.
PI from Scratch is a written walkthrough, published as a website, that builds a small coding agent called nano-pi from zero, following the structure of the existing "pi" agent. The article and an accompanying code editor are shown side by side: as the article progresses, the source code shown alongside it fills in a piece at a time, and by the end the complete nano-pi implementation is visible in the editor.
The project also includes a trace viewer that lets a reader step through the agent's execution line by line to see how a coding agent's control flow works. Running nano-pi locally requires Node.js 22 or later and an OpenAI-compatible API; the online version replays a pre-recorded trace and does not call any model.
It is written in TypeScript and released under the MIT license.