Setting up pi.dev with z.ai

Tags:

I'm not really happy with using Claude Code as my coding harness. Not that I have spent much time in the last three months using the slopmachines, but as the GLM subscription is already paid for and GLM 5.2 just came out, I'm revisiting coding harnesses other than Claude Code, and here is my setup for running pi.dev in a Podman container.

pi.dev running with GLM 5.1

Plugins

The agent now supports subagents and task lists via plugins. Obra's superpowers is indispensable to me.

Pi-subagents

I don't believe in large context or large agent conversations, so subagents are a must for me.

Pi-tasks

Maintaining a task list is also important to me.

Superpowers

The main thing I use for doing agent-driven development

Prerequisites

pi needs Nodejs 22+, so the container is based on Debian forky.

Containerfile for pi.dev

FROM docker.io/library/debian:forky-slim
# debian-forky-slim
RUN <<EOF
apt update

# Install our packages
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y npm perl build-essential imagemagick git apache2 wireguard wget curl cpanminus liblocal-lib-perl ripgrep

EOF

RUN <<EOF
# Install pi.dev
npm install -g --ignore-scripts @earendil-works/pi-coding-agent

mkdir /work

export HOME=/root

# 1. Install Superpowers, subagents and task-list plugins
pi install git:github.com/obra/superpowers
pi install npm:pi-subagents

# Create some directories that we want to mount from the outside
mkdir -p /root/.pi/agent/sessions/--work--/

EOF

ENTRYPOINT ["bash"]
CMD ["-i"]

Pi setup and configuration

API key

I created a separate API key via z.ai API keys, just in case the API key gets leaked due to a bad plugin.

Environment variables / login

Documentation from pi.dev providers:

Edit ~/.pi/auth.json:

{
  "zai": {
    "type": "api_key",
    "key": "your API key"
  }
}

Customization

Like all coding harnesses, pi.dev also uses a lot of blinking lights to keep the user entertained while they wait for tokens. I removed the background colors by editing ~/.pi/agent/settings.json:

{
    "theme": "transparent"
}

And adding transparent.json to ~/.pi/agent/themes/transparent.json:

{
    "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
    "name": "transparent",
    "vars": {
            "cyan": "#00d7ff",
            "blue": "#5f87ff",
            "green": "#b5bd68",
            "red": "#cc6666",
            "yellow": "#ffff00",
            "gray": "#808080",
            "dimGray": "#666666",
            "darkGray": "#505050",
            "accent": "#8abeb7",
            "white": "#ffffff"
    },
    "colors": {
            "accent": "accent",
            "border": "blue",
            "borderAccent": "cyan",
            "borderMuted": "darkGray",
            "success": "green",
            "error": "red",
            "warning": "yellow",
            "muted": "gray",
            "dim": "dimGray",
            "text": "white",
            "thinkingText": "gray",

            "selectedBg": "",
            "userMessageBg": "",
            "userMessageText": "",
            "customMessageBg": "",
            "customMessageText": "",
            "customMessageLabel": "#9575cd",
            "toolPendingBg": "",
            "toolSuccessBg": "",
            "toolErrorBg": "",
            "toolTitle": "white",
            "toolOutput": "gray",

            "mdHeading": "#f0c674",
            "mdLink": "#81a2be",
            "mdLinkUrl": "dimGray",
            "mdCode": "accent",
            "mdCodeBlock": "green",
            "mdCodeBlockBorder": "gray",
            "mdQuote": "gray",
            "mdQuoteBorder": "gray",
            "mdHr": "gray",
            "mdListBullet": "accent",

            "toolDiffAdded": "green",
            "toolDiffRemoved": "red",
            "toolDiffContext": "gray",

            "syntaxComment": "#6A9955",
            "syntaxKeyword": "#569CD6",
            "syntaxFunction": "#DCDCAA",
            "syntaxVariable": "#9CDCFE",
            "syntaxString": "#CE9178",
            "syntaxNumber": "#B5CEA8",
            "syntaxType": "#4EC9B0",
            "syntaxOperator": "#D4D4D4",
            "syntaxPunctuation": "#D4D4D4",

            "thinkingOff": "darkGray",
            "thinkingMinimal": "#6e6e6e",
            "thinkingLow": "#5f87af",
            "thinkingMedium": "#81a2be",
            "thinkingHigh": "#b294bb",
            "thinkingXhigh": "#d183e8",

            "bashMode": "green"
    }
}