packages/coding-agent/docs/termux.md
Pi runs on Android via Termux, a terminal emulator and Linux environment for Android.
# Update packages
pkg update && pkg upgrade
# Install dependencies
pkg install nodejs termux-api git
# Install pi
npm install -g @earendil-works/pi-coding-agent
# Create config directory
mkdir -p ~/.pi/agent
# Run pi
pi
Clipboard operations use termux-clipboard-set and termux-clipboard-get when running in Termux. The Termux:API app must be installed for these to work.
Image clipboard is not supported on Termux (the ctrl+v image paste feature will not work).
Create ~/.pi/agent/AGENTS.md to help the agent understand the Termux environment:
# Agent Environment: Termux on Android
## Location
- **OS**: Android (Termux terminal emulator)
- **Home**: `/data/data/com.termux/files/home`
- **Prefix**: `/data/data/com.termux/files/usr`
- **Shared storage**: `/storage/emulated/0` (Downloads, Documents, etc.)
## Opening URLs
```bash
termux-open-url "https://example.com"
```
## Opening Files
```bash
termux-open file.pdf # Opens with default app
termux-open --chooser image.jpg # Choose app
```
## Clipboard
```bash
termux-clipboard-set "text" # Copy
termux-clipboard-get # Paste
```
## Notifications
```bash
termux-notification -t "Title" -c "Content"
```
## Device Info
```bash
termux-battery-status # Battery info
termux-wifi-connectioninfo # WiFi info
termux-telephony-deviceinfo # Device info
```
## Sharing
```bash
termux-share -a send file.txt # Share file
```
## Other Useful Commands
```bash
termux-toast "message" # Quick toast popup
termux-vibrate # Vibrate device
termux-tts-speak "hello" # Text to speech
termux-camera-photo out.jpg # Take photo
```
## Notes
- Termux:API app must be installed for `termux-*` commands
- Use `pkg install termux-api` for the command-line tools
- Storage permission needed for `/storage/emulated/0` access
/storage/emulated/0 (Downloads, etc.), run termux-setup-storage once to grant permissionsEnsure both apps are installed:
Then install the CLI tools:
pkg install termux-api
Run once to grant storage permissions:
termux-setup-storage
If npm fails, try clearing the cache:
npm cache clean --force