pi vs Claude Code: The Philosophical Split

Earlier posts in this series covered the Claude Code source leak, a field guide to the current crop of agent CLIs, and a focused look at pi. A hands-on post running pi against local Gemma is still to come.

Claude Code and pi are both TypeScript agents wrapping an LLM, with similar shape and the same kind of back-end API. The interesting thing is how differently they’re built on top of those shared parts.

Size and scope

According to the Medium analysis of the leak, Claude Code is around half a million lines of TypeScript. pi, as Mario describes it, is closer to a few thousand lines with four tools (read, write, edit, bash).

Some of the difference is feature scope: Claude Code includes a renderer rebuilt around game-engine-style techniques, a substantial bash sandbox, multi-agent coordination, and several unreleased features visible in the source. The rest comes from how each team chose to handle the same problem.

Where the orchestration lives

The leak shows that Claude Code’s multi-agent coordination, memory handling, and sub-agent behaviour live mostly in prompt strings rather than in code. Anthropic can change agent behaviour by editing a string and shipping a new release.

pi takes the opposite position. The system prompt fits on a slide. The orchestration logic, where it exists, is in TypeScript that the user (or the agent) can read, edit, and hot-reload during a session. Anthropic’s design keeps the orchestration internal. pi’s keeps it in user-editable TypeScript.

Anthropic’s approach updates behaviour for a large user base in one release. pi’s leaves that update under user control.

What TypeScript enables for each

Both tools are TypeScript, which matters more than it sounds. The agent itself can read and modify the source of its harness, because the source is in the same language the agent already generates. pi’s “self-modifying via TypeScript extensions” pitch only works because of this.

A Rust-based agent (Codex CLI is the obvious example) cannot do the same trick. Extensions in another language can shell out, but the agent cannot hot-reload them mid-session. So the malleable-agent pitch is one only TypeScript or a similarly dynamic language can make.

Claude Code is TypeScript too, but does not lean into the property. Its extension model is CLAUDE.md, skills, hooks; configuration rather than code the agent rewrites in place. pi uses the same language to bet the other way.

What the leak changes

Until March, the strongest argument for staying on Claude Code (besides the model, which is excellent) was that the tooling around it was hard to replicate. The leak puts a working reference for the renderer, the sandbox, and the prompt orchestration into competitors’ hands. How quickly that translates into shipped features in other tools is the open question.

The choice between Claude Code and pi was always about whether you want a vendor-managed harness or one you control. The leak makes that choice more pressing because the value of the vendor-managed half goes down once everyone has the recipe.

What the choice comes down to

Claude Code is the right tool for most users most of the time. The model is strong, the harness handles cases that would otherwise need attention, and Anthropic ships improvements faster than most users could keep up with by hand.

pi is the right tool if you want a harness you can read end to end, modify in place, and depend on across releases without surprises.

The useful question is which trade-off matches the way you work.