Files
Arvex 07c85d0016 README: dragony rewrite - strip marketing fluff, honest docs, audit-first
Replaced the bloated emoji-heavy original with something that actually
respects your intelligence. Straight talk, no sales pitch, proper
architecture diagram, and the audit info front and center.
2026-04-05 15:16:34 -06:00

191 lines
5.5 KiB
Markdown

# OpenClaw on Android (OCA)
Your old Android phone is not e-waste. It's an ARM64 server sitting in a drawer.
This repo turns any Termux device into a full OpenClaw AI server — native glibc, no proot, no VM, no excuses.
**Mirror** of [PsProsen-Dev/OpenClaw-On-Android](https://github.com/PsProsen-Dev/OpenClaw-On-Android) with audited install scripts. See [SAFE_INSTALL.md](SAFE_INSTALL.md) or the `safe/` directory for cleaned-up versions that don't blindly pipe things to bash.
---
## Quick Start
### 1. Install Termux from F-Droid
Play Store version is dead. Get it from [f-droid.org/packages/com.termux](https://f-droid.org/packages/com.termux/).
### 2. Phone prep
- Turn on Developer Options
- Enable "Stay Awake"
- Set Termux battery optimization to "Unrestricted"
- Run `termux-wake-lock` in the app
Without this Android will kill your processes the moment the screen turns off.
### 3. Install
```bash
pkg update -y && pkg install -y curl
curl -sL https://raw.githubusercontent.com/PsProsen-Dev/OpenClaw-On-Android/master/bootstrap.sh | bash
source ~/.bashrc
```
Takes 3-10 minutes. Want to know what this actually runs? [Read SAFE_INSTALL.md](SAFE_INSTALL.md).
### 4. Onboard
```bash
openclaw onboard
openclaw gateway
```
Run `openclaw gateway` directly in Termux, not over SSH — disconnecting the session kills it.
### 5. Verify
```bash
source ~/.bashrc
brew --version
go version
openclaw --version
```
---
## What You Get
| Thing | Details |
|-------|---------|
| **OpenClaw** | AI agent gateway with SSH, CLI tools, plugin system |
| **glibc runtime** | Linux binaries running natively on Android via ld.so wrapper |
| **Node.js v24** | Official linux-arm64 builds, glibc-patched |
| **Homebrew** | Linuxbrew inside Debian proot-distro |
| **Go 1.23** | glibc Go toolchain |
| **code-server** | VS Code in the browser (via Debian FHS container) |
| **Playwright** | Headless Chromium + xvfb for web automation |
| **OpenCode** | AI code editor (bun-based) |
| **AI CLIs** | Qwen Code, Gemini CLI, Claude Code, Codex (opt-in) |
---
## Architecture
```
Android (Termux)
├─ glibc-runner (ld.so wrapper)
│ └─ Node.js v24 (linux-arm64)
│ ├─ OpenClaw Gateway
│ │ ├─ AI CLIs
│ │ ├─ SSH server (:8022)
│ │ └─ clawdhub
│ └─ Local LLM (optional)
│ ├─ llama.cpp
│ └─ Ollama + cloud models
└─ proot-distro (Debian)
├─ Homebrew / Linuxbrew
├─ code-server
└─ Playwright + Chromium + xvfb
```
The trick: Android uses Bionic libc, but Linux binaries expect glibc. OCA uses a `glibc-runner` wrapper that injects `ld-linux-aarch64.so.1` so standard Linux executables run directly on ARM64 Android. No proot overhead for the stuff that matters.
---
## CLI
```
oca --update Update OpenClaw and patches
oca --status Global installation health
oca --clean Purge caches
oca --uninstall Remove everything
oca --version Version info
oca --help Full help
```
---
## Local LLM
Run models on-device or route through cloud models via Ollama.
### Cloud models (recommended)
Zero RAM/STORAGE cost on your phone:
```bash
ollama pull kimi-k2.5:cloud
ollama launch openclaw --model kimi-k2.5:cloud
```
### Local models (experimentation)
| Model | Size | RAM | Speed |
|-------|------|-----|-------|
| TinyLlama 1.1B | ~670MB | 2GB | Fast |
| Phi-3 Mini | ~2.3GB | 4GB | OK |
| Llama 3.2 1B | ~670MB | 2GB | Fast |
| Mistral 7B | ~4.1GB | 8GB | Slow |
CPU only. No GPU offloading on Android. Keep your expectations in check.
---
## Remote Access
SSH tunnel from your PC:
```bash
ssh -L 3000:localhost:3000 -L 8080:localhost:8080 [email protected] -p 8022
```
Then open `localhost:3000` in your browser.
---
## Android 12+ Phantom Process Fix
If you get `Process completed (signal 9)`, Android is killing Termux background processes:
```bash
adb shell settings put global development_settings_enabled 1
adb shell settings put global max_phantom_processes 64
```
---
## Audit & Safe Install
The upstream project uses `curl | bash` for several tool installers. We audited every external download and wrote safe replacements in the `safe/` directory:
- **[SAFE_INSTALL.md](SAFE_INSTALL.md)** — What each script actually downloads and runs
- **`safe/install-code-server.sh`** — Downloads release tarball from GitHub, no pipe
- **`safe/install-bun.sh`** — Downloads bun zip from oven-sh/bun releases, no pipe
- **`safe/install-nodesource.sh`** — Manual NodeSource apt repo setup, no pipe
- **`safe/install-opencode.sh`** — Safe bun + opencode-ai install
- **`safe/install-playwright.sh`** — Safe NodeSource + playwright install
- **`safe/install-homebrew.sh`** — Git clone (has integrity checks, not curl|bash)
Same tools. Just no blind piping.
---
## Docs
| Guide | What it covers |
|-------|---------------|
| [Quick Start](docs/quickstart.mdx) | 5-minute walkthrough |
| [Phone Setup](docs/phone-setup.mdx) | Battery, dev options, wakelock |
| [Installation](docs/installation.mdx) | Full installer breakdown |
| [AI CLI Tools](docs/ai-cli-tools.mdx) | Qwen, Claude, Gemini, Codex |
| [Local LLM](docs/local-llm.mdx) | Models, cloud vs local |
| [SSH Setup](docs/ssh-guide.mdx) | Remote access |
| [Troubleshooting](docs/troubleshooting.mdx) | Common errors |
| [Phantom Process Killer](docs/disable-phantom-process-killer.mdx) | Android 12+ fix |
---
*Fork maintained by Dragon on [git.rewr.ca](https://git.rewr.ca/Dragon/OpenClaw-On-Android)*
*Original by [PsProsen-Dev](https://github.com/PsProsen-Dev/OpenClaw-On-Android)*
*MIT License*