Pi – 一个极简的终端编码工具。
Pi – A minimal terminal coding harness

原始链接: https://pi.dev

## pi:一个极简且可扩展的编码代理 `pi` 是一个基于终端的编码代理,旨在适应性强——它优先考虑*你的*工作流程,而不是强制规定。使用 `npm install -g @mariozechner/pi-coding-agent` 安装。 它支持 15 多个提供商(OpenAI、Google、Mistral 等),并提供四种模式:交互式、打印/JSON、RPC 和 SDK。主要功能包括树形结构的可共享会话历史记录以及通过可定制的系统提示和压缩实现强大的上下文工程。 `pi` 不像内置子代理或计划模式等功能,而是强调使用 TypeScript 构建的**扩展**。这允许用户构建或安装软件包来实现这些功能,保持核心极简。 `pi` 支持技能(指令/工具包)、提示模板和动态上下文注入。可以轻松地从 npm 或 git 安装软件包并与社区共享。它专为完全可观察性和直接交互而设计,为编码任务提供灵活的基础。 本质上,`pi` 提供基本要素——你构建*你*需要的功能。

## Pi:一个极简终端编码工具 - 摘要 Hacker News 的讨论围绕着 **Pi** 展开,这是一个新的开源“编码工具”([pi.dev](https://pi.dev)),因其灵活性和用户控制力而备受关注。与传统的编码助手不同,Pi 强调通过可下载的“技能文件”进行扩展,以定制代理的行为,将软件变成一个个性化、不断进化的工具。 用户称赞 Pi 的设计提供了所有权和自由感,这与许多商业软件的限制性形成了对比。一个关键点是转向更沙盒友好的方法,鼓励用户在隔离环境中运行代理以提高安全性。 对话突出了 Pi 的可扩展性,用户分享了分支和集成(如 Oh-My-Pi),并讨论了沙盒解决方案。 关于是否需要内置功能(如规划和子代理)存在争论,许多人认为 Pi 的架构允许用户将其添加为扩展。 几位用户报告称 Pi 显著提高了 Qwen3 等模型的性能,并为 Claude Code 等工具提供了令人耳目一新的替代方案。 最终,Pi 被视为赋予用户定制编码体验并重新掌控工具的权力。
相关文章

原文

There are many coding agents, but this one is mine.

$ npm install -g @mariozechner/pi-coding-agent

About

Why pi?

Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around. Extend it with TypeScript extensions, skills, prompt templates, and themes. Bundle them as pi packages and share via npm or git.

Pi ships with powerful defaults but skips features like sub-agents and plan mode. Ask pi to build what you want, or install a package that does it your way.

Four modes: interactive, print/JSON, RPC, and SDK. See clawdbot for a real-world integration.

Read the docs

Providers & Models

15+ providers, hundreds of models

Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, Hugging Face, Kimi For Coding, MiniMax, OpenRouter, Ollama, and more. Authenticate via API keys or OAuth.

Switch models mid-session with /model or Ctrl+L. Cycle through your favorites with Ctrl+P.

Add custom providers and models via models.json or extensions.

Sessions

Tree-structured, shareable history

Sessions are stored as trees. Use /tree to navigate to any previous point and continue from there. All branches live in a single file. Filter by message type, label entries as bookmarks.

Tree view in pi

Export to HTML with /export, or upload to a GitHub gist with /share and get a shareable URL that renders it.

Context

Context engineering

Pi's minimal system prompt and extensibility let you do actual context engineering. Control what goes into the context window and how it's managed.

AGENTS.md: Project instructions loaded at startup from ~/.pi/agent/, parent directories, and the current directory.

SYSTEM.md: Replace or append to the default system prompt per-project.

Compaction: Auto-summarizes older messages when approaching the context limit. Fully customizable via extensions: implement topic-based compaction, code-aware summaries, or use different summarization models.

Skills: Capability packages with instructions and tools, loaded on-demand. Progressive disclosure without busting the prompt cache. See skills.

Prompt templates: Reusable prompts as Markdown files. Type /name to expand. See prompt templates.

Dynamic context: Extensions can inject messages before each turn, filter the message history, implement RAG, or build long-term memory.

Queuing

Steer or follow up

Submit messages while the agent works. Enter sends a steering message (delivered after current tool, interrupts remaining tools). Alt+Enter sends a follow-up (waits until the agent finishes).

Extensions

Primitives, not features

Features that other agents bake in, you can build yourself. Extensions are TypeScript modules with access to tools, commands, keyboard shortcuts, events, and the full TUI.

Sub-agents, plan mode, permission gates, path protection, SSH execution, sandboxing, MCP integration, custom editors, status bars, overlays. Yes, Doom runs.

Doom running in pi

Don't want to build it? Ask pi to build it for you. Or install a package that does it your way. See the 50+ examples.

Packages

Install and share

Bundle extensions, skills, prompts, and themes as packages. Install from npm or git:

$ pi install npm:@foo/pi-tools
$ pi install git:github.com/badlogic/pi-doom

Pin versions with @1.2.3 or @tag. Update all with pi update, list with pi list, configure with pi config.

Test without installing using pi -e git:github.com/user/repo.

Find packages on npm or Discord. Share yours with the pi-package keyword.

Browse packages

Integration

Four modes

Interactive: The full TUI experience.

Print/JSON: pi -p "query" for scripts, --mode json for event streams.

RPC: JSON protocol over stdin/stdout for non-Node integrations. See docs/rpc.md.

SDK: Embed pi in your apps. See clawdbot for a real-world example.

Philosophy

What we didn't build

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. Use a TODO.md file, or build your own with extensions.

No background bash. Use tmux. Full observability, direct interaction.

联系我们 contact @ memedata.com