Pi

AI coding agent with CLI interface.

1. Overview

Pi is a full-featured AI coding agent that runs in the terminal. It provides built-in tools for file operations (bash, read, write, edit), model registry with multi-provider support, agent sessions with JSONL persistence, and an interactive TUI mode.

2. Building

nix build .#pi

The output is a pi binary at $out/bin/pi.

3. Architecture

Pi is built from source as a Node.js npm package:

  • npm build — compiles TypeScript to JavaScript
  • Native deps — cairo, pango, libjpeg for image processing
  • WASM — photon_rs for image manipulation at runtime
  • Patch — skips network-dependent model generation (committed)

4. Runtime dependencies

Pi requires these at runtime (included in the nix closure):

  • nodejs_22 — JavaScript runtime
  • cairo, pango — image rendering
  • libjpeg, giflib, librsvg — image format support

5. Usage

pi                    # Interactive mode (TUI)
pi --help             # Show help
pi -m anthropic/claude-sonnet-4-20250514   # Specify model

6. SDK integration

Pi also provides a programmatic SDK used by other packages:

  • @mariozechner/pi-ai — model definitions, API clients
  • @mariozechner/pi-agent-core — agent session management
  • @mariozechner/pi-coding-agent — coding tools, resource loaders

The SDK is consumed by the bot package for email agent functionality.

7. Source

pkgs/pi/default.nix — builds from the pi-mono git input.