{"slug": "experiment-02-claude-runs-on-the-phone-with-root-working", "title": "Experiment 02: Claude runs on the phone, with root (Working)", "summary": "A developer running the handle \"rethink\" got Claude Code v2.1.330 with Claude Opus 5.5 running directly on an Android phone by unpacking Debian 13 (arm64) from Docker's debian:trixie-slim image into /data/local/rethink/debian, entering it with chroot, and giving the agent root through a single `sudo android <command>` wrapper that reaches Android's real root shell via /proc/1/root. In a recorded run, the agent answered \"Can you call Gaurav\" by running `content query` against the contacts provider and then `am start -a android.intent.action.CALL -d tel:+91XXXXXXXXXX`, placing a call that ended on its own after about 8 seconds. The first call attempts failed with \"Failed transaction\" because SELinux blocked Android's system service from writing am output into Debian's files; the fix was routing output through a pipe instead of a file.", "body_md": "Warning\n\n**Highly experimental. Proceed with caution.** Reproducing this means flashing a new operating system and running\ncode as root. One wrong step can brick your phone or erase everything on it. Use a spare phone you can afford to lose.\n\n## What I wanted to try\n\nIn [Experiment 01](https://rethinkphone.tech/experiments/claude-operates-the-phone/), Claude ran on my laptop and reached the phone over USB. I wanted the agent itself on the phone. So I put a small Debian Linux system inside the phone, installed Claude Code there, and opened it from a terminal app on the phone's own screen.\n\nI also gave it root. Instead of a fixed set of tools, Claude runs Android's own commands: `content query` to read contacts, `am start` to place a call, `input tap` to touch the screen.\n\n## What you're watching\n\nThe phone's screen, mirrored to my laptop with [scrcpy](https://github.com/Genymobile/scrcpy) for recording.\n\n1. I open the terminal app ([Termux](https://github.com/termux/termux-app) ).`debian` logs in to the phone's Debian, and`claude` starts Claude Code there. The header shows it's running in`/home/rethink` , on the phone.\n2. I type `Can you call Gaurav` . Claude searches the phone's contacts, finds the number and places the call. The dialer comes up, then Claude tells me the call has started.\n\nThese are the two commands it ran, from the phone's own log:\n\n```\n16:18:10  content query --uri content://com.android.contacts/data/phones --projection display_name:data1\n16:18:16  am start -a android.intent.action.CALL -d tel:+91XXXXXXXXXX\n```\n\n| Model | Claude Opus 5.5, in Claude Code v2.1.330, running on the phone | \n| Permissions | I had auto mode on, so Claude Code ran both commands without asking | \n| Typing | I typed on my laptop's keyboard through scrcpy, which forwards keystrokes to the phone. Claude, its tools and the call all ran on the phone | \n| Takes | One earlier run at 15:17, the first time it worked, which also placed and ended a call. Before that, calls failed (see below) | \n| Ending | The call ended on its own after about 8 seconds. Claude didn't hang up, and the take stops with \"hang up\" typed but not sent | \n| Edits | Cropped to the phone. The number is covered in the dialer and in Claude's replies, and the transcript is covered for 6 seconds while the command with the number scrolled by. Re-encoded at 30 fps. No cuts, no speed changes | \n| Log | [android-commands.log](https://rethinkphone.tech/assets/experiments/02/android-commands.log) , number redacted | \n\n## How it works\n\n- **Debian 13 (arm64)** is unpacked into`/data/local/rethink/debian` and entered with`chroot` . It's the root filesystem of Docker's official`debian:trixie-slim` image, pinned by commit and checksum.\n- **Claude Code** is the official Linux arm64 build, installed as an ordinary user,`rethink` .\n- **Root** is a single command,`sudo android <command>` , which runs the command in Android's real root shell. It gets there through`/proc/1/root` , the root filesystem of Android's first process. Every call is appended to a log.\n- **A `CLAUDE.md`** file tells Claude it's on the phone, lists the useful commands, and asks it to say what it's about to do before calling or messaging anyone.\n- **Termux** is the terminal. It's an ordinary app without root, so it logs in to Debian over SSH on`127.0.0.1` . I can also SSH in from my laptop on the same Wi-Fi.\n\nThe whole setup is three scripts in [`phone/linux/`](https://github.com/gauravtiwari5050/rethink/tree/main/phone/linux).\n\n## What went wrong first\n\nClaude's first attempts to call failed with `Failed transaction`. The kernel's SELinux log showed why. Claude Code saves each command's output to a file. `am` passes that file to Android's system service, and SELinux won't let the service write into Debian's files. My tests over SSH used pipes instead of files, so they passed. The fix: `android` now always passes output through a pipe.\n\n## Root versus the MCP server\n\nExperiment 01 gave Claude 13 named tools through an MCP server. This one gives it root.\n\n- **What root adds:** anything Android can do, with no tool to write first.\n- **What it costs:** no limits. Claude could read every app's data or wipe the phone. What's left is Claude Code's permission prompt, which shows each exact command, plus`CLAUDE.md` and the log. With auto mode on, as in this take, only the last two apply.\n\nI'm keeping both for now, and I'll write up which one I keep and why.\n\n## Reproduce it\n\nStep by step, from a fresh phone: [Reproduce Experiment 02](https://rethinkphone.tech/experiments/claude-runs-on-the-phone/reproduce/). It starts from [Set up your phone](https://rethinkphone.tech/setup/).\n\n## What it can't do yet\n\n- After a reboot, it needs `start.sh` over USB again.\n- The model still runs in Anthropic's cloud. The phone runs the agent, its tools and its log.\n- Termux's OpenSSH comes from its rolling package repository, so that piece isn't pinned.", "url": "https://wpnews.pro/news/experiment-02-claude-runs-on-the-phone-with-root-working", "canonical_source": "https://rethinkphone.tech/experiments/claude-runs-on-the-phone/", "published_at": "2026-11-22 09:00:00+00:00", "updated_at": "2026-11-25 14:12:38.979533+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Claude Opus 5.5", "Debian 13", "Termux", "scrcpy", "rethink", "SELinux", "Android"], "also_reported_by": [], "takeaway": "Running Claude Code inside a chrooted Debian 13 on the phone with a `sudo android` wrapper around /proc/1/root lets the agent drive Android's own commands, but am output must be piped rather than written to a file or SELinux blocks the call with \"Failed transaction\".", "recommendation": {"advice": "When giving an agent root on Android via a chroot, pipe command output instead of writing it to files in the chroot, since SELinux blocks Android's system service from writing there and calls fail with \"Failed transaction\".", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/experiment-02-claude-runs-on-the-phone-with-root-working", "markdown": "https://wpnews.pro/news/experiment-02-claude-runs-on-the-phone-with-root-working.md", "text": "https://wpnews.pro/news/experiment-02-claude-runs-on-the-phone-with-root-working.txt", "jsonld": "https://wpnews.pro/news/experiment-02-claude-runs-on-the-phone-with-root-working.jsonld"}}