Pi Agent Rust: A High-Performance AI Coding Agent CLI in Rust
pi_agent_rust is a Rust rewrite of Mario Zechner's Pi Agent, offering a single binary, instant startup, and hardened extension security for terminal AI coding.
pi_agent_rust is a from-scratch Rust port of Mario Zechner's Pi Agent, built with his approval, targeting the sluggish startup, heavy memory use, and flaky streaming common in Node.js or Electron-based coding assistants. It ships as a single binary with instant startup and eight built-in tools, powered by two custom Rust libraries: asupersync, a structured-concurrency async runtime, and rich_rust, a terminal-rendering library.
Security is a core design pillar rather than an afterthought. The project implements capability-gated hostcalls, two-stage extension execution checks that block dangerous shell patterns by default, a per-extension trust lifecycle (pending, acknowledged, trusted, killed), and emergency kill-switches that can contain a misbehaving extension without disabling the whole system. A tamper-evident runtime risk ledger allows security decisions to be replayed and audited.
On performance, the project is deliberately conservative: numeric claims are only published in the README when backed by fresh, provenance-matched CI evidence artifacts, avoiding stale or unverifiable benchmarks. The speed comes from a combination of engineering choices — a single static binary with no runtime bootstrap, zero-copy hot paths, deterministic hostcall dispatch, SQLite-backed session storage, and a network-tuned SSE streaming parser.
For Pi Agent and OpenClaw users running large, multi-agent, extension-heavy workloads, the Rust port aims to preserve the existing workflow while upgrading the underlying engine, with scalability tested across session states ranging from 100k to 5 million tokens.