Integration guide

Use Ansight with Cursor, Claude Code, Codex or any coding agent to verify iOS and Android changes

No plugin or MCP server required. If your agent can run a shell command, it can drive Ansight. Ansight is a command-line tool: your agent runs ansight commands to launch a mobile app, tap and swipe, read the screen, logs and performance data, and leave a captured session you review afterwards. Cursor, Claude Code and Codex differ only in which file holds the instruction that tells them to do it.

Last updated

Quick start

Four steps from install to a reviewable session.

  1. 01

    Install the CLI

    Run the Ansight installer for your machine, then run ansight doctor to check platform tools. This is the only required install.

  2. 02

    Add the SDK (recommended)

    Install the Ansight SDK for your platform in a development build for the deepest view of the app. Skip it to start with the CLI alone.

  3. 03

    Paste the instruction snippet

    Put the snippet in a Cursor rules file, a CLAUDE.md block or AGENTS.md for Codex, so the agent verifies mobile changes with the Ansight CLI.

  4. 04

    Ask the agent to check a change

    The agent launches the app, drives the changed flow and leaves a session. Review it with ansight session serve.

01 What it does

What can a coding agent do with Ansight?

Ansight lets a coding agent build a mobile app, launch it on a simulator, emulator or device, tap and swipe through the changed flow, read what the app shows and logs, and leave a captured session for you to review. All of it happens through ansight CLI commands, so any agent with a terminal can do it.

What the agent can read depends on a single choice you make once. Run the CLI alone and Ansight watches the app from the outside, a mode its docs call external capture. Put the SDK in a development build and it can also read from inside the app. Either way the agent types the same commands; the table shows where the two diverge.

What the agent does With the CLI alone With the SDK added
Build, install, launch The agent builds with your normal toolchain. device install and device launch put the build on a target. Same. An SDK build also connects to the host by itself.
Tap, swipe, type, wait, assert Yes, through platform accessibility on simulators and emulators. Yes, plus tools the app chooses to expose.
Read the UI tree The platform accessibility tree. The in-app visual tree, with framework detail.
Screenshots and replay Yes. Yes, aligned with touches and screen views.
Logs Native system logs (Apple unified logs, Logcat). App logs from inside the app, plus explicit client log events.
Network Not captured. Sanitized HTTP request and response evidence.
Touches Sent by the agent, not recorded. Recorded as evidence.
Memory and FPS Process memory. Android emulator frame stats when supported. iOS simulator FPS is unavailable. Memory and FPS telemetry samples.
App state Sandbox files on simulators and emulators. Preferences, databases, files and custom state through guarded tools, plus crash evidence.
Reviewable session Yes, opened with ansight session serve. Yes, with the richer timeline.

Highlighted cells are depth that needs the SDK. Exact evidence depends on platform, capture mode and enabled SDK features; see Capture Modes. On a physical device, CLI-only capture needs Appium for an iPhone or ADB for an Android phone.

Ansight and MCP

Ansight is CLI-based. The host accepts commands through the CLI, not an MCP listener, and there is no Ansight MCP configuration to write. If your agent setup is built around MCP, Ansight still works wherever that agent has terminal access: it runs the same ansight commands as any other agent.

02 Prerequisites

What do you need installed?

The CLI is required and the SDK is recommended. Nothing else is, and local use needs no account.

Required

The Ansight CLI

Install it on the machine where your agent runs, then check the platform tools it needs.

macOS or Linux

sh
curl -fsSL https://www.ansight.ai/install.sh | bash

Windows PowerShell

ps
irm https://www.ansight.ai/install.ps1 | iex

Check it

sh
ansight --version
ansight doctor

Recommended

The SDK for your platform

It works with the CLI alone; add the SDK for the best and deepest understanding of what happens in your app. It adds the in-app UI tree, app state, logs from inside the app, network requests, recorded touches, memory and FPS telemetry, and crash evidence.

Install it in development or QA builds only. Your agent can do the setup: paste this prompt with the app repository open.

prompt
Use https://www.ansight.ai/skills/ansight-install.md to set up Ansight in this project and verify a connected development build.

03 Command loop

How does any agent use the CLI? Launch, interact, inspect, review.

These four stages are the whole integration. Every command takes --json for structured output, and --headless keeps simulator and emulator windows closed. Commands that need the SDK are marked.

01

Launch

Start the host once. Install and launch the build on a target. An SDK build connects to the host by itself. A CLI-only app is registered with app watch add, which records it without any app changes. The command prints a session ID the later stages use.

sh
# start the host once and leave it running in its own terminal
ansight host run
ansight device list --json
ansight device install ios <simulator-id> ./build/App.app
ansight device launch ios <simulator-id> com.example.shop
# CLI-only apps: register the app once so it is recorded
ansight app watch add com.example.shop
ansight session list --connected --json
02

Interact

Read a snapshot before every decision, then act on an automation ID or exact text. A selector that matches zero or several elements fails instead of guessing, so the agent has to look again. Selectors here are examples; use ones from the app's current screen.

sh
ansight ui snapshot --session <session-id> --json
ansight ui find --session <session-id> --text Work --role button --json
ansight ui tap --session <session-id> --automation-id address-row-work
ansight ui type --session <session-id> --automation-id search-field --value Kalymnos
ansight ui swipe --session <session-id> --direction up
ansight ui wait --session <session-id> --automation-id confirmation-banner --condition visible
ansight ui assert --session <session-id> --automation-id confirmation-banner --expected-text Saved
03

Inspect

Read the evidence behind what the screen showed. Logs, metrics and images work with the CLI alone. SDK Network, in-app trees, recorded touches and app tools need the SDK in the build.

sh
ansight session logs <session-id> --json
ansight session metrics <session-id> --json
ansight session images <session-id> --json
# SDK builds only
ansight session network <session-id> --failed --json
ansight session trees <session-id> --json
ansight session touches <session-id> --json
ansight app tools <session-id> --detail summary --json
04

Review

There is no record command. A session is captured while the app is connected, whether an agent or a person is driving it. The agent hands you the ID, and you open the session in the local player instead of repeating the steps.

sh
ansight session show <session-id> --json
ansight session serve <session-id> --open

Syntax follows the CLI command reference. Run ansight help or ansight <command> --help for the version you installed.

04 Agent setup

Where does each agent read its instructions?

There is no config to install. Each agent needs one block of instructions in the file it already reads, and the block is the same for all of them.

The instruction block, for any agent

md
## Verify mobile changes with Ansight

When a change touches the iOS or Android app, check it in the running app with the Ansight CLI before you report it as done. Ansight is a command-line tool; run it from the terminal.

1. Run `ansight host status --json`. If no host is running, start one with `ansight host run` in a separate terminal and leave it running.
2. Build the app, install it on a simulator, emulator or connected device, and launch it (`ansight device list --json`, `ansight device install`, `ansight device launch`).
3. Get the session ID with `ansight session list --connected --json`. If the app does not have the Ansight SDK, register it once with `ansight app watch add <app-id>` first.
4. Drive the changed flow with `ansight ui snapshot`, `ui find`, `ui tap`, `ui type`, `ui swipe`, `ui wait` and `ui assert`, each with `--session <session-id> --json`. Read a fresh snapshot before choosing a target and prefer automation IDs over coordinates.
5. Read the evidence for that flow: `ansight session logs <session-id> --json` and `ansight session metrics <session-id> --json`.
6. Finish with the session ID, what you verified and what you could not check. Do not report success from a screenshot alone. Tell me to review it with `ansight session serve <session-id> --open`.

If this project has the Ansight SDK installed, also use `ansight session network <session-id> --failed --json` for failed requests, `ansight session trees <session-id> --json` and `ansight app tools <session-id> --detail summary --json` for in-app UI and state, and compare memory and FPS in `ansight session metrics`.

Only run Ansight against development or QA builds. Run `ansight <command> --help` if a flag is unclear.

The last paragraph before the closing line is the SDK variant: it points the agent at the deeper commands when the project has the SDK installed. Leave it in either way, because the agent only uses it when it applies.

  • Cursor

    A rules file

    Save the block as .cursor/rules/ansight.mdc. Cursor project rules use the .mdc extension and a short frontmatter header. The copy button below includes that header.

    mdc
    ---
    description: Verify iOS and Android changes in the running app with the Ansight CLI
    alwaysApply: true
    ---
    

    File.cursor/rules/ansight.mdc

  • Claude Code

    A CLAUDE.md block

    Paste the block into CLAUDE.md in the project root, under its own heading. If you already keep the instructions in AGENTS.md, a one-line CLAUDE.md containing @AGENTS.md imports that file.

    FileCLAUDE.md

  • Codex

    An AGENTS.md entry

    Paste the block into AGENTS.md at the repository root. Codex reads that file before it starts work, so the next task already knows to verify mobile changes with Ansight.

    FileAGENTS.md

Any other agent: paste the same block where it keeps project instructions.

That may be a rules file, a system prompt or the first message of a session. Ansight also publishes Markdown skills that explain its commands in more depth. They are optional; to use one, add a line to the block pointing at https://www.ansight.ai/skills/agents/ansight-app-inspection.md.

05 Worked example

A Claude Code change to order history, and what the developer reviews.

An illustrative scenario with invented numbers, not a customer story and not real terminal output. It shows the shape of what comes back.

You ask Claude Code to make order history load 20 orders at a time and fetch the next page when the list reaches the bottom. It builds a development build with the SDK, launches it on an iOS simulator and runs the flow with the commands below. Your CLAUDE.md block told it to, so you did not ask.

What the agent ran

sh
ansight session list --connected --json
ansight ui snapshot --session <session-id> --json
ansight ui swipe --session <session-id> --direction up
ansight ui swipe --session <session-id> --direction up
ansight ui wait --session <session-id> --text 'Order 21' --condition visible
ansight session network <session-id> --json
ansight session metrics <session-id> --json

What it reported back

report
Orders 1-20 load, and scrolling to the bottom loads 21-40.
Checked in session <session-id> on the iOS simulator.
Problem: GET /v1/orders?page=2 fired twice, 90 ms apart.
p10 frame rate during the scroll was 44 fps.
Not checked: Android, the empty state, offline.

Forty rows on screen would have looked like a pass. The agent also read the network evidence, which is how the duplicate request surfaced. You open the session with ansight session serve, scrub to the second swipe, and find both requests on the timeline right beside the frame rate dip. You never tapped through the flow yourself. You hand the session ID back as the brief, the agent fixes the guard and runs the flow again, and the new session shows one request.

Evidence CLI only SDK-enabled build
Screenshots and UI tree Rows 1 to 20, then 21 to 40, from the accessibility tree. The same rows, plus the in-app visual tree.
Network Not captured. The second page appears, so the duplicate request goes unseen. GET /v1/orders?page=2 twice, 90 ms apart.
Logs Visible only if the app writes to the system log. App logs show the next-page loader called twice.
Touches Sent by the agent, not recorded. Two swipes recorded on the timeline.
Memory and FPS Process memory only. iOS simulator FPS is unavailable. p10 frame rate 44 fps, memory up from 212 MB to 268 MB.

A CLI-only run would still have caught that the list loads and the right rows appear. What it cannot see is the request the screen never shows, which is why the SDK is recommended.

06 Reproduce first

How do you reproduce a Sentry or PostHog report with an agent?

Hand the agent the report, let it replay the flow in the app through ansight ui commands, and read the session to see whether the bug appears. After the fix, run the same flow again: the second session is your proof. The original recording stays in Sentry or PostHog; Ansight captures your development build.

  1. 01

    Hand over the report

    Give the agent the Sentry or PostHog export, link or written steps, and say not to change code yet.

  2. 02

    Replay the flow

    The agent follows the steps on a simulator or emulator and captures a session.

  3. 03

    Read what happened

    Logs, network and state around the failing step show whether the bug reproduced and why.

  4. 04

    Fix, then prove it

    The agent changes the code and replays the same flow. You compare the two sessions.

A prompt for the first two steps

prompt
Here is a Sentry replay export for a crash on the order screen. Use the Ansight CLI to replay the same steps in the connected app on the simulator. Read the session logs and metrics and tell me whether the bug reproduced and what the app logged when it did. Do not change code yet.

Beta shortcut

sh
ansight replay sentry ./sentry-replay.json
ansight replay posthog <recording-id>
ansight replay --help

Two routes: your agent drives it, or Ansight does.

The prompt above keeps your own coding agent in control and needs no sign-in. The ansight replay commands are a beta feature: Ansight's own AI re-drives a Sentry or PostHog recording for you, and it uses your Ansight sign-in. Reproduction is not automatic either way. Someone still has to follow the report, and the session shows whether the bug appeared.

07 Local-first

Does session data leave your machine?

Not by default. The agent runs against the app on your machine, and the Ansight host stores sessions there as ordinary local files protected by your operating system account and disk encryption. Viewing a session in the local player uploads nothing, so session data does not have to leave the machine.

Stays local

Capture, inspection, review

Launching, UI commands, reading logs and metrics, and opening a session in the player. None of these need an account.

Leaves only when you choose

Export, share, model-backed runs

A ZIP export, sharing a session to Ansight Cloud, or a command that uses Ansight's own AI, such as ansight app execute or ansight replay. Sessions can hold personal data from the app, so use test accounts.

Your agent's context is separate from Ansight's storage.

When your coding agent reads --json output, that text becomes part of its conversation and goes to the agent's own model provider. Local-first describes where Ansight keeps the session; what the agent reads from it follows your agent provider's terms. Keep secrets out of development builds and test data. For cloud data handling, read the security documentation, the data and privacy guide and the privacy policy.

08 Remote vs in-app

Device-cloud MCP servers vs an in-app SDK and CLI: what does your agent need to see?

A device-cloud MCP server gives an agent remote access to a device it can drive from outside the app. An in-app SDK with a CLI gives the agent evidence from inside the app: the UI tree, state, memory and FPS. The right one depends on whether the question is where the app can run or why it behaved as it did.

Remote device access

Reach for it when the question is coverage

  1. Does the flow work on a device model or OS version you do not own?
  2. Does the layout hold across many screen sizes?
  3. Can a CI job get a device without a local simulator?

In-app evidence

Reach for it when the question is cause

  1. Why did the screen announce success when the save failed?
  2. Did the change slow scrolling or grow memory?
  3. What do preferences, files and databases hold after the flow?

Access from outside the app shows what the screen did. State, network requests and frame timing live inside the process, which is where an SDK reads them. Nothing forces a choice between the two: a team can send an agent to remote devices for breadth and run Ansight on a local build for depth. Where an agent already talks to remote devices over MCP, Ansight sits beside that as a CLI, as the note above describes.

09 FAQ

Questions about using Ansight with a coding agent.

  • Does Ansight work with Cursor, Claude Code and Codex?

    Yes. Ansight is a command-line tool, so any coding agent that can run terminal commands can use it, including Cursor, Claude Code and Codex. Each agent only needs an instruction telling it to verify mobile changes with the Ansight CLI: a Cursor rules file, a CLAUDE.md block or an AGENTS.md entry for Codex.

  • Does Ansight need an MCP server?

    No. The integration is the CLI, not a plugin or an MCP server. The Ansight host accepts commands through the CLI, so an agent that can run a shell command can drive it. If your agent setup is built around MCP, Ansight still works wherever that agent has terminal access.

  • Do I need the Ansight SDK?

    No, but it is recommended. The CLI alone can launch an app on a simulator or emulator, tap, swipe, read the accessibility tree and capture screenshots, native logs and process metrics. Adding the SDK to a development build gives the deepest understanding of app behavior: the in-app UI tree, app state, network requests, recorded touches and FPS.

  • Which platforms does it support?

    iOS, Android, React Native (including Expo development builds), Flutter, .NET (MAUI and .NET mobile) and Capacitor, on simulators, emulators and physical devices. CLI-only capture covers simulators and emulators without app changes. Physical devices need the SDK, or Appium for an iPhone and ADB for an Android phone.

  • Where does the data go?

    By default it stays on your machine. The Ansight host stores sessions as ordinary local files, and viewing them uploads nothing. Data leaves only when you export a session, share it to Ansight Cloud or run a model-backed command. Anything your coding agent reads from CLI output goes to that agent's own model provider.

  • Do I need an Ansight account?

    Not for local use. Capture, UI commands, inspection and session review need no account or subscription. Signing in is needed for cloud sharing, uploads, remote runners and the Ansight-run AI commands, such as ansight app execute and ansight replay.

  • Where do I put the instructions for each agent?

    Cursor reads project rules from a .mdc file in .cursor/rules. Claude Code reads CLAUDE.md in the project root. Codex reads AGENTS.md at the repository root. For any other agent, use whichever file or system prompt it reads for project instructions.

Get started

Install the CLI, paste the block, let your agent check its next change.

Local capture, inspection and replay are free and need no account. Add the SDK when you want the deepest view of the app.

curl -fsSL https://www.ansight.ai/install.sh | bash