Agent Traffic Control (atc)
Coordinate builds and exclusive Android and iOS device leases across concurrent coding agents, without a daemon and without ever running shell commands.
Overview
When several coding agents share a machine, they collide on Android emulators, iOS Simulators, USB phones, and heavy builds. atc serializes access through a user-private state.json file under an atomic directory lock (atc.lock) with <20 ms in-memory critical sections and zero npm dependencies.
atc handles exactly two domains: devices (emulators, simulators, physical devices) and builds (Gradle, Bazel, Xcode). Agents never hand atc a shell command. They ask for an allowlisted, typed operation, and atc validates every value, builds the literal argv itself, and runs it under the right lease, build slot, and workspace lock.
| Entry point | Use it for |
|---|
atc exec <system> <op> … | One simple operation, e.g. atc exec gradle tasks :app:assembleDebug or atc exec android install app.apk. |
atc batch | Multi-step workflows, dependencies, per-step cwd/env, scoped claims, or timeouts. Runs a validated JSON plan (DAG) of typed ops. |
atc mcp | The same ops as MCP tools (atc_gradle, atc_bazel, atc_xcode, atc_android, atc_ios, atc_batch, plus atc_claim, atc_free, atc_renew, atc_snapshot, atc_status, atc_guide). |
Invalid requests are rejected before anything runs, with all problems listed at once ({path, code, message, hint}). Unsupported operations or flags are refused with the closest supported alternative and a link to request them: https://github.com/rock3r/atc/issues.
flowchart LR
A["Coding agent"] -->|"atc exec gradle tasks …<br/>atc batch plan.json<br/>atc_* MCP tools"| V{"Validate<br/>every value"}
V -->|"any problem"| R["Rejected, exit 7<br/>all problems + hints<br/>nothing ran"]
V -->|"valid"| P["Plan<br/>find wrapper, workspace,<br/>exact argv"]
P --> Q["Admit<br/>build slot, workspace lock,<br/>RAM, device lease"]
Q -->|"busy"| W["Queue<br/>warm-affinity"]
W --> Q
Q --> X["Run<br/>literal argv + heartbeat"]
X --> T["Gradle / Bazel / Xcode<br/>adb / simctl"]
When two agents on one machine build the same app and test on devices:
sequenceDiagram
participant A as Agent A
participant B as Agent B
participant ATC as atc
A->>ATC: gradle tasks assembleDebug
ATC-->>A: build slot + workspace lock
B->>ATC: gradle tasks assembleDebug (same repo)
ATC-->>B: queued (same workspace)
A->>ATC: claim phone, android install
ATC-->>A: lease emulator-5554
Note over ATC: A's build finished, so B's build starts
B->>ATC: claim phone
ATC-->>B: lease emulator-5556 (a different device)
A->>ATC: free
B->>ATC: free
Requirements and install
Requires Node.js >= 20 on macOS, Linux, or Windows, plus the Android SDK (adb, emulator, android CLI) and/or Xcode (xcrun simctl, xcodebuild) on macOS.
npm install -g @rock3r/atc
atc status
| Agent host | Optional plugin / hook setup |
|---|
| Claude Code | /plugin marketplace add rock3r/atc then /plugin install atc@atc |
| Codex | codex plugin marketplace add rock3r/atc && codex plugin add atc@atc |
| GitHub Copilot CLI / app | copilot plugin marketplace add rock3r/atc && copilot plugin install atc@atc |
| Antigravity | Symlink or copy package root into ~/.gemini/config/plugins/atc (loads plugin.json, skills/atc, hooks.json, and mcp_config.json) |
| Gemini CLI | Copy skills/atc into ~/.gemini/skills/atc and wire atc hook pre-tool-use + atc hook stop |
| Cursor | Copy .cursor/hooks.json into .cursor/hooks.json (and optional .mcp.json) |
| Pi | Load extensions/atc/index.ts (releases leases on session end) |
The hooks only record your agent's session identity, inject it into atc_* MCP calls, and free leases when a session ends. They never read, block, or rewrite shell commands.
Quick start
atc status # RAM/disk, emu/sim/build slots, fleet
atc guide # workflow guide and rules
atc exec --help # the full operation catalog