Extending Pi to make it a serious  Claude Code alternative

6 min read piagentic-harnessclaude-code

Claude Code is becoming more of a black box. Un-extended Pi is neat but bare. In this post I introduce a few Pi customizations that make it far more potent.

image

Background

Pi is an open-source harness for working with AI. It's customizable and very clean and lean, which makes it an excellent basis for building your own agentic flows. Of course, you can do things in Claude, but you might find it going in weird directions and skewing your intentions in ways that are sometimes hard to undo.

Pi is lean. Out-of-the-box, it can't do many things that are easy to take for granted with other AI coding tools & platforms. For example, no web-search, web-fetch, background-workers, or peer messaging. Which is also its strength; Since whatever you add, you are responsible for. And whilst you're experimenting, things will crash and behave strangely. Pi is built with it's Pi Durable package, which will give you the logs etc needed to correct things.

For most people, stick with Claude, Antigravity, OpenCode, etc. For those interested in doing things your own way, and staying (more) in control of your sessions/context, customizing Pi is one way to experiment with agentic systems without having to re-invent everything yourself.

What is Pi?

image

Pi's docs etc are at pi.dev and include this summary:

Pi is an extensible AI agent that works from your terminal. Give it a goal and a working folder, and it can inspect files, run commands, edit content, and work through multi-step tasks.

The Idea

Give Pi everything it needs to excel as an agentic orchestration harness.

Once you've installed Pi, you need to configure an AI provider. For example; Cloudflare AI, Anthropic API, or Openrouter. Then it's like a real-time strategy game; where making moves in the right order can accelerate growth by removing blockers and making scaling-up of the capability easier and easier. Since in effect, we can use pi to essentially build itself.

At the time of writing, my favourite (cheap) model was DeepSeek 4.1 via Openrouter. It's very cheap, and replaced some other bigger models even for planning. Just keep the context light and focussed, and it is extremely capable.

DeepSeek 4.1 does for pennies what Claude does for 10x - 100x the price. It can be a bit slow. And sometimes I miss Fable or Opus 5.5. But overall I ENJOY working with it and am very impressed with its results.

The speed thing stops mattering when you get a good orchestrator setup set up. Which is part of what this post describes. Here we can choose a boundary; How much we specialize Pi, vs how much we use Skills or harness conventions in projects or a layer around/above our Pi customizations.

Let's build:

  1. Cost reporting and usage summaries (ctx, CH, $, etc).
  2. Webfetch: We can make fetching from the web easier and safer.
  3. Websearch: We can make searches more reliable via search APIs.
  4. Workers: We can create the sub-session concept such that Pi can run its own workers.

Beyond that, there's UI customizations for:

  1. Git state: I hate seeing tokens burned for git reminders. So we'll use scripts instead of session context.
  2. Worker switching and interaction.

Monitoring token usage is important. It give you insights into patterns and helps you to build the intuition needed to design and refine processes.

Context-usage, tokens, cache-hits, and costs is the AI-era's equivalent of monitoring build output. Of course, monitoring api traffic, session logs, and wire-logs is far more detailed.... so maybe it's more akin to Visual Studio's (not VSCode's) Task List that is the summary of errors.

My first work-through is flawed though; The api-usage costs aren't automatically fetched or checked in any way. I have a protocol that I need to remember to run in order to ensure that the status shown in Pi is based on real API costs. This also has the duality of what you think it costs (via the cost API from your provider) isn't exactly what it costs. So be careful.

Showing Git Status and Context Token Usage Statistics

image
image

Adding Background Workers to Pi

safsdf

image
image
image

Adding Webfetch and Websearch to Pi

asdfsdf

image

In a future article, I'll also share how custom verbs can be setup neatly so that you can create your own "language" and multi-agent capabilities for standardising tasks and really upping the specialized capacity of agentic workflows.

harness
Pi
model
deepseek-4-1
use propose

Starting bg propose worker...

image

Above you can see how my Pi session has invited me to use Plan or Propose to prepare to make the changes. You might prefer handing over Requirements or a Spec to a specialized Agent Team. That's the beauty of Pi; Work however you want to. The downside is that whatever you commission, you need to maintain. Same SDLC pain-points, just shifted up and sideways a little.