agentleFS
lycorp-jplycorp-jp/sim-use/AGENTS.md

sim-use

AGENTS.md1.4k starsChanged 4 months agoApache-2.0View on GitHub

The FB* XCFrameworks are static archives built without library evolution — build_products/ is locked to the toolchain that produced it. Re-run ./scripts/build.sh dev after switching Xcode versions. make test runs swift test --enable-code-coverage — unit tests that exercise parsing, outline rendering, daemon protocol, and cross-platform dispatch without a live simulator. When xcsift is installed (brew install xcsift — optional, never required), make build / make test condense swift output into a TOON summary plus a coverage report. SIM_USE_XCSIFT=0 make test…

  • Installs packages

Trending

Quiet since September.thin dataabout the whole repository

Jan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 2 mentionsAug 2026: 0 mentionsSep 2026: 1 mentionOct 2026: 0 mentionsNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the lycorp-jp/sim-use repository that our weekly crawl found: only 3 in all, so this is a hint, not a trend. There is no adoption data for this file yet.
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,691 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository5 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow Swift best practices and match the style of surrounding code.

    line 5
  2. Very specific:

    When adding or removing commands/options, update the README and skills/sim-use/SKILL.md.

    line 6
  3. Very specific:

    When xcsift is installed (brew install xcsift — optional, never required), make build / make test condense swift output into a TOON summary …

    line 41
  4. Distinctive:

    After any non-trivial change, at minimum:

    line 89
  5. Very specific:

    Cross-platform: write IOSSim<Verb>Command + Android<Verb>Command, plus a top-level forwarder in Sources/SimUse/Commands/<Verb>.swift.

    line 121
  6. Very specific:

    iOS-only: write IOSSim<Verb>Command, register in IOSSimCommand only.

    line 122

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Development Rules

Code quality

  • No Any types unless absolutely necessary; upgrade dependencies rather than downgrading code to work around type errors.
  • Follow Swift best practices and match the style of surrounding code.
  • When adding or removing commands/options, update the README and skills/sim-use/SKILL.md. If the Skill starts relying on behavior newer than its current compatibility floor, also bump MINIMUM_SIM_USE_VERSION in skills/sim-use/scripts/preflight.py and extend PreflightScriptTests.

Changelog

CHANGELOG.md follows Keep a Changelog. Add entries under ## [Unreleased] as you land changes. Subsection order: ### Added / ### Changed / ### Fixed / ### Removed. Never modify already-released version sections.

Build and test

First-time setup

brew install xcodegen    # idb generates its Xcode project with XcodeGen
./scripts/build.sh dev   # clone idb, build XCFrameworks
make build               # build sim-use

The FB* XCFrameworks are static archives built without library evolution — build_products/ is locked to the toolchain that produced it. Re-run ./scripts/build.sh dev after switching Xcode versions.

Daily workflow

make build                                           # incremental build
.build/debug/sim-use describe-ui --device $UDID      # test against a booted simulator

Running tests

make test                        # unit tests (no simulator needed)
swift test --filter TapTests     # run a single test suite

make test runs swift test --enable-code-coverage — unit tests that exercise parsing, outline rendering, daemon protocol, and cross-platform dispatch without a live simulator.

When xcsift is installed (brew install xcsift — optional, never required), make build / make test condense swift output into a TOON summary plus a coverage report. SIM_USE_XCSIFT=0 make test forces plain swift output.

End-to-end tests (live device)

make e2e            # BOTH iOS + Android in sequence (needs a booted sim AND an emulator)
make e2e-ios        # iOS only — booted simulator + Playground fixture
make e2e-android    # Android only — reachable device/emulator + Playground fixture
make e2e-matrix     # iOS across Xcode 26/27 × Device Hub closed/open legs (~35 min default)
make eval           # agent evals (real `claude -p` cost; prompts before running)

Run the Android emulator headless (-no-window) for video work. screenrecord only produces frames while SurfaceFlinger is compositing, and with a windowed emulator that depends on the window being genuinely visible — frames stop when it is on another Space or occluded, which makes any automation of capture unreliable. Headless uses offscreen rendering and is stable. Measured over 5 s of sustained interaction:

GPUwindowframes
swiftshader_indirectvisible2
hostvisible110
hoston another Space1
swiftshader_indirect-no-window31

Note the failure is the window, not the GPU mode: hardware rendering with an invisible window is as dead as software rendering.

The video E2E suites pass either way, and legitimately so — they run against a still playground screen, and screenrecord is strictly variable-frame-rate, so a still screen yields exactly one opening frame whether or not capture is healthy (measured: 29,804 bytes / 1 frame headless vs 29,724 / 1 windowed, near byte-identical). No assertion can separate the two without driving sustained motion, and doing that from a test is itself enough to knock the emulator off adb mid-suite. So if Android video capture ever looks empty, check how the emulator was booted before suspecting the code.

E2E suites compile always but skip unless SIM_USE_E2E=1 (iOS) / SIM_USE_E2E_ANDROID=1 (Android) is set — make test never touches a device, which is why CI needs no simulator. The runners set those vars for you.

Budget the time: a full green make e2e-ios run is ~15 minutes. The iOS suites drive real HID gestures and wait on simulator animations/keyboard settling, so per-suite waits dominate — this is expected, not a hang. make e2e (both platforms) is ~20+ min. When you only touched one platform, run just that platform's target. The runners keep going past a failed suite and print a full pass/fail map at the end, so read the summary rather than assuming the first red aborted the rest.

make e2e-matrix validates the host-environment matrix: Xcode 26.x / 27.x × Device Hub closed at boot (*-sim legs — the Simulator.app workflow, legacy HID) or open at boot (*-hub legs — CoreDevice dtuhidd HID). One leg runs the full suite (default x27-hub; ARGS="--full <leg>|all|none"), the rest run the smoke tier (scripts/test-runner.sh --smoke: describe-ui, tap, type, scroll); legs whose Xcode is missing are skipped. The package builds once on the xcode-select toolchain — each leg only swaps the runtime Xcode via SIM_USE_TEST_DEVELOPER_DIR and boots a device matching its iOS generation, with dtuhidd/transport gates before and after the suites so a choreography failure cannot green-run the wrong combination. It quits Device Hub and shuts down every booted simulator, so never run it alongside other simulator work. Per-leg logs + evidence: .build/e2e-matrix/<timestamp>/.

Agent-facing behaviour (the bundled skill) has its own natural-language eval layer — see e2e/agent-evals/README.md and docs/ai/xxxx-e2e-confidence-suite/.

Verifying a change

After any non-trivial change, at minimum:

  1. make build succeeds.
  2. make test passes.
  3. Spot-check the affected command on a live simulator (describe-ui, tap @N, screenshot).

Module layout

Five SwiftPM targets; dependency graph flows in one direction.

TargetPathDepends on
SimUseCoreSources/SimUseCore/Foundation + ArgumentParser
SimUseVideoSources/SimUseVideo/SimUseCore + AVFoundation/ImageIO
iOSSimBackendSources/iOSSimBackend/SimUseCore + SimUseVideo + FB* XCFrameworks + AVFoundation
AndroidBackendSources/AndroidBackend/SimUseCore + SimUseVideo + ArgumentParser
SimUse (executable)Sources/SimUse/SimUseCore + SimUseVideo + iOSSimBackend + AndroidBackend + FB*

SimUseVideo holds the platform-neutral host-side video plumbing (H.264 Annex B parsing, passthrough muxing, AVAssetWriter encoding, frame utilities) shared by the iOS and Android recording/streaming paths. It must stay FB*-free — anything that needs FBSimulatorControl belongs in iOSSimBackend (e.g. the VideoFrameUtilities.captureScreenshotData extension), anything adb-shaped in AndroidBackend.

Verb dispatch

A verb (tap, swipe, type, ...) reaches three surfaces:

  1. Top-level — Sources/SimUse/Commands/<Verb>.swift. Resolves the target via PlatformRouter, then forwards to the iOS or Android backend.
  2. sim-use ios <verb> — Sources/iOSSimBackend/Verbs/IOSSim<Verb>Command.swift.
  3. sim-use android <verb> — Sources/AndroidBackend/Verbs/Android<Verb>Command.swift.

Four verbs are iOS-only (key, key-combo, key-sequence, batch) — no top-level alias.

Adding a new verb

  • Cross-platform: write IOSSim<Verb>Command + Android<Verb>Command, plus a top-level forwarder in Sources/SimUse/Commands/<Verb>.swift. Register in IOSSimCommand.swift, AndroidCommand.swift, and main.swift.
  • iOS-only: write IOSSim<Verb>Command, register in IOSSimCommand only. Use HIDKeyCommandHelp.androidUnsupportedMessage to reject Android UDIDs (see IOSSimKeyCommand).
  • Shared flags: @OptionGroup var udid: UDIDOptions + @OptionGroup var json: JSONOutputOptions.

Daemon

SimUseExecutableCommand.run() forwards UDID-scoped verbs to a per-UDID auto-spawned daemon (Sources/SimUseCore/Daemon/). Platform-agnostic — both iOS and Android verbs route through it. Key regression test: Tests/DaemonCommandParserInjectionTests.swift.

Android development

The bridge/ directory contains a Kotlin Android app (AccessibilityService + HTTP server) that the Swift CLI talks to over adb forward.

Required tooling

ToolVersion
Android SDKcompileSdk=35, minSdk=30
JDK17 -- 21 (Gradle 8.7 rejects 22+)
Gradle8.7 (wrapper in bridge/gradlew)

scripts/build-bridge.sh auto-detects JDK and SDK paths. Run scripts/build-bridge.sh --check to verify the environment.

Bridge wire spec

  • BuildConfig.PROTOCOL_VERSION (Kotlin) and BridgeClient.expectedProtocolVersion (Swift) must match — bump together on breaking wire changes only.
  • versionCode / versionName in bridge/app/build.gradle.kts — bump on any APK change.
  • Endpoints: bridge/.../server/ActionRouter.kt; handlers in .../handler/.

Bundling the APK

The APK is gitignored (Sources/AndroidBackend/Resources/*.apk). Run scripts/build-bridge.sh before make build so the binary includes Android support.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.