{"slug": "the-irrational-effectiveness-of-the-pi-harness", "title": "The irrational effectiveness of the Pi harness", "summary": "Redowan Delwar, writing on his blog 'Redowan's Reflections', argues that the Pi coding harness, created by Mario Zechner, is more effective than Claude Code and Codex because its system prompt and tool definitions total around 1,000 tokens, compared to Codex's approximately 4,400-token system prompt and Claude Code's several-thousand-token tool descriptions. Delwar praises Pi's minimal design, which provides only four tools (read, write, edit, bash) and allows users to opt into extensions, contrasting with the opaque and bloated nature of other harnesses.", "body_md": "[Redowan's Reflections](/)\n\n# The irrational effectiveness of the Pi harness\n\nA few months back, Pi’s creator Mario Zechner gave a talk on [developing Pi and slowing\nthings down](https://www.youtube.com/watch?v=RjfbvDXpFls). It resonated with me so much that I wanted to try out the harness. I’m also\ngetting increasingly wary of how bloated Claude Code and Codex have gotten over time.\n\nI have no idea what these harnesses are putting into the system prompt or how that’s affecting the models’ responses. I also have no clue about how their tool calling works or what search engine they’re using while searching for something. This opaque nature, along with the sweeping changes they make to their system instructions every now and then, makes it difficult to build a reliable workflow. Models are non-deterministic enough. I really don’t want my harness to add to it.\n\nPi is a tiny coding harness written in TypeScript. By default, it gives the model four\ntools: `read`, `write`, `edit`, and `bash`. Ostensibly, that’s all you need for most coding\nwork. The core is small enough that you can read the important parts in one sitting. The\nrepo has more packages than this, but these are the four salient ones, and they’re quite\npleasant to read:\n\n```\npackages/\n|-- ai/           # model APIs, streaming, and token usage\n|-- agent/        # agent loop and tool execution\n|-- tui/          # terminal rendering and keyboard input\n`-- coding-agent/ # CLI, sessions, and extensions\n```\n\nIts [agentic loop](https://github.com/earendil-works/pi/blob/main/packages/agent/src/agent-loop.ts) boils down to this:\n\n``` js\nwhile (true) {\n    const response = await callModel(messages, tools)\n    messages.push(response)\n\n    if (response.stopReason === \"error\" || response.stopReason === \"aborted\") {\n        break\n    }\n\n    const calls = response.content.filter((part) => part.type === \"toolCall\")\n    if (calls.length === 0) {\n        break\n    }\n\n    const results = await executeTools(calls)\n    messages.push(...results)\n}\n```\n\nThe model requests tool calls and Pi runs them. The results go back into the conversation. This repeats until the model replies without requesting another tool. The actual loop also handles queued user messages and emits events for the UI. The above sketch leaves those out, along with tool validation and error handling.\n\nPi’s [system prompt](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/system-prompt.ts) and [tool definitions](https://github.com/earendil-works/pi/tree/main/packages/coding-agent/src/core/tools) together come in at around 1,000 tokens. In\ncontrast, the [Codex system prompt](https://github.com/openai/codex/blob/main/codex-rs/models-manager/prompt.md) that ships with the CLI is about 4,400 tokens before you\ncount its tool definitions. Claude Code isn’t open source, but people have [reconstructed\nits prompts](https://github.com/Piebald-AI/claude-code-system-prompts), and the built-in tool descriptions alone add up to several thousand tokens.\nThere is no benchmark that proves these huge system prompts make the output measurably\nbetter. But they make the sessions costlier from the get-go for sure.\n\nPi doesn’t bundle extra skills, subagents, or MCP support. If you need them, you can ask Pi to write an extension or install someone else’s. Pi knows its internals, and writing an extension is such a pleasant experience. You can literally one-shot most of the simple extensions with any capable model.\n\nI really like this opt-in approach. Don’t add garbage you think I need that I actually don’t. Let me pick my own.\n\nI’m also skeptical of installing random skills and extensions from the internet. My local setup has a few I’ve written or adapted:\n\n- [skill:whip](https://github.com/rednafi/dotfiles/tree/main/dot_agents/skills/whip) : tames the insufferable text that LLMs generate. I copied the content of[tropes.fyi](https://tropes.fyi) into a skill and regularly use it to fix PR descriptions at work.\n- [extension:web.ts](https://github.com/rednafi/dotfiles/blob/main/dot_pi/agent/extensions/web.ts) : lets Pi search DuckDuckGo and open the results as plain text. It tells\nthe model to read the pages before answering factual questions.\n- [extension:subagent](https://github.com/rednafi/dotfiles/tree/main/dot_pi/agent/extensions/subagent) : delegates a task to a separate Pi process with its own context. I\ncopied the code from Pi’s[extension example](https://github.com/earendil-works/pi/tree/main/packages/coding-agent/examples/extensions/subagent) . I can run agents in parallel or pass one\nagent’s findings to the next.\n- [extension:welcome-logo.ts](https://github.com/rednafi/dotfiles/blob/main/dot_pi/agent/extensions/welcome-logo.ts) : draws the block-letter Pi logo in the screenshot above. This\nis the first Pi extension I wrote. It replaces the startup header and uses the current\ntheme’s accent color.\n\nI don’t use `/goal` or `/plan` mode. I still babysit agents and read every line of their\noutput, so I haven’t found the way `/goal` works particularly useful for my workflow. As for\nplanning, I just ask the model to dump the plan in a `plan.md` file.\n\nApart from these, I also installed [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) for MCP access. Its bundled\n`mcp-scripting` skill lets Pi combine MCP calls in JavaScript. That’s the only third-party\nextension I’m currently using. At some point, I’d like to dig into its implementation and\nwrite my own MCP extension too.\n\nMy [Pi configuration](https://github.com/rednafi/dotfiles/tree/main/dot_pi/agent) is in my dotfiles repo.\n\nI thought Pi’s bare-bones defaults would slow me down. But almost irrationally, I’ve used it\nevery day for the last 30 days and haven’t felt the need to return to a more feature-packed\nharness. It feels good to use a tool whose core I can keep in my head without flailing. The\nTUI has been rock solid too. It hasn’t crashed or frozen on me once. I haven’t seen it\nflicker while I’m working. Maybe that’s because it’s a frikkin TUI and [not a game engine!](https://x.com/trq212/status/2014051501786931427)", "url": "https://wpnews.pro/news/the-irrational-effectiveness-of-the-pi-harness", "canonical_source": "https://rednafi.com/misc/pi-harness/", "published_at": "2026-09-04 22:00:00+00:00", "updated_at": "2026-09-07 04:25:56.257974+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["Redowan Delwar", "Mario Zechner", "Pi", "Claude Code", "Codex"], "alternates": {"html": "https://wpnews.pro/news/the-irrational-effectiveness-of-the-pi-harness", "markdown": "https://wpnews.pro/news/the-irrational-effectiveness-of-the-pi-harness.md", "text": "https://wpnews.pro/news/the-irrational-effectiveness-of-the-pi-harness.txt", "jsonld": "https://wpnews.pro/news/the-irrational-effectiveness-of-the-pi-harness.jsonld"}}