Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript Extensions, Skills, Prompt Templates, and Themes. Put your extensions, skills, prompt templates, and themes in Pi Packages and share them with others via npm or git.
Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow.
Pi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See openclaw/openclaw for a real-world SDK integration.
Then just talk to pi. By default, pi gives the model four tools: read, write, edit, and bash. The model uses these to fulfill your requests. Add capabilities via skills, prompt templates, extensions, or pi packages.
For each built-in provider, pi maintains a list of tool-capable models, updated with every release. Authenticate via subscription (/login) or API key, then select any model from that provider via /model (or Ctrl+L).
Subscriptions: - Anthropic Claude Pro/Max - OpenAI ChatGPT Plus/Pro (Codex) - GitHub Copilot - Google Gemini CLI - Google Antigravity
API keys: - Anthropic - OpenAI - Azure OpenAI - Google Gemini - Google Vertex - Amazon Bedrock - Mistral - Groq - Cerebras - xAI - OpenRouter - Vercel AI Gateway - ZAI - OpenCode Zen - Hugging Face - Kimi For Coding - MiniMax
Custom providers & models: Add providers via ~/.pi/agent/models.json if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See docs/models.md and docs/custom-provider.md.
---
Interactive Mode
The interface from top to bottom:
- Startup header - Shows shortcuts (/hotkeys for all), loaded AGENTS.md files, prompt templates, skills, and extensions - Messages - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI - Editor - Where you type; border color indicates thinking level - Footer - Working directory, session name, total token/cache usage, cost, context usage, current model
The editor can be temporarily replaced by other UI, like built-in /settings or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). Extensions can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
$3
| Feature | How | |---------|-----| | File reference | Type @ to fuzzy-search project files | | Path completion | Tab to complete paths | | Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) | | Images | Ctrl+V to paste, or drag onto terminal | | Bash commands | !command runs and sends output to LLM, !!command runs without sending |
Standard editing keybindings for delete word, undo, etc. See docs/keybindings.md.
$3
Type / in the editor to trigger commands. Extensions can register custom commands, skills are available as /skill:name, and prompt templates expand via /templatename.
| Command | Description | |---------|-------------| | /login, /logout | OAuth authentication | | /model | Switch models | | /scoped-models | Enable/disable models for Ctrl+P cycling | | /settings | Thinking level, theme, message delivery | | /resume | Pick from previous sessions | | /new | Start a new session | | /name | Set session display name | | /session | Show session info (path, tokens, cost) | | /tree | Jump to any point in the session and continue from there | | /fork | Create a new session from the current branch | | /compact [prompt] | Manually compact context, optional custom instructions | | /copy | Copy last assistant message to clipboard | | /export [file] | Export session to HTML file | | /share | Upload as private GitHub gist with shareable HTML link | | /reload | Reload extensions, skills, commands, context files (themes hot-reload automatically) | | /hotkeys | Show all keyboard shortcuts | | /changelog | Display version history | | /quit, /exit | Quit pi |
$3
See /hotkeys for the full list. Customize via ~/.pi/agent/keybindings.json. See docs/keybindings.md.
- Enter queues a steering message, delivered after current tool execution (interrupts remaining tools) - Alt+Enter queues a follow-up message, delivered only after the agent finishes all work - Escape aborts and restores queued messages to editor - Alt+Up retrieves queued messages back to editor
Configure delivery in settings: steeringMode and followUpMode can be "one-at-a-time" (default, waits for response) or "all" (delivers all queued at once).
---
Sessions
Sessions are stored as JSONL files with a tree structure. Each entry has an id and parentId, enabling in-place branching without creating new files. See docs/session.md for file format.
$3
Sessions auto-save to ~/.pi/agent/sessions/ organized by working directory.
`bash pi -c # Continue most recent session pi -r # Browse and select from past sessions pi --no-session # Ephemeral mode (don't save) pi --session # Use specific session file or ID `
$3
/tree - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.
- Search by typing, page with ←/→ - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all - Press l to label entries as bookmarks
/fork - Create a new session file from the current branch. Opens a selector, copies history up to the selected point, and places that message in the editor for modification.
$3
Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
Manual: /compact or /compact
Automatic: Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via /settings or settings.json.
Compaction is lossy. The full history remains in the JSONL file; use /tree to revisit. Customize compaction behavior via extensions. See docs/compaction.md for internals.
---
Settings
Use /settings to modify common options, or edit JSON files directly:
What's possible: - Custom tools (or replace built-in tools entirely) - Sub-agents and plan mode - Custom compaction and summarization - Permission gates and path protection - Custom editors and UI components - Status lines, headers, footers - Git checkpointing and auto-commit - SSH and sandbox execution - MCP server integration - Make pi look like Claude Code - Games while waiting (yes, Doom runs) - ...anything you can dream up
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on npmjs.com or Discord.
> Security: Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
`bash pi install npm:@foo/pi-tools pi install npm:@foo/pi-tools@1.2.3 # pinned version pi install git:github.com/user/repo pi install git:github.com/user/repo@v1 # tag or commit pi install https://github.com/user/repo pi remove npm:@foo/pi-tools pi list pi update # skips pinned packages pi config # enable/disable extensions, skills, commands, themes `
Packages install to
~/.pi/agent/git/ (git) or global npm. Use -l for project-local installs (.pi/git/, .pi/npm/).
Pi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with extensions, skills, or installed from third-party pi packages. This keeps the core minimal while letting you shape pi to fit how you work.
No MCP. Build CLI tools with READMEs (see Skills), or build an extension that adds MCP support. Why?
No sub-agents. There's many ways to do this. Spawn pi instances via tmux, or build your own with extensions, or install a package that does it your way.
No permission popups. Run in a container, or build your own confirmation flow with extensions inline with your environment and security requirements.
No plan mode. Write plans to files, or build it with extensions, or install a package.
No built-in to-dos. They confuse models. Use a TODO.md file, or build your own with extensions.
No background bash. Use tmux. Full observability, direct interaction.
`bash pi install [-l] # Install package, -l for project-local pi remove [-l] # Remove package pi update [source] # Update packages (skips pinned) pi list # List installed packages pi config # Enable/disable package resources `
-p, --print | Print response and exit | | --mode json | Output all events as JSON lines (see docs/json.md) | | --mode rpc | RPC mode for process integration (see docs/rpc.md) | | --export [out] | Export session to HTML |
--system-prompt | Replace default prompt (context files and skills still appended) | | --append-system-prompt | Append to system prompt | | --verbose | Force verbose startup | | -h, --help | Show help | | -v, --version | Show version |
$3
Prefix files with
@ to include in the message:`bash pi @prompt.md "Answer this" pi -p @screenshot.png "What's in this image?" pi @code.ts @test.ts "Review these files" `
$3
`bash
Interactive with initial prompt
pi "List all .ts files in src/"
Non-interactive
pi -p "Summarize this codebase"
Different model
pi --provider openai --model gpt-4o "Help me refactor"