我为什么从 Claude Code 换到了 Pi Agent
用了很久的 Claude Code。从 Opus 4.6 一路用到 4.7,说实话,体验不差——Anthropic 的模型在代码能力上确实有东西。但就像我上一篇文章吐槽过的,A 厂的问题从来不在模型本身:封号、限流、模型说禁就禁、账单像过山车一样飘忽不定。之后也尝试在Claude Code上使用第三方模型,如:GLM 5.2、Deepseek V4等等。但随着模型升级,Claude Code的功能也在增加。如Claude Code的workflows功能很强,但一次任务动辄数十分钟、长则数个小时。Token消耗都是数百万起,这种情况总给我一种"花钱不受我自己控制"的感觉…
I used Claude Code for a long time — from Opus 4.6 to 4.7. Honestly, the experience wasn't bad — Anthropic's models genuinely have coding chops. But as I complained in my last article, Company A's problems were never about model quality: account bans, rate limits, models disabled without warning, bills swinging like a rollercoaster. I tried third-party models in Claude Code too — GLM 5.2, DeepSeek V4, etc. But as Claude Code's features grew (workflows are powerful, but a single task takes tens of minutes to hours, burning millions of tokens), I kept feeling my spending was out of my control...
后来有一段我切到了 Codex。GPT 系列沉稳、谨慎、不太犯错——但偶尔谨慎到让你想敲键盘。"这个改动会不会有风险?要不要再确认一下?你真的要这么做吗?"——行了行了我知道了,你倒是动手啊!还有就是传Codex有SSD杀手的可能性,动不动就是几个几十个G的项目文件。说实在我不知道它在做些什么一个问题需要几十个G甚至上T的数据量。
I switched to Codex for a while. The GPT series is steady, cautious, rarely makes mistakes — but sometimes so cautious you want to punch the keyboard. "Could this change have risks? Should we confirm again? Are you sure?" — OK, I get it, just do it already! Also, Codex allegedly has SSD-killer tendencies, hoarding tens of gigabytes of project files. Honestly, I have no idea what it's doing that needs dozens of GB or even TB of data.
然后 Pi Agent 出现了。
Then Pi Agent appeared.
先说一个你可能没注意到的数字
Let me start with a number you may not have noticed:
你付给 AI 编程助手的钱,大部分不是花在写代码上,而是花在了 你还没开始写代码之前 。Claude Code 每开一个会话,系统提示大约 14,000 个 token。这是什么概念?每次你打开终端输入第一行指令之前,14K token 已经烧掉了。这些 token 在告诉模型:你是谁、你能用什么工具、你要怎么说话、你不能做什么、你要怎么处理权限、你要怎么管理子任务、你要怎么格式化输出……一大串。Codex CLI 也差不多。这些"重型" Agent 的设计哲学是:把模型当成一个需要详细说明书的新手,所以把所有规则写在前面。Pi Agent 反着来。它的系统提示只有大约 1,000 个 token。四个工具——read、write、edit、bash。没了。
Most of what you pay your AI coding assistant isn't for writing code — it's for everything that happens before you start coding. Claude Code's system prompt is about 14,000 tokens per session. What does that mean? Before you even type your first command, 14K tokens have already been burned. These tokens tell the model: who you are, what tools you can use, how to speak, what not to do, how to handle permissions, how to manage subtasks, how to format output... a massive list. Codex CLI is similar. These "heavy" agents are designed on the philosophy that the model is a novice needing a detailed manual, so all rules go upfront. Pi Agent flips this. Its system prompt is only about 1,000 tokens. Four tools — read, write, edit, bash. That's it.
这不是偷懒。这是一种判断:"前沿模型已经被 RL 训练得足够好了,它天生就知道怎么当编程助手,不需要你再写一万字的说明书。" 把规则写进提示,不如把 token 留给真正的任务。
This isn't laziness. It's a judgment: "Frontier models have been RL-trained well enough — they inherently know how to be a coding assistant without a ten-thousand-word manual." Rather than stuffing rules into the prompt, give those tokens to the actual task.
省下来的 token,谁来买单?你!
Who pays for those saved tokens? You!
Databricks 那份报告说了什么
What the Databricks report revealed:
大概在 7 月初,Databricks 的 CTO Matei Zaharia 发了一份内部评测报告,在他们自己的数百万行代码库上对比了各种编程 Agent。这个代码库涵盖 Scala、Go、Rust、Java、Python、TypeScript 等十几种语言——远不是那种"只有几个 Python 文件"的玩具测试。
Around early July, Databricks CTO Matei Zaharia published an internal evaluation comparing various coding agents on their own multi-million-line codebase — covering a dozen languages including Scala, Go, Rust, Java, Python, TypeScript. Far from a "few Python files" toy test.
报告的核心结论之一是:"Harness(就是 Agent 的外壳、中间层)对成本的影响比模型本身还大。"
One of the report's core conclusions: "The Harness impacts cost more than the model itself."
同一个模型(Opus 4.8),通过 Pi Agent 运行比通过 Claude Code 运行便宜 2.08 倍,而且任务完成质量完全相同。Pi 做到的秘诀很简单——每次对话轮次发送的上下文少了大约 3 倍。上下文少了,模型处理得快了,不需要反复回看几十条工具定义。GPT 5.5 跑同一个任务,Codex harness 消耗了 1,235,000 个 token,而 Pi 只消耗了 665,000 个 token——几乎少了一半。便宜的单token价格 ≠ 便宜的总成本。A厂的Sonnet 5每token比Opus 4.8便宜1.7倍,但实际每个任务Sonnet成本是 $2.09,Opus是 $1.94。Sonnet更贵,完成率还低6个百分点(81% vs 87%)。
Same model (Opus 4.8): Pi Agent ran 2.08× cheaper than Claude Code, with identical task quality. Pi's secret? It sends roughly 3× less context per conversation turn. Less context, faster processing, no need to re-read dozens of tool definitions. GPT-5.5 on the same task: Codex harness burned 1,235,000 tokens; Pi burned 665,000 — nearly halved. Cheap per-token price ≠ cheap total cost. Sonnet 5 costs 1.7× less per token than Opus 4.8, yet actual per-task Sonnet cost was $2.09 vs Opus's $1.94. Sonnet was more expensive and 6 percentage points lower on completion rate (81% vs 87%).
Databricks 的答案是:"单任务成本"才是唯一值得看的指标。而 Pi Agent 在"单任务成本"这个指标上,几乎所有模型都做到了最优——不是因为它的模型特别强,而是因为它够轻。还记得我之前说给Deepseek V4加一个强制深度思考协议吗?在Pi下,我只需要提高DS V4的深度思考深度。然后…然后效果比之前在Claude下添加那个劳什子协议要强悍很多。
Databricks' answer: "per-task cost" is the only metric worth watching. And on this metric, Pi Agent achieved optimal results for almost all models — not because its models are stronger, but because it's light enough. Remember my Mandatory Deep Thinking Protocol for DeepSeek V4? Under Pi, I just needed to increase DS V4's thinking depth. The result... far more powerful than that elaborate protocol under Claude.
多模型工作流:不同的事,找不同的人
Multi-model workflows: different tasks, different people.
Pi天生是模型厂商无关的,它不假设你一定用哪家的模型。你可以在配置文件里随便切换:这一轮用Fable做架构设计,下一轮用DeepSeek实现代码,再用GPT做审查——全在一个终端里完成。
Pi is inherently vendor-agnostic — it never assumes which model you'll use. Swap freely in config: this round Fable for architecture, next round DeepSeek for implementation, then GPT for review — all in one terminal.
再往上一层,Pi还有一个叫pi-crew的扩展,让你可以用YAML定义多Agent工作流。还有一个更激进的做法——直接让两个Pi Agent互相聊天。生产环境的Agent和开发环境的Agent通过网络通信,协调完成一个Bug修复——而生产端全程自动脱敏。两个Agent是平等的,没有"上级派活给下级",像一个真正的两人团队在合作。
One level up: pi-crew, a community extension (MIT open source), lets you define multi-agent workflows in YAML. There's an even more radical approach — direct Pi-to-Pi communication: two Pi Agents chat with each other over the network to coordinate a bug fix, with production-side auto-redaction. Two equal agents, no "superior delegating to subordinate" — like a real two-person team collaborating.
不光是写代码
Not just for coding.
因为Pi本质上只是一个连接你和大模型的极简通道,所以你能用大模型做的事情,Pi都能帮你做,而且更快、更省token。写文章、整理表格、写邮件、分析日志、查Linux命令——用Pi就是一句话的事。
Since Pi is fundamentally just a minimal channel between you and large models, anything you can do with a large model, Pi can do faster with fewer tokens. Writing articles, organizing spreadsheets, drafting emails, analyzing logs, checking Linux commands — with Pi, it's a one-liner.
也不是没有代价。Pi 的极简意味着你得自己承担一些事情。Claude Code 的系统提示里藏了很多"保姆级"的规则:怎么管理上下文、怎么压缩对话、子任务的权限边界在哪……这些 Pi 都不替你处理。你要自己学一点 context engineering,学会写好的 AGENTS.md,学会在合适的时候开始新会话。
It's not without cost. Pi's minimalism means you shoulder some things yourself. Claude Code's system prompt hides many "nanny-level" rules: context management, conversation compression, subtask permission boundaries — Pi doesn't handle any of this. You need to learn some context engineering, write good AGENTS.md files, know when to start fresh sessions.
这有点像 Arch Linux 和 macOS 的区别。一个给你最小内核,剩下你自己搭;一个替你做好所有决策,你只管用。
It's a bit like Arch Linux vs macOS. One gives you a minimal kernel and you build the rest; the other makes all decisions for you and you just use it.
所以呢。过去几个月,我从 Claude Code 切到 Codex 再切到 Pi Agent。不是哪个工具不好——每个都在某个阶段帮了我很多——而是我发现自己在变。我不再需要一个什么都替我包办的助手了。我更需要一个不挡路的、轻量的、让我能自由选择和组合的通路。Pi Agent 就是这个通路。
So here we are. Over these months, I went from Claude Code to Codex to Pi Agent. Not because any tool is bad — each helped me tremendously at different stages — but because I've changed. I no longer need an assistant that does everything for me. I need an unobstructed, lightweight channel that lets me freely choose and combine. Pi Agent is that channel.
Databricks 的报告给了一个旁证:在真实的、复杂的工程任务面前,轻就是好。少发 token 就是省钱。少加载的规则就是留给模型更多的思考空间。其实这个也是符合我自己的多模型协同系统的设计里面:尽量少的给AI限制!
The Databricks report provides corroborating evidence: in real, complex engineering tasks, lighter is better. Fewer tokens = saved money. Fewer loaded rules = more thinking space for the model. This actually aligns with my multi-model orchestration system's design principle: impose as few constraints on AI as possible!
如果你现在用的是 Claude Code 或者 Codex,我不建议你立刻全切——每种工具都有它最适合的场景。但如果你和我一样,开始对臃肿的系统提示感到疲惫,开始在意每一笔 token 花在了哪里,开始想让不同模型做它们各自擅长的事——那 Pi 值得你试一下。开源、MIT 许可、45,000+ GitHub stars、你只付需要付AI的 API 费用。对了:Pi 是支持那些Coding plan和订阅的!
If you're on Claude Code or Codex, I don't recommend switching completely — each tool has its sweet spot. But if like me, you're tired of bloated system prompts, starting to care where every token goes, wanting different models to do what they each do best — Pi is worth a try. Open source, MIT license, 45,000+ GitHub stars, you only pay API costs. Oh, and Pi supports coding plans and subscriptions!
也许你也会和我一样,用了之后回不去。
Maybe you'll be like me — once you try it, you won't go back.
下一篇聊什么还没想好。也许是那个折腾了几个月还差一点的贝叶斯智能路由方案,也许是白锦龟背竹的养护心得。反正,不着急。
Haven't decided what to write next. Maybe that Bayesian intelligent routing system I've been tinkering with for months, maybe Monstera albo care tips. No rush.