Docs / Running Pi.dev AI Agent

Running Pi.dev AI Agent

Learn how to install and run Pi.dev, a pure JavaScript AI coding agent, locally on Android using Casshper's embedded Node.js 22 runtime and Zsh shell.

Local AI Pair Programming with Pi.dev

Pi.dev is a lightweight, minimal AI coding agent designed to run directly in terminal environments. Because Pi.dev is implemented entirely in Pure JavaScript without native C/C++ binary dependencies, it installs and executes natively inside Casshper's embedded Node.js 22 runtime.

Why Pure JS Matters for Mobile AI

Many terminal AI utilities require complex native C++ extensions or heavy Python environments. Pi.dev's pure JavaScript architecture allows it to run 100% locally inside Casshper without compiling native binary addons.

Step-by-Step Installation and Setup

1. Install Pi.dev via npm

Install the Pi coding agent globally using Casshper's embedded npm package manager (use --ignore-scripts to skip unnecessary build hooks):

$ npm install -g --ignore-scripts @earendil-works/pi-coding-agent

2. Export Your API Key in ~/.zshrc

Casshper bundles a native Zsh shell by default. Add your AI provider API key (e.g. ANTHROPIC_API_KEY or OPENAI_API_KEY) to your ~/.zshrc file so it persists across shell sessions:

# Append API key to ~/.zshrc (or ~/.bashrc)
$ echo 'export ANTHROPIC_API_KEY="your-anthropic-api-key"' >> ~/.zshrc
$ source ~/.zshrc

3. Launch Pi.dev

Navigate to any local project folder and start the agent:

$ pi

Interact with Pi.dev to analyze repository files, generate refactors, and execute terminal commands. Combined with Ghostty's GPU renderer, LLM streaming output renders at 120FPS+ without UI input lag.

Workflow Tip: Persistent AI Sessions

Run Pi.dev inside a persistent background session. If you switch to another app to test a web server or review code, your AI session remains active in the background without losing state.