Try
↑↓Move↵OpenCtrl↵New tabescClose

ProjectOpen source

pi-rust

The pi agent in Rust.

Overview

pi-rust is the pi (opens in a new tab) coding agent by Mario Zechner, rebuilt in Rust. It’s fully compatible with pi and reads the same config files, so your setup works as is.

Terminal
curl -fsSL https://ryanyannelli.com/file/pi-rust/install.sh | sh
Memory per session
~35 MiB
Less memory than Node pi
5×
Runtime dependencies
0
Platforms
7

Get the highlights.

One binary

Nothing to install but pi.

pi-rust is a single binary for Linux, macOS, and Windows. No Node, no runtime to set up.

Download the latest release

  • Runs on any Linux

    Linux builds are static, so they run on any distro and on Termux.

  • Verified downloads

    The install script checks each archive against SHA256SUMS. No sudo, no telemetry.

  • Updates itself

    pi update --self installs the latest release.

Memory

Run 20 agents at once.

20 pi-rust sessions running together used about a fifth of the memory of Node pi or Codex CLI.

  • Done sooner, too

    All 20 pi-rust sessions finished first, ahead of Codex CLI and Node pi.

  • vs. Codex CLI

    Codex CLI is also written in Rust, and it still peaked more than four times higher.

  • The test

    Each tool ran the same 20 read-only sessions on one Mac. The method and raw samples are in the repo.

Interactive

The pi you know, in your terminal.

Run pi in a project to start. Type while the agent works to steer it, or press Alt+Enter to queue a follow-up.

  • Slash commands

    Type / for commands like /model, /tree, /fork, and /compact.

  • Resume any session

    pi -c picks up the last session, and pi -r lets you choose one.

  • Prompt history

    Up and Down scroll through prompts from every project. Ctrl+R searches them.

  • Notifies when done

    Long runs end with a terminal notification.

Only in pi-rust

Six commands upstream doesn’t have.

  • /context

    Shows what fills the context window, part by part.

  • /review

    Has the agent list bugs, risky changes, and missing tests by severity, without touching files.

  • /undo

    Restores the files the agent changed in the last prompt.

  • /retry

    Runs the last prompt again on a new branch, so the old answer stays.

  • /init

    Has the agent explore the project and write an AGENTS.md.

  • /diff

    Shows the git diff, with the stat and untracked files.

Scripting

Made for scripts, too.

pi -p runs once and prints the answer. --mode json and --mode rpc stream events instead.

  • Run limits

    --max-turns and --max-cost stop a run, and pi -c picks it back up.

  • Structured output

    With --output-schema, the answer is JSON that matches your schema. If it doesn’t, pi asks again.

  • Pipes and files

    Pipe a log into pi, attach files with @notes.md, and read the answer from stdout.

Editors

pi, inside Zed.

pi --mode acp runs pi as an external agent in Zed and other Agent Client Protocol (ACP) editors.

  • In the editor

    The editor shows tool call diffs, terminals, the model picker, and slash commands.

  • Pick up in the terminal

    Editor sessions are regular pi sessions, so pi -r can resume them.

  • Log in from the editor

    With no model set up, the editor offers to open pi in a terminal so you can log in.

Providers

Every provider. Only the models you can use.

pi-rust speaks every wire protocol upstream pi does, including Anthropic, OpenAI, Bedrock, and Vertex. With a key set, it lists only the models your account can use.

  • OAuth logins

    /login signs in to Anthropic, OpenAI Codex, GitHub Copilot, OpenRouter, and more.

  • Keys stay on your host

    Model list requests don’t follow redirects, so your key only goes to the host you set.

  • Local models

    llama.cpp servers and virtual models work the same as upstream pi.

Extensions

Node modules, without Node.

Extensions run on embedded QuickJS, with TypeScript and every Node built-in module.

  • Packages

    pi install npm:<package> adds extensions, skills, prompt templates, and themes.

  • MCP

    pi has a Model Context Protocol (MCP) client with OAuth. Manage servers with /mcp.

  • Codemode

    A sandboxed JavaScript runtime where the model writes scripts that call tools.

  • Unsupported APIs

    An API that can’t work throws ERR_PI_UNSUPPORTED. Native npm addons don’t load.

Upstream parity

Everything pi does, and more.

pi-rust has every feature of upstream pi, and a daily check keeps it in sync.

  • Your config carries over

    auth.json, settings.json, models.json, MCP servers, skills, and themes work in both.

  • Upstream bugs, fixed

    pi-rust fixes bugs that are still open upstream, like strict tools on Bedrock and stuck pastes.

  • Older setups

    On first run, pi-rust moves files from older pi layouts, like upstream pi does.

Libraries

Use only the parts you need.

Use the LLM API, the agent loop, or the terminal UI as Rust crates on their own, or embed pi through a C ABI.

  • pi-ai

    Message types, streaming events, providers, OAuth, and the model registry.

  • pi-agent

    The agent loop, tool argument validation, and the stateful Agent.

  • pi-embedded

    Runs pi sessions inside a native app, with a C header.

  • pi-durable

    Durable sessions in memory, SQLite, or JSONL.

Even more

All the little things.

Get started

One line to install.

On Linux and macOS, run the script. pi doctor checks the install, and pi starts a session. On Windows, run this in PowerShell:

irm https://ryanyannelli.com/file/pi-rust/install.ps1 | iex
curl -fsSL https://ryanyannelli.com/file/pi-rust/install.sh | shpi doctorpi