> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sightmap.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Sightmap Device Commands: Driving iOS Apps in the Simulator

> Snapshot a native iOS app's accessibility tree against your corpus and tap, type, and scroll by identifier or component query in the local iOS Simulator.

`sightmap device` drives a native iOS app in the local iOS Simulator the way [`sightmap browser`](https://docs.sightmap.org/cli/browser) drives Chrome. It reads the app's accessibility tree, applies your `.sightmap/` corpus with the same matcher as `sightmap snapshot`, and acts on elements by accessibility identifier or [component query](https://docs.sightmap.org/cli/interaction.md#component-queries). Nothing leaves the Mac except the app's own traffic.

> [!NOTE]
>
> `sightmap device` needs an Apple Silicon Mac, macOS 15 or later, and Xcode 26 or later selected with `xcode-select` (the Command Line Tools alone are not enough). Run [`device doctor`](#device-doctor) first.

## Conventions

* Every command takes `--json` (machine-readable output) and `--sightmap-dir` (default `.sightmap`). There is no upward search for the corpus, so run commands from the project root.
* `device start` records the session in `.sightmap/.device-session` and writes one run log per run to `.sightmap/.device-runs/<run>.jsonl`. Add both to `.sightmap/.gitignore`.
* Errors print one line, then a `Next:` line with the step to take.
* Coordinates are screen **points**, not pixels: a 390×844 pt screen is 1170×2532 px in a screenshot.

### Targets

`click`, `fill`, `scroll --in`, and `scroll --until` take one target:

| Target | Example | Resolves to |
| - | - | - |
| Snapshot id | `12` | Element 12 of the latest snapshot |
| Identifier | `login-submit`, `product.12` | The one element whose accessibility identifier is exactly this. A dotted identifier works bare, also in `scroll --until` before it is on screen |
| Component query | `ProductRow[title^="Product 15"]` | A component filtered on extracted properties; `LoginForm SignInButton` and `ProductRow#2` work as in the browser |
| Selector | `button[id="login-submit"]`, `[text="Not Now"]#0` | A CSS selector over the normalized tree, for elements no component names |

A target that matches several elements is an error that lists the candidates; add a predicate or append `#N`.

### Views without routes

The spec requires a `route` on every view, and native screens have no URL, so native corpora use short placeholder routes such as `/login`. `sightmap device` ignores routes: a snapshot uses the view whose own components match the most elements, marked `(inferred)`, unless you pass `--view`. SEP-0024 proposes a route-less `screen:` selector for this case; it is not part of the spec yet.

### Selectors on iOS

Each element exposes a role from its accessibility type (`button`, `text`, `textfield`, `securetextfield`, `switch`, `tab`, `cell`, `image`, `other`, and so on), its `accessibilityIdentifier` as the element's **id**, and the attributes `text` (the label) and `value`.

**Select by id.** `#login-submit` or `[id="login-submit"]` is the form other tools that read the same app match too, such as a pipeline that records the app's views. `device` also exposes the identifier as the attributes `identifier` and `testid` (a React Native `testID` arrives as the identifier), but those names are its own: a definition written with them matches only in `device`.

Only accessible elements reach the iOS tree. An identifier on a plain wrapper view (a React Native `testID` on a non-accessible `View`, for example) never appears there, so `[id="login-form"] [id="login-submit"]` matches nothing. Write leaf selectors such as `[id="login-submit"]`.

Identifiers often contain dots, which `#` reads as a class: escape them and single-quote the selector so YAML keeps the backslashes, as in `'#product\.1'`. Unescaped, `#checkout.submit` means id `checkout` with class `submit` and matches nothing, since native elements have no classes. A leading digit takes a hex escape, its code point followed by a space: `1.circle` is `'#\31 \.circle'`. `[id="1.circle"]` selects the same element and reads more easily.

Role names (the tag: `navbar`, `tabbar`, `other`, `image`, …) may still change, to agree with other sources that read native trees. Prefer ids; use a role in a selector only to tell apart elements that share an id prefix.

```yaml .sightmap/views/login.yaml theme={null}
version: 1
views:
  - name: Login
    route: /login            # placeholder; sightmap device ignores it
    components:
      - name: EmailField
        selector: '[id="login-email"]'
      - name: SignInButton
        selector: '#login-submit'
```

#### Splitting a combined label

A tappable container such as a SwiftUI `NavigationLink` row is one element whose label is its texts joined with `", "`, so `dom.text` reads `Trail Runner, Acme, $89.99`, not three values. A `pattern` splits it:

```yaml .sightmap/views/products.yaml theme={null}
version: 1
views:
  - name: Products
    route: /products
    components:
      - name: ProductRow
        selector: '[id^="product."]'
        properties:
          - name: title
            extract: { from: dom.text, pattern: '^(.+?)(?:, [^,]+)?, \$[\d,]+(?:\.\d+)?$' }
          - name: brand
            extract: { from: dom.text, pattern: '^.+, ([^,]+), \$[\d,]+(?:\.\d+)?$' }
          - name: price
            extract: { from: dom.text, pattern: ', \$([\d,]+(?:\.\d+)?)$' }
```

The brand is optional, so `Trail Runner, $89.99` gives `title` and `price` and no `brand`, and a comma inside a title with a brand stays in `title`. The label carries no field boundaries, though, so no pattern can tell apart two cases that read the same: a title containing a comma with no brand (`Lamp, Large, $9.99` gives `title="Lamp"`, `brand="Large"`), and a brand containing `", "`. For an exact split, start the session with [`--probe`](#reading-inside-the-app), which reads each text from inside the app, or give each child its own identifier; treat a split label as a convenience for reading, not a value to assert on.

### Hooks that hold outside `device`

A definition you write against `device` can also be matched by another source: a capture pipeline that reads the app's view tree, or an SDK that records view type names. Neither reads the accessibility tree the way `device` does, so what `device` shows is not all that they can match.

| Hook | In `device` | In a source that does not read the accessibility tree |
| - | - | - |
| Id (`#x`, `[id="x"]`; the `accessibilityIdentifier`) | Shown on every element that reaches the tree | The hook most likely to be shared, if the source records `accessibilityIdentifier`. Check that it records yours (see below) |
| Role (`button`, `switch`, `heading`, `tab`) | From the element's accessibility type | Not recorded. The source may derive one from a class or type name, and it can differ from `device`'s |
| State (`(selected)`, `(disabled)`, a switch's checked value) | From accessibility traits and the control's value | Not recorded for SwiftUI controls. A UIKit control keeps its own state |
| `text` | The element's accessibility label | Missing when the source masks text, which captured sessions often do by default |
| Type name | Not shown. Planned: `[type="X"]` on the element itself (`switch[type="LabeledSwitch"]`), for apps built with an SDK that records type names. The form is a draft; don't write definitions by type yet. [`--probe`](#reading-inside-the-app) emits an experimental `view[type="X"]` node, which is not this form. | The same form, once the source records type names |

**Why they differ.** SwiftUI builds accessibility elements only while an assistive technology such as VoiceOver is running. `device start` turns app accessibility on in the simulator, so `device` sees them; code inside an app on a phone with VoiceOver off finds almost none.

**What to do.**

* Set `.accessibilityIdentifier` on each control the corpus names, and write its definition by id first. A definition that also matches elsewhere should not rest on a role, a state or `text` alone.
* Treat an identifier as portable only once the other source shows it. With VoiceOver off, a reader of accessibility data inside the app gets no identifier for a `TextField`, a segmented `Picker` or a `Stepper`. A source that records identifiers when the app is built may get them; check there rather than assume.

***

### `device doctor`

Checks macOS, Apple Silicon, `xcode-select`, the Xcode version, iOS Simulator runtimes and devices, and Swift, then builds the simulator helper and the [in-app probe](#reading-inside-the-app) if they are not built yet. With a session running, it also reports the session's network sources and probe. Exits `1` if any check fails.

| Flag | Default | Description |
| - | - | - |
| `--fix` | off | Run the unprivileged fixes (download an iOS runtime, create a simulator), then check again |

```bash theme={null}
sightmap device doctor
```

```text theme={null}
[ok  ] macos          macOS 26.0
[ok  ] apple-silicon  arm64
[ok  ] xcode-select   /Applications/Xcode.app/Contents/Developer
[ok  ] xcode-version  Xcode 26.0
[ok  ] ios-runtime    iOS 26.0
[ok  ] ios-device     8 iOS simulators; booted: iPhone 17 Pro
[ok  ] swift          Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
[ok  ] helper         /Users/you/Library/Caches/sightmap/device/helper/3f9c1a7d2b4e6f80/sightmap-device-helper
[ok  ] probe          /Users/you/Library/Caches/sightmap/device/probe/8c41d0e9a7b25f13/sightmap-probe.dylib

All checks passed.
```

***

### `device start`

Boots the simulator, enables app accessibility, installs and launches the app, starts the session daemon, and begins a run log. The first time a simulator gets app accessibility, `start` reboots it once. Without `--detach`, `start` holds the shell as a foreground daemon; agents and scripts should pass `--detach`.

On a running session, `start` reinstalls (with `--app`) and relaunches the same app; after a reinstall the network sources are chosen again for the new build. It refuses a different app or device; run `device stop` first. One simulator runs one session: a `start` from another sightmap directory on a simulator that already has one fails with `session_running` and names the directory to stop it from.

| Flag | Default | Description |
| - | - | - |
| `--app` | none | The `.app` bundle built for the simulator, to install |
| `--bundle-id` | none | An installed app's bundle id (instead of `--app`) |
| `--device` | a booted simulator, else the newest iPhone | Simulator name or UDID |
| `--label` | none | Label for the run log |
| `--console-limit` | `5000` | How many console entries the session keeps |
| `--network` | `auto` | Network source: `auto`, `har`, `rn-cdp`, `summary` or `off` (see [`device network`](#device-network)) |
| `--network-limit` | `1000` | How many network entries the session keeps |
| `--metro-port` | the app's `RCT_jsLocation`, else `8081` | Where the `rn-cdp` source looks for Metro |
| `--probe` | off | Load the in-app probe: one node per Text, and an experimental `view` node per SwiftUI view type (see [Reading inside the app](#reading-inside-the-app)) |
| `--probe-fields` | all, redacted | With `--probe`, `none` leaves app views' stored fields out of the tree |
| `--detach` | off | Run the daemon in the background and return once it is ready |

```bash theme={null}
sightmap device start --app build/SimSample.app --device "iPhone 17 Pro" --detach
```

```text theme={null}
✓ simulator session started in 9.4 s
  device:  iPhone 17 Pro, iOS 26.0 (5D3E1A2B-7C8F-4E9A-B0C1-D2E3F4A5B6C7)
  app:     installed /Users/you/app/build/SimSample.app and launched org.sightmap.SimSample
  daemon:  pid 48213; session file .sightmap/.device-session; log /Users/you/Library/Caches/sightmap/device/sessions/5D3E1A2B-7C8F-4E9A-B0C1-D2E3F4A5B6C7/daemon.log
  run:     20261029T171502Z-3fa1 (`sightmap device run tail --follow` to follow)
  next:    sightmap device snapshot
```

Apps must be built by Xcode (`xcodebuild` or the Xcode app) so they carry the simulated entitlements a simulator app needs.

***

### Reading inside the app

The accessibility tree is read from outside the app, and SwiftUI joins the texts inside a row, a `NavigationLink` or a `Button` into one element whose label separates them with ", ". `start --probe` also loads a small probe into the app, which reads SwiftUI's own view graph from inside it, and each snapshot merges two things from it onto the accessibility tree:

* a `view` node for each instance of one of your view types, with `type` set to its name and one attribute per stored field (`item.title`, `maker`, `item.price`);
* a `text` node for each Text in it, with `field` naming the stored field it shows, and for `Text(value, format:)` the unformatted `value` and a `format` such as `currency USD`.

```text theme={null}
4 button[id="catalog-row-1"] "Socks, Wool, Pair of 2, Acme, Inc., $9.99"
  5 view[type="CatalogRow"]
    6 text[field="item.title"] "Socks, Wool, Pair of 2"
    7 text[field="maker"] "Acme, Inc."
    8 text[field="item.price"][format="currency USD"] "9.99" value="9.99"
```

> [!WARNING]
>
> The `view[type="…"]` node is experimental, and its type names are not reliable. SwiftUI's view graph inlines your views and names them only sometimes, so a view can have a `view` node on one screen and none on the next, and a definition by type would match some screens and not others. `view` nodes are not the planned form for type names (`[type="X"]` on the element itself; see [Hooks that hold outside `device`](#hooks-that-hold-outside-device)), and the probe is expected to drop them when `device` builds its tree from the view graph. Don't write definitions by type yet. The `text` nodes and their `field`, `value` and `format` don't depend on type names.

A corpus then reads each field exactly through child components, commas and all:

```yaml theme={null}
- name: CatalogRow
  selector: '[id^="catalog-row-"]'
  properties:
    - { name: title, extract: { from: component, path: Title.text } }
    - { name: maker, extract: { from: component, path: Maker.text } }
    - { name: price, extract: { from: component, path: Price.value } }
  children:
    - { name: Title, selector: 'text[field="item.title"]', properties: [{ name: text, extract: { from: dom.text } }] }
    - { name: Maker, selector: 'text[field="maker"]', properties: [{ name: text, extract: { from: dom.text } }] }
    - { name: Price, selector: 'text[field="item.price"]', properties: [{ name: value, extract: { from: dom.attr, path: value } }] }
```

Without `--probe` the same corpus still names each row; the properties read from its Texts are absent. The Text nodes are `--probe` output and experimental.

The accessibility tree stays the source of truth for what is on screen and tappable: the probe only adds nodes under elements whose label already contains their text, never duplicates a text the tree reports separately, and adds nothing under a secure field. Its `text` nodes have real frames, so `click` can target them.

How it works and what it costs:

* `start --probe` compiles the probe from source embedded in `sightmap` with your Xcode (one `clang` call, cached under `~/Library/Caches/sightmap/device/probe`; `device doctor` builds it ahead of time; `SIGHTMAP_DEVICE_PROBE` names a dylib to use instead) and launches the app with `DYLD_INSERT_LIBRARIES` and `SWIFTUI_VIEW_DEBUG` set. No app code or build setting changes, and the app needs no `get-task-allow`. Every relaunch, restart and `start --app` loads it again.
* The probe answers on a Unix socket. Right after launch the session runs a first read in the background, since SwiftUI's first walk of its graph is slow; the first read of each new screen still takes a few seconds, and later reads of it a few hundred milliseconds. Only `snapshot` reads through the probe, plus `click`/`fill` when a target is not in the plain tree; the re-reads while a screen settles reuse the last read while the layout is unchanged, and hosting views off screen are skipped.
* If the app never loads the probe (an app signed with the hardened runtime, or one that clears `DYLD_*` variables), `start` says why, snapshots carry a `[Probe]` note and are the plain accessibility tree, and `status` and `doctor` report it.
* Field values go through the same redaction as [network entries](#redaction): a field whose name contains `token`, `password`, `secret` or `key` reads `<redacted>`, as do a URL's credential query parameters. `--probe-fields none` leaves fields out entirely. The run log never records a probe node's text.

The probe reads SwiftUI's view debug data, which is undocumented and can change with any Xcode release; when it does, snapshots fall back to the plain tree. The probe reads it with Swift's `Mirror` rather than SwiftUI's own JSON encoder, which traps on some screens (a SwiftData `@Query` inside a `NavigationStack` or `TabView`) and takes the app down. If a read still ends the app, the session reports which hosting view it was reading, leaves that kind of view out of later reads, and you relaunch the app. UIKit-only screens gain nothing from it yet.

***

### `device status`, `device stop`, `device launch`, `device relaunch`

`status` reports the session's device, app, helper, console buffer, network sources, in-app probe (with `--probe`), and current run; it exits `1` when no session is running. If the app has exited or crashed, `status` says so, and `snapshot` and the actions fail with `app_not_running` instead of reading the home screen; `relaunch` brings it back. `stop` stops the daemon and the app and switches HAR capture back off; `--shutdown` also shuts the simulator down. `launch` brings the app to the foreground; `relaunch` restarts it and re-enables accessibility first.

```bash theme={null}
sightmap device status
```

```text theme={null}
✓ session running (daemon pid 48213, since 2026-10-29T17:15:02Z)
  device:  iPhone 17 Pro, iOS 26.0 (5D3E1A2B-7C8F-4E9A-B0C1-D2E3F4A5B6C7)
  app:     org.sightmap.SimSample (pid 48290)  /Users/you/app/build/SimSample.app
  helper:  running
  console: 112 entries
  network: 3 entries (--network auto)
    har      active      capturing [3 entries]
    rn-cdp   off         not needed: HAR logs a React Native app's JS fetch/XHR traffic too
    summary  active      backstop: lists requests HAR did not log (such as ones made before capture began), with method, host, status and timing
  session: /Users/you/app/.sightmap/.device-session
  run:     20261029T171502Z-3fa1 (6 entries)
```

***

### `device snapshot`

Prints the annotated accessibility tree in the shape of [`sightmap snapshot`](https://docs.sightmap.org/cli/capture): the view, a guide of matched components, the tree with per-snapshot ids, conflicts, and visible-only coverage. Matched elements show `[Component prop="value"]`; unmatched ones show `role[id="…"] "label"`.

| Flag | Default | Description |
| - | - | - |
| `--view` | inferred | Apply this view's components instead of inferring the view |
| `--include-offscreen` | off | List off-screen elements too |
| `--out` | none | Also write the snapshot to this file, plus a `.tree.json` companion that `sightmap explain --snap` and `sightmap coverage` read |
| `--tree-out` | none | Write the tree JSON here |

```bash theme={null}
sightmap device snapshot
```

```text theme={null}
[View: Login] (inferred)

[Guide]
EmailField     1
PasswordField  1
SignInButton   1

--- component tree ---

1 application "Sightmap Sim Sample"
  2 text[id="login-title"] "Sightmap Sim Sample"
  3 [EmailField]
  4 [PasswordField]
  5 [SignInButton "Sign In"]

[Coverage] (visible only)
3 interactive · 3 direct T1 (100%) · 0 scoped T2 (0%) · 0 orphaned T3 ✓
```

Extra sections appear when they apply:

| Section | Meaning |
| - | - |
| `[Overlay]` | A system sheet from another process, such as iOS's "Save Password?", is in front of the app, and the tree is that sheet. Dismiss it with one of its buttons: `click '[text="Not Now"]'`. |
| `[Mostly empty]` | The app exposes no interactive elements, or only a small floating element, with the likely causes in order. |
| `[LogBox]` | A React Native LogBox toast covers the bottom of the screen; the section gives the `tap-xy` that hits its ✕. |
| `[Memory]` | `memory:` entries for the view and its matched components. |
| `[Conflicts]` | Elements matched by more than one component. |
| `[Off-screen]` | How many off-screen nodes were left out. Targets still resolve them. |

The corpus reloads whenever a YAML file under `--sightmap-dir` changes, so the next snapshot reflects your edits.

***

### `device click`

Resolves the target in a fresh read of the screen, checks that its center is on screen, not under the status bar or a navigation bar or outside the visible part of its list, not under a tab bar, toolbar, navigation bar, keyboard, LogBox toast, any control drawn over it (such as a custom tab bar of plain buttons over a list), or a floating dev-menu button, and that it is enabled, then taps its center. A switch is pressed for 0.15 s instead, at the trailing end of its row when it spans one (a SwiftUI `Toggle` in a `Form`): its label ignores taps, and an iOS 26 switch ignores most instant taps. While the target is missing or the screen is still moving, it re-reads for up to 3 s first. It taps only once two reads in a row agree on where the target and the screen are, and the screen has held still for 0.75 s. Two reads alone are not enough: the accessibility tree reports where an animation ends rather than where it is drawn, so a screen presented a moment ago reads the same throughout its slide, and iOS drops touches until a presentation finishes. A tap on a screen that was already still costs no extra wait. A screen still moving, or changed too recently, when the wait runs out is refused with an `unstable` error instead of being tapped mid-transition.

| Flag | Default | Description |
| - | - | - |
| `--settle` | `3s` | How long to wait for a missing target or a moving screen, e.g. `5s` for a Debug React Native build that redraws slowly after a navigation |

```bash theme={null}
sightmap device click SignInButton
```

```text theme={null}
✓ clicked 6 [SignInButton "Sign In"] at (196, 412)
```

A refused click names the reason and the fix:

```text theme={null}
error: 42 [ProductRow title="Product 40"] is off-screen (center 196,1210 on a 402x874 screen); refusing to tap
Next: run `sightmap device scroll down --until "ProductRow[title=\"Product 40\"]"`, then retry
```

***

### `device fill`

Taps the target, types the text, and errors if the field does not show it. Text is appended unless you pass `--clear`. `fill TARGET "" --clear` empties a field; a field that then shows only its placeholder reports an empty value.

| Flag | Default | Description |
| - | - | - |
| `--clear` | off | Empty the field first |
| `--settle` | `3s` | As for `click` |

```bash theme={null}
sightmap device fill login-email "a@example.com" --clear
```

```text theme={null}
✓ filled 4 [EmailField "Email"] → value "a@example.com"
```

***

### `device scroll`

Scrolls one page in a direction (`up`, `down`, `left`, `right`), or until a target is tappable. Like `click`, it first waits for a screen that just changed to hold still for 0.75 s, so the swipe is not dropped mid-transition. Long SwiftUI and UIKit lists only expose rows near the screen, so a row further down is not found until you scroll to it. `--until` scrolls slowly enough not to fling past the target and refreshes the snapshot ids when it stops.

| Flag | Default | Description |
| - | - | - |
| `--in` | the screen | Scroll inside this element |
| `--until` | none | Scroll until this target is tappable |
| `--max` | `20` | Give up after this many swipes |

```bash theme={null}
sightmap device scroll down --until 'ProductRow[title="Product 40"]'
```

```text theme={null}
✓ 42 [ProductRow title="Product 40"] is on screen after 5 scroll(s) down; snapshot ids refreshed, act on it by id 42 or by the same target
```

***

### Raw input

| Command | Description |
| - | - |
| `device tap-xy X Y` | Tap a screen point; points off the screen are refused |
| `device swipe X1 Y1 X2 Y2 [--duration S]` | Swipe between two screen points |
| `device type TEXT` | Type into the focused field |
| `device key NAME` | Press `return`, `delete`, `tab`, `escape`, `space`, or an arrow key |
| `device button NAME` | Press `home`, `lock`, `siri`, `side`, `apple_pay`, `volume_up`, or `volume_down` |
| `device openurl URL` | Open a URL or deep link |
| `device screenshot --out F.png` | Write a PNG of the screen |

***

### `device console`

`console list` reads the app's own `os_log`/`Logger` output and its stdout and stderr, captured by the session daemon. `console get N` prints one entry in full.

| Flag | Default | Description |
| - | - | - |
| `--limit` | `50` | The most recent N entries (`0`: all) |
| `--grep` | none | Case-insensitive substring of the message or subsystem |
| `--level` | all | Comma-separated levels: `debug`, `info`, `default`, `error`, `fault`, `stdout`, `stderr` |
| `--all` | off | Include Apple framework entries, hidden by default as noise |
| `--since` | none | Only entries after this index, oldest first; `--limit` then takes the first N, and the result's `last` is the index to page on from |
| `--follow` | off | Keep printing new entries until interrupted (with `--json`, one entry per line) |

The session keeps the latest 5,000 entries (`start --console-limit` changes that). When a list would have reached further back, it says so: `(N earlier entries dropped; …)`, or `dropped` in `--json`.

```bash theme={null}
sightmap device console list --grep "signed in"
```

```text theme={null}
#12 info    dev.sightmap.SimSample:app  signed in as agent@example.com
#13 stdout   signed in as agent@example.com
```

React Native `console.log` output arrives as `info` entries from the `com.facebook.react.log` subsystem.

***

### `device network`

`network list` lists the requests the app made, oldest first, each led by the [`requests:`](https://docs.sightmap.org/spec/requests) definitions in your corpus that match it, as [`browser network list`](https://docs.sightmap.org/cli/devtools) does, and trailed by the properties those definitions extract. `network get N` prints one entry with its headers and bodies.

```bash theme={null}
sightmap device network list
```

```text theme={null}
#0 [CreateOrder]          POST http://127.0.0.1:18765/anything/sightmap/order-1 → 201 (56 ms, har) {order=1, echoed=1}
#1 [--]                   GET https://api.example.com/v1/me → 200 (88 ms, har)
```

| Flag | Default | Description |
| - | - | - |
| `--limit` | `50` | The most recent N entries (`0`: all) |
| `--grep` | none | Case-insensitive substring of the method, URL, status, source or matched request name |
| `--source` | all | Only entries from `har`, `rn-cdp` or `summary` |
| `--since` | none | Only entries after this index, oldest first, as in `console list` |
| `--follow` | off | Keep printing new entries until interrupted (with `--json`, one entry per line) |
| `--unredacted` | off | Show credentials (see *Redaction*) |
| `--request-file`, `--response-file` | none | `network get`: write the stored request or response body to a file, redacted unless `--unredacted` |

#### Sources

The session reads the app's traffic from the first of these sources that works; each entry's `source` says which one recorded it.

| Source | What it gives | Needs |
| - | - | - |
| `har` | Method, full URL with query, status, timing, request and response headers, and bodies up to 1 MiB, for everything that goes through `URLSession`/CFNetwork (including a React Native app's `fetch`) | The app's executable signed with the `get-task-allow` entitlement |
| `rn-cdp` | Method, full URL, the headers JavaScript set, request and response bodies, for a React Native Debug build's JS `fetch`/XHR only | Metro running, and a Debug build that reports to it |
| `summary` | Status, timing, byte counts and protocol, plus the method and host (`http://host`, no path). It never matches a `requests:` route | Nothing |

`--network auto` (the default) arms `har` before the app launches when the app has `get-task-allow`, and keeps `summary` as a backstop for requests HAR did not log. Without the entitlement it uses `summary` and looks for Metro every 2 s; once it attaches to the app's Metro page, `rn-cdp` replaces `summary` (which would list the same JS requests with less detail) until the connection drops, and it reattaches after a relaunch. `--network har`, `rn-cdp` or `summary` uses that source alone; `off` captures nothing. `device status` and `device doctor` report which source is active and why the others are not.

**`get-task-allow`.** CFNetwork logs HAR entries only for a process with this entitlement. A Debug build that Xcode signs for development carries it. A simulator build signed ad hoc (`CODE_SIGN_IDENTITY = "-"`) does not unless you add it: point `CODE_SIGN_ENTITLEMENTS` at a file containing

```xml theme={null}
<key>get-task-allow</key><true/>
```

Release and App Store builds never have it, so they fall back to `summary`. `start` reads the entitlement from the executable and, when it is missing, `status` says so and why.

**How HAR capture works.** `har` switches on CFNetwork's own HAR logging inside the simulator, the mechanism Instruments' HTTP Traffic instrument uses, with private, undocumented CFNetwork preferences (`har-capture-global`, `har-body-size-limit`) and the `com.apple.CFNetwork` `HAR` log category; then it reads the simulator's unified log. Requests already under way when capture starts are missed. `stop` deletes the preferences and resets the log category. The capture is leased for 10 minutes at a time and renewed while the session runs, so a session that dies leaves it on for at most 10 minutes. A future iOS release may change these switches.

Only `URLSession`/CFNetwork traffic is visible to `har` and `summary`; raw sockets, SwiftNIO and other custom stacks are not. `rn-cdp` misses image loads and native modules' requests, and requests made before it attached.

#### Redaction

Output hides credentials by default: the values of the `Authorization`, `Cookie`, `Set-Cookie` and `Proxy-Authorization` headers, and of any header, query parameter, form field or JSON key whose name contains `token`, `password`, `secret` or `key` (case-insensitive) become `<redacted>`. Properties are extracted from the redacted entry, so a property that reads a credential shows `<redacted>` too. `--unredacted` shows everything.

The session keeps the latest 1,000 entries (`start --network-limit`) in memory, with each body capped at 256 KiB, and never writes them to disk: network entries and bodies stay out of the run log.

***

### `device run`

Every action appends one JSON line to `.sightmap/.device-runs/<run>.jsonl` with its timestamp, sequence number, arguments, target element, view, and outcome. Another agent or tool can follow a session with `run tail --follow`, or poll with `--since`, and line up its own data with the steps by timestamp. `launch` and `relaunch` are logged as such, so a restart is told apart from a first launch.

| Command | Description |
| - | - |
| `device run new [--label L]` | Start a new run |
| `device run current` | Print the current run's id and path |
| `device run note TEXT [--kind K]` | Record an annotation in the run, e.g. `--kind session-start`, so a tool layered on top can mark its own events among the steps |
| `device run tail [--follow] [--since SEQ] [--run ID]` | Print run entries; `--follow` keeps printing new ones |

***

## How the simulator helper is distributed

The simulator is driven by a small Swift helper built on Meta's FBSimulatorControl, using the prebuilt xcframeworks from the idb v1.7.7 release (arm64 only). It reads the accessibility tree and sends touch, key, and button input.

The helper's sources are embedded in the `sightmap` binary. On first use (`device doctor` or `device start`), `sightmap` builds them with your local Xcode toolchain; Swift Package Manager downloads idb's frameworks (about 10 MB) during that build. Nothing else needs installing: no Homebrew, no `idb` or `idb_companion`. The build takes a minute or two and is cached under `~/Library/Caches/sightmap/device` (set `SIGHTMAP_DEVICE_CACHE` to move it). It rebuilds only when the embedded sources change. To use a helper you built yourself, set `SIGHTMAP_DEVICE_HELPER` to its path.

Sightmap builds the helper locally instead of shipping a prebuilt, signed binary for two reasons:

* The helper links Apple's private CoreSimulator and accessibility frameworks through FBSimulatorControl. Those frameworks track the installed Xcode, so a helper built against your Xcode matches it, while a prebuilt binary could break on the next Xcode release.
* `go install`, the npm package, and the release binaries stay identical, with no per-platform codesigning or notarization pipeline for a separate helper.

A new Xcode release can still need a sightmap update; `device doctor` says so when the helper fails to build.

## Limits

* Simulator only, on Apple Silicon. Physical devices are not supported.
* No hover or file upload. For another screen size, start on a different `--device`.
* `click` confirms the tap was delivered, not that the app handled it. On iOS 26, a screen with a hidden search field and search scopes can have an invisible strip up to \~35 pt below the navigation bar that swallows touches (a real finger's too), with nothing in the accessibility tree to show it. Check the result with `snapshot` and, if nothing changed, use `tap-xy` lower in the target.
* `--probe` reads SwiftUI views only, from Apple's undocumented view debug data.
* Network capture covers `URLSession`/CFNetwork traffic (and, for React Native Debug builds, JS traffic through Metro); full detail needs the `get-task-allow` entitlement.

The `sightmap-device` agent skill covers the full agent workflow, including React Native specifics. Install it with [`sightmap skills install`](https://docs.sightmap.org/cli/integrate#sightmap-skills-install).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.