Tools/SaladDay/pi-from-scratch

pi-from-scratch

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

802nascentTypeScriptMIT Licensenew this week

The Lens

By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.

Updated Aug 2026

Pi-from-scratch rebuilds a working coding agent, one that reads files, edits code, and runs shell commands, in about 600 lines of TypeScript. It's a deliberate deconstruction of the pi agent framework, delivered as an interactive web tutorial where the code appears progressively as you read, with a trace debugger for stepping through the agent loop. MIT licensed, free, bring an OpenAI-compatible API key.

Setup is Node 22 and npm install, or just read the hosted version. The tutorial prose is primarily in Chinese, so non-Chinese readers will lean on translation.

Read it if you use coding agents daily and can't explain what happens between your prompt and the file edit. It also works as a skeleton for a custom agent. The upstream pi framework is the production version; Anthropic's and OpenAI's agent SDKs are what you'd actually build on.

The catch: this is pedagogy, not infrastructure. Its entire value is that it stays small enough to read in a sitting, which is exactly why nobody should ship it.

Free vs Self-Hosted vs Paid

fully free

Free: Everything. MIT, sponsored, hosted read-along version available.

BYO costs: Running the agent locally needs an OpenAI-compatible API key; tokens bill at your provider.

The trade: None. It's a free lesson.

Completely free and open source. A tutorial, not a product.

Self-hosting ops:trivial

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
63/100 · B
Adoption8/30
Maintenance25/25
Community5/20
License15/15
Analysis10/10

A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores

License: MIT License

Use freely, including commercial. Just keep the license.

Commercial use: ✓ Yes

About

Owner
SaladDay (User)
Stars
802
Forks
52

Explore Further

More tools in the directory