Pi: The Minimal Agent Within OpenClaw, written on January 31, 2026. If you haven't been living under a rock, you will have noticed this week that a project of my friend Peter went viral on the internet. It went by many names. The most recent one is OpenClaw but in the news you might have encountered it as ClawdBot or MoltBot depending on when you read about it. It is an agent connected to a communication channel of your choice that just runs code. What you might be less familiar with is that what's under the hood of OpenClaw is a little coding agent called Pi. And Pi happens to be, at this point, the coding agent that I use almost exclusively.
《Pi:OpenClaw 里的极简 Agent》,2026 年 1 月 31 日。如果你这几天没住在石头下,应该注意到我朋友 Peter 的一个项目在互联网上爆红。它有过很多名字:最新的叫 OpenClaw,早些的新闻里你可能见过 ClawdBot 或 MoltBot(取决于你什么时候读到的)。它是一个接上你选择的通讯渠道、只管运行代码的 agent。你可能不太熟悉的是:OpenClaw 引擎盖之下,是一个叫 Pi 的小 coding agent。而 Pi 恰好是我此时几乎唯一在用的 coding agent。
Over the last few weeks I became more and more of a shill for the little agent. After I gave a talk on this recently, I realized that I did not actually write about Pi on this blog yet, so I feel like I might want to give some context on why I'm obsessed with it, and how it relates to OpenClaw.
过去几周我越来越像这个小 agent 的自来水。最近就它做了一次分享之后,我意识到博客里居然还没写过 Pi——所以想交代一下我为什么沉迷它、它和 OpenClaw 是什么关系。
Pi is written by Mario Zechner and unlike Peter, who aims for "sci-fi with a touch of madness," Mario is very grounded. Despite the differences in approach, both OpenClaw and Pi follow the same idea: LLMs are really good at writing and running code, so embrace this. In some ways I think that's not an accident because Peter got me and Mario hooked on this idea, and agents last year.
Pi 出自 Mario Zechner 之手。与追求「带一点疯狂的科幻」的 Peter 不同,Mario 非常接地气。尽管路数迥异,OpenClaw 与 Pi 遵循同一个想法:LLM 极其擅长写代码与运行代码——所以拥抱它。某种意义上这不是偶然:去年是 Peter 把我和 Mario 带上这条 agent 路的。
What is Pi? · Pi 是什么
So Pi is a coding agent. And there are many coding agents. Really, I think you can pick effectively anyone off the shelf at this point and you will be able to experience what it's like to do agentic programming. In reviews on this blog I've positively talked about AMP and one of the reasons I resonated so much with AMP is that it really felt like it was a product built by people who got both addicted to agentic programming but also had tried a few different things to see which ones work and not just to build a fancy UI around it. Pi is interesting to me because of two main reasons: First of all, it has a tiny core. It has the shortest system prompt of any agent that I'm aware of and it only has four tools: Read, Write, Edit, Bash. The second thing is that it makes up for its tiny core by providing an extension system that also allows extensions to persist state into sessions, which is incredibly powerful.
Pi 是一个 coding agent。而 coding agent 有很多——真的,此刻随便从货架上拿一个,你都能体验到 agentic programming 是什么滋味。我在博客评论里正面谈过 AMP,与它共鸣的原因之一是:它真像是「既对 agentic programming 上瘾、又试过多种方案验证什么有效」的人做的产品,而不是围着它搭个花哨 UI。Pi 让我感兴趣有两条主因:**一,内核极小**——据我所知它是所有 agent 里系统提示词最短的,且只有四个工具:Read、Write、Edit、Bash;**二,用扩展系统补足小内核**——扩展还能把状态持久化进会话,这极其强大。
And a little bonus: Pi itself is written like excellent software. It doesn't flicker, it doesn't consume a lot of memory, it doesn't randomly break, it is very reliable and it is written by someone who takes great care of what goes into the software.
还有个加分项:Pi 本身写得像优秀软件。不闪屏、不吃内存、不随机崩、非常可靠——出自一位对进入软件的每一行都极其在意的人之手。
Pi also is a collection of little components that you can build your own agent on top. That's how OpenClaw is built, and that's also how I built my own little Telegram bot and how Mario built his mom. If you want to build your own agent, connected to something, Pi when pointed to itself and mom, will conjure one up for you.
Pi 还是一小组组件的集合,你可以在上面搭自己的 agent——OpenClaw 是这么建的,我的小 Telegram bot 是这么建的,Mario 的 mom 也是。想造一个接到某个渠道的自有 agent?把 Pi 指向它自己和 mom,它就能给你变一个出来。
What's Not In Pi · Pi 里没有什么
And in order to understand what's in Pi, it's even more important to understand what's not in Pi, why it's not in Pi and more importantly: why it won't be in Pi. The most obvious omission is support for MCP. There is no MCP support in it. While you could build an extension for it, you can also do what OpenClaw does to support MCP which is to use mcporter. mcporter exposes MCP calls via a CLI interface or TypeScript bindings and maybe your agent can do something with it.
要理解 Pi 里有什么,更重要的是理解 Pi 里**没有**什么、为什么没有、以及更重要的:为什么永远不会加。最显眼的缺席是 MCP 支持——Pi 里没有。你可以为它写个扩展,也可以照 OpenClaw 的做法用 mcporter:它把 MCP 调用暴露成 CLI 接口或 TypeScript 绑定,你的 agent 也许能拿它做点什么。
And this is not a lazy omission. This is from the philosophy of how Pi works. Pi's entire idea is that if you want the agent to do something that it doesn't do yet, you don't go and download an extension or a skill or something like this. You ask the agent to extend itself. It celebrates the idea of code writing and running code.
这不是偷懒的省略,而是 Pi 工作哲学的一部分。Pi 的全部想法是:想让 agent 做它还不会的事,不是去下载一个扩展、一个技能之类的东西——**你让 agent 扩展它自己**。它庆祝「代码写代码、代码跑代码」这个理念。
That's not to say that you cannot download extensions. It is very much supported. But instead of necessarily encouraging you to download someone else's extension, you can also point your agent to an already existing extension, say like, build it like the thing you see over there, but make these changes to it that you like.
这不是说不能下载扩展——完全支持。但与其鼓励你下载别人的扩展,你还可以把 agent 指向一个现成扩展,说:照那边那个东西的样子造一个,但按我的喜好改这几处。
Agents Built for Agents Building Agents · 为「造 agent 的 agent」而造的 agent
When you look at what Pi and by extension OpenClaw are doing, there is an example of software that is malleable like clay. And this sets certain requirements for the underlying architecture of it that are actually in many ways setting certain constraints on the system that really need to go into the core design.
看 Pi(以及延伸开的 OpenClaw)在做什么,你会看到一种**像黏土一样可捏塑的软件**的实例。这给底层架构设了要求——很多方面是必须进核心设计的约束。
So for instance, Pi's underlying AI SDK is written so that a session can really contain many different messages from many different model providers. It recognizes that the portability of sessions is somewhat limited between model providers and so it doesn't lean in too much into any model-provider-specific feature set that cannot be transferred to another.
比如 Pi 底下的 AI SDK 写成这样:一个会话可以真正容纳来自多家模型 provider 的不同消息。它认识到会话在 provider 之间的可移植性有限,所以不过度依赖任何一家不可迁移的 provider 特性。
The second is that in addition to the model messages it maintains custom messages in the session files which can be used by extensions to store state or by the system itself to maintain information that either not at all is sent to the AI or only parts of it.
第二,除了模型消息,它还在会话文件里维护自定义消息——扩展可以用它存状态,系统自己也可以存「完全不发给 AI 或只发一部分」的信息。
Because this system exists and extension state can also be persisted to disk, it has built-in hot reloading so that the agent can write code, reload, test it and go in a loop until your extension actually is functional. It also ships with documentation and examples that the agent itself can use to extend itself.
因为这套机制存在、扩展状态又能落盘,它内置了热重载:agent 可以写代码→重载→测试,循环往复直到扩展真正能用。它还随附文档和示例——agent 自己就能拿它们来扩展自己。
Even better: sessions in Pi are trees. You can branch and navigate within a session which opens up all kinds of interesting opportunities such as enabling workflows for making a side-quest to fix a broken agent tool without wasting context in the main session. After the tool is fixed, I can rewind the session back to earlier and Pi summarizes what has happened on the other branch.
更妙的是:Pi 的会话是**树**。你可以在会话内分支与导航,打开各种有趣的玩法——比如开一条支线去修一个坏掉的 agent 工具,而不浪费主会话的上下文;工具修好后,我把会话回卷到早先,Pi 会把另一条分支上发生的事总结给我。
This all matters because for instance if you consider how MCP works, on most model providers, tools for MCP, like any tool for the LLM, need to be loaded into the system context or the tool section thereof on session start. That makes it very hard to impossible to fully reload what tools can do without trashing the complete cache or confusing the AI about how prior invocations work differently.
这一切之所以重要,举个对照:MCP 的机制要求(在多数 provider 上)MCP 工具与任何 LLM 工具一样,必须在会话启动时装进系统上下文或工具区。这导致「完全重载工具定义」变得极难或不可能——要么打爆整个缓存,要么把 AI 搞糊涂(它记得的先前调用方式和新定义对不上)。
Tools Outside The Context · 上下文之外的工具
An extension in Pi can register a tool to be available to the LLM to call and every once in a while I find this useful. For instance, despite my criticism of how Beads is implemented, I do think that giving an agent access to a to-do list is a very useful thing. And I do use an agent-specific issue tracker that works locally that I had my agent build itself. And because I wanted the agent to also manage to-dos, in this particular case I decided to give it a tool rather than a CLI. It felt appropriate for the scope of the problem and it is currently the only additional tool that I'm loading into my context.
Pi 的扩展可以注册一个供 LLM 调用的工具,偶尔我也觉得这有用。比如,虽然我批评过 Beads 的实现方式,但给 agent 一个待办清单确实很有用。我在用一个本地运行的、agent 专属的 issue 跟踪器——就是让 agent 自己造的。因为我还想让 agent 管待办,这个场景我决定给它一个工具而不是 CLI:就问题的规模而言这样合适,而且它目前是我加载进上下文的唯一额外工具。
But for the most part all of what I'm adding to my agent are either skills or TUI extensions to make working with the agent more enjoyable for me. Beyond slash commands, Pi extensions can render custom TUI components directly in the terminal: spinners, progress bars, interactive file pickers, data tables, preview panes. The TUI is flexible enough that Mario proved you can run Doom in it. Not practical, but if you can run Doom, you can certainly build a useful dashboard or debugging interface.
但大多数时候,我给 agent 添加的不是技能就是 TUI 扩展——让与 agent 协作更愉快。斜杠命令之外,Pi 扩展能直接在终端渲染自定义 TUI 组件:转圈指示、进度条、交互式文件选择器、数据表格、预览面板。这 TUI 灵活到 Mario 证明过能在里面跑 Doom——不实用,但既然能跑 Doom,造个有用的仪表盘或调试界面自然不在话下。
I want to highlight some of my extensions to give you an idea of what's possible. While you can use them unmodified, the whole idea really is that you point your agent to one and remix it to your heart's content.
挑几个我的扩展给你看看可能性。原样可用当然没问题,但整套想法的真义是:把 agent 指向其中一个,按你的心意重混(remix)。
### /answer I don't use plan mode. I encourage the agent to ask questions and there's a productive back and forth. But I don't like structured question dialogs that happen if you give the agent a question tool. I prefer the agent's natural prose with explanations and diagrams interspersed. The problem: answering questions inline gets messy. So /answer reads the agent's last response, extracts all the questions, and reformats them into a nice input box.
我不用计划模式。我鼓励 agent 提问,来回切磋很有产出。但我不喜欢「给 agent 一个提问工具」后出现的结构化问答对话框——我偏好 agent 的自然散文,解释与图示穿插其间。问题是:就地回答问题会越来越乱。于是 /answer 读取 agent 的上一条回复,抽出所有问题,重排成一个漂亮的输入框。
### /todos Even though I criticize Beads for its implementation, giving an agent a to-do list is genuinely useful. The /todos command brings up all items stored in .pi/todos as markdown files. Both the agent and I can manipulate them, and sessions can claim tasks to mark them as in progress.
虽然批评过 Beads 的实现,但给 agent 待办清单是真有用。/todos 命令列出 .pi/todos 下以 markdown 文件存储的全部条目——agent 和我都能改,会话还能认领任务标记为进行中。
### /review As more code is written by agents, it makes little sense to throw unfinished work at humans before an agent has reviewed it first. Because Pi sessions are trees, I can branch into a fresh review context, get findings, then bring fixes back to the main session. The UI is modeled after Codex which provides easy to review commits, diffs, uncommitted changes, or remote PRs. The prompt pays attention to things I care about so I get the call-outs I want (eg: I ask it to call out newly added dependencies.)
越来越多代码由 agent 写,把没完的活直接扔给人之前先让 agent 审一遍才合理。因为 Pi 会话是树,我可以分支出一个干净的审查上下文、拿回发现、再把修复带回主会话。UI 仿 Codex:轻松审查 commit、diff、未提交变更或远端 PR。提示词盯我在意的东西,得到的提醒正是我要的(比如我要求它专门标出新加的依赖)。
### /control An extension I experiment with but don't actively use. It lets one Pi agent send prompts to another. It is a simple multi-agent system without complex orchestration which is useful for experimentation.
一个我在试验但没日常使用的扩展:让一个 Pi agent 给另一个发提示词。一个没有复杂编排的极简多 agent 系统,适合做实验。
### /files Lists all files changed or referenced in the session. You can reveal them in Finder, diff in VS Code, quick-look them, or reference them in your prompt. shift+ctrl+r quick-looks the most recently mentioned file which is handy when the agent produces a PDF.
列出会话中变更或引用过的所有文件:在 Finder 里显示、在 VS Code 里 diff、快速预览、或在提示词里引用。shift+ctrl+r 快速预览最近提到的文件——agent 产出 PDF 时很好用。
Others have built extensions too: Nico's subagent extension and interactive-shell which lets Pi autonomously run interactive CLIs in an observable TUI overlay.
别人也造了扩展:Nico 的 subagent 扩展,以及 interactive-shell——让 Pi 在一个可观察的 TUI 覆盖层里自主运行交互式 CLI。
Software Building Software · 软件造软件
These are all just ideas of what you can do with your agent. The point of it mostly is that none of this was written by me, it was created by the agent to my specifications. I told Pi to make an extension and it did. There is no MCP, there are no community skills, nothing. Don't get me wrong, I use tons of skills. But they are hand-crafted by my clanker and not downloaded from anywhere. For instance I fully replaced all my CLIs or MCPs for browser automation with a skill that just uses CDP. Not because the alternatives don't work, or are bad, but because this is just easy and natural. The agent maintains its own functionality.
这些都只是「你能用 agent 做什么」的点子。重点是:**没有一样是我写的——全是 agent 按我的规格造的。**我跟 Pi 说做个扩展,它就做了。没有 MCP、没有社区技能、什么都没有。别误会,我用了大量技能——但它们都是我的 clanker 手工打的,不是从哪儿下载的。比如我把浏览器自动化的全部 CLI 和 MCP 换成了一个只用 CDP 的技能——不是因为替代品不好使,而是这样做就是简单、自然。agent 维护它自己的功能。
My agent has quite a few skills and crucially I throw skills away if I don't need them. I for instance gave it a skill to read Pi sessions that other engineers shared, which helps with code review. Or I have a skill to help the agent craft the commit messages and commit behavior I want, and how to update changelogs. These were originally slash commands, but I'm currently migrating them to skills to see if this works equally well. I also have a skill that hopefully helps Pi use uv rather than pip, but I also added a custom extension to intercept calls to pip and python to redirect them to uv instead.
我的 agent 有不少技能,而且关键在于——不需要的我就扔掉。比如给过它一个「读其他工程师分享的 Pi 会话」的技能,code review 时有用;还有一个帮 agent 按我想要的方式写提交信息与提交行为、更新变更日志的技能——它们最初是斜杠命令,我正在迁去技能形态看看效果是否同样好。我还有个希望帮 Pi 用 uv 而不是 pip 的技能,另外加了个自定义扩展拦截对 pip 和 python 的调用、重定向到 uv。
Part of the fascination that working with a minimal agent like Pi gave me is that it makes you live that idea of using software that builds more software. That taken to the extreme is when you remove the UI and output and connect it to your chat. That's what OpenClaw does and given its tremendous growth, I really feel more and more that this is going to become our future in one way or another.
使用 Pi 这样极简 agent 的迷人之处,一部分在于它让你亲历「用造软件的软件过日子」这个理念。把它推到极致:去掉 UI 与输出、接进你的聊天——这就是 OpenClaw 干的事。看着它的爆发式增长,我越来越觉得:**这将以某种方式成为我们的未来。**