Building a Pi-Style Coding Agent, One Git Checkpoint at a Time
Most agent courses offer pseudocode; this one makes you build a Pi-style coding agent from an offline trace across fifteen runnable Git checkpoints.

What it does
This is a Chinese-language online textbook with a companion repo of runnable TypeScript. It walks through fifteen checkpoints—from message protocols and streaming events to tool registries, agent loops, session trees, and context compaction—to assemble a Pi-style coding agent. Each checkpoint is an actual Git commit you can check out and run, not a static code listing.
The interesting bit
The course starts from a single offline agent trace and rebuilds the system layer by layer. Every chapter pairs textbook prose with the exact commit, focused tests, and deliberate fault experiments, so you see the scaffolding and the failure modes, not just the finished architecture.
Key highlights
- Fifteen progressive checkpoints covering protocol design, provider adapters, tool execution, stateful agents, and evaluation
- Course code is maintained as real Git history (
course(00)throughcourse(14)) in a separate branch, not a folder of reference files - Each chapter includes fault experiments to surface edge cases
- A
practicemode strips answers so you can rebuild alongside a study agent - Explicitly unofficial and community-built; code is MIT, content is CC BY 4.0
Caveats
- The primary material is in Chinese; an English README exists but the course content is not translated
- The README states this is an unofficial community project with no affiliation to Pi or Earendil Works
- Expects solid TypeScript and async fundamentals from the outset
Verdict
A strong fit for Chinese-speaking developers who want to understand agent internals by typing them out rather than reading about them. Look elsewhere if you need a drop-in framework or English-first documentation.
Frequently asked
- What is hahhforest/pi-textbook?
- Most agent courses offer pseudocode; this one makes you build a Pi-style coding agent from an offline trace across fifteen runnable Git checkpoints.
- Is pi-textbook open source?
- Yes — hahhforest/pi-textbook is open source, released under the MIT license.
- What language is pi-textbook written in?
- hahhforest/pi-textbook is primarily written in TypeScript.
- How popular is pi-textbook?
- hahhforest/pi-textbook has 598 stars on GitHub.
- Where can I find pi-textbook?
- hahhforest/pi-textbook is on GitHub at https://github.com/hahhforest/pi-textbook.