Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/agents/device-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ A failed command can look like a fast success. Before you record the time of a c

Use one session for each purpose. For more isolation, use a separate `--state-dir` under `/private/tmp`.
Close each session that you opened manually, including failed attempts, with its original session, platform, UDID, and state directory.
If your session booted a local simulator or emulator, add `--shutdown`, unless the user asks to keep it running.

For `DEVICE_IN_USE`:

- "already in use by session X": follow the `close --session` hint of this daemon.
- "owned by session X in workspace Y": examine `device status`. Use `device release --stale` only for provably dead owners.
A live or uncertain owner blocks `open`, unless the device rebooted after the claim.
With reboot evidence, `open` settles old resources, takes the claim, and reports the release in `warnings`.
Do not search for PIDs. Do not steal the claim.

If cleanup is stuck, run `agent-device device status --stale`.
To stop the owning daemon, run `agent-device daemon stop --state-dir <dir>`. For retained runners, add `--clean`.
To release dead owners, run `agent-device device release --stale`.
If you are blocked, report the session, state directory, and status output. Always report incomplete cleanup.
The physical runner handoff checklist is in `docs/evidence/ios-physical-runner-handoff-2026-09-19.md`.

Expand Down
2 changes: 1 addition & 1 deletion packages/command-surface/src/management/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const openCommandMetadata = defineFieldCommandMetadata(

const closeCommandMetadata = defineFieldCommandMetadata(
'close',
'Close the named app, or close the active session app when app is omitted. Use shutdown only when the selected simulator or emulator should also stop. Android ADB close fails with android-app-close-timeout if the app stays foreground past 2s, a killed process does not exit within 10s, or a new process runs past 2s. It fails with android-process-probe-unavailable when adb pidof cannot list the app processes; if that happens before the force-stop, the app keeps running.',
'Close the named app, or close the active session app when app is omitted. If the session booted a local simulator or emulator, add shutdown when you finish, unless the user asks to keep it running; close alone never stops the device. Android ADB close fails with android-app-close-timeout if the app stays foreground past 2s, a killed process does not exit within 10s, or a new process runs past 2s. It fails with android-process-probe-unavailable when adb pidof cannot list the app processes; if that happens before the force-stop, the app keeps running.',
{
app: stringField('Optional app to close.'),
shutdown: booleanField('Shutdown the session/device where supported.'),
Expand Down
2 changes: 2 additions & 0 deletions scripts/__tests__/simulator-skills-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const SKILLS = [
id: 'foreground platform open',
requiredText: 'agent-device open <app-or-bundle-id> --platform ios --foreground',
},
{ id: 'device shutdown on finish', requiredText: 'agent-device close --shutdown' },
] satisfies Contract[],
prohibitions: [
{ id: 'version startup probe', forbiddenText: 'agent-device --version' },
Expand Down Expand Up @@ -64,6 +65,7 @@ const SKILLS = [
id: 'foreground platform open',
requiredText: 'agent-device open <app-or-package-id> --platform android --foreground',
},
{ id: 'device shutdown on finish', requiredText: 'agent-device close --shutdown' },
] satisfies Contract[],
prohibitions: [
{ id: 'version startup probe', forbiddenText: 'agent-device --version' },
Expand Down
2 changes: 1 addition & 1 deletion skills/agent-device/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ agent-device open <app> --foreground

That starts the session and returns the initial interactive snapshot with `@refs`.

Loop: act with `press|click|fill|longpress <target> ... --settle`, `scroll <direction> --settle`, or `back --settle`; continue from the printed diff, verify the named expectation (`wait text "..."`, `is`, `get`, or `find`), then run `agent-device close`.
Loop: act with `press|click|fill|longpress <target> ... --settle`, `scroll <direction> --settle`, or `back --settle`; continue from the printed diff, verify the named expectation (`wait text "..."`, `is`, `get`, or `find`), then run `agent-device close`, or `agent-device close --shutdown` if your session booted a local simulator or emulator, unless the user asks to keep it running.

Reaching an off-screen target is one command, not a scroll-and-check loop: `scroll down --until <selector>` scrolls until that element is on screen, and `scroll bottom` runs to the end of the content. Repeated bare `scroll down` calls are the slow way to find something.

Expand Down
2 changes: 2 additions & 0 deletions skills/android-emulator/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ agent-device open <app-or-package-id> --platform android --foreground

Follow the initial interactive snapshot and corrective error hints. If the shell reports that `agent-device` is unavailable, stop and ask the user to install it or expose their existing installation on `PATH`.

When you finish, if your session booted the emulator, run `agent-device close --shutdown`, unless the user asks to keep it running.

Only when the task is specialized or a command shape is unclear, read the relevant version-matched help topic:

```bash
Expand Down
2 changes: 1 addition & 1 deletion skills/dogfood/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Read current CLI guidance:
agent-device help dogfood
```

Loop: open app -> snapshot -i + screenshot -> explore flows -> capture evidence per issue -> close.
Loop: open app -> snapshot -i + screenshot -> explore flows -> capture evidence per issue -> close (`close --shutdown` if your session booted a local simulator or emulator, unless the user asks to keep it running).

Target app is required; infer platform or ask. Findings must come from runtime behavior, not source reads. Let `help dogfood` provide exact report shape, evidence commands, and current workflow guidance.
2 changes: 2 additions & 0 deletions skills/ios-simulator/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ agent-device open <app-or-bundle-id> --platform ios --foreground

Follow the initial interactive snapshot and corrective error hints. If the shell reports that `agent-device` is unavailable, stop and ask the user to install it or expose their existing installation on `PATH`.

When you finish, if your session booted the simulator, run `agent-device close --shutdown`, unless the user asks to keep it running.

Only when the task is specialized or a command shape is unclear, read the relevant version-matched help topic:

```bash
Expand Down
4 changes: 2 additions & 2 deletions src/commands/schema/cli-help-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Loop:
4. Treat a settled:true diff as the next observation. Do not add wait stable or another snapshot when the diff already shows the next target or expected result.
5. If --settle prints not settled, follow its hint before the next ref-based action.
6. Verify named expectations with wait text/selector/absent, get, is, find, or the settled diff. A bare screenshot/snapshot is not verification for a named expectation.
7. Close the session when the script ends.
7. Close the session when the script ends. If your session booted a local simulator or emulator, use close --shutdown, unless the user asks to keep it running.

Command shapes:
agent-device open com.example.app --relaunch
Expand Down Expand Up @@ -278,7 +278,7 @@ Loop:
3. Use snapshot -i and press/fill/click/longpress --settle for UI-driving steps.
4. Use the settled diff as evidence when it shows the changed behavior; otherwise verify with wait/get/is/find, screenshot, logs, network, perf, or trace based on the claim.
5. Record timings, token/output size, screenshots/videos, logs, or perf artifacts only when they answer the validation question.
6. Close sessions and release leases before finishing.
6. Close sessions and release leases before finishing. If your session booted a local simulator or emulator, use close --shutdown, unless the user asks to keep it running.

Evidence:
CLI/runtime freshness: pnpm build, pnpm clean:daemon, then agent-device --version or the command under test.
Expand Down
Loading