Dicklesworthstone/pi_agent_rust
High-performance AI coding agent CLI written in Rust with zero unsafe code
What it solves
pi_agent_rust is a high-performance AI coding agent CLI designed to replace slower, memory-heavy assistants written in Node.js or Python. It addresses common terminal-based AI tool issues such as slow startup times, high memory consumption, and unreliable streaming, while providing a robust security model for executing external tools and extensions.
How it works
Written from scratch in Rust, the project is a port of the original Pi Agent. It utilizes two specialized libraries: asupersync for structured concurrency and async runtime management, and rich_rust for high-quality terminal UI rendering. The agent operates as a single static binary that integrates with various LLM providers (including local ones like Ollama and llama.cpp) and implements a custom SSE parser for efficient token streaming.
Who it’s for
Developers who want a fast, lightweight, and secure AI coding assistant directly in their terminal, particularly those who prefer Rust's performance and safety guarantees over traditional interpreted runtimes.
Highlights
- Extreme Performance: Sub-100ms startup and low idle memory footprint (<50MB).
- Built-in Tooling: Includes 8 core tools for file system operations (
read,write,edit,grep,find,ls) and shell execution (bash). - Advanced Session Management: Supports conversation branching, automatic compaction for long histories, and persistence via JSONL files.
- Robust Extension Security: Features a two-stage execution guard, capability-gated hostcalls, and a trust-state lifecycle with kill-switches to prevent dangerous shell commands.
- Flexible Execution Modes: Offers Interactive TUI, Print mode for scripting, and an RPC mode for IDE integrations.
- Local Model Support: Native integration with Ollama, llama.cpp, mistral.rs, and LM Studio.