# Pocketwatch **Pocketwatch is an AI beta tester for real iPhone apps. Give it a user journey; it changes device conditions, attempts the journey through iPhone Mirroring, captures evidence, and restores the phone when the run ends.** > The interesting question is not whether software can tap an iPhone. It is whether you can > hand a phone task off entirely — see the plan, approve the consequential parts, and get > back a result you can actually check. ## Current direction: AI Beta Tester The beta-testing workflow is the product direction. The Settings perturbations and automatic restore checkpoint are implemented, but the visual layout judge and batched test-plan approval are not yet complete. The older Phone Health Check remains the verified fallback demo while the new workflow is validated on hardware. See [docs/beta-tester-workflow.md](docs/beta-tester-workflow.md) for the build status and target-app criteria. ## Why this needs an iPhone Real rendering at accessibility text sizes, permission prompts, background/resume behavior, network transitions, and interaction latency only exist faithfully on a physical phone. The verified fallback workflow also reads iOS Storage, Battery, and Location permissions, which have no equivalent Mac app or public API. The full scoring of six candidate workflows, including why the flashier "Travel Day Operator" was **deferred rather than chosen**, is in [docs/workflow-selection.md](docs/workflow-selection.md). ## Demo ``` ✓ Read iPhone storage usage The iPhone Storage screen shows a list of apps with sizes: iPhone Storage | Offload Unused Apps ✓ Identify the safest space to reclaim Offload Unused Apps appears under Recommendations: Recommendations | Offload Unused Apps ✓ Confirm findings before reporting The iPhone Storage screen shows a list of apps with sizes: iPhone Storage | Offload Unused Apps No changes were made to your phone. ``` Every line above cites text Pocketwatch actually saw on screen. A milestone that cannot produce evidence is marked failed, not complete. ## Architecture ``` Dashboard (Next.js) ──SSE── RunEngine ──gate── PhoneController ──MCP── device bridge │ │ │ plan → observe → decide ├─ device adapter ScreenCaptureKit → GATE → execute └─ mock adapter + CGEvent → verify → recover │ │ iPhone Mirroring models · policy · skills ``` **The one invariant: every action that can touch the phone passes through the policy gate first.** There is no second path. Full detail in [docs/architecture.md](docs/architecture.md). ## Requirements - macOS 15 (Sequoia) or later — this build is verified on macOS 26.5 - An iPhone paired to the Mac, supporting iPhone Mirroring (unavailable in some regions) - Node.js 20+ and pnpm - Optional: an Anthropic API key. **Pocketwatch runs without one**, using a deterministic offline planner. ## Install ```bash git clone pocketwatch && cd pocketwatch pnpm install pnpm bridge:install # the device control layer; choose "5) Skip" if prompted pnpm doctor # tells you exactly what is still missing ``` ## Permissions macOS must trust the process that launches Pocketwatch — your **terminal**, not Pocketwatch itself: 1. System Settings → Privacy & Security → **Screen Recording** → enable your terminal 2. System Settings → Privacy & Security → **Accessibility** → enable your terminal 3. **Quit and reopen the terminal** — macOS does not apply these to a running process The device bridge is fail-closed: it hides every mutating tool until you allow it. Let Pocketwatch write a recommended config: ```bash pnpm demo:check --write-permissions ``` ## Model configuration ```bash export ANTHROPIC_API_KEY=sk-ant-... # optional export PLANNER_MODEL=claude-opus-5 # planning and summarizing export FAST_MODEL=claude-opus-5 # per-step action choice and verification export VISION_MODEL=claude-opus-5 # icons, seat maps, ambiguous pricing ``` Without a key, Pocketwatch uses a rule-based planner that handles the shipped workflows and **asks for a handoff rather than guessing**. The dashboard always shows which mode you are in. ## Running ```bash pnpm doctor # check setup, with a remedy per failure pnpm phone:smoke # connect, see, act, verify, stop — the controller gate pnpm dashboard # http://localhost:4319 pnpm demo:check # validate everything the demo depends on pnpm demo:reset # clear run data, return the phone to Home pnpm test # 100 tests, ~8s ``` ### Verification status The Settings storage workflow is **verified end to end on a physical iPhone** (iOS 26). Skills carry a `lastVerified` date; an explicit `null` means written but never confirmed on hardware. `tsx scripts/dev/trace-skill.ts ` runs one skill live, step by step, and is the tool for closing that gap. ### The verified fallback demo Open the dashboard and run: > "Find a safe way to free space and improve privacy on my iPhone. Do not delete photos, > messages, or accounts. Show me what you recommend and ask before every change." The full script is in [docs/DEMO.md](docs/DEMO.md). ### The fallback demo — no iPhone required Tick **Demo mode** in the dashboard, or: ```bash pnpm run:task --mock "Find a safe way to free space. Do not delete anything." ``` This runs the entire pipeline — planner, policy, skills, verification, recovery — against recorded screen graphs through the same `PhoneController` interface. It is not a stub; it is what the integration tests exercise. ## Safety model | Level | Examples | Behavior | |---|---|---| | `read_only` | Opening an app, reading storage, inspecting permissions | Proceeds | | `reversible` | Navigating, opening a settings screen | Proceeds, logged | | `external_side_effect` | Offloading an app, creating an alarm, checking in | **Approval card** | | `sensitive` | Money, Wallet, health data, permissions, posting | **Explicit per-action approval** | | `prohibited` | Confirming a purchase, typing a password, deleting an account, disabling security | **Never executed** | Three things make this more than a prompt: 1. **The policy engine is deterministic code** that runs after the model proposes and before the controller executes. A model that proposes "Confirm Purchase" is blocked. 2. **Screen context escalates risk.** Tapping "Continue" is reversible on a Settings page and prohibited on a checkout page. 3. **Your own words are enforced.** "Do not spend money" blocks a "Buy upgrade" tap on a priced screen — verified by test. Blocked by default: banking, brokerage, payments, crypto, password managers, authenticators, and health apps. Wallet is allowed only for a named boarding-pass skill. Stop with the **Stop** button, the **Escape** key, `Ctrl-C`, or by closing iPhone Mirroring. See [docs/privacy-model.md](docs/privacy-model.md). ## Limitations Stated plainly, because a polished handoff beats a failed autonomous action: - The iPhone must stay **locked** and near the Mac. Unlocking ends the session. - Pocketwatch **takes foreground focus** to type, and may switch macOS Spaces. Put the mirroring window in its own Space. - **Face ID, camera, and microphone** cannot be driven through mirroring — Pocketwatch requests a handoff. - **Keyboard shortcuts with modifiers do not reach iOS apps.** Platform limitation. - **iOS autocorrect applies** to typed text. - Some apps mark content protected and appear **blank** to screen capture. - Mirroring sessions drop. Pocketwatch surfaces this as a handoff rather than failing silently. - iPhone Mirroring is **unavailable in some regions**. - The offline planner recognizes the shipped workflows; novel objectives need an API key. - `skills/travel/` is **deliberately empty** — see the workflow doc for why. - A narrow mirroring window truncates OCR ("Personal Hotspot" reads as "Personal Ho"). Enlarge the window before a demo; skills use short labels for this reason. - Which storage Recommendations iOS offers is device-specific, so the automatic offload action is optional and is skipped when the phone does not offer it. Pocketwatch does not have unrestricted iPhone access. It has exactly the tools the device bridge was configured to expose, minus what the policy engine blocks. ## License Apache-2.0. ## Troubleshooting [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) — the most common issue by far is granting Screen Recording and Accessibility but not restarting the terminal.