Pi coding agent guide: install, the four-tool design, extensions and modes
Pi is a terminal coding agent with a different philosophy from most of its competitors. Where Claude Code, Codex CLI and OpenCode keep adding built-in features, Pi keeps its core small and asks you to add only what you use.
Mario Zechner, known for the libGDX game framework, started Pi in August 2025. He described his reasoning in a November 2025 blog post: he wanted an agent with a short, readable system prompt, a handful of tools and no hidden behavior, so he could see exactly what the model was given and why it acted as it did. The project gathered a strong following among developers who felt the same. Armin Ronacher, creator of Flask, became one of its most active contributors. The repository now sits at earendil-works/pi, has more than 100,000 GitHub stars, and reached version 1.0 alongside a durable session feature called Pi Durable.
The four-tool design
Pi gives the model four tools:
| Tool | What it does |
|---|---|
| read | Read a file, or part of one |
| write | Create or overwrite a file |
| edit | Replace a specific piece of text in a file |
| bash | Run a shell command |
Everything else, such as searching code, running tests, using git or calling APIs, happens through bash, which frontier models already use well. The system prompt plus tool definitions use under 1,000 tokens. Many agents spend several thousand tokens of every request on instructions before your code appears.
Pi leaves out features that other agents treat as standard: subagents, plan mode, built-in to-do lists and background tasks. Zechner's position is that these features often add behavior you cannot see, and that a capable model with a shell can do the same work when you ask it to. If you want them, extensions can add them.
Installing Pi
| Method | Command |
|---|---|
| Install script | curl -fsSL https://pi.dev/install.sh | sh |
| npm | npm install -g --ignore-scripts @earendil-works/pi-coding-agent |
The npm package needs Node.js 22.19 or later. After installing, run pi inside a project.
Models and logins
Pi works with many providers, including Anthropic, OpenAI, Google, xAI, Groq, Mistral, OpenRouter and local servers that speak the OpenAI API format. You can switch models mid-session, and Pi keeps the conversation when you do, which makes it easy to hand a hard problem to a stronger model.
The /login command signs in to supported subscription services so you can use a plan you already pay for. Check each provider's terms first. Anthropic, for example, limits consumer Claude subscriptions to its own apps, so use an API key for Claude models.
Project instructions
Pi reads AGENTS.md from your project and home directory as standing instructions, the same format used by Codex CLI, OpenCode and others. Keep build and test commands, code style and project notes there. Because Pi's own prompt is short, your AGENTS.md has more influence on its behavior than in agents with long built-in prompts.
Extensions, skills and packages
Pi's customization works at three levels:
- Extensions are TypeScript modules that can add tools, slash commands, keyboard shortcuts and interface elements, or hook into each step of the agent loop. You can write one to block certain commands, add a confirmation step before
git push, or add a subagent tool. - Skills are instruction files, with optional scripts, that the model loads when a task calls for them. They follow the same idea as Claude Code's skills.
- Packages bundle extensions and skills so you can share them or install other people's from npm or git.
The community has published packages for web search, MCP support, subagents, plan modes and many other features. You choose which ones to trust and load.
Ways to run Pi
| Mode | How | Use it for |
|---|---|---|
| Interactive | pi | Day-to-day coding in the terminal |
pi -p "prompt" | One-off tasks and shell scripts, with text or JSON output | |
| RPC | pi --mode rpc | Driving Pi from another program over stdin and stdout |
| SDK | Import the package | Embedding the agent in your own app |
The SDK is why Pi shows up inside other projects. OpenClaw, an open-source personal assistant, uses Pi as its agent core.
Sessions
Pi stores sessions as files you can resume, branch from an earlier point and share. Branching is useful when an attempt goes wrong: go back to the message before the mistake and try a different instruction, without losing the original path.
Where Pi works well
- Experienced developers who want to see and control everything the model receives.
- Long sessions, where a smaller fixed prompt leaves more room for code.
- People building their own agent workflows, through extensions or the SDK.
- Teams that want to standardize on one small, auditable core with a vetted list of extensions.
Limits and risks
Less out of the box. New users who expect plan mode, subagents or built-in MCP support will need to install packages or work without them.
No permission prompts by default. Pi's core trusts the model with bash. Zechner argues that permission prompts give a false sense of security, since a model with a shell can find ways around them. If you want approvals, add an extension, and run Pi in a container or virtual machine for anything risky.
Third-party extensions run with your permissions. Read an extension's code before installing it, as you would any npm package.
Model quality matters more. With fewer guardrails in the prompt, weaker models make more mistakes. Pi works best with frontier models.
Pi compared with other terminal agents
| Tool | Core size | License | Extensibility |
|---|---|---|---|
| Pi | 4 tools, under 1,000-token prompt | MIT | TypeScript extensions, skills, packages, SDK |
| Claude Code | Many built-in tools and modes | Proprietary | Hooks, skills, plugins, MCP |
| OpenCode | Build and plan agents, LSP | MIT | Custom agents, commands, MCP, SDK |
| Codex CLI | Built-in sandbox and review | Apache 2.0 | MCP, config |
| Aider | Edit formats and repo map | Apache 2.0 | Config and scripting |
Choose Pi if you want a small, predictable agent you shape yourself. Choose Claude Code or OpenCode if you want more built in from the first run. See the terminal tools guide for the rest.
Frequently asked questions
What is Pi?
Pi is a coding agent you run in the terminal, like Claude Code or OpenCode, built around a deliberately small core. It gives the model four tools and a very short system prompt, and leaves features such as subagents, planning modes and to-do lists out of the core. Mario Zechner wrote it because he wanted an agent whose behavior he could predict and control. It is MIT licensed and works with many model providers.
How do I install Pi?
Run curl -fsSL https://pi.dev/install.sh | sh, or install from npm with npm install -g --ignore-scripts @earendil-works/pi-coding-agent, which needs Node.js 22.19 or later. Then change into a project and run pi. Use /login to sign in to a supported subscription or set an API key for your provider.
Why does Pi have only four tools?
Zechner's argument is that frontier models are already trained to use a shell well, so read, write, edit and bash cover almost everything an agent needs, and every extra tool or long instruction costs context and makes behavior harder to predict. Pi's system prompt and tool definitions together use under 1,000 tokens. Features other agents build in, such as subagents or plan mode, can be added as extensions if you want them.
Can I extend Pi?
Yes. Pi supports extensions written in TypeScript that add tools, commands, interface elements or hooks into the agent loop, plus skills, which are instruction files the model loads when relevant, and packages that bundle extensions and skills for sharing. Many community packages add features such as subagents, web search or MCP support.
Can I use Pi from my own program?
Yes. Besides the interactive terminal interface, Pi has a print mode, pi -p, that runs one prompt and prints the result or JSON, an RPC mode for driving it from another process over standard input and output, and an SDK for embedding the agent in your own application. OpenClaw, a popular personal assistant project, is built on Pi.