aua 0.48.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2394 @@
1
+ Metadata-Version: 2.5
2
+ Name: aua
3
+ Version: 0.48.0
4
+ Summary: Give AI agents eyes on Android, iOS-simulator and web UIs: structured elements with stable IDs, not pixels. CLI + MCP server.
5
+ Project-URL: Homepage, https://github.com/The-Wordlab/Android-UI-Analyser
6
+ Project-URL: Documentation, https://github.com/The-Wordlab/Android-UI-Analyser#readme
7
+ Project-URL: Changelog, https://github.com/The-Wordlab/Android-UI-Analyser/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/The-Wordlab/Android-UI-Analyser/issues
9
+ Author: Eiliya
10
+ License: MIT License
11
+
12
+ This license applies to the Android UI Analyser software, documentation, and training
13
+ tools. It does not apply to the modified FunctionGemma model derivative under
14
+ `src/android_ui_analyser/resources/functiongemma/`; that directory is distributed under
15
+ its included Gemma Terms of Use, prohibited-use policy, and notices.
16
+
17
+ Copyright (c) 2026 The Wordlab
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all
27
+ copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
36
+ License-File: LICENSE
37
+ Keywords: accessibility,agent,ai-agents,android,ios,mcp,ocr,set-of-marks,ui-testing,uiautomator2,web
38
+ Classifier: Development Status :: 4 - Beta
39
+ Classifier: Intended Audience :: Developers
40
+ Classifier: Operating System :: MacOS
41
+ Classifier: Operating System :: POSIX :: Linux
42
+ Classifier: Programming Language :: Python :: 3
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Topic :: Software Development :: Quality Assurance
47
+ Classifier: Topic :: Software Development :: Testing
48
+ Requires-Python: >=3.11
49
+ Requires-Dist: android-ui-analyser==0.48.0
50
+ Provides-Extra: all
51
+ Requires-Dist: android-ui-analyser[all]==0.48.0; extra == 'all'
52
+ Provides-Extra: apple
53
+ Requires-Dist: android-ui-analyser[apple]==0.48.0; extra == 'apple'
54
+ Provides-Extra: audio
55
+ Requires-Dist: android-ui-analyser[audio]==0.48.0; extra == 'audio'
56
+ Provides-Extra: dev
57
+ Requires-Dist: android-ui-analyser[dev]==0.48.0; extra == 'dev'
58
+ Provides-Extra: easyocr
59
+ Requires-Dist: android-ui-analyser[easyocr]==0.48.0; extra == 'easyocr'
60
+ Provides-Extra: functiongemma
61
+ Requires-Dist: android-ui-analyser[functiongemma]==0.48.0; extra == 'functiongemma'
62
+ Provides-Extra: hybrid-policy
63
+ Requires-Dist: android-ui-analyser[hybrid-policy]==0.48.0; extra == 'hybrid-policy'
64
+ Provides-Extra: lxml
65
+ Requires-Dist: android-ui-analyser[lxml]==0.48.0; extra == 'lxml'
66
+ Provides-Extra: omniparser
67
+ Requires-Dist: android-ui-analyser[omniparser]==0.48.0; extra == 'omniparser'
68
+ Provides-Extra: paddle
69
+ Requires-Dist: android-ui-analyser[paddle]==0.48.0; extra == 'paddle'
70
+ Provides-Extra: proxy
71
+ Requires-Dist: android-ui-analyser[proxy]==0.48.0; extra == 'proxy'
72
+ Provides-Extra: rapidocr
73
+ Requires-Dist: android-ui-analyser[rapidocr]==0.48.0; extra == 'rapidocr'
74
+ Provides-Extra: tesseract
75
+ Requires-Dist: android-ui-analyser[tesseract]==0.48.0; extra == 'tesseract'
76
+ Provides-Extra: typesafe
77
+ Requires-Dist: android-ui-analyser[typesafe]==0.48.0; extra == 'typesafe'
78
+ Provides-Extra: web
79
+ Requires-Dist: android-ui-analyser[web]==0.48.0; extra == 'web'
80
+ Provides-Extra: yolo
81
+ Requires-Dist: android-ui-analyser[yolo]==0.48.0; extra == 'yolo'
82
+ Description-Content-Type: text/markdown
83
+
84
+ # android-ui-analyser (`aua`)
85
+
86
+ > **The android in the name is your AI agent, not the platform.** Read it as "a UI analyser for
87
+ > androids": the robot is the one looking, and what it looks at can be Android, an iOS simulator,
88
+ > or the web.
89
+
90
+ `aua` is a configurable CLI that gives an AI agent structured "what's on screen and where" for
91
+ Android, iOS-simulator, and web UI testing. It reads the native accessibility/view hierarchy or
92
+ browser DOM first, returning elements with tracked IDs, types, text, and bounding boxes.
93
+ Image-based detection, OCR, and optional grounding cover screens with incomplete accessibility
94
+ data. The agent sends a published ID to `aua tap-and-analyze <id>` or
95
+ `aua input-and-analyze <id> "hello"`; AUA resolves the element on the current screen and computes
96
+ the coordinates.
97
+
98
+ > **New here?** Start with [Installation help](#installation-help). Claude Code and Codex users
99
+ > can install one plugin that supplies the AUA skill and starts the matching released MCP server;
100
+ > no clone or permanent AUA install is required.
101
+
102
+ ---
103
+
104
+ ## Installation help
105
+
106
+ Choose the path that matches how you want to use AUA:
107
+
108
+ | You want to… | Recommended path | Is AUA permanently installed? |
109
+ |---|---|---|
110
+ | Use AUA from **Claude Code** | [Install the Claude Code plugin](#claude-code-plugin) | No |
111
+ | Use AUA from **Codex** | [Install the Codex plugin](#codex-plugin) | No |
112
+ | Run one CLI command or pin AUA in automation | [Run it with `uvx`](#run-the-cli-without-installing-aua) | No |
113
+ | Use the `aua` command everywhere or contribute | [Clone and bootstrap](#install-the-cli-permanently) | Yes |
114
+
115
+ The plugin paths are the easiest option for agents: each bundles the operating skill and starts
116
+ the local MCP server from the Git tag matching the plugin version.
117
+
118
+ ### Prerequisites
119
+
120
+ `aua` is a Python CLI with separate Android, iOS-simulator, and web platform adapters. Every
121
+ installation needs Python; the target-specific transport is needed only for the platform you use:
122
+
123
+ | Requirement | Version | Why / how to get it |
124
+ |---|---|---|
125
+ | **Python** | **3.11 or newer** | Runs the CLI. Check with `python3 --version`. |
126
+ | **uv** | any recent | Runs AUA without a permanent install (`uvx`) and powers the Claude/Codex plugins. ([install](https://docs.astral.sh/uv/getting-started/installation/)) |
127
+ | **Android platform-tools (`adb`)** | any recent | Android only: discovers devices and lets `uiautomator2` drive them. ([install](#installing-adb-platform-tools)) |
128
+ | **An Android device or emulator** | Android 7.0 (API 24) or newer | Android only: a running AVD or USB-attached phone. ([setup](#connect-a-device-or-emulator)) |
129
+
130
+ You do **not** need Android Studio's IDE, Gradle, or the app's source code — `aua` works against any app already installed on the device, including release builds. (Android Studio is just the easiest way to obtain `adb` and an emulator.)
131
+
132
+ Optional, only for specific features:
133
+ - **Xcode 26+ and [AXe](https://github.com/cameroncooke/AXe)** (`./install.sh --with-ios`, or `aua --platform ios doctor --fix`) — only for [iOS simulators](#ios-simulators) via `--platform ios`.
134
+ - **Playwright plus a supported browser** — only for [web pages](#web-browsers) via
135
+ `--platform web`; install the `web` extra and run `playwright install chromium`, or use an
136
+ installed Chrome channel.
137
+ - **`tesseract`** system binary — only if you enable the `tesseract` OCR extra.
138
+ - A **GPU** (CUDA / Apple Metal) — speeds up the `yolo`/`omniparser` detectors and local grounding, but everything also runs on CPU.
139
+ - **API keys** (`OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY`) — only if you opt into a commercial grounding provider (off by default).
140
+ - **Apple silicon + a separately downloaded MLX FunctionGemma base** — only if you opt into
141
+ the local guarded next-call policy. The base is not bundled or downloaded by AUA.
142
+
143
+ ### Installing `adb` (platform-tools)
144
+
145
+ `adb` ships in the Android SDK **platform-tools**. Get it any of these ways:
146
+
147
+ - **Android Studio** → *SDK Manager* installs it under `~/Library/Android/sdk/platform-tools` (macOS) or `~/Android/Sdk/platform-tools` (Linux).
148
+ - **Standalone download**: grab [platform-tools](https://developer.android.com/tools/releases/platform-tools) and unzip.
149
+ - **Homebrew (macOS)**: `brew install android-platform-tools`.
150
+ - **Linux (Debian/Ubuntu)**: `sudo apt install android-tools-adb`.
151
+
152
+ Then make sure it's on your `PATH` (macOS / Android Studio layout shown):
153
+
154
+ ```bash
155
+ export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" # add to ~/.zshrc or ~/.bashrc
156
+ adb version # confirm it resolves
157
+ ```
158
+
159
+ ### Claude Code plugin
160
+
161
+ Run these commands inside Claude Code:
162
+
163
+ ```text
164
+ /plugin marketplace add The-Wordlab/Android-UI-Analyser
165
+ /plugin install android-ui-analyser@the-wordlab
166
+ ```
167
+
168
+ Open a new Claude Code session after installation. The plugin supplies the generated AUA skill,
169
+ the selector-safety hook, and the MCP server configuration automatically.
170
+
171
+ ### Codex plugin
172
+
173
+ Run these commands in a terminal:
174
+
175
+ ```bash
176
+ codex plugin marketplace add The-Wordlab/Android-UI-Analyser
177
+ codex plugin add android-ui-analyser@the-wordlab
178
+ ```
179
+
180
+ Open a new Codex session after installation. The plugin supplies the same generated AUA skill and
181
+ pinned MCP server as the Claude Code plugin. See OpenAI's
182
+ [marketplace CLI documentation](https://developers.openai.com/plugins/build/plugins#add-a-marketplace-from-the-cli)
183
+ for the underlying repository-marketplace flow.
184
+
185
+ ### Run the CLI without installing AUA
186
+
187
+ Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), then run the latest
188
+ release from [PyPI](https://pypi.org/project/android-ui-analyser/):
189
+
190
+ ```bash
191
+ uvx android-ui-analyser --version
192
+ ```
193
+
194
+ `uvx` creates an isolated environment and caches it for later calls; no clone, `git pull`, editable
195
+ environment, or global `aua` executable is needed. The package installs one command under two
196
+ names, `aua` and `android-ui-analyser`, and `uvx` starts the one named after the package. Any AUA
197
+ command follows it, for example `uvx android-ui-analyser doctor`.
198
+
199
+ The base package reads the UI hierarchy. To add the OCR and emulator-audio extras, name them with
200
+ `--from` and call `aua`:
201
+
202
+ ```bash
203
+ uvx --from 'android-ui-analyser[apple,rapidocr,audio]' aua --version
204
+ ```
205
+
206
+ For automation, pin a release so a later run starts the same code. Either append the version
207
+ (`uvx android-ui-analyser@<version> …`), or install the tag straight from GitHub, which also
208
+ reaches the releases before 0.48.0 that were never uploaded to PyPI:
209
+
210
+ ```bash
211
+ uvx --from \
212
+ 'android-ui-analyser[apple,rapidocr,audio] @ git+https://github.com/The-Wordlab/Android-UI-Analyser.git@v0.48.0' \
213
+ aua --version
214
+ ```
215
+
216
+ Replace `v0.48.0` with the release you want. The
217
+ [latest GitHub Release](https://github.com/The-Wordlab/Android-UI-Analyser/releases/latest) shows
218
+ the current tag and its release notes.
219
+
220
+ ### Install the CLI permanently
221
+
222
+ Clone the repository and run the idempotent bootstrap:
223
+
224
+ ```bash
225
+ git clone https://github.com/The-Wordlab/Android-UI-Analyser.git
226
+ cd Android-UI-Analyser
227
+ ./install.sh # add --with-web for browser support, --with-ios for AXe (macOS)
228
+ # add --with-policy for the optional local policy runtime
229
+ ./install.sh --print-plan # preview without changing anything
230
+ ```
231
+
232
+ The script installs `aua` globally through `uv tool` or `pipx` (with a project-venv fallback),
233
+ installs equivalent user-level Claude Code and Codex skills, and runs `aua doctor`. Codex uses
234
+ `~/.agents/skills/android-ui-analyser`; the older `${CODEX_HOME:-~/.codex}/skills` copy remains
235
+ synchronized for existing clients. Both locations are generated from the same source.
236
+
237
+ ### Connect and verify
238
+
239
+ Start an emulator or attach an Android device with USB debugging enabled, then check that `adb`
240
+ can see it:
241
+
242
+ ```bash
243
+ adb devices
244
+ ```
245
+
246
+ For a permanent CLI install, verify everything and start goal-oriented work:
247
+
248
+ ```bash
249
+ aua doctor
250
+ aua session start --goal "inspect the current screen"
251
+ ```
252
+
253
+ For a plugin install, open a new Claude Code or Codex session and ask: **“Use AUA to list the
254
+ Android devices.”** The agent should use the plugin's MCP server; a global `aua` command is not
255
+ required. See [Connect a device or emulator](#connect-a-device-or-emulator) for physical-device,
256
+ AVD, Docker, and multi-agent setup.
257
+
258
+ ### Update later
259
+
260
+ Claude Code plugin:
261
+
262
+ ```text
263
+ /plugin update android-ui-analyser@the-wordlab
264
+ ```
265
+
266
+ Codex plugin:
267
+
268
+ ```bash
269
+ codex plugin marketplace upgrade the-wordlab
270
+ codex plugin add android-ui-analyser@the-wordlab
271
+ ```
272
+
273
+ Permanent CLI installs can check the latest release with `aua update --check` and install it with
274
+ `aua update --install`; clone-based installs upgrade by checking out the newer tag and re-running
275
+ `./install.sh`. See [Releases and updating](#releases-and-updating) for the automation exit-code
276
+ contract.
277
+
278
+ ### Common setup problems
279
+
280
+ | Symptom | Fix |
281
+ |---|---|
282
+ | `uvx: command not found` | [Install `uv`](https://docs.astral.sh/uv/getting-started/installation/) (`brew install uv` on macOS), then open a new terminal. The plugin's MCP launcher also looks in `~/.local/bin`, `/opt/homebrew/bin`, `/usr/local/bin` and `~/.cargo/bin`, so a `uv` installed there works even when the host's PATH does not list it. |
283
+ | `brew install axe` refuses to load the untrusted tap `cameroncooke/axe` | A current Homebrew needs `brew trust cameroncooke/axe` first. `aua --platform ios doctor --fix` (or `./install.sh --with-ios`) runs the tap, trust and install steps for you. |
284
+ | `adb: command not found` | Install Android platform-tools and follow [Installing `adb`](#installing-adb-platform-tools). |
285
+ | `adb devices` is empty | Boot an emulator, or enable USB debugging on the phone and accept its authorization prompt. |
286
+ | The plugin is installed but AUA is unavailable | Confirm `uvx --version` works, then open a new Claude Code or Codex session so the plugin's MCP server starts. |
287
+ | `./install.sh` succeeded but `aua` is not found | Run `uv tool update-shell` (or `pipx ensurepath`), then open a new terminal. The bootstrap prints an absolute fallback path if it had to use `.venv`. |
288
+
289
+ ### Developer and source-install details
290
+
291
+ If you are developing AUA itself, use one of the following editable-install paths.
292
+
293
+ Base install (macOS / Apple Silicon, recommended extras — Python 3.11+ per
294
+ [Prerequisites](#prerequisites)):
295
+
296
+ ```bash
297
+ python -m venv .venv && source .venv/bin/activate
298
+ uv pip install -e ".[dev,apple,rapidocr,audio,web]"
299
+ ```
300
+
301
+ Or without uv:
302
+
303
+ ```bash
304
+ pip install -e ".[dev,apple,rapidocr,audio,web]"
305
+ ```
306
+
307
+ Global install (no extras):
308
+
309
+ ```bash
310
+ uv tool install . # or: pipx install .
311
+ ```
312
+
313
+ **If you are going to edit the source, install it editable — once:**
314
+
315
+ ```bash
316
+ uv tool install --force --reinstall --editable .
317
+ ```
318
+
319
+ `aua` then resolves straight to your working tree, so every edit is live and there is no
320
+ re-install step to forget. Confirm with
321
+ `python -c "import android_ui_analyser.selectors as m; print(m.__file__)"` — it should print a
322
+ path inside your clone.
323
+
324
+ **If you install non-editable, re-installing needs `--reinstall`:**
325
+
326
+ ```bash
327
+ uv tool install --force --reinstall . # picks up your working tree
328
+ uv tool install --force . # does NOT - silently reuses a cached build
329
+ ```
330
+
331
+ `--force` only means "replace the existing tool entry"; uv still resolves `.` from its build
332
+ cache, so the second command reports `Installed 1 executable: aua` and leaves the **old** code
333
+ in place. Nothing warns you. The failure mode is invisible: you edit, install, test, and measure
334
+ the previous build while believing it is the new one - which is how a working fix got recorded
335
+ as a fix that did nothing. If a change seems to have had no effect, verify what is actually
336
+ installed before doubting the change:
337
+
338
+ ```bash
339
+ grep -c my_new_symbol "$(uv tool dir)"/android-ui-analyser/lib/python*/site-packages/android_ui_analyser/*.py
340
+ ```
341
+
342
+ And restart the daemon afterwards (`aua daemon stop && aua daemon start`) - a running daemon
343
+ keeps serving the code and the config it started with, so a fresh install or an env override
344
+ does not reach it.
345
+
346
+ ### Put `aua` on your PATH (works from any directory)
347
+
348
+ Like `adb`, the `aua` binary must resolve from **any** directory — you (and your agents)
349
+ will call it from project folders, not from this repo:
350
+
351
+ - `uv tool install .` / `pipx install .` (run from the clone) install it globally to
352
+ `~/.local/bin`. If a **new** shell still can't find `aua`, run `uv tool update-shell`
353
+ or `pipx ensurepath` once, then open a new terminal.
354
+ - `./install.sh` does all of the above automatically (uv → pipx → venv fallback). If it
355
+ printed the venv-fallback warning, `aua` exists **only** at `<repo>/.venv/bin/aua`:
356
+ call it by that absolute path, add `<repo>/.venv/bin` to your `PATH`, or install
357
+ `uv`/`pipx` and re-run `./install.sh`.
358
+ - Verify from your home directory:
359
+
360
+ ```bash
361
+ cd ~ && command -v aua && aua --version
362
+ ```
363
+
364
+ ### Optional-dependency extras matrix
365
+
366
+ | Extra | Installs | Notes |
367
+ |---|---|---|
368
+ | `apple` | `pyobjc-framework-Vision` | Apple Vision OCR — **macOS only**, fastest OCR on Mac |
369
+ | `rapidocr` | `rapidocr-onnxruntime`, `onnxruntime` | Cross-platform ONNX OCR; default non-macOS OCR |
370
+ | `paddle` | `paddleocr`, `paddlepaddle` | PP-OCRv5; highest accuracy, slower |
371
+ | `tesseract` | `pytesseract` | Requires system `tesseract` binary |
372
+ | `easyocr` | `easyocr` | Optional OCR engine |
373
+ | `audio` | `grpcio` | Authenticated PCM injection into an Android Emulator microphone |
374
+ | `web` | `playwright` | Web DOM, screenshots, and input; install a browser with `playwright install chromium` |
375
+ | `yolo` | `ultralytics`, `torch` | UI element detection with user-supplied weights |
376
+ | `omniparser` | `ultralytics`, `torch`, `huggingface-hub` | OmniParser detection — **AGPL-3.0, opt-in** |
377
+ | `functiongemma` | `mlx-lm` | Apple-silicon-only local policy runtime; base model stays external. Not in the default install — opt in with `./install.sh --with-policy` |
378
+ | `hybrid-policy` | `mlx-lm`, `mlx-vlm` | Adds the larger MLX-VLM policy reviewer; `./install.sh --with-policy=hybrid` |
379
+ | `proxy` | `mitmproxy` | Headless HTTPS mock / record / replay (`aua proxy`, `aua mock`) |
380
+ | `lxml` | `lxml` | Faster XML parse for huge hierarchy dumps |
381
+ | `dev` | pytest, ruff, mypy, respx | Development and test tooling |
382
+ | `all` | Perception, web, proxy, and XML extras | Excludes platform-specific `functiongemma`; add it explicitly |
383
+
384
+ Heavy deps are **lazy-imported** — a missing optional extra never breaks the core CLI. The two
385
+ policy extras are the only ones `install.sh` will not install unless asked (`--with-policy`), since
386
+ they are hundreds of megabytes of Apple-silicon-only ML runtime for a lane that is off by default
387
+ and needs a separately downloaded base model. When one is configured but absent, `aua doctor`
388
+ reports it with the exact install command instead of leaving autopilot to hand off every step.
389
+
390
+ ## Releases and updating
391
+
392
+ AUA follows Semantic Versioning. Every release is a `vX.Y.Z` git tag with a matching
393
+ [GitHub Release](https://github.com/The-Wordlab/Android-UI-Analyser/releases); its notes come from
394
+ [CHANGELOG.md](CHANGELOG.md), so the release page says what changed without requiring a pull of
395
+ `main` or a read through commit history.
396
+
397
+ Check the installed version against the latest release without touching a device:
398
+
399
+ ```bash
400
+ aua update --check # installed vs latest, release notes, and the upgrade command
401
+ aua update --check --json # one JSON object for automation
402
+ ```
403
+
404
+ The exit code is `0` when current, `10` when an update is available, and `1` when the check could
405
+ not run. A CI gate can branch on that contract without parsing human text:
406
+
407
+ ```bash
408
+ if aua update --check --json > /tmp/aua-update.json; then
409
+ echo "AUA is up to date"
410
+ else
411
+ case $? in
412
+ 10) jq -r '"new AUA: \(.latest) — \(.release_url)"' /tmp/aua-update.json ;;
413
+ *) cat /tmp/aua-update.json >&2; exit 1 ;;
414
+ esac
415
+ fi
416
+ ```
417
+
418
+ Install the latest release, or a chosen one, over the running `aua`:
419
+
420
+ ```bash
421
+ aua update --install # the latest release
422
+ aua update --install --version 0.33.0 # a specific release, newer or older
423
+ ```
424
+
425
+ A `uv tool` install of a release is reinstalled at that tag with the extras and `--with` packages
426
+ its uv receipt recorded, and the user-level skill files that already exist are rewritten by the
427
+ new version. A clone, a `uvx` run, the plugins and any other environment are never changed: the
428
+ result names the exact command for that install instead (`git checkout <tag> && ./install.sh`,
429
+ `uvx --from …@<tag>`, `/plugin update …`). The exit code is `0` when the target is installed or
430
+ already current, `10` when the printed commands still have to run, `1` when the install failed
431
+ and `2` for a version that is not a published release.
432
+
433
+ Without AUA installed, the equivalent release lookup is one API call:
434
+
435
+ ```bash
436
+ curl -fsSL https://api.github.com/repos/The-Wordlab/Android-UI-Analyser/releases/latest \
437
+ | jq -r .tag_name
438
+ ```
439
+
440
+ Pin a clone-based install to a release instead of tracking `main`:
441
+
442
+ ```bash
443
+ git fetch --tags
444
+ git checkout v0.48.0
445
+ ./install.sh
446
+ ```
447
+
448
+ Upgrade by checking out the newer tag and re-running `./install.sh`. Return to the moving branch
449
+ with `git checkout main && git pull && ./install.sh`. Maintainers cut releases using the procedure
450
+ in [docs/RELEASING.md](docs/RELEASING.md).
451
+
452
+ ---
453
+
454
+ ## Connect a device or emulator
455
+
456
+ `aua session start` selects from everything `adb` can see. It checks host-wide leases and target
457
+ capabilities, then leases a compatible free target to the calling agent process. If none is free,
458
+ it boots a matching configured AVD automatically.
459
+
460
+ ### Option A — Emulator (AVD)
461
+
462
+ Agents do not list, start, name an owner, or acquire a lease before goal work:
463
+
464
+ ```bash
465
+ aua session start --goal "verify the change"
466
+ # re-use the returned observation; later commands follow the automatic sticky lease
467
+ # … drive the flow …
468
+ aua session finish # restores state/releases lease; keeps its emulator warm
469
+ aua session finish --stop-started-target # unattended: stop only this session's exact boot
470
+
471
+ # Capability-aware selection/provisioning:
472
+ aua session start --goal "record HTTPS" --needs root,proxy
473
+ aua session start --goal "verify Play billing" --needs play
474
+ aua session start --goal "show the QA run" --headed
475
+ aua session start --goal "verify expand/collapse motion" --animations
476
+ ```
477
+
478
+ Each AUA-started emulator checks the inherited Android proxy setting before app launch. A proxy
479
+ that is both unowned and confirmed blackholed (no reachable listener/tunnel) is cleared
480
+ automatically; reachable foreign proxies and AUA-owned proxies are left intact.
481
+
482
+ Long emulator boots emit `AUA_PROGRESS` records and ten-second heartbeats on stderr while keeping
483
+ stdout reserved for the single final JSON result. If an agent shell yields a live process/session
484
+ id, poll that same process; do not launch a duplicate `emulator start`.
485
+
486
+ **HTTPS proxy / mock** needs a *rootable* Google APIs image — Google Play AVDs refuse `adb root`, so the mitm CA cannot be installed as a system trust and HTTPS recording stays empty:
487
+
488
+ ```bash
489
+ aua emulator recommend-proxy # suggests a small package (no download)
490
+ aua emulator ensure-proxy # one-time google_apis image setup
491
+ aua session start --goal "record HTTPS" --needs root,proxy
492
+ aua proxy start # needs: pip/uv install with [proxy]
493
+ aua session finish
494
+ ```
495
+
496
+ You can still create AVDs by hand (`sdkmanager` / `avdmanager` / Android Studio). Prefer SDK `cmdline-tools/latest` under `$ANDROID_HOME` over stale Homebrew copies. On Mac, headless defaults to **host GPU** so fans stay quiet; override with `--gpu swiftshader` only for CI without a display.
497
+
498
+ ### Emulator microphone input
499
+
500
+ `aua` can feed deterministic host audio into an app's microphone through the Android
501
+ Emulator's authenticated control API. This is emulator-only (not a USB phone), needs the
502
+ `audio` extra, and the AVD must be started with audio enabled:
503
+
504
+ ```bash
505
+ aua session start --goal "verify voice input" --audio
506
+
507
+ aua mic inject sample.wav
508
+ aua mic inject sample.wav --rid hold_to_talk # DOWN → audio → UP (default hold)
509
+ aua mic inject sample.wav --rid record_button --control-mode toggle # tap start, then tap stop
510
+ aua mic inject sample.wav 7 --pre-roll-ms 300 --post-roll-ms 500
511
+
512
+ # macOS convenience: /usr/bin/say creates a temporary 44.1 kHz S16 mono WAV
513
+ aua mic speak "Testing one two" --voice Samantha --rate 175 --rid hold_to_talk
514
+ ```
515
+
516
+ Input must be an uncompressed RIFF/WAVE file: unsigned 8-bit or little-endian signed 16-bit
517
+ PCM, mono or stereo, at 48 kHz or less, and no longer than five minutes. The default delivery
518
+ mode is server-backpressured. With a target, `--control-mode hold` remains the default:
519
+ DOWN → pre-roll → recording readiness → audio → post-roll → UP. `--control-mode toggle` instead sends one
520
+ non-retrying tap to start, waits/injects, then sends one non-retrying tap to the exact same
521
+ point to stop. Toggle mode requires a target that is enabled, clickable, and initially off;
522
+ when its active state is not exposed as `checked`/`selected`, the caller must establish that
523
+ precondition. Toggle mode is best-effort unless the app exposes an active-state/STOP selector:
524
+ use short media and require the control to remain actively recording through post-roll. If the
525
+ app auto-stops early (timeout, max duration, or recognition completion), the same final tap could
526
+ start a new recording instead. Each command then returns the post-action observation with fresh ids.
527
+
528
+ Before streaming, AUA waits up to three seconds for a current, active recording input. Historical
529
+ recording logs, idle inputs, and endpoint authentication do not satisfy this check.
530
+ `mic_recording_not_ready` means no audio was sent; inspect the attached observation for a
531
+ permission prompt or inactive recording control. A held control is released on failure.
532
+ Readiness is a prerequisite for injection, not a guarantee against emulator faults.
533
+
534
+ AUA discovers the endpoint by matching the selected `emulator-<port>` serial to the emulator's
535
+ `pid_*.ini` runtime record and sends its bearer token only as gRPC metadata; the token is never
536
+ printed. `mic speak` has a focused unsupported-host error off macOS; generate a compatible WAV
537
+ with another TTS tool and use `mic inject` there. `mic_delivery_uncertain` means the emulator
538
+ returned `INTERNAL` after accepting packets: samples may already have arrived, so inspect
539
+ `error.result.observation` and do not repeat the voice action. A timeout or unclassified RPC
540
+ close can also happen after partial delivery; its hint likewise requires inspecting the UI
541
+ before any new attempt. `mic_delivered_release_failed` means all audio arrived but the target
542
+ control gesture did not finish cleanly—do not repeat it; inspect the attached observation and
543
+ verify the control state. `mic_toggle_start_uncertain` means the one START tap may have landed:
544
+ AUA sends no audio and no blind compensating tap, because recording may be active.
545
+ `mic_toggle_stop_uncertain` means START was confirmed but STOP could not be sent or confirmed
546
+ safely. In either toggle uncertainty, protect nearby speech, inspect the forced observation,
547
+ and never tap or repeat audio blindly. AUA rechecks that the same foreground package owns the
548
+ screen before audio and STOP; if ownership changes it refuses to inject or tap stale coordinates.
549
+ If injection reports
550
+ `mic_emulator_unavailable`, run `aua devices`, then restart only that emulator with `--audio`
551
+ if it is offline or absent; never blindly retry either outcome. AUA conservatively permits
552
+ only one injection attempt per boot on Android Emulator 36.4.10 because of its observed
553
+ repeat-stream crash. This applies even across workers with separate AUA cache directories.
554
+ A second attempt
555
+ returns `mic_repeat_unsafe`; restart only that emulator and make the next attempt the sole
556
+ injection for the new boot.
557
+
558
+ ### Option B — Physical device
559
+
560
+ 1. On the phone, enable **Developer options** (tap *Settings → About phone → Build number* seven times), then turn on **USB debugging**.
561
+ 2. Connect over USB and accept the **"Allow USB debugging"** prompt.
562
+ 3. `adb devices` should now list it with state `device`.
563
+
564
+ ### First run
565
+
566
+ On the first command against a device, `uiautomator2` automatically pushes a small helper agent (the uiautomator/ATX server) to it — there's nothing to install by hand, but that first call is slower while it sets up. Verify the whole chain end-to-end:
567
+
568
+ ```bash
569
+ adb devices # device appears as "device" (not "unauthorized" or "offline")
570
+ aua doctor # checks: adb on PATH · uiautomator2 importable · devices reachable · provider readiness · installed skill is current
571
+ aua devices # aua's own device listing (serial, model, Android version)
572
+ ```
573
+
574
+ `aua doctor` is the single command to run whenever something isn't working — it pinpoints which prerequisite is missing. See [Troubleshooting](#troubleshooting).
575
+
576
+ ---
577
+
578
+ ## Working on `aua` itself
579
+
580
+ Dependencies are locked (`uv.lock`) and the interpreter is pinned (`.python-version`), so
581
+ everyone resolves the same versions:
582
+
583
+ ```bash
584
+ # The test suite asserts apple-vision + rapidocr ARE available and paddle/easyocr are NOT
585
+ # (tests/test_ocr.py), so sync exactly that set — `--all-extras` fails the
586
+ # "provider unavailable" tests, and syncing none fails the "provider available" ones.
587
+ uv sync --extra dev --extra apple --extra rapidocr --extra yolo
588
+
589
+ uv run pytest # test
590
+ uv run ruff check src # lint
591
+ uv run aua analyze # run the CLI from THIS tree
592
+ ```
593
+
594
+ Use `uv run`, not a hand-rolled `.venv`. `uv run` resolves the project from the working
595
+ directory, so inside a **git worktree** you get that worktree's source. An editable install in
596
+ a shared `.venv` points at whichever checkout created it, which silently tests the wrong tree —
597
+ that has produced real false conclusions (a flag reported "missing" that was present all along).
598
+
599
+ Two related traps:
600
+
601
+ * **The daemon caches loaded modules.** After changing source, `aua daemon stop` — otherwise a
602
+ warm daemon keeps serving the old code.
603
+ * **`.githooks/pre-commit` resolves `aua` from `PATH`**, which in a worktree is the *main*
604
+ checkout, so it can regenerate `SKILL.md` from the wrong tree. Regenerate manually
605
+ (`uv run aua guide --emit-skill <path>`) and commit with `--no-verify` if it interferes.
606
+
607
+ ## Quickstart
608
+
609
+ ```bash
610
+ # Check environment: adb, device, uiautomator2 agent, provider availability
611
+ aua doctor
612
+
613
+ # List attached devices
614
+ aua devices
615
+
616
+ # Analyze the current screen → Set-of-Marks JSON
617
+ aua analyze
618
+
619
+ # Compact format (fewer tokens, drops null/default fields — best for agents)
620
+ aua --format compact analyze
621
+
622
+ # Unchanged-screen / binary dumps (warm daemon + native host path)
623
+ aua --format delta analyze # skip payload when hierarchy hash unchanged
624
+ aua --format msgpack analyze # compact binary frame (AUA1)
625
+
626
+ # One element per line, tab-separated, status-bar noise already dropped — the
627
+ # readable view; pick your own columns with --fields
628
+ aua --format tsv analyze
629
+ aua --format tsv analyze --fields id,text,rid,checked
630
+
631
+ # Ask a narrower question instead of filtering the JSON yourself
632
+ aua --format tsv analyze --region 0,0,1080,300 --clickable # just the header
633
+ aua --format tsv analyze --where-rid settingsSwitch --fields id,checkable,checked
634
+
635
+ # Is "Sign in" visible right now? Exit 0 = yes, 1 = no
636
+ aua has "Sign in"
637
+
638
+ # Wait on state (don't sleep) — including any hierarchy change
639
+ aua wait-and-analyze --for "Sign in"
640
+ aua wait-and-analyze --changed # any tree fingerprint change
641
+
642
+ # Act on elements by ID from the last analyze
643
+ aua tap-and-analyze 4
644
+ aua input-and-analyze 2 "hello@example.com"
645
+ aua swipe-and-analyze up
646
+
647
+ # Multi-emulator: same command on several serials
648
+ # aua fanout --serials emulator-5554,emulator-5556 analyze
649
+
650
+ # Force the vision fallback + write an annotated screenshot (numbered boxes)
651
+ aua analyze --source vision --annotate
652
+
653
+ # Find the best-matching element for a natural-language description
654
+ # Tries the hierarchy first; escalates to grounding only if needed
655
+ aua analyze --query "the Submit button"
656
+ aua analyze --query "the Submit button" --deep # force grounding escalation
657
+ aua analyze --query "the Submit button" --cheap # forbid escalation beyond hierarchy
658
+
659
+ # Ask a vision model about the whole screen. It receives screenshot + element graph,
660
+ # and returns structured regions, elements, graph ids, bounds, latency, and token usage.
661
+ aua ask "Describe this screen from top to bottom and say where each control is"
662
+ ```
663
+
664
+ The **analyze → act → analyze** loop is the core workflow:
665
+ 1. `aua analyze` returns elements with IDs.
666
+ 2. The agent picks an ID and acts: `aua tap-and-analyze <id>` / `aua input-and-analyze <id> "text"`.
667
+ 3. No manual re-analyze needed — by default each action returns the next screen inline (`observation`, with fresh IDs), folding step 1 into step 2.
668
+
669
+ The observation is **compact by default** (`id,text,rid,clickable`, app nodes only), so it is
670
+ also the cheapest way to read the new screen — widen it with `--observe-fields all` or any
671
+ field list. You should not need `--no-observe` followed by `analyze`; that pair costs two
672
+ round trips for one screen.
673
+
674
+ When the next screen is slow, say what you are waiting for and the action waits on evidence
675
+ instead of a fixed settle window:
676
+
677
+ ```bash
678
+ aua tap-and-analyze <id> --until "rid:resultsPanel" --until-timeout 45000
679
+ aua tap-and-analyze <id> --until "text:Results,!text:Loading" # terms are ANDed; ! means absent
680
+ aua tap-and-analyze <id> --until 'text:Hello\, explorer' # \, is a literal comma in one value
681
+ aua tap-and-analyze <id> --until "net:POST /v1/chat,text:x =" # backend replied AND the screen shows it
682
+ ```
683
+
684
+ The response then carries `await_outcome` — `satisfied` / `screen-changed` / `timeout` — plus
685
+ per-term results, so a slow backend is distinguishable from a hang. Term prefixes are `text:`,
686
+ `rid:`, `desc:`, `net:` (a completed HTTP exchange, needs `aua proxy start`) and `log:`
687
+ (logcat since the wait began, no proxy needed). AUA keeps hierarchy polling cheap, then uses
688
+ available OCR before accepting `!text:` as visually absent or declaring a positive `text:` timeout.
689
+
690
+ > **Never re-tap on `nothing changed` / `stale_risk`.** The settle can only wait ~1.1s, so a
691
+ > slower screen reports "unchanged" for an action that landed. It cannot tell "no effect" from
692
+ > "not yet" — re-tapping means a second submit. Re-read, or pass `--until`.
693
+
694
+ ### Several agents at once
695
+
696
+ With more than one agent running, leases use one host-wide registry even when every run has an
697
+ isolated cache. Start goal work with one command:
698
+
699
+ ```bash
700
+ aua session start --goal "verify search" # automatic process-bound lease
701
+ aua session start --goal "record HTTPS" --needs root,proxy
702
+ aua lease list # administrative inspection only
703
+ ```
704
+
705
+ `session start` probes all attached targets (including leased ones), discards a lease as soon as
706
+ its owner PID/start-token is dead, selects a compatible free target, or provisions a matching AVD.
707
+ Each normal owner gets exactly one device. After AUA assigns it, omit `--serial` from ordinary
708
+ commands: the lease is the routing source, and repeating a physical serial adds stale state.
709
+ Keep a serial for initial selection and intentional administration/fanout. Asking for another
710
+ device first fails with `lease_switch_required` and changes nothing; acknowledge the switch with
711
+ the administrative `aua lease acquire <new> --replace`, which cleans and releases the previous device.
712
+ `aua fanout` preserves the same rule by giving each explicitly targeted worker its own stable,
713
+ one-device logical owner scope.
714
+
715
+ An orchestrator can delegate the same running emulator without resetting it:
716
+
717
+ ```bash
718
+ # orchestrator: freezes its device and returns a five-minute, one-time token
719
+ aua lease transfer <serial>
720
+ # spawned agent: atomically becomes the lease owner; later commands omit --serial
721
+ aua lease accept <token>
722
+ # orchestrator can abort an unaccepted offer without releasing the device
723
+ aua lease cancel-transfer <serial>
724
+ ```
725
+
726
+ Lease transfer does not transfer goal-session or emulator-lifecycle ownership.
727
+
728
+ Asking for a device someone else holds fails with **exit 9 (`device_leased`)**. Drop a serial only
729
+ when it was a redundant stale pin and the existing assignment is acceptable. If the user named
730
+ that target, never redirect: wait, provision another device with user intent, or reconcile the
731
+ holder identity. `--needs` gets a capable device or a refusal, never a silent mismatch.
732
+
733
+ The owner label and caller process identity travel separately, including through the warm daemon,
734
+ so `AUA_OWNER` stays readable without becoming a 15-minute lock. A crashed agent is immediately
735
+ treated as gone; PID reuse is rejected by the recorded process-start token. The sole bounded
736
+ exception is an explicit pending transfer: its reservation survives a source crash for at most
737
+ five minutes so the spawned receiver cannot lose the device before accepting the token.
738
+ `--no-lease` opts out entirely for single-agent scripts.
739
+
740
+ ---
741
+
742
+ ## What the Claude Code and Codex plugins install
743
+
744
+ `aua` ships one generated skill plus a local MCP server. The skill auto-activates when you ask an
745
+ agent to test or inspect an Android app, and the plugin starts the matching released MCP server
746
+ through `uvx`.
747
+
748
+ The plugin path needs `uv`, `adb`, and a device/emulator. It does **not** need `aua` installed
749
+ globally: the MCP process runs from the Git tag matching the plugin version. The first start builds
750
+ and caches an isolated environment; later starts reuse it. Copy-paste setup and update commands
751
+ are collected in [Installation help](#installation-help).
752
+
753
+ The Claude Code plugin also installs a `PreToolUse` guard. It denies raw `adb` operations AUA already
754
+ covers (UI input, recording, screenshots, logs, app lifecycle, settings, and app data), gives the
755
+ exact AUA replacement, and asks for user approval on unknown raw-adb operations. Host build tools
756
+ such as Gradle are unaffected. AUA-evidence ffmpeg commands are redirected to the built-in
757
+ timestamped contact sheet.
758
+
759
+ [OpenAI's public plugin submission currently requires a remote MCP endpoint](https://developers.openai.com/plugins/guides/submit-claude-plugin),
760
+ so AUA's local stdio MCP plugin is distributed from this repository. A skills-only public listing
761
+ can be submitted separately without changing the repository plugin.
762
+
763
+ ### Goal-first sessions and acceptance evidence
764
+
765
+ After [connecting a device or emulator](#connect-a-device-or-emulator), CLI users start with
766
+ `aua session start --goal "<what must be verified>"`. Plugin users call MCP `session_start`; the
767
+ server provides the same goal-first protocol during initialization.
768
+
769
+ For deterministic acceptance proof, attach an authored assertion contract and a portable
770
+ cross-command artifact directory:
771
+
772
+ ```bash
773
+ aua session start --goal "sort the fixture and restore it" \
774
+ --app dev.aua.fixture \
775
+ --contract evals/agent_loop/contracts/classic-sort.yaml \
776
+ --artifacts-dir artifacts/classic-sort --evidence all --junit \
777
+ --wait-for-lease 30
778
+ ```
779
+
780
+ Contract checkpoints reuse the flow assertion grammar (`assert`, `assert_order`, `within`,
781
+ `same_parent_as`, `contains_all`) and can only pass from one fresh fingerprinted observation;
782
+ `--phase-done` cannot complete them. `session finish` refuses to terminate while a contract is
783
+ incomplete unless `--allow-incomplete` is explicit. Every analyzed response includes a typed
784
+ `observation_contract` saying whether its frame is reusable or another analyze is required.
785
+ The bundle keeps redacted `calls.jsonl`, `manifest.json`, linked observation/screenshot evidence,
786
+ `report.md`, `result.json`, optional `junit.xml`, the canonical contract, and the candidate flow.
787
+
788
+ After every checkpoint passes, `aua session candidate-flow NAME` previews only the actions
789
+ recorded after the session watermark. Promotion requires deterministic reset and replay:
790
+
791
+ ```bash
792
+ aua session candidate-flow classic-price --replay --save \
793
+ --reset-flow evals/agent_loop/flows/reset-fixture.yaml
794
+ ```
795
+
796
+ The reset and candidate must both pass; an existing saved flow is never overwritten.
797
+
798
+ ### Keeping the skill current
799
+
800
+ The SKILL.md and Codex `agents/openai.yaml` are **generated** from the same source as `aua guide`,
801
+ so they do not drift from the CLI/MCP capability contract. After upgrading, re-run `./install.sh`;
802
+ `aua doctor` reports Claude, current Codex and legacy Codex skill drift separately. Use the
803
+ [release flow](#releases-and-updating) to choose the version before reinstalling.
804
+
805
+ ### Prefer a different MCP client?
806
+
807
+ `aua mcp` exposes the same actions over stdio (see [MCP server](#mcp-server)). Point another MCP
808
+ client at `uvx android-ui-analyser mcp`, at a global `aua` install, or copy the repository's
809
+ [`.mcp.json`](.mcp.json) configuration to let `uvx` run the pinned release.
810
+
811
+ ---
812
+
813
+ ## Escalation ladder (cost-aware routing)
814
+
815
+ `aua` starts at the cheapest tier that could answer the question and escalates only when that tier returns no confident result. No LLM is used to route — routing is pure heuristics.
816
+
817
+ | Tier | Method | Latency | Used for |
818
+ |---|---|---|---|
819
+ | T0 | Hierarchy text match (selector) | ~tens of ms | `aua has "text"` |
820
+ | T1 | Hierarchy selector locate | ~tens of ms | Tap/find a known element |
821
+ | T2 | Hierarchy full parse → element list | ~50–150 ms | `aua analyze` |
822
+ | T3 | Vision: detection + OCR (local) | ~150–600 ms | Compose/Flutter/WebView/canvas |
823
+ | T4 | Grounding VLM (local or commercial) | ~0.5–6 s | Fuzzy / visual / semantic targets |
824
+
825
+ Key rules:
826
+ - Default ceiling is **T3 (local vision)**. T4 grounding is entered only when `grounding.enabled: true` and `max_tier: grounding` (or `--deep`).
827
+ - The router **never silently escalates to a paid/commercial provider** — that tier must be explicitly enabled.
828
+ - `meta.tier_used` and `meta.providers_used` always report which tier ran.
829
+ - `--cheap` lowers the ceiling; `--deep` raises it for one call.
830
+
831
+ ---
832
+
833
+ ## App memory & navigation
834
+
835
+ `aua` remembers each app's layout **locally** as you use it — every `analyze` records the current screen and every state-changing action records a route between screens. No extra calls, and nothing leaves your machine (stored under `memory.dir`, default `~/.android-ui-analyser`).
836
+
837
+ Because of that, `analyze` hands navigation affordances back to you **inline**, so you rarely need a separate `aua map` call:
838
+
839
+ | `meta` field | What it gives you |
840
+ |---|---|
841
+ | `known_screen` | The recognised screen name on a revisit (flagged `stale` if its signature or the app version drifted, so you re-verify) |
842
+ | `known_routes` | Outgoing routes from here, e.g. `["tap 'Catalog' → catalog"]` |
843
+ | `suggested_gotos` | Ranked, ready-to-run targets, e.g. `["goto product_detail"]` — ordered by what you've navigated to recently |
844
+ | `research_tasks` | Open map-quality questions for the calling agent to investigate in source/runtime and submit through `reconcile` |
845
+ | `map_hint` | A nudge like `"12 screens mapped — run aua map"` when there's a map but nothing actionable from the current screen |
846
+
847
+ ### Jump to a known screen in one command
848
+
849
+ ```bash
850
+ aua goto "product detail" # replay the remembered steps: selector-matched, verified per hop
851
+ aua goto "settings" --plan # print every step and risk; do not act
852
+ aua goto "onboarding" # safe UI steps run; cross-app/deeplink effects return a refusal preview
853
+ aua goto "onboarding" --allow-unsafe # only after reviewing that preview
854
+ aua goto "login" --allow-destructive # required when a step matches memory.destructive_labels
855
+ ```
856
+
857
+ `goto` resolves the goal (fuzzy) against the map, walks the shortest **verified** route from the current screen, and replays each edge's recorded steps — matching by resource-id first, then label — re-checking `known_screen` after every hop. Known in-app hops are hierarchy-only for speed; OCR runs only when a remembered selector is absent or hierarchy-only arrival verification fails. Transit/foreign screens keep automatic OCR. A newly auto-observed edge is provisional until the same transition is observed again; a cross-package transit journey supplies independent corroboration. Selectorless and conflicting edges are retained for audit but rejected from navigation.
858
+
859
+ An observed route proves that its actions preceded a destination; it does not prove those actions were navigation-only. `goto` therefore preflights the **whole** route before its first step. Ordinary semantic taps, scrolls, waits, and Back remain automatic. Deeplinks, external-package actions, settings/data/environment mutation, app lifecycle changes, and other actions with unproven side effects return `code: unsafe_route` plus the annotated `route`, `risks`, and `required_opt_in`; no route step has run. Re-run with `--allow-unsafe` only after reviewing that preview. Destructive labels (delete / sign out / pay / …) separately require `--allow-destructive`; a route containing both classes requires both flags. Prefer an explicitly authored flow for setup or mutation journeys.
860
+
861
+ Auth excursions through `memory.transit_packages` (Google sign-in in Chrome/GMS, permission dialogs) are recorded as **one edge on the origin app**, but their cross-package steps require that deliberate unsafe-route opt-in. A step whose identity was redacted (e.g. an account row containing an email) hands off for one manual tap — then re-run `goto --from-here` to resume mid-route, even mid-auth. On divergence it reports work already performed and replans from the actual recognized screen when another verified route exists, without replaying the failed edge. Reaching the target earlier than an obsolete intermediate is success. It exits `0` on arrival, returning the destination's `elements` (fresh ids). It runs through the warm daemon too.
862
+
863
+ ### Replay whole journeys in one call (flows)
864
+
865
+ A **flow** is a Maestro-style YAML journey — authored directly by you/your agent, or materialized from what you just did. The repeated setup path to the screen under test (reset account → log back in → reach onboarding) becomes one command:
866
+
867
+ ```bash
868
+ aua flow run reset_account_google_login --param ACCOUNT="Engineering Team"
869
+ aua flow run smoke --dry-run # print the resolved steps, act on nothing
870
+ aua flow run smoke --from-step 4 # resume after fixing a divergence
871
+ aua flow run smoke --artifacts-dir artifacts/smoke --evidence failures --junit
872
+ aua flow save reach_checkout --last 8 # preview scope/selectors/proof; writes nothing
873
+ aua flow save reach_checkout --last 8 --save # save only after review
874
+ aua flow list · aua flow show <name> · aua flow delete <name>
875
+ ```
876
+
877
+ Flows live under `<memory.dir>/flows/<package>/<name>.yaml`, filed by the app they start in (they still span transit packages by design — an auth leg stays with its origin app); a flow with no `app:` and every flow written before this layout stays directly in `flows/` and still loads. `aua flow list --app <package>` asks for one app's flows. Two apps may own the same flow name: `run`, `show`, and `delete` accept `<package>:<name>`, each `flow list` entry carries the `ref` that loads it, and a bare name matching two apps is refused with both candidates named instead of one being picked for you. Step vocabulary: `launch_app`, `tap` (by `id:`, `desc:`, or `text:`), `input` (with `${PARAM}` substitution), `key`, `swipe`, `scroll_to`, `wait_for`, `wait_stable`, `assert_visible`, rich `assert` predicates, explicit-axis `assert_order`, named `screenshot` checkpoints, and `goto:` to compose map navigation. `assert` shares the `expect` predicates (`exists`, `absent`, `count`, `text_is`, `text_contains`, `checked`, `enabled`, `selected`, `focused`) and adds canonical-tree relationships (`within`, `same_parent_as`, `contains_all`). `assert_order` accepts `axis: horizontal|vertical|reading`; `reading` follows the adapter's normalized structural traversal rather than guessed geometry. Parentless vision elements fail structural assertions explicitly instead of receiving inferred parentage. The same relationships are available from `expect-and-analyze`, suites, and MCP; `analyze --fields parent` exposes the evidence. `flow save` selects only the newest same-origin/context capture segment and is preview-first; only `--save` writes. Its result includes the authoritative path, current existence/collision status, and an exact `save_call` with `--force` when replacement is required. Collision previews also include `invalid_mode_probe`, the exact typed error code and CLI/MCP call for deliberately checking `--force` without `--save`; agents never need to guess. Saving still rechecks atomically, so a preview never authorizes a race. `flow delete` is idempotent and reports `status: already_absent` when cleanup was already complete. New recordings prefer a unique stable resource id, then a unique non-PII content description, then unique stable non-PII text, and refuse a step with no safe selector. The preview's value-free `selector_resilience` explains whether each selector is strong across frames and whether localization or positional ordering can break replay. It never persists typed values — inputs become required `${PARAM_n}` placeholders. A freshly recognized mapped destination is stored as `arrival_screen`. An unmapped destination remains explicit `arrival_status: unverified` unless the immediately preceding analyzed action satisfied a privacy-safe positive `--until` predicate on this exact package/context/frame; only then is that predicate promoted to authored `arrival:` proof with source `satisfied_action_until`. Flows are deliberate authored intent, so destructive steps run by default (`--no-allow-destructive` opts back into the guard). On divergence you get the failing step index, assertion detail, the remaining steps, and the current elements — fix, then `--from-step N`.
878
+
879
+ `--artifacts-dir DIR` writes a portable run bundle (`flow.yaml`, `result.json`, `manifest.json`, `report.md`, named screenshots, and observations). `--evidence failures` captures the failed frame and platform diagnostics by default; `all` captures every completed leaf step; `none` keeps only explicit `screenshot:` checkpoints. Add `--junit` for `junit.xml`. Reusing a non-empty directory creates a unique run subdirectory instead of overwriting evidence. CLI and MCP both accept exactly one source: a saved `name`, `file`, or inline `yaml` (`--yaml` on the CLI).
880
+
881
+ ```yaml
882
+ # ~/.android-ui-analyser/flows/reset_account_google_login.yaml
883
+ name: reset_account_google_login
884
+ app: com.example.app.dev
885
+ params:
886
+ ACCOUNT: "Engineering Team"
887
+ steps:
888
+ - launch_app: com.example.app.dev
889
+ - tap: {id: buttonSettings} # unlabeled gear — id-tail selector
890
+ - tap: "Account & Data"
891
+ - tap: "Delete my account"
892
+ - tap: "Delete"
893
+ - wait_for: {text: "Continue with Example ID", timeout_ms: 15000}
894
+ - tap: "Continue with Example ID"
895
+ - tap: {text: "${ACCOUNT}", package: com.android.chrome}
896
+ - tap: {text: "Continue", package: com.android.chrome}
897
+ - wait_stable
898
+ - assert: {id: productTitle, count: 2}
899
+ - assert: {id: consentSwitch, checked: true}
900
+ - assert_order:
901
+ axis: horizontal
902
+ selectors: [{text: "Basic"}, {text: "Professional"}]
903
+ - screenshot: catalog_sorted
904
+ ```
905
+
906
+ ### Inspect and manage the map
907
+
908
+ ```bash
909
+ aua map # learned screens + routes for the current app
910
+ aua map --find "image" # verified route only; provisional evidence is not replay advice
911
+ aua map --context flags-catalog_experiment-… # one verified feature-flag context
912
+ aua map --all-contexts # compare variants across contexts
913
+ aua map --audit # ambiguities + questions for a research agent
914
+ aua memory show|path|update|forget
915
+ aua memory update --screen login # rename a badly-auto-named screen
916
+ ```
917
+
918
+ Memory schema v4 treats a feature-flag set as part of UI identity. `flags set/apply`
919
+ activates a deterministic context after the app restarts. When `flags.prefs_files` or
920
+ `flags.context_keys` is configured, every `analyze` also reads the app's already-active,
921
+ privacy-filtered experiment/treatment/variant/flag values and switches context before
922
+ recording. Exact-context routes outrank compatible legacy routes; v1/v2/v3 maps migrate
923
+ without losing trusted edges. Stable resource namespaces produce locale-independent names,
924
+ and the map groups flag variants plus loading/error/empty/ready states under one logical
925
+ destination instead of filling the output with numeric/hash suffixes.
926
+
927
+ ### Agent feedback and self-correction
928
+
929
+ Knowledge learned by a person, runtime probe, source inspection, or external agent can be
930
+ stored with provenance and context:
931
+
932
+ ```bash
933
+ aua knowledge add --app com.example.app --kind claim \
934
+ --text "Catalog uses catalogTabTOOLS under catalog_experiment=a" \
935
+ --source agent --agent codex --evidence workspace-alerts
936
+ aua knowledge list --app com.example.app
937
+ aua knowledge stale <knowledge-id> --app com.example.app
938
+ ```
939
+
940
+ The correction loop deliberately uses an external-agent contract: AUA automatically
941
+ materializes tasks when it sees weak names, stale/duplicate screens, unverified contexts,
942
+ provisional routes, or unreplayable/conflicting edges. It surfaces those tasks in
943
+ `analyze.meta.research_tasks` and `MAP.md`; the calling agent researches source/runtime and
944
+ feeds evidence back. AUA applies validated changes but does not choose or spawn a model.
945
+
946
+ ```bash
947
+ aua reconcile plan --app com.example.app > tasks.json
948
+ # An external agent researches source/runtime using package, version, flags, and questions.
949
+ aua reconcile submit --app com.example.app report.json
950
+ aua reconcile status --app com.example.app
951
+ aua reconcile rollback --app com.example.app <rollback-id>
952
+ ```
953
+
954
+ A report has `verdict: apply|review|reject`, evidence, knowledge, and typed operations
955
+ (`rename`, `alias`, `merge`, `split`, variant/state/context changes, route guards/replacement/
956
+ verification/rejection/deletion, knowledge upsert, or stale marking). `apply` is autonomous: AUA modifies a deep
957
+ copy, validates stable IDs and route references, snapshots the old map, commits atomically,
958
+ and returns a rollback ID. `review` is queued without mutation and `reject` is retained as
959
+ feedback. The same audit, reconciliation, and knowledge operations are available as MCP
960
+ tools.
961
+
962
+ **Privacy:** only the durable skeleton is stored (screen names, routes, stable elements). Dynamic lists are kept as a *shape*, and `EditText` values / secrets / PII are redacted (`<filled>` / `<redacted>`) — which is also why auto-learned edges never contain typed text, and why an account row may need one manual tap during replay.
963
+
964
+ ### Optional: LLM assist (off by default)
965
+
966
+ Everything above is fully deterministic — no model runs during navigation. If you opt in, a **fast planner LLM** (default Gemini Flash Lite) plugs into the *edges* of that core to cut agent iterations further. It's off unless you enable it **and** ask for it:
967
+
968
+ ```yaml
969
+ planner:
970
+ enabled: true # off by default; also needs the model's API key (GEMINI_API_KEY)
971
+ chain: [gemini_flash]
972
+ ```
973
+
974
+ ```bash
975
+ aua goto "onboarding" --assist # on a divergence, the planner tries to recover in-call
976
+ aua flow run reset --assist # dismiss an unexpected popup mid-flow, then resume
977
+ aua navigate "open the image generator" # drive to a goal with NO prior map…
978
+ aua navigate "reach checkout" --save-flow checkout # …and record it as a reusable flow
979
+ ```
980
+
981
+ Two roles: (1) **recovery** — when `goto`/`flow` diverge (an "Allow notifications?" popup, an A/B modal, a moved button), `--assist` lets the planner clear the blocker and continue in the same call instead of handing the whole screen back to you; the un-assisted handoff hint tells you when it's worth adding. (2) **`aua navigate "<goal>"`** — autonomous, map-free navigation that **records the path into memory**, so the next `aua goto <that screen>` is a free, deterministic replay (the expensive run happens once). The planner reads the compact element list (a cheap text call; a screenshot is attached only on unlabeled screens), may only act on an on-screen element, is bounded by `--max-steps`, and its taps still obey the destructive guard — so it never wanders into Delete/Pay without `--allow-destructive`.
982
+
983
+ ### Tuning
984
+
985
+ ```yaml
986
+ memory:
987
+ suggest: true # push known routes/gotos/map hints into analyze
988
+ suggest_max: 4 # cap on suggested_gotos per analyze
989
+ rank_half_life_days: 3.0 # recency decay for usage-based ranking
990
+ auto_research: true # create/surface research tasks for map uncertainty
991
+ research_suggest_max: 3
992
+
993
+ flags:
994
+ auto_context: true
995
+ prefs_files:
996
+ com.example.app.dev: "flag_overrides.xml"
997
+ # Optional exact allow-list; otherwise only flag-like key names survive.
998
+ context_keys:
999
+ com.example.app.dev: [catalog_experiment, services_treatment]
1000
+ ```
1001
+
1002
+ ---
1003
+
1004
+ ## Configuration
1005
+
1006
+ ### Precedence (highest to lowest)
1007
+
1008
+ 1. Individual CLI flags (e.g. `--serial`, `--format`, `--no-cache`)
1009
+ 2. `--config <path>` explicit config file
1010
+ 3. Environment variables (`AUA_*` and provider key vars like `OPENAI_API_KEY`)
1011
+ 4. `--profile <name>` overlay (deep-merged over the base config)
1012
+ 5. Project config: nearest `.android-ui-analyser.yaml` walking up from CWD
1013
+ 6. User config: `$XDG_CONFIG_HOME/android-ui-analyser/config.yaml` (default `~/.config/...`)
1014
+ 7. Built-in defaults
1015
+
1016
+ ### Secrets
1017
+
1018
+ **Secrets are never stored in config.** The config references the env-var **name** (`api_key_env: OPENAI_API_KEY`); the tool reads the value at runtime. `aua config show` and `aua doctor` never print secret values.
1019
+
1020
+ To supply a required key and continue automatically, wrap the program that needs it:
1021
+
1022
+ ```bash
1023
+ aua config exec --env-file /absolute/project/.env --require OPEN_ROUTER_API_KEY \
1024
+ -- python /absolute/project/runner.py
1025
+ ```
1026
+
1027
+ Use your existing runner and arguments after `--`. Missing values open a private masked
1028
+ Save/Cancel dialog; **Save** launches the program once after every requirement is satisfied.
1029
+ Nonempty process values win, followed by only the named variables in that exact `.env` file.
1030
+ Repeat `--require NAME` for additional keys. Cancellation prevents launch; `--no-prompt`
1031
+ fails on missing credentials without a dialog. Child output and exit status pass through,
1032
+ with literal required values redacted; the child must still avoid printing secrets.
1033
+ Wrapper errors can override that exit status. If an error says `started: true`, inspect the
1034
+ program's status/evidence before recovery; do not repeat side effects to recover missing output.
1035
+
1036
+ To save a key without launching anything:
1037
+
1038
+ ```bash
1039
+ aua config secret GEMINI_API_KEY --env-file /absolute/project/.env
1040
+ # Other variables use the same dialog, including OPEN_ROUTER_API_KEY.
1041
+ ```
1042
+
1043
+ MCP agents use `credential_request(name="GEMINI_API_KEY", env_file="/absolute/project/.env")`.
1044
+ The result contains only status, variable name, and destination. Existing nonempty values are
1045
+ preserved unless `--replace` / `replace=true` is supplied. The dialog opens on the CLI/MCP server
1046
+ host, so it requires that host's graphical desktop.
1047
+
1048
+ `config secret` only saves; `config exec` loads named credentials for its child. Neither changes
1049
+ the parent shell, MCP server, or an existing daemon. Direct SDK consumers must parse dotenv
1050
+ data with interpolation disabled, never shell `source`. Keep the file outside version control.
1051
+ See the [credential setup tutorial](docs/credentials.md) for the Python continuation helper,
1052
+ existing AUA runs, cancellation, and unattended use. The wrapper works with external programs;
1053
+ it does not bundle the experimental OpenRouter harness.
1054
+
1055
+ ### Example config
1056
+
1057
+ ```yaml
1058
+ # .android-ui-analyser.yaml (or aua config init to write the full commented version)
1059
+ ocr:
1060
+ chain: [apple_vision, rapidocr] # macOS: apple first; cross-platform: just [rapidocr]
1061
+ augment_hierarchy: true # fuse an Apple OCR pass into every hierarchy analyze
1062
+ drop_redundant: true # withhold readings of text the hierarchy already reports
1063
+
1064
+ grounding:
1065
+ enabled: true
1066
+ # Ordered fallback. Missing keys are skipped automatically; reverse this list
1067
+ # if you prefer OpenAI whenever both keys exist.
1068
+ chain: [gemini, openai]
1069
+
1070
+ models:
1071
+ apple_vision: { recognition_level: accurate, max_width: 720 }
1072
+ gemini: { model: gemini-2.5-flash, api_key_env: GEMINI_API_KEY }
1073
+ openai: { model: gpt-5.6-luna, api_key_env: OPENAI_API_KEY,
1074
+ reasoning_effort: none, screen_image_detail: high,
1075
+ screen_preview_max_width: 720, screen_preview_jpeg_quality: 55 }
1076
+ ```
1077
+
1078
+ The grounding factory tries providers in chain order. A provider whose `api_key_env` is
1079
+ missing is skipped, as are request failures or empty answers. With only `GEMINI_API_KEY`,
1080
+ Gemini runs; with only `OPENAI_API_KEY`, Luna runs; with both, the first configured provider
1081
+ wins. `aua ask "…"` uses the same provider-neutral interface and reports the provider/model
1082
+ that answered. Apple Vision OCR remains local; it downsizes wide screenshots to 720px for
1083
+ recognition and maps boxes back to original coordinates. Hierarchy and OCR run concurrently,
1084
+ and the two are fused into one observation, so web content inside a Chrome Custom Tab is visible
1085
+ to a plain `analyze`. Readings that merely repeat text the hierarchy already reports are
1086
+ withheld (`ocr.drop_redundant`, default true): they cost tokens on every observation, they made
1087
+ `tap --text` ambiguous, and a misread of text the tree had right is worse than no reading at
1088
+ all. Pixel-only text - and any repair of lossy `U+FFFD` labels - always survives. Remote
1089
+ screen-analysis calls use a compressed preview.
1090
+
1091
+ ### Profiles
1092
+
1093
+ ```yaml
1094
+ profiles:
1095
+ cloud:
1096
+ grounding: { enabled: true, chain: [gemini] }
1097
+ local:
1098
+ grounding: { enabled: false }
1099
+ ```
1100
+
1101
+ Activate with `aua --profile cloud analyze --query "the Submit button"`.
1102
+
1103
+ ### Config commands
1104
+
1105
+ ```bash
1106
+ aua config init # write commented default config to the user config path
1107
+ aua config show # print the current config (secrets masked)
1108
+ aua config show --effective # print after all precedence layers are merged
1109
+ aua config path # print the resolved config file path
1110
+ aua config secret OPEN_ROUTER_API_KEY --env-file /absolute/project/.env # private dialog
1111
+ aua config exec --require OPEN_ROUTER_API_KEY -- python runner.py # Save then launch once
1112
+ ```
1113
+
1114
+ ---
1115
+
1116
+ ## Provider / license matrix
1117
+
1118
+ ### OCR
1119
+
1120
+ | Provider | Extra | Platform | License | Notes |
1121
+ |---|---|---|---|---|
1122
+ | `apple_vision` | `apple` | **macOS only** | Proprietary (native) | Fastest OCR on Mac (~100–500 ms); Neural Engine |
1123
+ | `rapidocr` | `rapidocr` | Cross-platform | Apache-2.0 | Default non-macOS OCR; ONNX PaddleOCR |
1124
+ | `paddleocr` | `paddle` | Cross-platform | Apache-2.0 | PP-OCRv5; highest accuracy |
1125
+ | `tesseract` | `tesseract` | Cross-platform | Apache-2.0 | Requires system binary |
1126
+ | `easyocr` | `easyocr` | Cross-platform | Apache-2.0 | — |
1127
+
1128
+ ### Detection
1129
+
1130
+ | Provider | Extra | License | Notes |
1131
+ |---|---|---|---|
1132
+ | `yolo` | `yolo` | Apache-2.0 (Ultralytics) | User-supplied weights path; **license-clean default** |
1133
+ | `omniparser` | `omniparser` | **AGPL-3.0** | OmniParser v2 detection-only; requires `accept_agpl: true` in config; CVE-2025-55322 patched in ≥2.0.1 — **never expose the OmniTool server** |
1134
+
1135
+ ### Grounding (all opt-in, `grounding.enabled: false` by default)
1136
+
1137
+ | Provider | License | Config key | Notes |
1138
+ |---|---|---|---|
1139
+ | `local_vllm` | Apache-2.0 (Holo1.5-7B) | `local_vllm` | OpenAI-compatible endpoint; e.g. vLLM, Ollama, LM Studio |
1140
+ | `openai` | Commercial | `openai` | GPT-5.6 Luna vision by default; key via `OPENAI_API_KEY` |
1141
+ | `anthropic` | Commercial | `anthropic` | Claude vision; key via `ANTHROPIC_API_KEY` |
1142
+ | `gemini` | Commercial | `gemini` | Gemini vision; key via `GEMINI_API_KEY` |
1143
+
1144
+ ### Icon names (opt-in, `icon_names.enabled: false` by default)
1145
+
1146
+ A clickable control the app never named (no text, content description or resource id) is
1147
+ cropped and named from its pixels, once per distinct icon. The name lands in `content_desc`
1148
+ with `named_by` set, so a reader sees "hamburger menu button, opens the side drawer" instead
1149
+ of "unlabelled control, top left". Names are kept by a perceptual key in one SQLite
1150
+ database shared by every AUA run on the machine (`icon_names.db`, default
1151
+ `~/.android-ui-analyser/icon-names.db`): the same icon on another screen, or in another
1152
+ run, costs nothing.
1153
+
1154
+ | Provider | License | Config key | Notes |
1155
+ |---|---|---|---|
1156
+ | `hosted_vision` | Commercial | `hosted_vision` | `openai/gpt-6-luna` by default, reasoning off (right 3/3 on a hamburger in 1.3-2.5 s); OpenAI itself when `OPENAI_API_KEY` is set, else OpenRouter via `OPEN_ROUTER_API_KEY` — see [docs/models.md](docs/models.md). Any OpenAI-compatible vision model id works. |
1157
+
1158
+ ### Planner (opt-in, `planner.enabled: false` by default)
1159
+
1160
+ The fast LLM behind `--assist` and `aua navigate` (see [Optional: LLM assist](#optional-llm-assist-off-by-default)). Text-first (the element list rides in the prompt; a screenshot is attached only on unlabeled screens).
1161
+
1162
+ | Provider | License | Config key | Notes |
1163
+ |---|---|---|---|
1164
+ | `gemini_flash` | Commercial | `gemini_flash` | Default; Gemini Flash Lite, key via `GEMINI_API_KEY`. Swap the `planner.chain` for any provider you prefer. |
1165
+
1166
+ ### Guarded next-call policy (opt-in, `policy.enabled: false` and `mode: off` by default)
1167
+
1168
+ | Provider | Extra | Platform | License | Notes |
1169
+ |---|---|---|---|---|
1170
+ | `functiongemma` | `functiongemma` | Apple silicon | Gemma Terms (adapter); MLX runtime under its own licenses | Bundled ~29 MB v10 LoRA + external pinned MLX base; inert until `policy.enabled: true` |
1171
+
1172
+ The repository's code, docs, and training tools remain MIT-licensed. The modified FunctionGemma
1173
+ adapter under `src/android_ui_analyser/resources/functiongemma/` is a separate model derivative
1174
+ distributed under the included Gemma terms, prohibited-use policy, and notices.
1175
+
1176
+ **Default config remains commercially licensable and model-free at runtime.** No AGPL provider,
1177
+ remote model, planner, or policy model is active out of the box. OmniParser requires explicit
1178
+ `accept_agpl: true`; grounding, the planner, and the policy are off until enabled.
1179
+
1180
+ ---
1181
+
1182
+ ## Optional: guarded local FunctionGemma policy (off by default)
1183
+
1184
+ This is a deliberately narrow local controller for an active goal session, not an unrestricted
1185
+ Android agent.
1186
+ AUA deterministically constructs complete, current-frame, stable-selector tap calls, removes unsafe,
1187
+ unauthorized, destructive, stale, ambiguous, and redundant choices, and gives the model only
1188
+ an independently built, privacy-screened projection of candidate metadata keyed by opaque integer
1189
+ IDs. AUA retains the authoritative call map. FunctionGemma cannot author arguments, grant
1190
+ authorization, or waive cleanup. Its output never replaces AUA's deterministic
1191
+ `recommended_call`:
1192
+
1193
+ - `shadow` records only policy audit metadata; it exposes no model-selected call.
1194
+ - `advisory` asks the model for a selection; any returned `policy_suggestion` is still separate
1195
+ and unexecuted. The bundled v10 manifest authenticates advisory, so an operator who turns the
1196
+ policy on can reach this mode without supplying their own adapter.
1197
+ - Zero eligible candidates produce a structured, non-executing `policy_handoff` in advisory mode.
1198
+ A model-selected handoff uses reserved ID `-1` and is accepted only when a pinned adapter manifest
1199
+ authenticates that prompt protocol. One action is selected deterministically without loading the
1200
+ model. The bundled v10 adapter is invoked for **two, three, or four** eligible candidates, the
1201
+ cardinalities its manifest authenticates; anything else reports `unsupported_cardinality` and
1202
+ fails closed.
1203
+
1204
+ For a separately authenticated adapter whose manifest permits advisory use, explicit
1205
+ `aua session autopilot` changes the transport—not the trust boundary. The local model selects an
1206
+ opaque candidate ID and the warm AUA daemon immediately revalidates and executes the corresponding
1207
+ AUA-authored call itself; a parent agent does not relay that call. The daemon consumes the folded
1208
+ post-action observation and repeats only while another safe navigation tap is available. It stops
1209
+ and returns the fresh screen on model handoff, stale/unknown outcome, unchanged frame, repeated
1210
+ call, input/toggle/wait/proof work, or the configured step/time limit. It currently executes only
1211
+ guard-approved taps. `policy_suggestion` remains advice and must not be executed manually.
1212
+
1213
+ ```bash
1214
+ aua session autopilot --max-steps 6 --max-duration-ms 30000
1215
+ ```
1216
+
1217
+ The bundled v10 manifest authenticates advisory, so this lane is reachable without an
1218
+ externally supplied adapter — but only after an operator turns the policy on. Nothing is loaded
1219
+ and no memory or compute is spent while `policy.enabled` is `false`, which is the shipped default.
1220
+ Shadow exists for developing and debugging the policy locally; it has no end-user purpose.
1221
+
1222
+ The checked-in adapter is 30,403,414 bytes. The compatible base is approximately 543 MiB and is
1223
+ **not** in this repository, wheel, or an automatic download path. Review and accept the
1224
+ [Gemma Terms](https://ai.google.dev/gemma/terms), then manually obtain the pinned external MLX
1225
+ conversion and revision recorded in the bundled manifest:
1226
+
1227
+ ```bash
1228
+ uv pip install -e ".[functiongemma]"
1229
+ hf download mlx-community/functiongemma-270m-it-bf16 \
1230
+ --revision bb327a9ad61044e1496a2bee2365a6b6a6684c72 \
1231
+ --local-dir /absolute/path/to/functiongemma-270m-it-bf16
1232
+ ```
1233
+
1234
+ The provider verifies the manifest's seven required base files and their aggregate digest
1235
+ `76aabb2800b6b9e6da9160028dfb233bbfa723d8c33e21623022ca87a8fa9fd5`; unrelated snapshot files
1236
+ do not affect that identity. Then turn the policy on explicitly — see
1237
+ [docs/LOCAL_POLICY_SETUP.md](docs/LOCAL_POLICY_SETUP.md) for the full recipe, including the
1238
+ two-model chain the device runs used:
1239
+
1240
+ ```yaml
1241
+ policy:
1242
+ enabled: true # false in shipped defaults; nothing loads until this is true
1243
+ mode: advisory # off | shadow | advisory
1244
+ chain: [functiongemma]
1245
+ max_candidates: 4
1246
+
1247
+ models:
1248
+ functiongemma:
1249
+ model_path: /absolute/path/to/functiongemma-270m-it-bf16
1250
+ adapter_path: null # null selects AUA's packaged v10 LoRA
1251
+ max_tokens: 24
1252
+ ```
1253
+
1254
+ Check config, dependency, artifact hashes, and daemon compatibility without touching Android or
1255
+ loading the model:
1256
+
1257
+ ```bash
1258
+ aua --config .android-ui-analyser.yaml policy status
1259
+ ```
1260
+
1261
+ #### What the bundled v10 adapter actually scores
1262
+
1263
+ Measured by an **independently authored** probe: its 150 jobs derive from the CLI surface rather
1264
+ than from the training generators. This distinction is not pedantic. An in-house probe that shared
1265
+ its generator's phrasing reported 6/6 on a refusal capability that independent measurement put at
1266
+ **0/144** — it was scoring the phrasing, not the model.
1267
+
1268
+ | Adapter | Probe accuracy (150 jobs) | Refusal | Notes |
1269
+ |---|---|---|---|
1270
+ | v8 | 0.387 | — | previous generation |
1271
+ | v9 | 0.620 | 6/38 | best accuracy of the Gemma line, but taps wrongly on a real device |
1272
+ | **v10 (bundled)** | **0.600** best checkpoint, 0.471 mean over 16 | 18/38 | 0 invalid outputs |
1273
+ | Qwen3-1.7B | 0.667 | 4/38 | ~2.3× the latency and ~2× the memory; kept as a `qwen3` profile |
1274
+
1275
+ On a real device v10 completed 5/5 navigations and 2/2 refusals with **0 wrong taps**, one refusal
1276
+ under a deliberately rephrased goal. The shipped bundle reproduces the external checkpoint exactly
1277
+ on the same 150 jobs (90/150, refusal 18/38, 0 invalid) at ~334 ms per call.
1278
+
1279
+ **This is not a promotion.** One seed, no live gate, and refusal is unstable across checkpoints
1280
+ (0, 2, 0, 5, 4, 18, 0, 3, 8, …), so the 18/38 figure is a best checkpoint rather than a reliable
1281
+ property. Safety does not rest on it: the deterministic guard removes unsafe, unauthorized,
1282
+ destructive, stale, ambiguous, and redundant candidates before the model sees anything, and
1283
+ revalidates before execution. No model in this line has learned refusal reliably enough to be
1284
+ load-bearing.
1285
+
1286
+ Earlier generations, for the record: frozen v3 scored 2,045/2,048 (99.8535%) on synthetic held-out
1287
+ data yet **failed** its strict static gate and then a production-serializer smoke at 60/96 (62.5%),
1288
+ with accuracy swinging 37.5 points across target IDs and 54.17 points across target positions — the
1289
+ gap between a synthetic score and a real one. A failure-driven v4 continuation also failed its
1290
+ independent gate and was never bundled.
1291
+
1292
+ ### Failure-driven v4 continuation (not promoted)
1293
+
1294
+ V4 learned the production serializer well: validation reached 2,767/2,768 (99.9639%), including
1295
+ 719/720 production-shaped validation cases; the untouched v3 smoke improved from 60/96 to 96/96;
1296
+ held-out production choices passed at cardinalities two (64/64), three (144/144), and four
1297
+ (512/512); and the fictional closed loop completed 4/4 cleanly.
1298
+
1299
+ It still **failed** the independent combined test: 2,764/2,768 correct (99.8555%), 99.6875%
1300
+ critical accuracy, and 100% parse success, with zero redundant but four unauthorized selections.
1301
+ All four were `sequence_recover_unknown`: the model ended the session early with `session_finish`
1302
+ instead of observing the uncertain outcome with `analyze_screen`. V4 is therefore ignored and not
1303
+ bundled. The next iteration needs independent recovery-focused data and an evaluation gate that
1304
+ keeps this failure family isolated.
1305
+
1306
+ Reproduction source is checked in as the
1307
+ [v4 production curriculum](experiments/functiongemma/production_curriculum.py),
1308
+ [training configuration](experiments/functiongemma/train-lora-v4.yaml),
1309
+ [static evaluator](experiments/functiongemma/evaluate.py),
1310
+ [production smoke](experiments/functiongemma/run_production_smoke.py), and
1311
+ [closed-loop runner](experiments/functiongemma/run_closed_loop.py). Generated datasets, adapters,
1312
+ and detailed reports remain ignored and are not linked as repository artifacts.
1313
+
1314
+ The complete fictional-data generator, validator, MLX LoRA runner, static evaluator, and deterministic
1315
+ closed-loop simulator are checked in under [`experiments/functiongemma/`](experiments/functiongemma/)
1316
+ so later agents and contributors can reproduce or improve the adapter without device data.
1317
+
1318
+ ---
1319
+
1320
+ ## Optional Android development tools
1321
+
1322
+ Install Google's Android CLI only when you want its additional tools:
1323
+
1324
+ ```bash
1325
+ aua devtools status # no device needed
1326
+ aua devtools setup # explicit, user-local installation
1327
+ aua devtools catalogue # discover operations and accepted options
1328
+ aua devtools run build :app:assembleDebug --project /path/to/project --timeout 600
1329
+ aua devtools run analyze /path/to/app.apk
1330
+ ```
1331
+
1332
+ The optional integration covers project builds, SDKs, artifact analysis, documentation, Studio,
1333
+ deployment, UI inspection, profiling and authorized cloud diagnostics. Device operations use AUA's
1334
+ leased target. The existing automation backend remains the default.
1335
+
1336
+ Compose previews give an agent images **and component trees** before deployment:
1337
+
1338
+ ```bash
1339
+ aua preview list :app --project /path/to/project
1340
+ aua preview render :app --project /path/to/project \
1341
+ --fqn com.example.demo.HomeScreenKt.HomePreview --output /path/to/evidence
1342
+ aua preview inspect /path/to/evidence/HomePreview_0.json
1343
+ ```
1344
+
1345
+ This compiles the preview target but needs no emulator or IDE. The component tree contains bounds,
1346
+ semantics, modifiers and source locations. During a normal device session, `aua profile start`
1347
+ and `profile stop` collect a trace around AUA actions; `profile heap` captures JVM memory.
1348
+ Profiling state has durable, caller-scoped cleanup.
1349
+
1350
+ With Android CLI 1.1.16919734+, `profile start --enable compose.recomposition` records Compose
1351
+ state changes (app `runtime-tracing` 1.13+), and `profile heap <process> --type perfetto` captures
1352
+ a reference graph on API 31+. HPROF remains the default. `devtools status` reports supported
1353
+ features; `devtools run update --yes` explicitly upgrades the optional CLI. Input JSON failures
1354
+ are checked even when the native command exits zero. See the integration guide for prerequisites.
1355
+
1356
+ Authored agent tests use `aua journey validate|start|status|check|record|finish`. The calling agent
1357
+ performs each instruction, deterministic assertions evaluate fresh evidence, and visual reviews
1358
+ remain explicitly agent-assessed. Journeys reuse AUA's ordinary session and cleanup workflow.
1359
+
1360
+ CLI and MCP share these implementations. See [optional Android CLI integration](docs/android-cli.md),
1361
+ [the complete operation catalogue](docs/android-cli-reference.md),
1362
+ [Compose previews](docs/compose-previews.md), [agent journeys](docs/journeys.md), and
1363
+ [executed validation evidence](docs/android-cli-validation.md).
1364
+
1365
+ ## iOS simulators
1366
+
1367
+ The same commands drive an iOS simulator when you select the built-in `ios` platform:
1368
+
1369
+ ```bash
1370
+ aua --platform ios doctor --fix # installs AXe (tap, trust, install) if it is missing
1371
+ aua --platform ios doctor # xcrun, axe, and which simulators are booted
1372
+ aua --platform ios --format compact analyze # or: export AUA_PLATFORM=ios
1373
+ aua --platform ios tap-and-analyze --text "General"
1374
+ aua --platform ios app launch com.example.app --arg --uitesting --until rid:home # launch flags + arrival
1375
+ ```
1376
+
1377
+ Elements, ids, `has`/`wait`, flows and maps behave as on Android; `resource_id` is the
1378
+ `accessibilityIdentifier`, `key back` performs the iOS back gesture, and `aua install` takes an
1379
+ `iphonesimulator` `.app` bundle. Details, the capability table
1380
+ and troubleshooting: [docs/ios.md](docs/ios.md).
1381
+
1382
+ Physical iPhone/iPad screenshots use the separate `ios-device` adapter, without AXe:
1383
+
1384
+ ```bash
1385
+ aua --platform ios-device --serial <UDID> session start --goal 'Capture current screen' --no-start-emulator
1386
+ # View observation.meta.raw_image; save a newer frame if needed:
1387
+ aua --platform ios-device screenshot /tmp/current.png
1388
+ aua --platform ios-device session finish --phase-done 'phase_1=Current screen captured and visually inspected'
1389
+ ```
1390
+
1391
+ This requires a connected, trusted device with Developer Mode and an Xcode version supporting
1392
+ CoreDevice screenshot capture. It exposes only `ui.screenshot`: no UI hierarchy, taps, or app
1393
+ navigation. The screenshot preserves the screen currently open on the phone.
1394
+
1395
+ ## Web browsers
1396
+
1397
+ The built-in `web` platform tests websites and web apps across Chromium, Firefox and WebKit,
1398
+ and can attach to supported existing browser/desktop windows. All connections use the same AUA
1399
+ commands and element schema, independent of the application's frontend framework:
1400
+
1401
+ ```bash
1402
+ uv pip install -e '.[web]'
1403
+ playwright install chromium
1404
+ aua --platform web --serial https://example.test/app doctor
1405
+ aua --platform web --serial https://example.test/app --format compact analyze
1406
+ aua --platform web --serial https://example.test/app tap-and-analyze --rid continue
1407
+ ```
1408
+
1409
+ `data-testid` and HTML `id` become `resource_id`; only viewport-intersecting DOM nodes satisfy
1410
+ `has`, waits, and `scroll-to`. Chromium, Firefox, and WebKit can run headed or headless. The warm
1411
+ daemon keeps one isolated browser context alive across commands; `storage_state` can seed login
1412
+ state without writing changes back. AUA can fuse its existing OCR, detection, and grounding
1413
+ providers over Playwright's native viewport screenshot for canvas or incomplete DOM semantics.
1414
+ `aua browser` adds console/network diagnostics, cookies and web storage, cache/session reset,
1415
+ offline/throttling, scoped CORS, context proxy, HAR record/replay, request mocks, popup/tab/frame
1416
+ inspection, and Playwright traces. URL path/query identities feed the same maps and flows, and goal
1417
+ cleanup restores the starting browser context. A second opt-in mode can instead attach to one
1418
+ user-approved tab in an existing, logged-in Chrome profile:
1419
+
1420
+ ```bash
1421
+ aua browser extension install
1422
+ # Load the printed directory once from chrome://extensions, then configure:
1423
+ # platforms.web.connection: existing-chrome
1424
+ # device.serial: existing-chrome
1425
+ ```
1426
+
1427
+ It preserves the personal profile and detaches automatically; profile-wide storage, network,
1428
+ proxy/CORS, tracing, tab closing, and access to unapproved tabs are disabled. For a running Chromium
1429
+ or Electron app exposing a local debugging endpoint, `connection: existing-cdp` attaches to one
1430
+ HTTP(S)/file page and leaves the app running at finish.
1431
+
1432
+ For parallel testing, configure `platforms.web.url` and omit `--serial`; `context_slots` provides
1433
+ independently leased browser contexts, with sticky agent ownership across commands. Console logs,
1434
+ JavaScript errors and network metadata arrive in `meta.browser_diagnostics` with each analysis
1435
+ and action observation. These features apply across the web platform.
1436
+
1437
+ Device-style app and database controls remain unsupported. Configuration, the exact capability
1438
+ boundary, and troubleshooting: [docs/web.md](docs/web.md).
1439
+
1440
+ ## Adding a platform adapter
1441
+
1442
+ Android is the default platform; iOS simulators and web browsers are also built in, all selected
1443
+ through a platform strategy. `device.platform`, `--platform`, or `AUA_PLATFORM` can select an installed adapter;
1444
+ third-party packages register adapters through the `aua.platforms` Python entry-point group.
1445
+ The choice is process/config scoped (not repeated on every command), and both target actions and
1446
+ optional services are gated: another platform never silently falls back to ADB.
1447
+ Optional simulator/emulator lifecycle uses the neutral `virtual_targets` capability and
1448
+ `aua virtual-target ...` commands; established `aua emulator ...` commands remain Android aliases.
1449
+ See [Platform adapters](docs/platform-plugins.md) for the contract and a minimal plugin skeleton.
1450
+
1451
+ ## Adding a provider
1452
+
1453
+ Three steps, zero changes to `engine.py` or `cli.py`:
1454
+
1455
+ 1. **Subclass** the relevant abstract base from `providers/base.py`:
1456
+ - `OcrProvider` — implement `recognize(image) -> list[TextBox]`
1457
+ - `DetectionProvider` — implement `detect(image) -> list[Box]`
1458
+ - `GroundingProvider` — implement `locate(image, instruction) -> Point|Box`; optionally
1459
+ implement `ask(image, question, elements) -> ScreenAnalysisResult` for `aua ask`
1460
+ - `PolicyProvider` — implement `select(context) -> int|None`; the context contains only
1461
+ privacy-screened projections of guard-approved candidates keyed by opaque IDs, and the
1462
+ provider never executes the authoritative call
1463
+
1464
+ 2. **Register** with the decorator from `providers/registry.py`:
1465
+ ```python
1466
+ from android_ui_analyser.providers.registry import register_ocr
1467
+
1468
+ @register_ocr("my_ocr")
1469
+ class MyOcrProvider(OcrProvider):
1470
+ ...
1471
+ ```
1472
+
1473
+ 3. **Add a `models.my_ocr` block** in your config:
1474
+ ```yaml
1475
+ models:
1476
+ my_ocr: { some_option: value }
1477
+ ```
1478
+
1479
+ Each provider must implement `is_available() -> tuple[bool, str]` to declare whether its dependencies and credentials are present.
1480
+
1481
+ ---
1482
+
1483
+ ## Daemon mode
1484
+
1485
+ The daemon holds a warm target runtime (`uiautomator2`, AXe/simctl, or Playwright) and loaded vision
1486
+ models, eliminating per-call cold-start overhead. The CLI auto-detects a running daemon via a unix
1487
+ socket and forwards requests to it; without a daemon it runs in-process (always correct, pays
1488
+ startup cost).
1489
+
1490
+ ```bash
1491
+ aua daemon start # start the background daemon (+ the app orientation blob)
1492
+ aua daemon start --quiet # start it without the blob
1493
+ aua daemon status # check if running
1494
+ aua daemon stop # stop the daemon
1495
+ aua orient # the orientation blob on demand, any time
1496
+ ```
1497
+
1498
+ `daemon start` prints a bounded current projection of what the tool already knows about the foreground app — description,
1499
+ screens, routes, selected deeplinks, login recipes, quirks, plus counts and an `aua about` pointer when more exists. Stale, wrong-version, and superseded facts retain their evidence but are filtered from `about`/`orient`. That is genuinely useful the first
1500
+ time in a session and pure noise on every restart afterwards, so `--quiet` suppresses it and
1501
+ `aua orient` prints it whenever you actually want it.
1502
+
1503
+ The daemon binds **only to a unix socket** (default `~/.cache/android-ui-analyser/daemon.sock`;
1504
+ per-serial sockets when multiple devices are in play). No TCP port, no auth surface.
1505
+
1506
+ Optional: set `daemon.push_ws_port` in config to push `screen_changed` events over a
1507
+ localhost WebSocket so agents can wait without polling. Unchanged screens short-circuit via
1508
+ `meta.via=hierarchy-unchanged` / `--format delta` when `perf.skip_unchanged_analyze` is on.
1509
+
1510
+ ### Optional: `aua-fast` (C thin client)
1511
+
1512
+ Once the daemon is up, each `aua …` call still pays Python/typer startup. `aua-fast` is a
1513
+ ~35 KB binary that speaks the same unix-socket JSON protocol and falls back to `aua` if the
1514
+ daemon is down:
1515
+
1516
+ ```bash
1517
+ make -C native/aua-fast install # → ~/.local/bin/aua-fast (also built by ./install.sh)
1518
+ aua daemon start --quiet
1519
+ aua-fast analyze
1520
+ aua-fast tap 4
1521
+ aua-fast has "Sign in" # exit 0/1
1522
+ ```
1523
+
1524
+ Hot commands: `ping`, `analyze`, `devices`, `has`, `tap`, `key`, `input`, `swipe`, `wait`.
1525
+ Everything else (and any unknown flags) exec's the full Python CLI. Host-side speedups
1526
+ (incremental analyze, delta/msgpack, WS push, fanout, vision defaults) are summarized in
1527
+ [`docs/NATIVE_ROADMAP.md`](docs/NATIVE_ROADMAP.md).
1528
+
1529
+ ---
1530
+
1531
+ ## Verified offline mode
1532
+
1533
+ Airplane mode alone does not prove an Android device is offline because Wi-Fi may remain active.
1534
+ Use the reversible network workflow for offline scenarios:
1535
+
1536
+ ```bash
1537
+ aua network status
1538
+ aua network offline --verify # snapshots controls, disables transports, verifies read-back
1539
+ # …exercise the offline scenario…
1540
+ aua network restore # restores and verifies the original controls/connectivity
1541
+ ```
1542
+
1543
+ `network offline` checks airplane mode, Wi-Fi, mobile-data state, and ConnectivityService's
1544
+ active default network. It exits non-zero if a transport such as Wi-Fi, cellular, Ethernet, or
1545
+ VPN remains active. The per-device restore point survives separate CLI invocations and is kept
1546
+ after a failed verification; repeated offline calls never overwrite the original state. Restore
1547
+ points are boot-aware so a recycled emulator serial cannot apply settings from an older boot.
1548
+
1549
+ For constrained-but-online scenarios, apply exactly one reversible profile:
1550
+
1551
+ ```bash
1552
+ aua network profile list
1553
+ aua network profile apply wifi-only
1554
+ aua network profile apply cellular-only
1555
+ aua network profile apply slow # emulator EDGE bandwidth + 80-400 ms latency
1556
+ aua session start --goal "verify packet loss" --needs root
1557
+ aua network profile apply lossy --loss-percent 10
1558
+ aua network profile status
1559
+ aua network profile restore
1560
+ ```
1561
+
1562
+ Profiles never stack with offline mode or each other. `slow` uses the Android Emulator console
1563
+ and fails on physical devices. `lossy` uses `tc netem` on the active interface, requires a
1564
+ rootable Google APIs AVD, preserves whether adbd was originally rooted, and refuses to overwrite
1565
+ an unfamiliar existing root qdisc. The loss applies to packets leaving the selected interface.
1566
+ Restore points stay in place until live evidence confirms the
1567
+ original conditions returned.
1568
+
1569
+ ---
1570
+
1571
+ ## Proxy / mock (HTTPS record & replay)
1572
+
1573
+ Optional extra: `pip`/`uv` install with `[proxy]` (pulls `mitmproxy`). Apps whose Network
1574
+ Security Config trusts **system CAs only** need a rootable emulator and a system CA install
1575
+ (see [Emulator](#option-a--emulator-avd)):
1576
+
1577
+ ```bash
1578
+ aua emulator ensure-proxy # one-time rootable image setup
1579
+ aua session start --goal "record login HTTPS" --needs root,proxy
1580
+ aua proxy start # random high port + system CA by default
1581
+ aua mock record start login_flow
1582
+ # … drive the app …
1583
+ aua mock record stop login_flow # cassette under memory.dir/cassettes/
1584
+ aua mock map GET /v1/foo --status 200 --body '{"ok":true}'
1585
+ aua mock replay login_flow
1586
+ aua proxy stop
1587
+ aua session finish
1588
+ ```
1589
+
1590
+ Empty cassettes almost always mean TLS rejected the forged cert (Play Store AVD / no system
1591
+ CA) — not “no traffic”.
1592
+
1593
+ ---
1594
+
1595
+ ## Backend changes vs. shipped app versions (`aua api`)
1596
+
1597
+ No device. `aua api check` exports the backend's OpenAPI spec at a base ref and in the working
1598
+ tree, reads every client repository through git at its release tags, and reports each change an
1599
+ already-shipped client can feel beside the client versions and source lines that call it:
1600
+
1601
+ ```yaml
1602
+ # aua-api.yaml — relative repo paths resolve against this file
1603
+ backend:
1604
+ repo: .
1605
+ base: origin/main
1606
+ spec_command: python scripts/export_openapi.py {out} # {out}, {repo}, {checkout}
1607
+ clients:
1608
+ - name: android
1609
+ repo: ../example-android
1610
+ scanner: retrofit # @GET("items"), @HTTP(method = …, path = …) in *.kt / *.java
1611
+ base_path: /api/v1/
1612
+ tags: "v*" # one entry per released version…
1613
+ version: {tag_pattern: '^v(\d+\.\d+\.\d+)'} # …or {file: …, pattern: …}
1614
+ min_version: "3.0.0" # older versions cannot reach the backend anyway
1615
+ max_versions: 10
1616
+ - name: web
1617
+ repo: ../example-web
1618
+ files: ["src/*"]
1619
+ exclude: ["*.test.*"]
1620
+ pattern: '(?P<path>/api/v1(?:/[A-Za-z0-9_\-{}$]+)+)' # or a list; a `method` group is optional
1621
+ ```
1622
+
1623
+ ```bash
1624
+ aua api check # working tree vs backend.base
1625
+ aua api check --base <ref> --head <ref>
1626
+ aua api usage "GET /api/v1/items" # which versions call it, and from where
1627
+ ```
1628
+
1629
+ A finding is one change to one schema, with every operation it reaches and every client version
1630
+ that calls one of them, each version with its own commit and source lines. It is a candidate: AUA
1631
+ matched the route, not the fields each client decodes, so the result's `agent_brief` asks the
1632
+ agent to classify it per version as `decode_fails`, `data_missing`, `unaffected` or `unknown`.
1633
+ `coverage` lists the called operations whose responses the spec does not describe (only their
1634
+ removal is visible), each client's `history` says which tags were left out, and `not_checked`
1635
+ names what a spec diff cannot see. `unused_changes` are not proof of safety. A base spec is exported
1636
+ from an extracted copy of that ref and cached by commit and export command (`--refresh` exports
1637
+ again after the exporter's setup changed); client files are cached by blob id, so a repeat run
1638
+ reads only what changed. Partial clones (`--filter=blob:none`) are fetched in one
1639
+ batch rather than one file at a time.
1640
+
1641
+ ---
1642
+
1643
+ ## Test a backend the way the app calls it (`aua api run`)
1644
+
1645
+ No device. A **cartridge** is a short YAML file holding the requests a client app sends for one
1646
+ user flow: a new install's first sign-in, then the feature's calls, with values such as a token or
1647
+ an id passed from one response to the next request. An agent writes it from the app's networking
1648
+ code (`aua api sample` prints an annotated example for a fictional app), and anyone working on the
1649
+ backend can run it without the app:
1650
+
1651
+ ```bash
1652
+ aua api sample > notes-ask.yaml # start here, then copy the app's real calls
1653
+ # Secrets come from the environment, e.g. `aua config exec --env-file .env -- aua api run …`
1654
+ aua api run notes-ask.yaml --base-url http://localhost:8000 --save-expect # once, on a backend that works
1655
+ aua api run notes-ask.yaml --base-url http://localhost:8000 # after every change
1656
+ aua api run notes-ask.yaml --input question="Is it raining?" # same flow, other input
1657
+ ```
1658
+
1659
+ ```yaml
1660
+ cartridge: 1
1661
+ base_url: https://api.example.com
1662
+ env: [EXAMPLE_CLIENT_KEY] # read from the environment, never stored in the file
1663
+ inputs: {question: What do I need to buy?}
1664
+ headers:
1665
+ X-Client-Key: "{{env.EXAMPLE_CLIENT_KEY}}"
1666
+ X-Install-Id: "{{install.id}}" # one UUID per install: per --session, else per run
1667
+ steps:
1668
+ - id: session
1669
+ method: POST
1670
+ path: /v1/sessions/anonymous
1671
+ once: true # skipped when a --session already holds the token
1672
+ save: {token: body.access_token} # body.<field>, header.<Name>, events.<event>.<field>
1673
+ - id: ask
1674
+ method: POST
1675
+ path: /v1/assistant/replies # a server-sent event stream is read to the end
1676
+ headers: {Authorization: "Bearer {{token}}"}
1677
+ json: {message: "{{input.question}}"}
1678
+ ```
1679
+
1680
+ Each step must answer with its `status` (any 2xx by default) and yield every value it `save`s;
1681
+ otherwise the run stops there (a saved null counts as missing). `{{now}}` is the current UTC
1682
+ time, for backends that reject a stale client timestamp. `--save-expect` writes each response's shape (field names and
1683
+ types, never values) to an `expect:` block at the end of the file. A later run reports a field
1684
+ that went missing or changed type as a `break` and exits 8; a field that is now null is a
1685
+ `warn`, and new fields are fine. Each step reports its status, time (first byte for a stream)
1686
+ and a shortened response with token-like fields hidden. The file holds no secrets and no
1687
+ recorded values, so it can be handed to whoever changes the backend.
1688
+
1689
+ A stream step also reports `event_ms`: when each kind of event first arrived, so the time to the
1690
+ first reply text (a `delta` event, say) is visible apart from the stream merely starting.
1691
+
1692
+ ### Write a shared sign-in once (`flow:`)
1693
+
1694
+ A step that says `- flow: sign-in.yaml` is replaced by that cartridge's steps, so the sign-in
1695
+ every flow starts with lives in one file beside them:
1696
+
1697
+ ```yaml
1698
+ steps:
1699
+ - flow: sign-in.yaml # its steps, sent with its own headers, inputs and secrets
1700
+ - id: create_note
1701
+ method: POST
1702
+ path: /v1/notes
1703
+ headers: {Authorization: "Bearer {{token}}"}
1704
+ ```
1705
+
1706
+ The shared file is a cartridge like any other, so it also runs on its own: `aua api run
1707
+ sign-in.yaml --session dev` signs in and does nothing else, and every later run with
1708
+ `--session dev` is that user. A session keeps a copy of the shared file beside its flow, so a
1709
+ handed-over session still finds it.
1710
+
1711
+ ### Keep one user across runs (`--session`)
1712
+
1713
+ Without a session every run is a new install and a new user. With one, the next run is the same
1714
+ user on the same install, so you can fix the backend and go on from where the last run stopped:
1715
+
1716
+ ```bash
1717
+ aua api run chat.yaml --base-url http://localhost:8000 --session bug-12 # signs in, chats
1718
+ # …fix the backend, restart it…
1719
+ aua api run continue-chat.yaml --session bug-12 # same user, same chat, same backend
1720
+ aua api session list # sessions, what each kept, when each goes
1721
+ aua api session export bug-12 # bug-12.aua-session.zip, to hand it over
1722
+ aua api session import bug-12.aua-session.zip # on their machine, to continue it there
1723
+ aua api session delete bug-12
1724
+ ```
1725
+
1726
+ A session keeps every value its runs `save` (the token, a chat id) and every `{{install.NAME}}`
1727
+ id, which stays the same for the whole session (a device id). A step marked `once: true`, the
1728
+ sign-in, is skipped when the session already holds every value it saves, and a step can save
1729
+ what it sent (`request.json.<field>`), such as the question a follow-up needs as context. Later
1730
+ runs go to the backend the session started on, since its user exists only there.
1731
+
1732
+ Each run is logged in full in the session's `runs/`: every request and response, secrets and
1733
+ tokens hidden, beside a copy of the flow and of the map version it was checked against. So an
1734
+ export holds what someone needs to continue: the sign-in, the logs, the flows and the schema;
1735
+ the client's keys are never in it, and the receiver uses their own. Sessions live in
1736
+ `~/.android-ui-analyser/api-sessions/`, readable only by you, and one nobody has used for 14
1737
+ days is removed. An export holds a live sign-in: send it only to people who may act as that
1738
+ user.
1739
+
1740
+ ### Versioned maps: simulate a specific app version
1741
+
1742
+ To answer "does version 3.1 of the app still work with my backend change?" without an emulator,
1743
+ keep a map next to the `aua-api.yaml` config (`map: aua-map` by default): one folder per client
1744
+ version, each holding a `schema.yaml` (what that version needs back from every endpoint it calls)
1745
+ and the `flows/` it runs. AUA runs no model here. The calling agent reads the client's code at the
1746
+ version's tag and writes the files; AUA finds tags, diffs versions, reports what is still
1747
+ unmapped, and checks every response against that version's schema.
1748
+
1749
+ ```bash
1750
+ aua api map # mapped versions, what each lacks, releases not mapped
1751
+ aua api map new android 3.1.0 --from 3.2.0 # tag + commit, the calls to map (file:line at the tag),
1752
+ # and which calls and API files changed since 3.2.0
1753
+ aua api run aua-map/android/3.1.0/flows/chat.yaml --base-url http://localhost:8000
1754
+ aua api map freeze android 3.1.0 # once it passes against a backend that works
1755
+ aua api map new android next --ref main # unreleased code: mapped, never frozen
1756
+ ```
1757
+
1758
+ ```yaml
1759
+ # aua-map/android/3.1.0/schema.yaml — written from that version's data models
1760
+ endpoints:
1761
+ "POST /v1/notes":
1762
+ response:
1763
+ body:
1764
+ id: string # required: absent or null, 3.1 cannot decode the reply
1765
+ state: enum(draft, published) # a value 3.1 does not know is a break
1766
+ pinned?: boolean # optional: may be absent or null
1767
+ title: string? # must be present, may be null
1768
+ "POST /v1/assistant/replies":
1769
+ response:
1770
+ events:
1771
+ done: {reply_id: string} # an event 3.1 needs in every stream
1772
+ tool?: {name: string} # one it decodes only when sent
1773
+ ```
1774
+
1775
+ A flow inside a version folder is checked against that schema: each step reports which endpoint
1776
+ it matched, a `decode_fails` break for a required field that is missing, null, retyped or an
1777
+ unknown enum value, and `optional_absent` for optional fields the backend left out. Label steps
1778
+ with `screen: Chat` to read the result screen by screen. A released version's code never changes,
1779
+ so `freeze` records every schema endpoint and flow; a later edit to one is reported by
1780
+ `aua api map` and `aua api run`, while newly mapped endpoints and flows are additions and freeze
1781
+ on the next `freeze`. Inside a one-line `{…}` mapping, quote anything with a `?`
1782
+ (`{"name?": string}`), as YAML requires.
1783
+
1784
+ ---
1785
+
1786
+ ## Dashboard (sneak-peek headless runs)
1787
+
1788
+ Agents often drive a **headless** emulator with no window. The dashboard is a detached service on
1789
+ one exact port, so it keeps running after the command returns and phone bookmarks remain valid:
1790
+
1791
+ ```bash
1792
+ # Start/reuse the dashboard. By default it is reachable at a name you can type:
1793
+ aua dashboard start
1794
+ # → publishes aua.local over mDNS, binds port 80, serves http://aua.local/ with no token
1795
+ aua dashboard status
1796
+ aua dashboard open
1797
+ aua dashboard stop
1798
+
1799
+ # Phone on the same network (Android browsers cannot resolve .local):
1800
+ aua dashboard qr
1801
+ # → writes and opens a QR code for the phone URL
1802
+
1803
+ # Narrow it when you are not on a network you control:
1804
+ aua dashboard start --local # loopback only, no published name
1805
+ aua dashboard start --auth # keep the network bind, require an access token
1806
+ aua dashboard start --name "" # publish no name
1807
+ aua dashboard start --port 48765 # pin an exact port
1808
+
1809
+ # Compatibility and foreground debugging:
1810
+ aua dashboard # alias for `dashboard start`
1811
+ aua dashboard start --detail # focus the first online device
1812
+ aua dashboard run # foreground; Ctrl-C stops it
1813
+ ```
1814
+
1815
+ **The default is open on your network.** `aua dashboard start` binds every interface, publishes
1816
+ `aua.local`, and serves without a token, so the dashboard is something you type rather than
1817
+ something you scan. Be clear about what that means: anything that can reach the port gets the whole
1818
+ dashboard, which drives the device, streams logcat (routinely carrying auth tokens and user
1819
+ identifiers), and queries app databases. Every start prints a warning saying so. Use it on a network
1820
+ whose members you would hand your unlocked phone to — a home LAN, not an office guest SSID, a
1821
+ coworking space, or a hotel — and use `--auth` or `--local` anywhere else.
1822
+
1823
+ Change the default once instead of typing a flag every time:
1824
+
1825
+ ```yaml
1826
+ # $XDG_CONFIG_HOME/android-ui-analyser/config.yaml
1827
+ dashboard:
1828
+ name: aua # mDNS name to publish; null or "" publishes nothing
1829
+ lan: true # bind every interface rather than loopback only
1830
+ auth: false # require an access token on network access
1831
+ port: null # exact port; null means 80 with a name, else 48765
1832
+ ```
1833
+
1834
+ A typed flag always beats config, in both directions: `--auth` re-arms the token for one start and
1835
+ `--no-auth` drops it, `--local`/`--lan` move the bind, `--name ""` publishes nothing.
1836
+
1837
+ Publishing the name needs no privilege — `dns-sd` on macOS and `avahi-publish` on Linux register a
1838
+ host record as an ordinary user — so nothing edits `/etc/hosts` and nothing prompts for a password.
1839
+ The record lives in a child process that dies with the dashboard, so a stopped dashboard leaves no
1840
+ name pointing at a closed port; a host with no publisher simply keeps its IP URL. Resolving `.local`
1841
+ is the *client's* job: macOS, iOS, and Windows 10+ do it natively, Android browsers do not — so a
1842
+ phone still uses `aua dashboard qr`.
1843
+
1844
+ Port 80 is a preference, not a requirement: macOS lets an ordinary user bind it, Linux does not
1845
+ without `CAP_NET_BIND_SERVICE`. When the default port cannot be bound the dashboard starts on 48765
1846
+ and says so, but a port you pinned with `--port` is never quietly moved. Service mode never walks to
1847
+ a *nearby* port — if the chosen port belongs to another process, startup fails and names the
1848
+ collision — and `status`, `open`, `qr`, and `stop` follow the running dashboard's port without you
1849
+ repeating it.
1850
+
1851
+ With `--auth`, every page, frame, journal, log, and control endpoint requires the generated access
1852
+ token; the browser exchanges the one-time URL token for an HttpOnly cookie and removes it from the
1853
+ address bar. Either way the dashboard speaks plain HTTP, so never expose the port through a router
1854
+ or public Wi-Fi.
1855
+
1856
+ The page live-polls capture frames + recent action marks. In a device detail view, the
1857
+ **Agent I/O journal** keeps rows compact while they stream; expand any row to inspect the full
1858
+ agent request and AUA response. Full payloads load only on demand, and credentials, SQL, bind
1859
+ parameters, typed input, microphone speech, and audio paths remain redacted. Events recorded by an
1860
+ older AUA version expand to the compact payload that was retained at the time. After input or
1861
+ microphone commands, free-form response strings are hidden as well: a UI can split or transform a
1862
+ private value, so exact-string replacement alone is not a privacy boundary.
1863
+
1864
+ Grid tiles and device detail headers show the live lease holder separately from the owner that
1865
+ started the emulator. They also show the AUA idle watchdog state and remaining auto-stop time.
1866
+ Auto-stop is lease-gated: reaching the idle threshold never stops a device while a live agent still
1867
+ holds its lease. Emulators AUA did not start report `auto-stop n/a`; an explicit `--idle-stop 0`
1868
+ reports `auto-stop off`.
1869
+
1870
+ In the same detail view, the
1871
+ **App database workspace** discovers databases for the foreground package, browses schema,
1872
+ runs bounded read-only SQL, creates/lists restore points, and exposes guarded mutation and
1873
+ restore actions. Mutation requires typing `MUTATE <database>`; restore requires typing
1874
+ `RESTORE <backup-id>`. Both keep the same server-side backup and integrity protections as
1875
+ the CLI. The phone layout prioritizes the live screen, enlarges touch targets, and keeps element
1876
+ overlays tappable. If no warm daemon is present, aua starts the capture **sidecar** (single-device)
1877
+ or uses platform screencap per tile (grid).
1878
+
1879
+ ---
1880
+
1881
+ ## App database inspection and mutation
1882
+
1883
+ For an installed **debuggable** build, use AUA instead of composing `adb run-as`, DB/WAL
1884
+ copies, host SQLite, and push-back commands yourself:
1885
+
1886
+ ```bash
1887
+ aua db list com.example.app
1888
+ aua db schema com.example.app app.db
1889
+ aua db schema com.example.app app.db --table messages
1890
+ aua db query com.example.app app.db \
1891
+ "SELECT id, state FROM messages WHERE chatId = :chat" \
1892
+ --params '{"chat":"abc"}' --limit 100
1893
+ ```
1894
+
1895
+ Android system images frequently omit the `sqlite3` executable. Read-only queries copy the
1896
+ selected database plus its WAL through `run-as` while the app keeps running, then use Python
1897
+ SQLite in read-only mode so the current screen and navigation state are preserved. Pass
1898
+ `--coherent` when transactional coherence matters more than UI continuity; that mode stops the
1899
+ package, includes WAL/SHM in the snapshot, and relaunches by default (`--no-restart` leaves it
1900
+ stopped). Queries use SQLite `query_only`, a row limit, and a timeout; blobs are returned as
1901
+ base64 metadata.
1902
+
1903
+ Data mutation is explicit and recoverable:
1904
+
1905
+ ```bash
1906
+ aua db execute com.example.app app.db \
1907
+ "UPDATE messages SET state = :state WHERE id = :id" \
1908
+ --params '{"state":"FAILED","id":"m1"}' --yes
1909
+
1910
+ aua db backups com.example.app app.db
1911
+ aua db restore com.example.app app.db <backup-id> --yes
1912
+ ```
1913
+
1914
+ `execute` accepts data statements (`INSERT`, `UPDATE`, `DELETE`, `REPLACE`, `WITH`) and
1915
+ refuses schema changes, PRAGMA, ATTACH, and transaction control. It always creates a restore
1916
+ point first, executes one transaction, checks schema stability, foreign keys, and
1917
+ `integrity_check`, consolidates WAL state, replaces the app database, removes stale sidecars,
1918
+ then relaunches. `restore` first preserves the current state as another safety backup.
1919
+ Restore points are device/package/database scoped under AUA's private cache and can contain
1920
+ user data; query only the rows needed and handle backups accordingly.
1921
+
1922
+ ---
1923
+
1924
+ ## MCP server
1925
+
1926
+ `aua mcp` runs an MCP server over stdio, exposing the same tools as the CLI. It is a thin adapter over the engine — no separate perception logic.
1927
+
1928
+ For web tasks, `aua --platform web mcp --tool-profile web` advertises a smaller catalogue of
1929
+ session, UI, map/flow and browser tools. `AUA_MCP_TOOL_PROFILE=web` is the equivalent environment
1930
+ setting. The compatible default is `full`; profiles are explicit and do not select the platform.
1931
+ See [web MCP setup](docs/web.md#browser-lab-controls) for configuration and restart behavior.
1932
+
1933
+ Tools include (non-exhaustive): `analyze_screen`, `tap_and_analyze`,
1934
+ `double_tap_and_analyze`, `long_press_and_analyze`, `drag_and_analyze`, `input_and_analyze`,
1935
+ `mic_inject_and_analyze`, `mic_speak_and_analyze`,
1936
+ `clear_and_analyze`, `swipe_and_analyze`, `scroll_and_analyze`,
1937
+ `scroll_to_and_analyze`, `key_and_analyze`, `wait_and_analyze`,
1938
+ `wait_stable_and_analyze`, `wait_changed_and_analyze`, `has`,
1939
+ `expect`, `screenshot`, `inspect`, `goto`, `flow_run`, `navigate`, `policy_status`, `list_devices`,
1940
+ `virtual_target_list` / `virtual_target_status` / `virtual_target_start` /
1941
+ `virtual_target_provision` / `virtual_target_create` / `virtual_target_delete` /
1942
+ `virtual_target_stop` / `virtual_target_reclaim`, plus the Android aliases
1943
+ `emulator_list` / `emulator_status` / `emulator_start` / `emulator_stop` (stop before exit —
1944
+ MCP also auto-stops emulators it started when the server process ends), `open_link_and_analyze`,
1945
+ `app`, `install_app`, `resolve`, clipboard/paste/copy/erase,
1946
+ location/orientation/airplane/network/network-profile/media/record/clock,
1947
+ `capture_*`, `dev_profile`, `a11y_scroll_and_analyze`, `flags_apply_and_analyze`,
1948
+ `database_list` / `database_schema` / `database_query` / `database_execute` /
1949
+ `database_backup` / `database_backups` / `database_restore`,
1950
+ map/`reconcile_*`/`knowledge_*`,
1951
+ `proxy_start` / `proxy_stop` / `mock_replay`, `configure`,
1952
+ `app_log_prefs_get` / `app_log_prefs_set`.
1953
+
1954
+ The full MCP profile also exposes `development_tools_status`, `development_tools_setup`,
1955
+ `development_tools_catalogue`, and `development_tool`, plus `preview_list`, `preview_render`,
1956
+ `preview_inspect`, `preview_check`, `journey_validate`, `journey_start`, `journey_status`,
1957
+ `journey_check`, `journey_record`, and `journey_finish`. Profiling uses `development_tool` with
1958
+ the catalogue's profiler operations; `profile_kind: "heap"` selects heap session status or
1959
+ cancellation without affecting an owned trace.
1960
+
1961
+ Example MCP client config (Claude Desktop / `claude_desktop_config.json`), running the latest
1962
+ release from PyPI:
1963
+
1964
+ ```json
1965
+ {
1966
+ "mcpServers": {
1967
+ "android-ui": {
1968
+ "command": "uvx",
1969
+ "args": ["android-ui-analyser", "mcp"]
1970
+ }
1971
+ }
1972
+ }
1973
+ ```
1974
+
1975
+ The same server pinned to one release, with the OCR and emulator-audio extras:
1976
+
1977
+ ```json
1978
+ {
1979
+ "mcpServers": {
1980
+ "android-ui": {
1981
+ "command": "uvx",
1982
+ "args": [
1983
+ "--quiet",
1984
+ "--from",
1985
+ "android-ui-analyser[apple,rapidocr,audio] @ git+https://github.com/The-Wordlab/Android-UI-Analyser.git@v0.48.0",
1986
+ "aua",
1987
+ "mcp"
1988
+ ]
1989
+ }
1990
+ }
1991
+ }
1992
+ ```
1993
+
1994
+ ---
1995
+
1996
+ ## CLAUDE.md snippet
1997
+
1998
+ > Most users should instead install the **plugin** (see [Installation help](#installation-help)) — it activates automatically and keeps the skill and MCP server on the same release. Use the snippet below only if you prefer inline per-project instructions over the plugin.
1999
+
2000
+ Paste this into your project's `CLAUDE.md` to teach Claude Code how to use `aua`:
2001
+
2002
+ ```markdown
2003
+ ## Android UI testing with `aua`
2004
+
2005
+ Use `aua` to inspect and drive the connected Android device.
2006
+
2007
+ ### Getting elements on screen
2008
+
2009
+ ```bash
2010
+ aua --format tsv analyze # readable: one element per line, noise filtered out
2011
+ aua --format compact analyze # get element IDs (smaller token footprint)
2012
+ aua analyze # full JSON with all fields
2013
+ ```
2014
+
2015
+ Elements are returned with tracked `el:` handles. By default, action commands already return the next
2016
+ screen in `observation` with fresh IDs, so you usually do not need a separate `analyze` immediately
2017
+ after state-changing actions.
2018
+
2019
+ A handle follows a uniquely identified element through scrolling and reordering. Repeated child
2020
+ controls are distinguished by their owning row's content and ancestry. Input values and checked,
2021
+ enabled, focused, and selected state do not determine identity. AUA refuses absent, changed,
2022
+ ambiguous, or expired handles with a fresh observation, without sending the action.
2023
+
2024
+ Session bootstrap publishes the same handles as analysis and actions. On clickable list rows with
2025
+ a title, a trailing English relative age such as `3 days ago` is treated as state; changing it to
2026
+ `4 days ago` keeps the handle and the original text remains visible. Rows with the same title and
2027
+ different ages are ambiguous. Bare ages, other text changes and unrecognized date formats still
2028
+ expire handles conservatively.
2029
+
2030
+ Handles persist across CLI/daemon restarts on the same attested target boot and adapter configuration.
2031
+ Without boot identity they remain local to the connected runtime. Records are bounded, so old handles
2032
+ can expire. Identical items without distinguishing semantics cannot be tracked reliably; visual-only
2033
+ identities may also expire when rendering changes. The separate `stable_key` remains a reusable
2034
+ selector fingerprint: `rid:row#1` means the first matching row on the current screen. Prefer `id`
2035
+ for acting on a previously observed item, and semantic selectors for saved flows. Integer ordinals
2036
+ remain supported for older scripts but belong to their cached observation.
2037
+
2038
+ ### Asking for fewer rows and columns (don't post-process the JSON)
2039
+
2040
+ Most of a screen is status-bar chrome and unlabelled containers, and you usually want
2041
+ four columns out of eighteen. Say so in the same call:
2042
+
2043
+ ```bash
2044
+ aua --format tsv analyze # id, text, rid, clickable
2045
+ aua --format tsv analyze --fields id,text,rid,bounds # your columns, your order
2046
+ aua --format tsv analyze --all # keep the noise too
2047
+ aua --format tsv analyze --region 0,0,1080,300 --clickable # the header's tap targets
2048
+ aua --format tsv analyze --where-text "Browse" # case-insensitive substring
2049
+ aua --format tsv analyze --where-rid homeTab --limit 5
2050
+ aua --format tsv analyze --no-meta # no `#` comment lines at all
2051
+ aua --format compact analyze --fields id,rid --nonempty # same views, JSON output
2052
+ ```
2053
+
2054
+ - `--fields` names: `id`, `type`, `text`, `rid` (short tail) / `resource_id` (full selector),
2055
+ `desc` / `content_desc`, `bounds`, `center`, `clickable`, `enabled`, `focused`, `checkable`,
2056
+ `checked`, `selected`, `scrollable`, `long_clickable`, `password`, `parent`, `source`,
2057
+ `confidence`.
2058
+ A wrong name exits **2** and lists the valid ones — before touching the device.
2059
+ - `--format tsv` implies `--nonempty --no-system` (drops rows with no text/id/desc, and
2060
+ status-bar chrome). `--all` opts out. JSON formats filter **nothing** unless you ask.
2061
+ - `--no-wrappers` (opt-in) drops the app's **own** id'd layout scaffolding — `app_bar`,
2062
+ `content_frame`, `collapsing_toolbar`: nodes that are unlabelled, non-actionable, and wrap
2063
+ something else. Leaves stay (an unlabelled leaf is the icon you tap), and so do actionable
2064
+ or scrollable containers. Worth it on View-based apps, where such wrappers can be most of
2065
+ the top of the list; Compose apps barely notice. `--nonempty` does **not** drop them —
2066
+ they do have a resource-id, which is exactly what makes them addressable.
2067
+ - Filters of different kinds AND together; repeating one kind ORs together
2068
+ (`--region A --region B` = either box).
2069
+ - **IDs are never renumbered.** The id in a filtered row is the id `aua tap-and-analyze` takes.
2070
+ - `--meta <csv>` / `--no-meta` control the metadata (the route/deeplink suggestions are
2071
+ worth reading once per session, not on every call).
2072
+
2073
+ ### Reading interaction state (is that switch on?)
2074
+
2075
+ Every element carries the a11y interaction flags, so a boolean question needs no screenshot:
2076
+
2077
+ ```bash
2078
+ $ aua --format tsv analyze --where-rid switch_widget --fields id,type,checkable,checked
2079
+ # screen=accessibility package=com.android.settings 1080x2400
2080
+ # elements=24 shown=2 tier_used=hierarchy duration_ms=220
2081
+ id type checkable checked
2082
+ 16 Switch true true
2083
+ 19 Switch true false
2084
+ ```
2085
+
2086
+ `selected` tells you which tab is active; `scrollable` tells you which container really
2087
+ scrolls. These are **tri-state**: `true`/`false` when the node reported the attribute, and
2088
+ **empty/`null` when genuinely unknown** (a vision-derived element has no a11y attributes),
2089
+ so *off* never masquerades as *unknown*.
2090
+
2091
+ ### Acting on elements
2092
+
2093
+ ```bash
2094
+ aua tap-and-analyze <id> # tap / click an element (returns the next screen by default)
2095
+ aua input-and-analyze <id> "text" # focus element and type; add --submit to send IME action
2096
+ aua tap-and-analyze <id> --no-observe # act WITHOUT returning the new screen (skip the folded analyze)
2097
+ aua swipe-and-analyze up # swipe direction (up|down|left|right)
2098
+ aua swipe-and-analyze --from <id> # scroll a specific container
2099
+ ```
2100
+
2101
+ By default every action returns the post-action screen inline (`observation`, with fresh
2102
+ ids), so `type → tap send` is two commands, not three. Add `--no-observe` to skip it.
2103
+
2104
+ ### Quick checks (no full analyze needed)
2105
+
2106
+ ```bash
2107
+ aua has "Sign in" # exit 0 if present, 1 if not — use to branch cheaply
2108
+ aua has "Submit" --match exact
2109
+ ```
2110
+
2111
+ Prefer `aua has` over re-analyzing when you only need to confirm presence.
2112
+
2113
+ ### Handling Compose / Flutter / WebView / game screens
2114
+
2115
+ When `analyze` returns few or no elements, the hierarchy is empty (common for
2116
+ Compose without semantics, Flutter, or canvas apps). Use:
2117
+
2118
+ ```bash
2119
+ aua analyze --source vision --annotate
2120
+ ```
2121
+
2122
+ This runs detection + OCR and writes an annotated PNG (numbered boxes) to the
2123
+ path shown in `meta.annotated_image`. Element IDs work the same way.
2124
+
2125
+ ### When you must actually LOOK at the screen
2126
+
2127
+ Reading a full 1080x2400 PNG is expensive. Capture only the part you need:
2128
+
2129
+ ```bash
2130
+ aua screenshot --out /tmp/header.png --region 0,0,1080,300 # crop before writing
2131
+ aua screenshot --out /tmp/small.png --max-width 320 # downscale (never upscales)
2132
+ aua screenshot --out /tmp/half.png --scale 0.5
2133
+ aua screenshot --annotate # full screen + numbered marks
2134
+ ```
2135
+
2136
+ The written path comes back as `detail` (`aua screenshot … | jq -r .detail`). Regions are
2137
+ screen pixels and are clamped to the screen; a box that misses it entirely exits **2**.
2138
+ `--annotate` can't be combined with cropping — marks are placed in full-screen coordinates.
2139
+
2140
+ ### Semantic / fuzzy target lookup
2141
+
2142
+ ```bash
2143
+ aua analyze --query "the Submit button" # tries hierarchy first, grounding only if needed
2144
+ aua analyze --query "the blue icon top-right" --deep # force grounding escalation
2145
+ ```
2146
+
2147
+ ### Navigating to known screens
2148
+
2149
+ `aua` remembers each app's screens and routes. Every `analyze` returns
2150
+ `meta.suggested_gotos` (ranked, ready-to-run) and `meta.known_routes`. To jump to
2151
+ a screen the tool has seen before, in one command:
2152
+
2153
+ ```bash
2154
+ aua goto "product detail" # taps + verifies each hop along the remembered route
2155
+ aua goto "settings" --plan # preview the route without acting
2156
+ ```
2157
+
2158
+ Prefer `goto` over manual tapping whenever your target is listed in `suggested_gotos`.
2159
+
2160
+ ### Typical loop
2161
+
2162
+ 1. `aua --format compact analyze` → read element IDs from JSON output.
2163
+ 2. `aua tap-and-analyze <id>` or `aua input-and-analyze <id> "text"`.
2164
+ 3. `aua has "<expected text>"` to confirm the transition.
2165
+ 4. `aua --format compact analyze` again for the new screen.
2166
+ ```
2167
+
2168
+ ---
2169
+
2170
+ ## Output schema summary
2171
+
2172
+ ```json
2173
+ {
2174
+ "schema_version": 1,
2175
+ "screen": { "width": 1080, "height": 2400, "package": "com.example", "activity": ".Main", "source": "hierarchy" },
2176
+ "elements": [
2177
+ {
2178
+ "id": 0,
2179
+ "type": "Button",
2180
+ "text": "Sign in",
2181
+ "resource_id": "com.example:id/sign_in",
2182
+ "content_desc": null,
2183
+ "bounds": [120, 1500, 960, 1610],
2184
+ "center": [540, 1555],
2185
+ "clickable": true,
2186
+ "enabled": true,
2187
+ "focused": false,
2188
+ "source": "hierarchy",
2189
+ "confidence": null
2190
+ }
2191
+ ],
2192
+ "meta": {
2193
+ "duration_ms": 42,
2194
+ "tier_used": "hierarchy",
2195
+ "path": "hierarchy",
2196
+ "providers_used": ["hierarchy"],
2197
+ "known_screen": "home",
2198
+ "known_routes": ["tap 'Catalog' → catalog"],
2199
+ "suggested_gotos": ["goto product_detail"],
2200
+ "map_hint": null,
2201
+ "annotated_image": null,
2202
+ "device_serial": "emulator-5554",
2203
+ "device_locale": "es-ES"
2204
+ }
2205
+ }
2206
+ ```
2207
+
2208
+ `meta.device_locale` is the device's UI locale — labels render in it, so match text you observed on screen (or use locale-proof resource-ids) rather than literals written in another language. On a text miss, `has`/`wait --for`/`scroll-to` echo the locale plus a hint — language-neutral, so a query in any language crossed with any device locale is caught. After `aua explore mine <repo>` has harvested the app's string resources (`values-*/strings.xml`), text lookups bridge locales automatically: `has "Edit basket"` finds "Editar cesta" on an es-ES device (any locale pair) and reports which string key and rendering matched.
2209
+
2210
+ `compact` format drops null fields and verbose defaults for the smallest token footprint.
2211
+ `pretty` is indented JSON. `tsv` is one element per line. `delta` / `msgpack` are for warm-
2212
+ daemon / native hot paths (unchanged hierarchy → tiny payload). All formats validate against
2213
+ the same pydantic schema where applicable.
2214
+
2215
+ Action-command responses also carry a compact contract so `analyze` is usually not needed:
2216
+
2217
+ ```json
2218
+ {
2219
+ "ok": true,
2220
+ "action": "tap",
2221
+ "observation_present": true,
2222
+ "known_screen": "chat",
2223
+ "stable_elements": [
2224
+ { "id": 25, "stable_key": "compose_input" },
2225
+ { "id": 26, "stable_key": "send" }
2226
+ ],
2227
+ "action_diff_summary": {
2228
+ "added": 0,
2229
+ "removed": 0,
2230
+ "changed": 2,
2231
+ "prev_count": 17,
2232
+ "curr_count": 17
2233
+ },
2234
+ "note": "No separate analyze needed; state is in observation.",
2235
+ "observation": { ... },
2236
+ "capture_hint": null
2237
+ }
2238
+ ```
2239
+
2240
+ If `observation_present` is false, the action was run as `--no-observe`; run a normal
2241
+ `analyze` to refresh ids and state.
2242
+
2243
+ ### Exit codes
2244
+
2245
+ | Code | Meaning |
2246
+ |---|---|
2247
+ | `0` | Success |
2248
+ | `1` | Negative result — `has`: text absent, or `goto`: route could not complete |
2249
+ | `2` | Usage error (bad flags, missing argument) |
2250
+ | `3` | No device / device error |
2251
+ | `4` | Provider error — all fallbacks exhausted |
2252
+ | `5` | Config error (invalid YAML, unknown key, bad value) |
2253
+
2254
+ Errors print a structured object to stderr: `{"error": {"code": ..., "message": ..., "hint": ...}}`.
2255
+
2256
+ ---
2257
+
2258
+ ## Command reference
2259
+
2260
+ Run `aua --help`, or `aua <command> --help` for any command. Global flags (`--format`, `--serial`, `--config`, `--profile`, `--timeout`, `--log-level`, `--no-cache`, `--with-image`) go **before** the subcommand.
2261
+
2262
+ | Command | What it does |
2263
+ |---|---|
2264
+ | `aua doctor` | Check environment plus separate Claude/Codex installed-skill freshness |
2265
+ | `aua capabilities [--goal "…"]` | Discover the canonical CLI/MCP capability catalogue |
2266
+ | `aua devtools status\|setup\|catalogue\|run` | Discover, explicitly install, and use optional Android CLI tools; inspect each operation's scope and accepted options |
2267
+ | `aua preview list\|render\|inspect\|check` | Compile Compose previews without a device, inspect images/component trees, and check saved evidence |
2268
+ | `aua profile start\|status\|stop\|cancel\|heap` | Profile the leased target with durable cleanup; requires optional Android CLI |
2269
+ | `aua journey validate\|start\|status\|check\|record\|finish` | Execute authored agent tests with separate assertion and visual-review evidence |
2270
+ | `aua session start --goal "…"` | Observe once and return one exact next call; optionally add `--contract`, `--artifacts-dir`, `--wait-for-lease`, `--animations` |
2271
+ | `aua session review\|finish` | Quantify calls; strict contracts keep finish active until proven (`--allow-incomplete` is explicit) |
2272
+ | `aua session candidate-flow NAME` | Preview a proven action window; reset + replay before `--save` |
2273
+ | `aua reach "<goal>" [--until …]` | Use verified goto then a matching safe flow, with semantic arrival proof |
2274
+ | `aua devices` | List attached devices/emulators |
2275
+ | `aua analyze` | Capture the screen → element list with IDs (the core command) |
2276
+ | `aua resolve <id\|key>` | Remap a prior id / `stable_key` onto the current screen |
2277
+ | `aua has "<text>"` | Exit 0 if text is on screen, 1 if not — cheap branch check |
2278
+ | `aua expect-and-analyze …` | Assert visibility / state (exit 8 on failure) |
2279
+ | `aua wait-and-analyze --for "<text>"` | Poll until text appears (`--idle` / `--for-stable` / `--changed`) |
2280
+ | `aua await-and-analyze '<predicate>'` | Wait on ANDed terms — `text:` `rid:` `desc:` `net:` `log:`, `!` = absent. Reports `await_outcome`: satisfied / screen-changed / timeout |
2281
+ | `aua lease list\|acquire\|release` | Who is driving which emulator (claimed automatically; `--needs root,play,proxy,animations`) |
2282
+ | `aua fanout …` | Run a command across multiple `--serials` |
2283
+ | `aua tap-and-analyze <id>` / `aua click-and-analyze <id>` | Tap an element by ID (also `--rid`/`--text`/`--desc`) |
2284
+ | `aua double-tap-and-analyze <id>` | Double-tap an element |
2285
+ | `aua long-press-and-analyze <id>` | Long-press an element by ID |
2286
+ | `aua drag-and-analyze --coords x1 y1 x2 y2` | Press, move and release (games, sliders, drag-and-drop); swipe moves content |
2287
+ | `aua input-and-analyze <id> "text"` | Focus an element and type (`--submit` fires the IME action) |
2288
+ | `aua clear-and-analyze <id>` / `aua erase-and-analyze` | Clear a field / backspace N chars |
2289
+ | `aua hide-keyboard-and-analyze` | Dismiss the IME without navigating away |
2290
+ | `aua swipe-and-analyze <up\|down\|left\|right>` | Swipe / scroll (`--from <id>` to scroll a container) |
2291
+ | `aua scroll-and-analyze` / `aua scroll-to-and-analyze "<text>"` | Directional scroll / scroll until text is found |
2292
+ | `aua key-and-analyze <back\|home\|enter\|…>` | Press a hardware/navigation key |
2293
+ | `aua open-and-analyze <uri> [--app pkg]` | Open a deeplink (pin package to skip "Open with…") |
2294
+ | `aua clipboard set\|get` / `paste` / `copy` | Clipboard helpers |
2295
+ | `aua location set LAT,LON` | Mock GPS |
2296
+ | `aua orientation set\|get` | Screen orientation |
2297
+ | `aua airplane on\|off\|toggle` | Radio control only; not proof of offline connectivity |
2298
+ | `aua network status\|offline\|restore` | Verified, saved, reversible network isolation |
2299
+ | `aua network profile list\|apply\|status\|restore` | Reversible Wi-Fi, cellular, slow, and lossy conditions |
2300
+ | `aua media add PATH` | Push media into the gallery |
2301
+ | `aua record start\|stop PATH` | Screen recording; stop waits for and validates the finalized MP4 |
2302
+ | `aua capture sheet PATH.png --since last-action` | Timestamped, evenly sampled transition contact sheet (no ffmpeg) |
2303
+ | `aua mic inject PCM-WAV [CONTROL-ID]` | Inject emulator PCM; optional selector plus `--control-mode hold\|toggle` |
2304
+ | `aua mic speak "TEXT" [CONTROL-ID]` | macOS `say` → temporary PCM WAV → the same hold/toggle path |
2305
+ | `aua clock set --ms <unix-ms>` | Set device clock (emulator / rooted) |
2306
+ | `aua screenshot [path]` | Save a raw screenshot (`--region` / `--scale`) |
2307
+ | `aua inspect <id>` | Dump full details for one element |
2308
+ | `aua app exists\|status <package>` | Read package presence/version from the leased target (`exists` exits 1 when absent) |
2309
+ | `aua app launch\|stop\|kill\|clear\|grant` | App control (`launch --clear` = clearState) |
2310
+ | `aua install <app.apk> [--launch]` | Install a build (skips the push when that version is already there); `--reinstall` keeps data, `--fresh --yes` wipes it |
2311
+ | `aua shell COMMAND…` | Bounded read-only diagnostic on the leased target; argv is remote-shell-quoted, unknown/mutating verbs are refused, and each output stream is capped at 256 KiB |
2312
+ | `aua db list\|schema\|query` | Structured private SQLite inspection for debuggable apps |
2313
+ | `aua db execute\|backup\|backups\|restore` | Confirmed, backed-up data mutation and rollback |
2314
+ | `aua virtual-target list\|status\|start\|provision\|create\|delete\|stop\|reclaim` | Manage the selected platform's optional virtual targets through the shared Engine contract |
2315
+ | `aua emulator list\|status\|start\|stop` | Boot/stop AVDs (`--headless`, `--audio`, `--parallel`, `--gpu`, `--mine`/`--owner`); `start --apk <app.apk> --launch` boots, installs, and opens in one call |
2316
+ | `aua emulator recommend-proxy\|ensure-proxy` | Suggest/create a small rootable Google APIs AVD |
2317
+ | `aua flags set\|apply` | Feature-flag writes with verify/restart |
2318
+ | `aua proxy start\|stop` / `aua mock …` | HTTPS mitm record/map/replay (`[proxy]` extra) |
2319
+ | `aua api check\|usage` | Backend OpenAPI changes vs. the client versions that call them (no device) |
2320
+ | `aua api run\|sample` | Send a backend the calls a client app makes, from a cartridge file (no device) |
2321
+ | `aua api session list\|export\|import\|delete` | Users `aua api run --session` keeps across runs, with their call logs; zip one to hand it over |
2322
+ | `aua api map [new\|freeze]` | Versioned per-release schemas and flows an agent writes from the client's code (no device) |
2323
+ | `aua capture …` | Session capture / export / explain |
2324
+ | `aua helper status\|enable\|remove` | Optional on-device helper APK — runs a long flow on the device (rootable targets, off by default) |
2325
+ | `aua session start --goal GOAL --contract FILE --apk APP --helper` | One-call DeepSeek helper session: prepare, run ordered checks, apply proof, clean up, return pass/fail; never falls back |
2326
+ | `aua helper model-run GOAL --checks FILE` | Experimental DeepSeek V4.1 Flash loop inside the helper; one host handoff, deterministic checks, ephemeral runtime key |
2327
+ | `aua dashboard start|status|open|qr|stop|run` | Persistent browser grid, by default open on your network at `http://aua.local/`; narrow it with `--auth`, `--local`, or `--name ""`; QR for phones |
2328
+ | `aua logcat` / `aua suite` | Device-clock log windows / scripted suites |
2329
+ | `aua logcat prefs show\|set\|reset` | Per-app, persisted `app_logs` preferences — ignored or only-wanted tags, priority set, line and per-tag caps |
2330
+ | `aua dev` / `aua a11y` | Dev options helpers / a11y scroll |
2331
+ | `aua map` | Show the active-context map (`--all-contexts`, `--audit`, or `--find "<goal>"`) |
2332
+ | `aua goto "<goal>"` | Drive the remembered route to a known screen — taps + verifies each hop (`--plan` previews, `--max-steps N`) |
2333
+ | `aua flow run\|save\|list\|…` | Maestro-style YAML journeys with rich assertions, named screenshots, artifact/JUnit bundles, and reversible network steps |
2334
+ | `aua navigate "<goal>"` | Opt-in planner drive (needs `planner.enabled`) |
2335
+ | `aua policy status` | Host-only readiness for optional guarded FunctionGemma advice |
2336
+ | `aua memory show\|path\|update\|forget` | Manage the per-app learned layout (`memory.backend: sqlite` optional) |
2337
+ | `aua knowledge list\|show\|add\|stale` | Manage scoped, provenance-bearing learned facts |
2338
+ | `aua reconcile plan\|submit\|status\|apply\|rollback` | Research and transactionally correct a map |
2339
+ | `aua about` / `aua remember` / `aua orient` | App playbook + orientation blob |
2340
+ | `aua config init\|show\|path` | Manage configuration |
2341
+ | `aua daemon start\|status\|stop` | Manage the optional warm-state daemon |
2342
+ | `aua guide` | Print the canonical manual (`--emit-skill` / `--emit-codex-metadata`) |
2343
+ | `aua mcp` | Run the MCP server over stdio |
2344
+
2345
+ All action commands (`tap`, `long-press`, `input`, `clear`, `swipe`, `scroll-to`, `key`, …) **return the post-action screen inline by default** (an `observation` with fresh element IDs), so you rarely need a follow-up `analyze`. Pass **`--no-observe`** to skip it. Prefer **`aua --format tsv analyze`** when reading a screen; use global **`aua --with-image …`** only when you must see pixels.
2346
+
2347
+ ---
2348
+
2349
+ ## Troubleshooting
2350
+
2351
+ | Symptom | Fix |
2352
+ |---|---|
2353
+ | `aua doctor` shows **adb: FAIL / not found on PATH** | Install platform-tools and add them to `PATH` — see [Installing adb](#installing-adb-platform-tools). |
2354
+ | `no device found` (exit 3) | Start an emulator or attach a phone; confirm with `adb devices`. Or `aua emulator start --headless`. |
2355
+ | Device shows as **`unauthorized`** | Accept the "Allow USB debugging" prompt on the device. If it never appears: `adb kill-server && adb start-server`, then reconnect. |
2356
+ | Device shows as **`offline`** | Re-plug the cable / cold-boot the emulator; `adb reconnect`. |
2357
+ | `multiple devices attached` | Automatic leasing normally prevents this. If leasing is intentionally disabled, pass `--serial <id>` from `aua devices`. |
2358
+ | First command is slow / times out | `uiautomator2` is pushing its helper agent on first connect — retry once it settles, then use `aua daemon start` to keep the connection warm. |
2359
+ | `uiautomator2 is not installed` | Reinstall the package — `uiautomator2` is a base dependency, not an extra. |
2360
+ | `mic_grpc_unavailable` | Install the optional transport: `pip install 'android-ui-analyser[audio]'`. |
2361
+ | `mic_audio_disabled` | Restart only the selected emulator with `aua emulator start --audio`; AUA refuses AVDs launched with `-no-audio`. |
2362
+ | `mic_repeat_unsafe` | Emulator 36.4.10 already had its permitted attempt this boot. Restart only that emulator with audio enabled. |
2363
+ | `mic_recording_not_ready` | No current recording input was established before the deadline. No audio was injected; inspect the attached observation. |
2364
+ | `mic_delivery_uncertain` | Samples may already have arrived despite the emulator's `INTERNAL` close. Inspect `error.result.observation`; do not repeat the voice action. |
2365
+ | `mic_delivered_release_failed` | Audio arrived, but target-control cleanup failed. Do not repeat it; inspect the attached observation and control state. |
2366
+ | `mic_toggle_start_uncertain` | START may have landed; no audio or blind STOP was sent. Recording may be active—protect privacy and inspect the forced observation. |
2367
+ | `mic_toggle_stop_uncertain` | START was confirmed but STOP is unconfirmed/unsafe. Do not retry blindly; inspect the forced observation and control state. |
2368
+ | `mic_injection_timeout` / `mic_injection_failed` | Samples may already have arrived. Do not retry blindly; inspect the current UI first. |
2369
+ | `mic_emulator_unavailable` / emulator goes offline during injection | Do not blindly retry. Check `aua devices`; restart only that emulator with audio enabled if it exited. |
2370
+ | `analyze` returns few/no elements | The hierarchy is empty (Compose/Flutter/WebView/canvas). Force vision: `aua --format compact analyze --source vision --annotate`. |
2371
+ | Typing does nothing / is slow on Android 14+ | `aua input-and-analyze` prefers accessibility `set_text`, then clipboard paste (restores clipboard), then IME keys. Focus the field first. |
2372
+ | Headless emulator pegs CPU / fans | Old default was SwiftShader (CPU). Current Mac/Windows headless uses `-gpu host`. Stop orphans with `aua emulator stop --mine`. Headless also auto-stops after `--idle-stop` (default 900s) with no aua activity. |
2373
+ | `proxy` / empty HTTPS cassettes | Need `[proxy]` extra + **rootable** Google APIs AVD (`aua emulator ensure-proxy`). Play Store images refuse `adb root` → system CA install fails → TLS handshake fails. |
2374
+ | `sdkmanager` / `ensure-proxy` fails | Prefer `$ANDROID_HOME/cmdline-tools/latest/bin` over outdated Homebrew cmdline-tools. |
2375
+
2376
+ ---
2377
+
2378
+ ## Further reading
2379
+
2380
+ - [`docs/preparing-a-test.md`](docs/preparing-a-test.md) — `aua prepare`: agree what a test must prove with the agent that wrote the feature, then keep the scenario.
2381
+ - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — design decisions and the hierarchy-first thesis.
2382
+ - [`docs/NATIVE_ROADMAP.md`](docs/NATIVE_ROADMAP.md) — `aua-fast`, delta/msgpack, WS push, fanout, vision defaults.
2383
+ - [`docs/RESEARCH.md`](docs/RESEARCH.md) — landscape research behind the approach.
2384
+ - [`PRD.md`](PRD.md) — the full product requirements document.
2385
+ - [`SMOKE.md`](SMOKE.md) — manual smoke-test checklist against a live device.
2386
+ - [`.claude/skills/android-ui-analyser/SKILL.md`](.claude/skills/android-ui-analyser/SKILL.md) — the operating manual an AI agent loads (also via `aua guide`).
2387
+
2388
+ ---
2389
+
2390
+ ## Author
2391
+
2392
+ Created and maintained by **Eiliya** — design, architecture, and direction. Parts of the implementation were written with AI coding assistants (Claude Code, Cursor); those contributions are recorded as `Co-Authored-By` trailers in the commit history.
2393
+
2394
+ Issues and ideas: [The-Wordlab/Android-UI-Analyser](https://github.com/The-Wordlab/Android-UI-Analyser/issues).