What is Pi
Pi (Agent Harness) is a minimalist open-source terminalcoding Agent, launched by Mario Zechner, and is also the underlying Coding Agent of OpenClaw . The tool only gives the model four basic tools: read, write, edit, and bash. The system prompt is less than 1000 tokens, and all other functionality is delegated to TypeScript extensions. Pi supports 15+ model providers, tree-like forked sessions, and cross-vendor model switching.
Pi's main features
- Minimalist toolset: By default, only four tools are given to the model: read, write, edit, and bash. Operations such as search are left to the model to solve using grep/find, and the system prompt is less than 1000 tokens.
- Multi-model integration: Built-in 15+ providers (Anthropic, OpenAI, Kimi, DeepSeek, MiniMax, etc.), supporting both OAuth subscription login and API Key.
- Tree-like session history: Sessions are stored in a tree structure. You can jump back to any historical node at any time to ask again, fork for trial and error, and all branches coexist in one file.
- Cross-vendor model switching: During a session, you can use
/modelorCtrl+Lto switch between models from different vendors, with automatic context handover and conversion. - Four run modes: Interactive TUI, Print/JSON script mode, RPC protocol, and Node.js SDK, satisfying different scenarios from daily coding to program integration.
- Extension customization: TypeScript extension modules can be hot-loaded when dropped into the directory. They can register custom tools and commands, intercept events, and allow Pi to write extensions for itself on the spot.
- Skills and Prompt templates: Supports the Agent Skills standard. Markdown files can directly become parameterized
/commands. - Community package ecosystem: Extensions, Skills, templates, and themes can be packaged as Pi packages and installed and shared with one click via
pi install npm:xxxor git repositories. - Compatible with existing configurations: Automatically searches along the directory tree and recognizes AGENTS.md and CLAUDE.md. Existing Claude Code configurations require no migration.
- Context engineering: Supports SYSTEM.md overriding the system prompt, automatic Compaction summaries, and dynamic context injection, allowing users to precisely control every token entering the context window.
Follow on WeChat and reply with “open source” to join theAI open-source project community group
How to use Pi
- Install: Install Pi in the terminal by running
npm install -g --ignore-scripts @earendil-works/pi-coding-agentorcurl -fsSL https://pi.dev/install.sh | sh. - Launch: After installation is complete, enter
piin the terminal to enter the interactive TUI interface. - Login configuration: For first-time use, run
/login, and choose OAuth subscription login or fill in an API Key to configure the model provider. - Enter the project: Enter your project directory and type
pi. Pi will automatically loadAGENTS.mdorCLAUDE.mdin the current directory and parent directories as context. - Start a conversation: In the interactive interface, directly describe your needs in natural language, use
@to fuzzy-search files,!to execute Shell commands,Ctrl+VPaste image. - Switch models: If you need to change models, you can enter
/modelat any time or pressCtrl+Lto switch between models from different vendors, and the context will be handed over automatically. - Tree-based backtracking: Use the
/treecommand to view the tree-structured session history, and jump back to any node to ask again or branch out for trial and error. - Extensions: If you need to extend functionality, you can write TypeScript extension modules in the
~/.pi/agent/extensions/directory, and after saving, enter/reloadto hot-reload and take effect. - Export and share: After the session ends, you can use
/exportto export as HTML, or use/shareto generate a GitHub Gist share link. - Exit and resume: Press
Ctrl+CorCtrl+Dto exit the current session, and next time usepi -cto continue the previous conversation.
Pi's core advantages
- Minimal and efficient: The system prompt plus tool definitions total less than 1000 tokens, giving the model only four basic tools, for extremely fast responses.
- Precise context control: Supports SYSTEM.md, AGENTS.md, dynamic context injection, and automatic Compaction, so you can decide how each token enters the context.
- Powerful extensibility: TypeScript extensions take effect immediately with hot reloading, and Pi can even be made to write extensions for itself on the spot; things the official team does not build are filled in by the community with packages.
- Tree-structured session history: Sessions are stored in a tree structure, so you can jump back to any node at any time and branch out for trial and error, avoiding the sunk cost of linear conversations.
- Seamless cross-vendor switching: Built in with 15+ providers, you can switch between models from different vendors at any time during a session, with automatic context handover and conversion.
- Zero migration cost: Automatically recognizes CLAUDE.md and AGENTS.md, and the Skills standard is compatible with Claude Code and Codex, so existing configurations can be reused directly.
- Friendly to domestic models: Built in with domestic models such as DeepSeek, Kimi, Zhipu, Qwen, MiniMax, and MiMo, with separately configured China-region nodes.
- Fully open source under MIT: The code is fully public, the supply chain security is hardened, and the community has already produced multiple ports in Go, Rust, Python, and more.
- Four operating modes: Interactive TUI, Print/JSON, RPC, and SDK cover the full range of scenarios from daily coding to enterprise integration.
- Self-explanation capability: Pi can explain its own features and documentation, and can even directly help you look up docs and write configurations, lowering the barrier to entry.
Pi's project addresses
- Project website:https://pi.dev/
- GitHub repository:https://github.com/earendil-works/pi
Comparison of Pi's similar competitors
| Dimension | Pi | Claude Code |
|---|---|---|
| Positioning | Minimal and extensible Agent Harness | Full-featured, ready-to-use Coding Agent |
| System prompt | < 1000 tokens, minimalist | Tens of thousands of tokens, feature-rich |
| Built-in tools | Only 4: read, write, edit, bash | A large number of built-in tools, including file search, code analysis, etc. |
| Sub-agents | Not built in; you need to spawn via bash yourself or install an extension | Native support |
| Plan Mode | Not built in; writing PLAN.md is recommended | Native support |
| MCP support | Not built in; the community has pi-mcp-adapter |
Native support |
| Permission confirmation | YOLO mode by default, no pop-ups | Has a permission pop-up confirmation mechanism |
| Model support | 15+ providers, switchable across vendors | Limited to Anthropic Claude |
| Session structure | Tree-structured history, supports branching and backtracking | Linear history |
Pi use cases
- Rapid scripting and prototyping: Use natural language directly in the terminal to generate, debug, and run scripts, and tree-structured sessions support quickly trying different implementation approaches.
- Codebase refactoring and maintenance: Use Pi's code editing capabilities and cross-model switching features to perform batch refactoring in large projects, while distilling project conventions through AGENTS.md.
- Custom development workflows: By writing TypeScript extensions, turn Pi into a dedicated toolchain that fits a team or individual (such as automated code review, documentation generation, and scaffolding for specific frameworks).
- Open-source collaboration and knowledge sharing: Use
/shareto export a GitHub Gist or/exportto generate HTML, sharing the complete debugging and development process with collaborators or using it for technical blogs. - Remote servers and containerized development: Run Pi on an SSH server or in a Docker container, and use tmux to achieve persistent background sessions, making it suitable for cloud development, CI/CD pipeline integration, and other GUI-less environments.