SaladDay/pi-from-scratch

600 行 TypeScript 写成的超级迷你版 pi,让你轻松从 0 写出属于你的 pi-agent

What it solves

It provides a simplified, step-by-step implementation of a coding agent, removing engineering complexity to focus on the core logic of how an AI agent can interact with a filesystem and execute commands.

How it works

Built with TypeScript, the project implements a "nano-pi" agent that can read files, modify code, and execute terminal commands. It is presented as an interactive tutorial where the source code is gradually revealed alongside an explanatory article, complemented by a Trace feature that allows users to step through the code execution flow line-by-line.

Who it’s for

Developers who want to understand the internal mechanics of coding agents without being overwhelmed by production-grade engineering details.

Highlights

  • Interactive Learning: Combines an article and a live editor to show code evolution.
  • Execution Tracing: Includes a Trace tool to visualize and debug the code execution flow.
  • OpenAI Compatible: Works with any OpenAI-compatible API.
  • Core Logic Focus: Strips away the noise of complex frameworks to show the essential data flow of a coding agent.

Related

  • Project
  • Project
  • Project
  • Project
  • Project