SKILL.md--- name: phone-harness description: "Control the user's phone - an iPhone through the Mac's iPhone Mirroring window, an Android over adb, a rented cloud Android, or a cloud iPhone over HTTPS: open apps, tap, type, swipe, read the screen." --- # phone-harness The main helpers are listed in [Helpers](#helpers). Direct control of a phone from Python scripts. The same helpers drive every kind of phone below; what differs is how each one sees and touches the screen, and that is what the per-phone sections below are for. Read **Which phone**, the shared **Working method**, and then only the section for the phone in front of you. ## Setup Check what this machine can do (OS, shell, install rights, network, attached phones; `phone-harness doctor` does the phone part), tell the user in a sentence or two which phone you can drive with what is here, and use the best one that actually runs. A phone on the desk wins; the cloud needs no hardware and is always the fallback. | Mode | Needs | | --- | --- | | Personal iPhone | macOS 15+, iPhone Mirroring paired to an iOS 18+ iPhone, Accessibility + Screen Recording for the app that runs Python | | Android on the desk | macOS, Linux or Windows; adb; USB debugging (or Wireless debugging, Android 11+) | | Cloud iPhone | HTTPS to phone-harness.com hosts; a signed-in account. No adb, any OS | | Cloud Android | the cloud iPhone list, plus adb and outbound TCP to the phone's adb port | | No install possible | HTTPS and an HTTP client: the API directly | - If something is missing, name it and the one step the user can take. - Ask the user only to approve sign-in and to pick a phone. - Detail: [iPhone](https://github.com/phone-harness/phone-harness/blob/main/setup/ios.md), [Android](https://github.com/phone-harness/phone-harness/blob/main/setup/android.md), [Cloud](https://github.com/phone-harness/phone-harness/blob/main/setup/cloud.md), [API](https://github.com/phone-harness/phone-harness/blob/main/setup/api.md). ## Helpers - `ensure_device()` - Screen bounds once the device is usable, or raises with what the user has to do. - `screen(min_confidence=0.3)` - Visible text as `{text, confidence, source, x, y, w, h}` boxes. On Android the boxes come from the accessibility tree; on iPhone Mirroring they come from recognizing text. - `screenshot(path=None)` - Capture the screen to a PNG, print its path, and return it. - `find_text(query, exact=False)` - Visible text boxes matching `query`. - `tap_text(query, index=0, exact=False)` - Tap the center of visible text matching `query`. - `tap(x, y)` - Tap one point. - `long_press(x, y, duration=0.8)` - Press and hold a point. - `type_text(text, delay=0.03, keystrokes=False)` - Type into the focused field. - `press(combo)` - Press a key, such as `press("enter")`. - `open_app(name)` - Launch an app and return the app id that launched. - `open_url(url)` - Open an https link in the phone'