This series organizes the installation, core concepts, customization, extensions, SDK/RPC and advanced capabilities of Pi (@earendil-works/pi-coding-agent), making it easy to read and compare official documents according to the route.
This series is a set of tutorials from shallow to deep Pi agent framework Chinese learning documents. The content is based on official documentation (https://pi.dev/docs/latest/ ), source code warehouse README / CHANGELOG / examples organized, code examples are taken directly from or compared with official documents and
examples/Directory.Data verification time: 2026-10-19 (Beijing time).
1. What is Pi (one sentence version)
Pi is a project initiated by Mario Zechner (GitHub: badlogic) "A minimalist, scalable agent harness". The original words of the official README are:
"Pi is a minimal, extensible agent harness that you can make your own."
It runs in the terminal. Give it a target and a working directory, and it can read files, run commands, change files, and complete multi-step tasks; at the same time, it provides Extensions, skills, prompt templates, themes, Pi packages, and print/JSON/RPC mode and TypeScript SDK, allowing you to transform it into your own tool or embed it into your own application.
2. Version Notes (Important)
npm package
- Description
@earendil-works/pi-coding-agent(command namepi)
Source code
- Description
- https://github.com/badlogic/pi-mono (Now redirected to https://github.com/earendil-works/pi )
Official website document
- Description
- https://pi.dev/docs/latest/
0.99.0
- Description
- Released on 2026-09-29, introduced Codemode and MCP, system theme, Sign in with ChatGPT,virtual model, classifier model
1.0.0
- Description
- Released on 2026-10-01: Default full-screen TUI, codemode prompt words are more streamlined, codemode image generation, etc.
Latest
- Description
- As of 2026-10-19, the latest version of npm is 1.3.0(2026-10-15)
| Project | Description |
|---|---|
| npm package | @earendil-works/pi-coding-agent(command name pi) |
| Source code | https://github.com/badlogic/pi-mono (Now redirected to https://github.com/earendil-works/pi ) |
| Official website document | https://pi.dev/docs/latest/ |
| 0.99.0 | Released on 2026-09-29, introduced Codemode and MCP, system theme, Sign in with ChatGPT,virtual model, classifier model |
| 1.0.0 | Released on 2026-10-01: Default full-screen TUI, codemode prompt words are more streamlined, codemode image generation, etc. |
| Latest | As of 2026-10-19, the latest version of npm is 1.3.0(2026-10-15) |
The "about 0.99" you mentioned is exactly the first version of codemode/MCP. Since it has been iterated to 1.3.0 in the next two weeks, this series starts with The latest documentation (docs/latest, corresponding to 1.3.x) shall prevail; any differences from 0.99 will be specially marked (for example, starting from 1.0, the default is full screen, starting from 1.2
before_agent_startsemantic changes). Use after installationpi --versionandpi --helpYour local version shall prevail.
3. Quick overview of Monorepo structure
The repository is a monorepo, with the core package (extracted from the root README):
@earendil-works/pi-ai- function
- Unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.)
@earendil-works/pi-agent-core- function
- Agent runtime with tool invocation and state management
@earendil-works/pi-coding-agent- function
- Interactive coding agent CLI (i.e.
pi), which is also the entrance to the SDK
@earendil-works/pi-tui- function
- Differential rendering terminal UI library
@earendil-works/pi-durable- function
- Persistence session/task/document runtime
@earendil-works/chord、pi-telemetry- function
- Plug-in hosting runtime, telemetry contract
| package | function |
|---|---|
@earendil-works/pi-ai | Unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.) |
@earendil-works/pi-agent-core | Agent runtime with tool invocation and state management |
@earendil-works/pi-coding-agent | Interactive coding agent CLI (i.e. pi), which is also the entrance to the SDK |
@earendil-works/pi-tui | Differential rendering terminal UI library |
@earendil-works/pi-durable | Persistence session/task/document runtime |
@earendil-works/chord、pi-telemetry | Plug-in hosting runtime, telemetry contract |
In addition, there are also packages/mcp、packages/codemode Waiting for support package.
4. Learning Roadmap
Getting Started ──► Core Concepts ──► Proficient Use ──► Customization ──► Extension Development ──► Integration ──► Advanced ──► Practical Combat
01 02 03 04 05 06 07 08
00
- Documentation
- Learning route and catalog (this article)
- difficulty
- ★
- you will learn
- Global understanding, version, reading order
01
- Documentation
- What is Pi, installation and getting started
- difficulty
- ★
- you will learn
- installation,
/login, first task, basic operations
02
- Documentation
- Core concepts: agent loop, session tree, branching and compression
- difficulty
- ★★
- you will learn
- Understand how Pi works internally
03
- Documentation
- Usage Tips: Four Modes, Models and Provider Configuration
- difficulty
- ★★
- you will learn
- print/JSON/RPC、
models.json, tool selection, safety
04
- Documentation
- Customization: context files, prompt templates, skills, themes, settings
- difficulty
- ★★★
- you will learn
- Transform Pi without writing code
05
- Documentation
- Extension development: TypeScript registration tool/command/event
- difficulty
- ★★★★
- you will learn
- Write your own extension
06
- Documentation
- SDK and RPC integration
- difficulty
- ★★★★
- you will learn
- Embed Pi into your own applications or other languages
07
- Documentation
- Advanced: MCP, Codemode, virtual model, custom Provider, Pi package distribution
- difficulty
- ★★★★★
- you will learn
- 0.99+ New Features and Distribution
08
- Documentation
- Practical project exercises and reference materials
- difficulty
- ★★★★★
- you will learn
- Comprehensive project + data index
| No. | Documentation | difficulty | you will learn |
|---|---|---|---|
| 00 | Learning route and catalog (this article) | ★ | Global understanding, version, reading order |
| 01 | What is Pi, installation and getting started | ★ | installation,/login, first task, basic operations |
| 02 | Core concepts: agent loop, session tree, branching and compression | ★★ | Understand how Pi works internally |
| 03 | Usage Tips: Four Modes, Models and Provider Configuration | ★★ | print/JSON/RPC、models.json, tool selection, safety |
| 04 | Customization: context files, prompt templates, skills, themes, settings | ★★★ | Transform Pi without writing code |
| 05 | Extension development: TypeScript registration tool/command/event | ★★★★ | Write your own extension |
| 06 | SDK and RPC integration | ★★★★ | Embed Pi into your own applications or other languages |
| 07 | Advanced: MCP, Codemode, virtual model, custom Provider, Pi package distribution | ★★★★★ | 0.99+ New Features and Distribution |
| 08 | Practical project exercises and reference materials | ★★★★★ | Comprehensive project + data index |
5. Suggested learning methods
- Use it first: 01, 02, 03 It is recommended to operate on the terminal while reading, and complete the task of "Let Pi change a small project" at least once.
- Customized according to the principle of "minimum mechanism": The official Quickstart gives the order of selecting customization methods - it can be used
AGENTS.mdThere is no need for templates. If you can use templates, you don’t need skills. If you can use skills, you don’t need extensions (see 04 Customized)。 - Subject to examples: Officially stated clearly "The checked extension examples are the implementation reference". When writing extensions/SDK, open the warehouse first
packages/coding-agent/examples/Contrast. - Subject to type declaration: Check the exact signature
node_modules/@earendil-works/pi-coding-agent/dist/down.d.ts, or source codesrc/core/extensions/types.ts。
6. Official customization method selection table (from Quickstart)
Provide persistent directives for a directory
- preferred mechanism
AGENTS.md(context file)
in
/Menu reuses a prompt word- preferred mechanism
- Prompt template
Add task-specific instructions and supporting files
- preferred mechanism
- Skill
Add executable tools, commands, or event handlers
- preferred mechanism
- Extension
Build custom terminal components
- preferred mechanism
- Terminal UI
Accessing an unsupported model service
- preferred mechanism
- Custom Provider
Install or distribute multiple resources
- preferred mechanism
- Pi package (Pi package)
| demand | preferred mechanism |
|---|---|
| Provide persistent directives for a directory | AGENTS.md(context file) |
in / Menu reuses a prompt word | Prompt template |
| Add task-specific instructions and supporting files | Skill |
| Add executable tools, commands, or event handlers | Extension |
| Build custom terminal components | Terminal UI |
| Accessing an unsupported model service | Custom Provider |
| Install or distribute multiple resources | Pi package (Pi package) |
7. Small exercises
- open https://pi.dev/docs/latest/ , browse the left navigation and find the three pages "How Pi Works", "SDK" and "Codemode".
- run
npm view @earendil-works/pi-coding-agent version, confirm the current latest version number. - Open at GitHub
packages/coding-agent/examples/extensions/README.md, pick 3 extension examples that interest you the most and write them down, and come back after learning 05 to implement or transform them.
8. Official sources
- Official website document homepage:https://pi.dev/docs/latest/
- Quickstart:https://pi.dev/docs/latest/quickstart
- Warehouse:https://github.com/earendil-works/pi (original https://github.com/badlogic/pi-mono )
- coding-agent CHANGELOG:https://github.com/earendil-works/pi/blob/main/packages/coding-agent/CHANGELOG.md
- npm:https://www.npmjs.com/package/@earendil-works/pi-coding-agent