For local automation builders
Use this when a local script or agent is actively driving a browser, editor, terminal, or uploader and Aion should keep that app open until the task is done.
Start with the socket →Automation guide
Keep Aion from auto-closing an app while your local script, tool, or automation workflow is still using it.
Who this is for
Use this page when a local tool launches or controls an app and needs Aion to wait until the work is really finished.
Use this when a local script or agent is actively driving a browser, editor, terminal, or uploader and Aion should keep that app open until the task is done.
Start with the socket →You do not need this page for normal setup. Use the user guide unless you are connecting your own local automation tool to Aion.
Read the user guide →Transport
Aion exposes a same-user Unix domain socket. Your tool can use it to tell Aion which app is still busy.
~/Library/Application Support/Aion/ipc/ai-protection.sock Aion 2.11 can also accept aion:// commands for scene changes, protection toggles, lists, status reads, and window actions. This is off by default and must be enabled in Settings → Advanced.
aion://scene/activate?name=Coding Use the packaged SKILL.md so compatible agents can discover the Aion CLI and request protection during long local tasks.
aion install-skill Open SKILL.md Protocol flow
Actions
session.hellolease.beginlease.renewlease.endlease.listlease.can_close.replylease.can_close.request
Handshake and transport errors
session.hellosession.readysession.errorinvalid_handshakeunsupported_protocol_versionholder_id_mismatchunauthenticated App identity
Limits
Examples
{
"action": "session.hello",
"protocolVersion": 1,
"holderId": "agent.local.test",
"clientName": "Test Agent",
"pid": 42
} {
"action": "lease.begin",
"requestId": "req_123",
"holderId": "agent.local.test",
"appKey": "com.google.Chrome",
"leaseSeconds": 600
} {
"action": "lease.can_close.reply",
"requestId": "close_777",
"holderId": "agent.local.test",
"appKey": "com.google.Chrome",
"result": "extend_lease",
"leaseSeconds": 300
} Lease responses
acceptedinvalid_payloadunknown_actionunknown_appnot_entitledholder_mismatchrequest_expiredlease_conflict What you can rely on
Recipes
Start with the socket and lease flow on this page. Use a recipe only when a specific runtime needs extra setup.
For local runtimes that actively drive an app: when to begin a lease, renew it, and release it.
Read the runtime guideNew in 2.11
The socket is for keeping busy apps protected. The optional aion:// commands are for broader control: scene changes, protection toggles, list updates, status reads, and window actions. Keep this disabled unless you trust the local tool using it.
Open Aion → Settings → Advanced → External Agent Control / 外部控制 and turn on the toggle. The switch is off by default.
Use open "aion://..." in a shell, or call NSWorkspace.shared.open(url) from Swift/Objective-C. Commands take effect immediately on the main thread.
open "aion://scene/activate?name=Coding" ~/.aion_status.json is refreshed by the status command and relevant status requests. Lease commands return through the Unix socket and do not depend on this file.
~/.aion_status.json URL Command Reference
aion://scene/activate?name=Coding Activate a scene by name aion://scene/activate?id=<uuid> Activate a scene by UUID aion://scene/deactivate Return to Standard Mode aion://scene/toggle Toggle active scene on/off aion://protect/video?on=true Toggle Full-Screen Video Lock aion://protect/smart-guards?on=false Toggle Smart Guards auto-quit protection aion://protect/focus-sync?on=true Toggle macOS Focus Mode sync aion://protect/instant?on=true Toggle Instant Task protection (Use & Go) aion://protect/clean-now Trigger an immediate idle app cleanup pass aion://blacklist/add?bundleId=com.apple.Safari Add app to blacklist (fast-quit target) aion://blacklist/remove?bundleId=com.apple.Safari Remove app from blacklist aion://blacklist/toggle?bundleId=<id> Toggle blacklist membership aion://whitelist/add?bundleId=com.apple.dt.Xcode Add app to whitelist (always keep running) aion://whitelist/remove?bundleId=com.apple.dt.Xcode Remove app from whitelist aion://whitelist/toggle?bundleId=<id> Toggle whitelist membership aion://ui/popover Open/close the menu bar HUD popover aion://ui/settings?tab=blacklist Open Settings to a specific tab aion://ui/history Open Activity History window aion://status Write current state to ~/.aion_status.json Status JSON
activeScene — Name of the currently active scene (or "Standard Mode")scenes — Array of all scenes with id and display nameprotections.autoQuit — Whether Auto-Quit is enabledprotections.fullScreenVideoLock — Whether Full-Screen Video Lock is enabledprotections.smartGuards — Whether Smart Guards protection is enabledprotections.focusIntegration — Whether macOS Focus sync is enabledprotections.instantTask — Whether Instant Task protection is enabledblacklist — Array of blacklisted bundle IDswhitelist — Array of whitelisted (kept-running) bundle IDsaiLeases — Active AI protection leases (keyed by app bundle ID)demoModeActive — Whether Demo Mode is currently activeversion — Current Aion app versionExample
{
"activeScene": "Coding",
"aiLeases": {
"com.google.Chrome": {
"holderId": "aion.cli",
"leaseUntil": "<ISO-8601 timestamp>",
"status": "active"
}
},
"blacklist": ["com.apple.Safari"],
"demoModeActive": false,
"protections": {
"autoQuit": true,
"focusIntegration": true,
"fullScreenVideoLock": true,
"instantTask": true,
"smartGuards": true
},
"scenes": [
{ "id": "...", "name": "Coding" },
{ "id": "...", "name": "Meeting" }
],
"version": "<current-version>",
"whitelist": ["com.apple.finder", "com.apple.dt.Xcode"]
} CLI Helper
The Aion project includes Scripts/aion-cli.sh. Lease commands use Aion's local Unix socket and return directly; other supported commands use the opt-in aion:// URL scheme. The status JSON file is refreshed only by the status command and relevant status requests.
The holder-less begin/end examples work across separate invocations because the CLI uses the stable default holder aion.cli. Pass an explicit holder when separate agents need isolated lease ownership.
./Scripts/aion lease begin com.google.Chrome 600 ./Scripts/aion lease end com.google.Chrome ./Scripts/aion lease list ./Scripts/aion scene activate "Coding" ./Scripts/aion protect video on ./Scripts/aion blacklist add com.apple.Safari ./Scripts/aion status FAQ
Only local scripts, agents, or automation tools that actively use an app need this integration. Normal Aion setup belongs in the user guide.
No. The documented transport is a same-user Unix domain socket on the Mac running Aion.
No. External Agent Control is off by default and must be enabled in Settings → Advanced before a trusted local tool can use it.
No. Lease commands return through the Unix socket. The status command refreshes ~/.aion_status.json when a snapshot is needed.
If you are connecting a local automation tool and this guide does not cover your case, email the use case and the message flow you need. For normal setup questions, the user guide is still the faster path.