The Four-Tool Agent That Writes Its Own Extensions

articleaiagent-architecturepicliextensionsminimalism

Joel's entire skill/extension/gateway stack runs on Pi's four-primitive architecture — this is a rigorous articulation of why that minimalism works

Armin Ronacher — the person behind Flask, Jinja2, Click, and VP of Engineering at Sentry — wrote up why he uses Pi as his primary coding agent. The core argument: an agent with four tools (Read, Write, Edit, Bash) and the shortest system prompt of any agent he’s aware of beats feature-rich alternatives. Not despite the minimalism, but because of it.

The architecture is deliberate. No MCP support — and it won’t be added. The philosophy is that if you want the agent to do something new, you don’t download a plugin. You ask the agent to extend itself. It writes code, hot-reloads, tests, and iterates until the extension works. Pi’s extension system persists state into sessions, and sessions are trees — you can branch into a side-quest (fix a broken tool, do a code review) without burning context in the main thread. When you rewind, Pi summarizes what happened on the other branch. That’s a structural solution to the context-management problem that most agents just ignore.

Armin’s own extensions illustrate the pattern. /answer reformats the agent’s questions into a clean input box. /todos gives the agent a local issue tracker stored as markdown files. /review branches into a fresh review context using Pi’s session trees — so you get agent code review without polluting the implementation session. He replaced all his browser automation CLIs and MCP tools with a single skill that uses CDP directly. Every skill is hand-crafted by the agent to his specifications, not downloaded from a marketplace. He throws skills away when he doesn’t need them anymore.

The article also traces the line from Pi to OpenClawPeter Steinberger’s viral project that connects Pi to a communication channel and lets it just run code. Pi is the engine; OpenClaw is what happens when you remove the UI. Mario Zechner built Pi, Peter built the “sci-fi with a touch of madness” layer on top. Same foundational bet: LLMs are good at writing and running code, so embrace that instead of wrapping it in abstraction layers.

Key Ideas

  • Four primitives are sufficient: Read, Write, Edit, Bash — everything else is built on top by the agent itself
  • No MCP by design: the agent extends itself by writing code, not by loading protocol-based tool registries into the system context
  • Sessions as trees: branching enables side-quests (reviews, tool fixes) without context pollution, with summarization on rewind
  • Extension hot-reloading: the agent writes an extension, reloads, tests it, iterates — a tight feedback loop for self-modification
  • TUI extensibility: extensions render custom terminal components — Doom runs in it, so dashboards and debugging interfaces are trivial
  • Skills are disposable: hand-crafted by the agent, thrown away when no longer needed — the opposite of a curated marketplace
  • Portable sessions across providers: Pi’s SDK stores messages so sessions aren’t locked to a single model provider
  • Agent-as-platform: Pi’s component architecture lets you build custom agents on top (OpenClaw, Telegram bots, Mario’s mom bot)