# iphone-use-flows The official flow registry for [iphone-use](https://github.com/leeguooooo/iphone-use). A flow is a reviewed, deterministic script that operates one iPhone app end to end. Once installed, a repeated phone task is **one command, no model, no screenshots**. ```bash MCP="$HOME/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp" "$MCP" flow update # mirror this repo into ~/.iphone-use/flows "$MCP" flow list # id · risk · verified · inputs · name PHONE_REMOTE_TOKEN=… "$MCP" flow run health/export-all-zh-cn ``` MCP clients (Claude Code, Claude Desktop) get the same as `phone_flow_list`, `phone_flow_info`, `phone_flow_run`, `phone_flow_update`, `phone_flow_publish`, and `phone_flow_report`; `phone_elements` tells the agent which installed flows fit the app that is on screen. ## What is in here | app | flow | verified on | does | |---|---|---|---| | `system` | `home` | iPhone 17 Pro Max · iOS 27.0 | back to the Home Screen | | `system` | `open-spotlight` | same | Home → Spotlight, waits for the text field | | `system` | `spotlight-search` | same | Spotlight, types `query`, submits (opens the top hit) | | `settings` | `open` | same | launches Settings | | `health` | `open` | same | launches Health | | `health` | `export-all-zh-cn` | same | Health → 资料 → 导出所有健康数据 → alert 导出 (zh-CN UI) | | `health` | `save-export-to-files-zh-cn` | same | share sheet → 保存到“文件” → Save | | `health` | `export-keep-both` | same | answers the 替换现有项目 alert with 保留两者 | | `health` | `export-all`, `save-export-to-files` | — (draft) | English-label twins of the above; need an English-UI run | `flow list` shows the same table for your installed copy; `--category health` and `--verified` filter it. `verified: no` means nobody has run that exact file on a phone yet — run it, take one checkpoint screenshot, and contribute `verified_on` back. ## Layout ```text index.json generated by scripts/build-index.py — id, path, sha256 of every flow /app.json {"id","bundle","name","category","description","aliases"} /.json strict iphone-use flow v1 + registry metadata ``` - A flow id is `/`; both are lowercase slugs. `` is the directory, `category` groups apps (`system`, `health`, `finance`, `im`, …). - `aliases` in `app.json` are the app's foreground label in each UI language (`["Health", "健康"]`). They let the MCP surface this app's flows the moment an agent reads the screen, so add one for every language you have seen. ## Flow file Flow v1 is the `phone_run_steps` step list plus optional string inputs. The registry adds optional metadata, all validated by the CLI: | field | meaning | |---|---| | `app` | bundle id the flow operates (`com.apple.Health`) | | `category` | lowercase slug; must match `app.json` | | `risk` | `read_only` · `navigation` · `side_effect`. A `side_effect` flow (send, publish, pay, delete) refuses to run without `--confirm` / `confirm=true` | | `locale` | UI language the labels were recorded under (`en`, `zh-CN`). A flow recorded in one language fails closed in another: zero matches, no tap | | `tags` | up to 8 slugs; `draft` marks a file that has not run on hardware | | `verified_on` | `[{"device","ios","app_version","date"}]` — runs that proved this exact file. `app_version` is the **iOS version for Apple system apps** (their own version is a placeholder). Empty shows as `verified: no` | | `app_version_min` | lowest app/iOS version the flow is known to work on; installed versions below it show `compat: incompatible` | | `example_inputs` | harmless values for the declared inputs, so the nightly canary can run a parameterized flow unattended. needs iphone-use ≥ 0.6.2 (older `flow update` rejects unknown fields) | What a flow may and may not do (the CLI enforces the mechanical parts): - Locate by exact, unique label or identifier (`tap_locator`, `tap_label`); zero or multiple matches send nothing. Prefer accessibility identifiers — they survive a language change. Coordinates are a last resort and must be followed by a `wait_for` that proves the screen changed. - Guard page transitions with `wait_for` (application, present, absent). No long sleeps: `after_ms` ≤ 3 s, `wait_for` ≤ 10 s, ≤ 60 s declared waiting in total, ≤ 24 steps. Split a long task at a natural checkpoint, as the Health export does. - Press system alerts with the `alert` step (native WDA route). Alerts do not reliably appear in the element tree, so do not `wait_for` them; pause briefly and press. - Typed text is a named `input`; the file never contains a value, and an input must never carry a password, one-time code, session token, or private message. - Stop at the first failed step; never retry inside the flow. ## Staying valid when apps update The CLI compares each flow's `verified_on` version with what the phone has installed and shows a `compat` verdict in `flow list` / `phone_flow_list` / `phone_elements`: `verified`, `untested-newer` (run it, then publish the refreshed `verified_on`), `incompatible`, `broken`, `needs-verification`, `draft`, `unknown`. Two tags drive the negative verdicts: `broken` (a report confirmed the flow fails) and `needs-verification` (set automatically when the nightly canary fails). A nightly job on a phone-owning Mac (`scripts/flow-reverify.py` in iphone-use) re-runs every verified `read_only` / `navigation` flow that is not tagged `no-canary`, refreshes `verified_on`, tags failures, and opens one `reverify/` PR here. Tag flows with real side effects on the device (the Health export creates a 50 MB zip) `no-canary`. ## Trust `flow update` downloads `index.json`, then every listed file, checks each sha256, and runs the same strict validator `flow run` uses before writing anything to `~/.iphone-use/flows` (mode 0600). One bad file aborts the whole update and leaves the store untouched. Files are pure JSON: nothing in this repository executes on your Mac or phone. This is the only supported source; the CLI has no `sources add`. `IPHONE_USE_FLOWS_SOURCE=` overrides it for development and CI. ## Contributing One command opens the pull request — fork if needed, branch, `app.json` for a new app, `index.json` rebuild, PR body from the flow's metadata: ```bash iphone-use-mcp flow publish my-flow.json --as / --alias Health --alias 健康 \ --note "iPhone 17 Pro Max · iOS 27.0 · zh-CN, ran 3×" ``` A file without `verified_on` opens as a draft PR. CI checks that `index.json` is current and that every flow passes `iphone-use-mcp flow validate`. The manual path and the review rules are in [CONTRIBUTING.md](CONTRIBUTING.md). ## Reporting a broken flow ```bash iphone-use-mcp flow report / --result @run.json --note "what you expected vs what the phone showed" ``` This files a `flow-broken` issue with the failed step and a redacted daemon result (typed text, screen labels, and element lists are stripped). From an MCP client, `phone_flow_report` reuses the last failed `phone_flow_run` automatically. Want a flow that does not exist yet? Open a [flow request](https://github.com/leeguooooo/iphone-use-flows/issues/new?template=new-flow.yml). ## License [MIT](LICENSE)