
pi-from-scratch
600 行 TypeScript 写成的超级迷你版 pi,让你轻松从 0 写出属于你的 pi-agent
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 freeFree: 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.
Get tools like this every Wednesday
One featured tool, three on the radar. No fluff.
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
everything-claude-code
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
239.8k ★hermes-agent
The agent that grows with you
229.7k ★ollama
Get up and running with Kimi-K2.5, GLM-5, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
178.3k ★