DEV Community

ghorbelhamdi
ghorbelhamdi

Posted on Fully Autonomous

I gave Claude Code my phone (and made it ask before it buys anything)

Buddy

I use Claude Code every day for work. At some point I caught myself wishing it could do the boring stuff on my phone too: reply to a message, turn on the lights, add something to my Amazon cart. Not write code for it. Just do it.

So I built Buddy, a free, open-source Android app. It's a chat bubble that floats over your apps. You type or say what you want, and an AI agent (Claude Code, Codex or OpenCode) reads the screen and taps through your apps for you.

Here's how it works, and a few things that surprised me along the way.

A small Linux inside the app

I didn't want "connect your phone to a PC with adb" or "root your phone". I wanted it to work after installing one app.

Claude Code, Codex and OpenCode are CLI tools, so Buddy ships a small Alpine Linux and runs it with proot, which needs no root. On first start it installs the agent you picked inside that Linux. You sign in with the plan you already pay for (Claude or ChatGPT), or use OpenCode's free models with no account at all. No API keys.

The first real bug I hit was in this layer. Android app storage doesn't allow hard links, so proot runs with --link2symlink, which fakes them with symlinks. That works until npm replaces a package in place: the fake links break, and you get opencode: not found right after an "update". The fix was boring: remove the old install completely before installing again, and only reinstall when there really is a newer version.

Giving the agent hands

The agent gets a small set of phone tools over MCP: read the screen, tap, type, scroll, swipe, open an app. Under the hood it's an Android accessibility service. The agent reads the screen as a tree of text and buttons with their positions, which is cheaper and more reliable than sending screenshots every step.

Every step shows up in the chat, so you watch it work, and you can stop it at any time.

Safety can't be left to the model

This was the part I spent the most time on.

My first version put the rule in the system prompt: "ask the user before you send, post, pay or delete". Models mostly follow that. Mostly isn't good enough when the button says "Buy now".

So Buddy checks it itself. Before a tap that would send, post, pay, delete or add to cart, Buddy stops and shows a card with exactly what's about to happen, and waits for your OK. The model can't skip that card, whatever it decides.

It paid off early. During testing, one free model went for "Buy now" instead of "Add to cart". Buddy stopped it and asked.

And a bug I found only this week proved the point again: after an OpenCode update, OpenCode quietly stopped reading the instructions Buddy passed to it, so for a few versions it ran without Buddy's system prompt at all. The confirm cards still worked, because they never depended on the prompt. (Fixed in 2.1.9: Buddy now writes its instructions to OpenCode's global AGENTS.md.)

Builds you can check

Buddy asks for a lot of trust: it can see your screen and tap for you. So it's Apache 2.0, and every release APK is built from the public code by GitHub Actions, not on my laptop. It's also on Google Play in closed testing.

Try it

It needs Android 11+ and a 64-bit phone. I'd love to hear what you'd ask it to do, and where it gets stuck.

Top comments (0)