Pi is a minimal, terminal-based coding agent by Mario Zechner (creator of libGDX). Open source (MIT), installed via npm install -g @mariozechner/pi-coding-agent.
"Adapt pi to your workflows, not the other way around."
It's the "Unix philosophy" coding agent — a small, extensible harness with just 4 built-in tools (read, write, edit, bash), and everything else is user-composable.
Pi gives the LLM four built-in tools and runs in four modes:
- Interactive — full TUI experience
- Print/JSON —
pi -p "query"for scripting,--mode jsonfor event streams - RPC — JSON protocol over stdin/stdout for non-Node integrations
- SDK — embeddable in your own apps via TypeScript API
| Feature | Pi | Claude Code | Cursor / Copilot |
|---|---|---|---|
| Model support | 15+ providers (Anthropic, OpenAI, Google, Mistral, Ollama, etc.) — switch mid-session | Anthropic only | Mostly tied to vendor |
| Extension system | Full TypeScript extension API — replace tools, add commands, custom TUI | Hooks + MCP | Plugin/extension based |
| Package ecosystem | pi install npm:... / pi install git:... for sharing skills, extensions, themes |
No marketplace | No marketplace |
| Sub-agents | Build your own (spawn pi instances via tmux) | Built-in Agent tool | Built-in |
| Permissions | None by default — use containers or build via extensions | Built-in permission system | IDE-integrated |
| Plan mode | Write plans to files, or build via extension | Built-in | Built-in |
| MCP support | Not built-in — use "Skills" (CLI tools + READMEs) instead | Built-in | Varies |
| Session model | Tree-structured — branch/fork from any point | Linear history | Linear |
This is the central difference. Where Claude Code, Cursor, and Copilot bake in features like sub-agents, plan mode, permission popups, MCP support, and background bash, pi intentionally omits all of these from the core and instead provides primitives to build them yourself:
- No MCP — Use "Skills" (CLI tools with READMEs) instead, or write an extension that adds MCP
- No sub-agents — Spawn pi instances via tmux, or build your own via extensions
- No permission popups — Run in a container, or build custom confirmation flows via extensions
- No plan mode — Write plans to files, or build it with extensions
- No built-in to-dos — Use a TODO.md file
- No background bash — Use tmux directly
All of these are available as example extensions (50+ examples provided), so users can adopt them if desired.
Unlike Claude Code (Anthropic-only) or GitHub Copilot (tied to GitHub/OpenAI), pi supports Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, Kimi, MiniMax, OpenRouter, Ollama, and more. You can switch models mid-session with /model or Ctrl+L, and cycle through favorites with Ctrl+P. Custom providers can be added via config or extensions.
Pi has a package system for sharing extensions, skills, prompt templates, and themes. This is more like a plugin marketplace model — something none of the major CLI agents (Claude Code, Aider) offer in a structured way.
Sessions are stored as tree structures in JSONL files. You can use /tree to navigate to any previous point in a conversation and branch from there. All branches live in a single file. This is more sophisticated than the linear session history in most competing tools.
Pi takes a "context engineering" approach with a deliberately minimal system prompt and multiple layers of control:
- AGENTS.md / CLAUDE.md — project instructions loaded at startup
- SYSTEM.md — replace or append to the default system prompt per-project
- Skills — on-demand capability packages (progressive disclosure without busting prompt cache)
- Prompt Templates — reusable Markdown prompts expanded via
/name - Dynamic context via extensions — inject messages before each turn, filter history, implement RAG, or build long-term memory
- Customizable compaction — auto-summarizes older messages when approaching context limits; fully overridable
You can submit messages while the agent is working: Enter sends a steering message (interrupts after current tool), Alt+Enter queues a follow-up (waits until agent finishes). This is a unique UX feature not found in most competitors.
- Low lock-in: Model-agnostic, open source MIT, no vendor dependency
- Scriptable: Print mode (
pi -p "...") and piped stdin make it easy to integrate into CI/CD, shell scripts, and automation - Embeddable: SDK and RPC modes let you build pi into other applications
- Customizable tools: You can replace or augment built-in tools (read, write, edit, bash) — e.g., add
grep,find,ls, or entirely custom tools - Per-project configuration:
.pi/settings.json,.pi/extensions/,.pi/skills/allow project-specific agent behavior - Session management: Continue (
-c), resume (-r), fork, and branch sessions; export to HTML or share via GitHub gist - Thinking level control: Cycle through off/minimal/low/medium/high/xhigh with
Shift+Tab, with editor border color indicating current level - OAuth login support: Use existing subscriptions (Claude Pro/Max, ChatGPT Plus/Pro, GitHub Copilot, Google Gemini CLI) rather than just API keys
- File references with
@: Fuzzy-search project files inline in the editor - Image support: Paste images with
Ctrl+Vor drag onto terminal - Shareable sessions: Export to HTML or upload to GitHub gist with a rendered shareable URL
- Cross-platform: Supports macOS, Linux, Windows, and even Termux on Android
- Runtime: Node.js / TypeScript
- Package:
@mariozechner/pi-coding-agenton npm - Monorepo structure with three core packages:
@mariozechner/pi-ai— core LLM toolkit@mariozechner/pi-agent— agent framework@mariozechner/pi-tui— terminal UI components
- Extension API: TypeScript modules that receive an
ExtensionAPIobject with access to tools, commands, keyboard shortcuts, events, and TUI rendering - Session storage: JSONL files with tree structure (id/parentId), stored in
~/.pi/agent/sessions/organized by working directory - Follows the Agent Skills standard (agentskills.io) for skill definitions
| Strength | Trade-off |
|---|---|
| Minimal core | More barebones out-of-the-box — you build what you need |
| No built-in permissions | Must use containers or build your own guardrails |
| No MCP | Must use Skills pattern or write extensions |
| Extension-heavy approach | Requires TypeScript knowledge for deep customization |
Pi is for developers who want full control over their AI coding workflow and are willing to invest in customization. Claude Code and Cursor give you more out-of-the-box; Pi gives you more composability and zero vendor lock-in. Think of it as the "Vim of AI coding agents" — powerful once configured, but requires setup.