Pi Coding Agent

Open the original

Short summary

Pi is an open-source coding agent you can install from npm, pnpm, or Bun, and then reshape to fit your own workflow. Its core stays small on purpose, with features like sub-agents and plan mode left for you to build or install as packages.

  • The default install is deliberately lean. Customization happens through TypeScript extensions, skills, prompt templates, and themes, which can be shared as npm or git packages.
  • It supports a wide range of model providers, including Anthropic, OpenAI, Google, Ollama, and OpenRouter, and you can switch models mid-session.
  • Sessions are stored as trees in a single file, so you can jump back to any earlier point and branch from there, and export or share them as HTML or gists.

Full summary

Pi is a minimal coding agent harness distributed as the npm package @earendil-works/pi-coding-agent, with install scripts for curl, PowerShell, npm, pnpm, and bun. Its pitch is that you adapt the tool to your workflow rather than the reverse. The core ships without sub-agents or plan mode, and instead of baking those in, it expects you to ask Pi to build them or install a package that does. Extensions are TypeScript modules with access to tools, commands, keyboard shortcuts, events, and the TUI. Skills, prompt templates, and themes round out the customization surface, and all of it can be bundled and shared via npm or git with a single command like `pi install npm:@foo/pi-tools`. The page lists examples of what people have built this way, including MCP integration, permission gates, SSH execution, sandboxing, and status bars. On the model side, Pi supports a long list of providers, including Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, OpenRouter, and Ollama, with authentication via API keys or OAuth. You can switch models mid-session with /model or Ctrl+L and cycle favorites with Ctrl+P. Custom providers can be added through models.json or extensions. Sessions are stored as trees in a single file, so you can use /tree to jump back to any earlier point and branch from there, filter by message type, and bookmark entries. Sessions can be exported to HTML with /export or shared as a GitHub gist via /share. The context management story is where the design gets most deliberate. Project instructions load from AGENTS.md at startup, SYSTEM.md can replace or extend the system prompt per project, and compaction automatically summarizes older messages near the context limit, with the summarization itself replaceable through extensions. Skills load on demand so they don't invalidate the prompt cache, and prompt templates expand with a slash command. Extensions can inject messages before each turn, filter history, or implement retrieval and long-term memory. Input handling is split too: Enter sends a steering message that interrupts remaining tools, while Alt+Enter queues a follow-up for after the agent finishes. The four run modes (interactive TUI, print/JSON for scripts, RPC over stdin/stdout, and an SDK for embedding) make it usable beyond the terminal, with OpenClaw cited as a real integration.

Ask about this article