pi:一个可以自己改造的极简编程智能体pi: a minimal coding agent you make your own
pi 是终端里的小型开源编程智能体。缺什么功能,自己加。
总览。 四种入口:终端界面、打印或 JSON 模式、RPC、SDK,共用一个会话。pi 拼请求,循环调模型和工具,保存对话。pi-ai 内置 42 家模型厂商。
pi 命令在 pi-coding-agent 里,基于 pi-agent-core 和 pi-ai。远程会话的包仍是实验版。
请求带系统提示词、工具列表和对话。项目的 .pi 目录要先信任才加载。技能用到才读全文。
模型回文字和工具调用。pi 逐个检查,默认并行执行,记下结果,再来一轮。中途可以插话。
默认开四个工具:read、bash、edit、write。codemode 和 tool-search 是内置扩展,工具默认关,MCP 需要时自动开。
MCP 服务端写在 mcp.json。默认模型看不到 MCP 工具,而是写沙箱脚本去调,只拿回输出。
会话是 JSONL 文件里的一棵树,只有当前分支发给模型。快满时用摘要替掉旧消息。
扩展是 pi 进程里的 TypeScript,能加工具、命令、厂商和界面。技能、模板和主题不用写代码。
用 /login 或 API key 登录。本地模型走 llama.cpp 或 models.json。
pi 没有内置权限系统,工具用你账号的权限跑。要隔离就用容器。
Pi is a small, open coding agent for the terminal. Missing a feature? You add it yourself.
Overview. Four ways in: the terminal UI, print or JSON mode, RPC and the SDK. All four share one session. Pi builds the request, loops over model calls and tool calls, and saves the conversation. pi-ai talks to 42 built-in model providers.
The pi command lives in pi-coding-agent, on top of pi-agent-core and pi-ai. The remote-session packages are still experimental.
A request carries the system prompt, the tool list and the conversation. A project's .pi folder loads only once you trust it. A skill is read in full only when needed.
The model answers with text and tool calls. Pi checks each call, runs them in parallel by default, records the results and goes again. You can steer it mid-run.
Four tools are on by default: read, bash, edit, write. codemode and tool-search are built-in extensions whose tools are off by default; an MCP server turns them on when it needs them.
MCP servers go in mcp.json. By default the model doesn't see MCP tools. It writes a sandboxed script that calls them and gets back only the output.
A session is a tree in one JSONL file. Only the active branch goes to the model. Near the limit, a summary replaces older messages.
Extensions are TypeScript inside the pi process. They can add tools, commands, providers and UI. Skills, templates and themes need no code.
Sign in with /login or an API key. Local models work through llama.cpp or models.json.
Pi has no built-in permission system: tools run with your account's rights. To isolate it, use a container.
来源Source: github.com