Unified iOS Simulator & Android Emulator Pool, TTL Lease, and Slimming Guardrails for AI Coding Agents
Stop parallel AI agents from melting your Mac or killing each other's simulators and emulators.
Manage iOS simulators and Android emulators in one local dashboard — one-click slim start, live RAM and cap guardrails, TTL leases, and automatic protection for devices owned by other sessions.
# Required for iOS simulators (macOS)
brew install mobai-app/tap/simslim
# Install mobpool (pick one)
uv tool install git+https://github.com/zereight/mobpool.git
# or: pipx install git+https://github.com/zereight/mobpool.gitAlternative: zero-build symlink or editable pip install
# Option A: Symlink to PATH (zero build step)
git clone https://github.com/zereight/mobpool.git ~/Documents/mobpool
mkdir -p ~/.local/bin
ln -sf ~/Documents/mobpool/bin/mobpool ~/.local/bin/mobpool
# Make sure ~/.local/bin is in your PATH (default macOS zsh does not include it):
export PATH="$HOME/.local/bin:$PATH"
# Option B: Editable pip install
git clone https://github.com/zereight/mobpool.git
cd mobpool && pip install -e .For humans — open the local web dashboard:
mobpool guiOpens http://127.0.0.1:8765/. On first run, click Auto-pick best devices (or run mobpool init --platform all), then click Start iOS or Start Android.
For AI coding agents — register skill/SKILL.md:
git clone https://github.com/zereight/mobpool.git ~/Documents/mobpool
mkdir -p ~/.agents/skills ~/.claude/skills
ln -sfn ~/Documents/mobpool/skill ~/.agents/skills/mobpool
ln -sfn ~/.agents/skills/mobpool ~/.claude/skills/mobpoolOnce linked, agents (Codex, Claude Code, Cursor, OpenMyBot, etc.) automatically call mobpool preflight / acquire / renew / release before booting or stopping any virtual device.
One-click Start iOS (slim boot + 1h TTL) → +1h lease renewal → Start Android with live progress → automatic 2 / 2 concurrency cap guardrail preventing Mac overload.
# 1. Agent A acquires a slim iOS simulator (1h TTL by default)
mobpool acquire --platform ios --owner feat-login
# → A1B2C3D4-1111-4000-8000-000000000001
# 2. Inspect running devices, RAM/CPU, slim status, leases, and Mac free memory
mobpool audit
# 3. Agent B cannot accidentally kill Agent A's simulator
mobpool release A1B2C3D4-1111-4000-8000-000000000001
# → BLOCKED: owned by feat-login (pass --force to override)
# 4. Agent A extends the lease during long runs, then releases cleanly
mobpool renew A1B2C3D4-1111-4000-8000-000000000001 --ttl 3600
mobpool release A1B2C3D4-1111-4000-8000-000000000001Example mobpool audit output (use --json for scripts and agent pipelines):
Booted devices: 1/2 (iOS 1/2, Android 0/1), total RAM 2.41 GB
[ios] A1B2C3D4-1111-4000-8000-000000000001 iPhone 17 Pro (iOS 26.2) 2.41 GB RAM 11.8% CPU slim (163/173) [claimed:feat-login]
Mac memory free: 61% (floor 25%)
When multiple AI coding agents (Claude Code, Codex, Cursor, OpenMyBot, etc.) run mobile builds and UI verifications in parallel on one Mac:
- Thermal & RAM meltdown: Agents independently call
xcrun simctl bootoremulator -avd, stacking 4–6 full virtual devices until macOS thrashes swap. - Friendly fire: Agent B shuts down or wipes Agent A's active simulator mid-test because there is no shared ownership model.
- Broken PID locks: Traditional PID-based claims vanish immediately when an agent's short-lived shell tool call exits.
- Fragmented workflows: iOS (
simctl/simslim) and Android (adb/emulator/avdslim) require completely different commands, IDs, and boot flags.
mobpool owns device lifecycle (pool selection, concurrency caps, host memory floor, atomic boot locks, TTL leases, and slim booting) and hands off UI interaction to your driver of choice (such as Argent, Maestro, Appium, simctl, or adb).
- One CLI for iOS + Android — Same
init,audit,preflight,acquire,renew,release,owners, andslimworkflow across both platforms. - Unified Local Web GUI (
mobpool gui) — Manage iOS simulators and Android emulators together in one browser dashboard (127.0.0.1loopback-only, CSRF/Origin/CSP protected, zero external dependencies). - TTL + heartbeat leases — Leases persist across transient agent subprocesses and auto-expire if a session crashes without cleanup.
- Atomic boot lock —
mkdir-based lock with dead-PID stale-lock recovery prevents concurrent agents from racing past your device caps. - Host memory & cap guardrails — Enforces per-platform caps (
IOS_CAP,ANDROID_CAP), machine-wideTOTAL_CAP, and a macOSmemory_pressurefree-memory floor before booting. - External owner awareness — Detects external worktree claims, legacy
sim-guard/agent-deviceclaims, and live app processes (MOBPOOL_APP_ID) so agents never touch someone else's device. - Slim by default — Uses
simslimon iOS andavdslim(or lightweight emulator flags whenavdslimis absent) on Android. - Zero Python dependencies — Pure Python 3.10+ standard library. Ships with an agent-ready
skill/SKILL.md.
flowchart LR
A1["AI Agent A<br/>(Claude / Codex / Cursor)"] --> CLI
A2["AI Agent B<br/>(Parallel Session)"] --> CLI
subgraph Core["mobpool Core (Python stdlib)"]
CLI["mobpool CLI<br/>init · audit · preflight · acquire · renew · release"]
GUI["mobpool GUI<br/>Local Web Dashboard (127.0.0.1)"]
SVC["Shared Service Layer<br/>(service.py)"]
LOCK["Atomic Boot Lock<br/>(mkdir + stale PID recovery)"]
GUARD["Caps & Memory Floor<br/>(IOS/ANDROID/TOTAL + memory_pressure)"]
CLAIMS["Owner & TTL Lease Resolver<br/>(TTL leases · worktrees · sim-guard · live app)"]
POOL["Pool Store<br/>(~/.config/mobpool/pools.json)"]
CLI --> SVC
GUI --> SVC
SVC --> LOCK
SVC --> GUARD
SVC --> CLAIMS
SVC --> POOL
end
subgraph Platforms["Platform Adapters"]
IOS["iOSAdapter<br/>xcrun simctl + simslim"]
AND["AndroidAdapter<br/>adb + emulator + optional avdslim"]
end
Core --> IOS
Core --> AND
IOS --> ID1["Booted iOS UDID"]
AND --> ID2["Booted emulator-XXXX"]
ID1 --> UI["UI Driver<br/>(Argent / Maestro / Appium / simctl / adb)"]
ID2 --> UI
sequenceDiagram
autonumber
participant A as Agent A (feat-login)
participant B as Agent B (feat-pay)
participant M as mobpool
participant D as Simulator / Emulator Pool
A->>M: mobpool acquire --platform ios --owner feat-login
M->>M: Acquire atomic mkdir lock & check caps + Mac free RAM
M->>D: simslim boot <UDID-1> & write TTL lease (3600s)
M-->>A: <UDID-1> (claimed: feat-login)
B->>M: mobpool acquire --platform ios --owner feat-pay
M->>M: Skip <UDID-1> ([claimed:feat-login]), check cap
M->>D: simslim boot <UDID-2> & write TTL lease (3600s)
M-->>B: <UDID-2> (claimed: feat-pay)
Note over A,B: Agents run builds & UI automation (e.g. Argent) safely in parallel
A->>M: mobpool renew <UDID-1> --ttl 3600
M-->>A: Lease extended (heartbeat)
B->>M: mobpool release <UDID-1>
M-->>B: Blocked! Owned by feat-login (use --force to override)
A->>M: mobpool release <UDID-1>
M->>D: Uninstall test apps, reset keychain, shutdown & drop lease
M-->>A: Released <UDID-1>
mobpool itself has zero external Python package dependencies (standard library only). Platform features rely on the native SDK tools installed on your Mac:
| Layer | Dependency | Required? | Purpose & Install |
|---|---|---|---|
| Core Runtime | Python 3.10+ | Required | Runs mobpool using stdlib only (pyproject.toml) |
| Host Guard | macOS memory_pressure |
Built-in (macOS) | Checks free memory % before booting (gracefully skipped if unavailable) |
| iOS | Xcode Command Line Tools (xcrun simctl, plutil) |
Required for iOS | Lists, inspects, cleans apps, resets keychain on iOS simulators |
| iOS | simslim |
Required for iOS | Boots simulators in slim mode, disables background daemons, reports RAM/CPU (brew install mobai-app/tap/simslim) |
| Android | Android SDK platform-tools (adb) |
Required for Android | Maps AVDs to emulator-XXXX serials, waits for boot, cleans apps, shuts down |
| Android | Android SDK emulator + ≥1 AVD |
Required for Android | Lists AVDs and boots emulators ($ANDROID_HOME/emulator/emulator) |
| Android | avdslim |
Optional | Applies AVD slim profile; if absent, mobpool falls back to lightweight boot flags (-no-audio -no-boot-anim -gpu host -no-snapshot-save) |
| UI Automation | Argent / Maestro / Appium | Optional | Drives UI taps, typing, and screenshots against the booted UDID or emulator-XXXX |
| Command | Flags | Description |
|---|---|---|
mobpool init |
--platform ios|android|all, --count N |
Picks unowned devices (preferring plain iOS-X-Y runtimes), applies slimming, and saves pool to ~/.config/mobpool/pools.json |
mobpool audit |
--platform ios|android|all, --json |
Lists booted devices, RAM/CPU usage, slim status, active owners, and Mac free memory % |
mobpool preflight |
--platform ios|android |
Runs audit and exits non-zero if platform cap, total cap, or Mac memory floor would be exceeded |
mobpool acquire |
--platform ios|android, --ttl SEC, --owner LABEL |
Atomically acquires lock, checks caps/memory, boots a free slim pool device, and writes a TTL lease |
mobpool renew <id> |
--ttl SEC, --force |
Extends an active TTL lease (heartbeat) by UDID, AVD name, or emulator-XXXX serial; refuses leases owned by another session unless --force |
mobpool release <id> |
--keep-apps, --force |
Refuses to kill non-self owned devices unless --force; cleans user apps, shuts down, and removes lease |
mobpool owners |
--platform ios|android|all |
Lists all currently claimed devices and their resolved owner source |
mobpool slim <id> |
--platform ios|android, --force |
Applies the slimming profile (simslim on / avdslim on); blocks non-self owned devices unless --force |
mobpool gui |
--host HOST, --port PORT, --no-open |
Launches the unified local web dashboard (127.0.0.1, localhost, or ::1 only; default port 8765) |
Manage iOS simulators and Android emulators from one local browser dashboard instead of switching between Xcode Devices and Android Studio Device Manager. Because it runs on Python's standard library, there are no extra dependencies and no macOS code-signing or Apple Developer account requirements.
# Start on http://127.0.0.1:8765/ and open in your default browser
mobpool gui
# Bind an automatic free port and print the URL without opening a browser
mobpool gui --port 0 --no-open
# Use a custom loopback host/port (only 127.0.0.1, localhost, or ::1 are allowed)
mobpool gui --host localhost --port 9000Press Ctrl+C in the terminal to stop the local server.
- At-a-glance status & one-click start: The top bar shows running slots and macOS free RAM (
0 / 2 running · 64% RAM free) and auto-refreshes every 8 seconds while the tab is visible. Click Start iOS or Start Android to boot the next available slim device from your Quick-start list. - Running: Always pinned at the top with plain status (
Yours · 52m left,In use by <owner>, orStarted outside mobpool), RAM usage, one-click ID copy, +1h (adds one hour to your reservation), Stop & clean (or Force stop with confirmation if used by another session), and a⋯menu for Stop (keep apps), Optimize RAM (Slim), or pinning. - Quick-start: Lists your pinned pool devices with simple
All / iOS / Androidtabs and a single Start button per device (disabled when another session owns the device or when caps/memory limits are reached). When no pool is configured yet, click Auto-pick best devices. - Other installed devices: Collapsed by default so unused simulators stay out of the way. Expand or type in Search devices... to Start any installed device directly (with slim setup applied automatically) or Pin it to Quick-start.
- No settings screen: Devices you start are labeled
mobpool-gui(or your configured owner) and reserved for the configured default TTL. Recent activity appears at the bottom only after you run an action.
- Same guardrails as the CLI: Every action goes through the shared
service.pylayer, enforcing atomic boot locks, concurrency caps, the macOS free-memory floor, and ownership checks. Foreign-owned devices (whether running or shut down) cannot be pinned or slimmed without explicit confirmation, and pinning an already-booted device never triggers a forced reboot. - Loopback-only & CSRF-protected: Refuses non-loopback
--hostvalues, sends a strict CSP header, and validatesHost,Origin,Sec-Fetch-Site, and a per-sessionX-Mobpool-Tokenheader on every mutating request.
mobpool resolves settings in the following precedence order:
- Environment variables (highest priority)
- Local config file:
~/.config/mobpool/config.json(override path viaMOBPOOL_CONFIG_FILE) - Built-in defaults
{
"ios_cap": 2,
"android_cap": 1,
"total_cap": 2,
"min_free_pct": 25,
"default_ttl_sec": 3600,
"simslim_except": "store,web",
"app_id": "com.example.app.dev",
"worktree_claims_dir": "~/.cache/worktree-claims"
}| Env Variable | config.json Key |
Default | Purpose |
|---|---|---|---|
MOBPOOL_CONFIG_DIR |
— | ~/.config/mobpool |
Base directory for config, pools, claims, and locks |
MOBPOOL_CONFIG_FILE |
— | <config_dir>/config.json |
Path to local JSON config file |
MOBPOOL_IOS_CAP |
ios_cap |
2 |
Max concurrently booted iOS simulators |
MOBPOOL_ANDROID_CAP |
android_cap |
1 |
Max concurrently booted Android emulators |
MOBPOOL_TOTAL_CAP |
total_cap |
2 |
Max concurrently booted virtual devices machine-wide |
MOBPOOL_MIN_FREE_PCT |
min_free_pct |
25 |
Minimum macOS free memory % required before booting |
MOBPOOL_CLAIM_TTL |
default_ttl_sec |
3600 |
Default lease duration in seconds |
MOBPOOL_OWNER |
owner_label |
workspace basename | Default owner label written into new leases |
MOBPOOL_ANDROID_FLAGS |
android_flags |
-no-audio -no-boot-anim -gpu host -no-snapshot-save |
Lightweight Android emulator boot flags |
SIMSLIM_EXCEPT |
simslim_except |
store,web |
simslim daemon categories kept enabled on iOS |
MOBPOOL_APP_ID |
app_id |
unset | Bundle/package ID treated as an active owner while running |
MOBPOOL_WORKTREE_CLAIMS_DIR |
worktree_claims_dir |
unset | Directory of <device_id>/owner external worktree claim files (also checks RB_CLAIMS) |
MOBPOOL_FORCE_RELEASE |
— | 0 |
Set 1 to bypass non-self owner protection on release |
Before booting, selecting pool devices, or shutting anything down, mobpool resolves device ownership across four layers:
mobpoolTTL leases (~/.config/mobpool/claims/) — Active leases with expiration timestamps and heartbeat renewal.- External worktree claims (
MOBPOOL_WORKTREE_CLAIMS_DIR/RB_CLAIMS) — Respects devices claimed by build scripts or git worktrees. - Legacy
sim-guard/agent-deviceclaims — Seamlessly coexists with existing simulator guard setups. - Running target app detection (
MOBPOOL_APP_ID) — Marks a booted device as owned if your dev app process is actively running on it.
Any device owned by another session is marked [claimed:...] in audit, skipped by init and acquire, and protected from release unless explicitly overridden with --force or MOBPOOL_FORCE_RELEASE=1.
A lease can only be renewed by the session that holds it: the same MOBPOOL_OWNER, or the workspace that acquired it (or a folder inside it). Renewing someone else's lease prints BLOCKED and leaves it untouched, so a dead session's lease still expires on time. renew --force overrides this; MOBPOOL_FORCE_RELEASE does not.
mobpool/
├── .githooks/pre-commit # Blocks commits that stage this machine's device IDs
├── bin/mobpool # Executable CLI entrypoint
├── docs/assets/ # README dashboard screenshot & demo GIF
├── pyproject.toml # Python 3.10+ packaging (zero dependencies)
├── scripts/
│ └── check_no_device_ids.py # Device-ID check the pre-commit hook runs
├── skill/SKILL.md # Drop-in AI agent skill instructions
├── src/mobpool/
│ ├── cli.py # Unified CLI subcommands
│ ├── service.py # Shared CLI & GUI lifecycle/pool/audit logic
│ ├── gui.py # Localhost-only HTTP server & async job controller
│ ├── gui_assets.py # Embedded HTML/CSS/JS dashboard assets
│ ├── config.py # Env + local config.json loader
│ ├── claims.py # TTL leases & external owner resolution
│ ├── lock.py # Atomic mkdir boot/state locks + stale recovery
│ ├── memory.py # macOS memory_pressure check
│ ├── pool_store.py # Pool persistence (~/.config/mobpool/pools.json)
│ └── platforms/
│ ├── base.py # PlatformAdapter interface
│ ├── ios.py # xcrun simctl + simslim adapter
│ └── android.py # adb + emulator + optional avdslim adapter
└── tests/ # Unit & CLI integration tests
PYTHONPATH=src python3 -m unittest discover -s tests -v
# Once per clone: refuse commits that stage this Mac's simulator UDIDs, adb serials, or AVD names
git config core.hooksPath .githooksThe hook runs scripts/check_no_device_ids.py, which compares the paths and added lines you stage against xcrun simctl list devices, adb devices, and emulator -list-avds on your machine. Example IDs such as A1B2C3D4-1111-4000-8000-000000000001 still pass, a missing tool is skipped, and emulator-5554-style serials are ignored because every machine shares them.
