Phone Agent is a native iPhone AI assistant. It understands the screen you choose to share, then uses an ESP32-S3 Bluetooth mouse and keyboard accessory to move, click, and type.
This project currently provides development source code. Build and install the app with Xcode. Phone control requires an ESP32-S3 accessory, pointer calibration, full screen sharing, and a model that accepts images.
Demo
Ask Phone Agent to open Meituan and find a Mixue lemon drink. These GIFs show each stage of the same iPhone recording at its original speed, with the action window visible during execution.
Watch the full demo (MP4)
1. Start a task
 Describe what you want to do. |
2. Open AssistiveTouch
 Open the system navigation menu. |
3. Return Home
 Return to the Home Screen. |
4. Open Meituan
 Find and launch the target app. |
5. Find drink deals
 Navigate to the relevant offers. |
6. Inspect the results
 Observe the screen before the next action. |
7. Select the lemon drink
 Open the matching offer. |
8. Review the order
 View the item and price before payment. |
The recording ends at order review, before payment. Location and account balance are blurred; the published clips are silent.
Features
Phone control — Observe the screen, generate an action, execute it, and observe the result. Queue tasks, pause or stop execution, take over manually, and add instructions during a task.
Conversations — Chat using text, dictation, shared screen images, or the camera. A separate configuration is available for real-time voice conversations.
Files and tools — Web search, memory, file and recording management, meeting notes, fishbone diagrams, and spreadsheets.
System integration — Siri and Shortcuts, Live Activities, and an action status window using Picture in Picture. Built with SwiftUI Liquid Glass, with light and dark appearances.
Bluetooth accessory — Mouse input, an ASCII keyboard, shortcuts, and pointer calibration in 21 steps. The GPIO48 RGB LED shows connection and task status: blue when disconnected, white when idle, rainbow during execution, red on failure, and green on completion.
Requirements
- An iPhone running iOS 27.
- An ESP32-S3 development board and a USB data cable. The default firmware configuration uses 4 MB flash and a WS2812 RGB LED on GPIO48.
- An OpenAI-compatible model endpoint that accepts images, and your own API key.
- AssistiveTouch enabled, with accessory pairing, pointer calibration, and screen sharing completed.
- A Mac and Xcode 27 to build the app. Select your signing team for both targets when installing on an iPhone.
- ESP-IDF 5.5.4 to build the firmware.
Install
-
Clone the repository and open the Xcode project:
git clone https://github.com/boboabw/phone-agent.git
cd phone-agent
open PhoneAgent.xcodeproj
-
Select your signing team for the PhoneAgent and PhoneAgentActivity targets. Choose your iPhone, then build and run.
-
In a terminal with ESP-IDF activated, run bash scripts/build-firmware.sh. Follow the firmware guide to flash the ESP32-S3.
-
In the app’s model connection settings, enter your provider name, complete HTTPS endpoint URL, model ID, and API key. Confirm the data sharing consent.
-
Pair AgentMouse-S3 in the system AssistiveTouch settings. Connect in the app and complete pointer calibration. Start full screen sharing, enter a task, and begin execution.
See Setup and Usage for detailed instructions.
Project Structure
GestaltEdit served as a reference for Swift source organization and README layout.
The Swift app separates its entry point, interface, coordination, services, and local storage. Shared models and the Live Activity extension live alongside the app; ESP32-S3 firmware has its own ESP-IDF project.
phone-agent/
├── PhoneAgent.xcodeproj/ # App and Live Activity targets
├── PhoneAgent/
│ ├── PhoneAgentApp.swift # App entry point and shared state
│ ├── ContentView.swift # Main workspace and navigation
│ ├── PhoneAgentViewModel.swift # Task and interaction coordination
│ ├── Models/ # Workspace and navigation types
│ ├── Views/ # SwiftUI screens and components
│ ├── Services/ # Capture, AI, BLE, voice, and tools
│ ├── Stores/ # Settings and local persistence
│ ├── Appearance/ # Theme, glass surfaces, and motion
│ ├── Resources/ # Assets, strings, and privacy metadata
│ └── Debug/ # Development review screens
├── Shared/ # Data models and accessory protocol
├── Activity/ # Live Activity and Dynamic Island UI
├── Skills/ # Bundled phone control instructions
├── firmware/ # ESP32-S3 BLE HID and GPIO48 RGB
├── scripts/ # Firmware build and check entry points
├── Tests/ # Existing offline checks
└── docs/ # Setup, architecture, and build records
Module Responsibilities
| Area |
Responsibility |
| App and coordination |
PhoneAgentApp creates shared state. ContentView presents the workspace. PhoneAgentViewModel connects user input, task execution, queue state, and services. |
| Views and appearance |
SwiftUI pages present state and route user actions to the coordinator or services. Appearance centralizes light and dark themes, glass surfaces, and transitions. |
| Phone control |
AgentEngine coordinates CaptureService, VisionClient, and MouseExecutor. BLETransport sends mouse and keyboard commands to the ESP32-S3. |
| Conversations and tools |
Services handle assistant conversations, voice, camera input, web research, system actions, and file processing. Corresponding views provide their interfaces. |
| Local storage |
Stores manage settings, task history and queues, memory, recordings, and service preferences. API credentials use the Keychain. |
| Shared types |
Shared defines action, protocol, and feature data models. Live Activity attributes and controls are also compiled into the extension. |
| System surfaces |
Activity renders Live Activities and Dynamic Island content. App services manage Activity updates, Picture in Picture, Siri, and Shortcuts. |
| Control instructions |
Skills contains bundled instructions loaded by PhoneControlSkill for the visual phone control loop. |
| Accessory firmware |
firmware/main implements BLE services, HID reports, command execution, and RGB status feedback for the ESP32-S3. |
Where to Make Changes
- Add or update a screen in
PhoneAgent/Views; use Appearance for shared styling.
- Add service behavior in
PhoneAgent/Services, persistent state in Stores, and reusable data types in Shared.
- Update phone control rules in
Skills and accessory commands in Shared/MouseProtocol.swift together with the firmware.
- Keep extension UI in
Activity; shared extension types belong in Shared with the appropriate target membership.
Xcode uses synchronized source folders. Swift files inside those folders are included automatically, subject to target membership exceptions. Skills is explicitly bundled as a folder resource. See Architecture for the execution flow and detailed component boundaries.
Data and Runtime
API keys are stored in the iPhone Keychain. Tasks, memory, recordings, and files are stored locally. Shared screen images, task text, and relevant context are sent to your configured model service after the required consent.
Voice, Siri, Picture in Picture, BLE, and execution across apps require verification on an actual iPhone. Background execution is subject to iOS scheduling. Continuous listening for a wake word is not implemented. See Verification for build and offline check records.
Development Docs
Architecture · Firmware and Protocol · Setup and Usage · Checks and Build Records
评论