| name | Antigravity Remote Control Loop |
| description | Instructs the agent how to poll for remote commands, execute them, stream real-time logs, and query for approvals via the mobile phone dashboard. |
Antigravity Remote Control Loop
When this skill is loaded, the agent participates in the remote command and confirmation loop with the FastAPI mobile server.
Execution Sequence
0. Check Remote Mode Toggle
Before starting, read remote_mode.json in the workspace root.
- If
"enabled": false: Do NOT run the remote control loop. Stop here and run standard workspace actions normally.
- If
"enabled": true (or if the file is missing): Proceed with the remote control sequence below.
1. Check for Active Remote Prompt
When waking up, check if a file named remote_prompt.json exists in the workspace root.
-
If it exists:
- Read the JSON content (which contains
id, prompt, and token).
- Overwrite
remote_prompt.json with {} to clear it.
- Treat the
prompt value as the primary user request for this turn.
- Write the current starting state to
agent_status.json:
{"status": "working", "task": "Starting task execution..."}
- Initialize
agent_execution.log with the initial start log:
[12:00:00] Starting remote task: "[Prompt]"
- Perform the requested task (creating files, editing code, running scripts).
- Whenever you perform a step (e.g. searching, writing a file, or running a test), update
agent_status.json with the current task and append a progress line to agent_execution.log using write_to_file so the mobile user can monitor your progress in real-time.
- If you need to execute any terminal command or modify files that require confirmation, use the silent file-based approval protocol to avoid PC desktop popups:
- Write the request to
agent_approval_request.json in the workspace root:
{"type": "command", "target": "<command or action>"}
- Wait and poll the workspace for the response file
agent_approval_response.json (check every 1.5 seconds, up to a timeout of 300 seconds).
- If
agent_approval_response.json is detected:
- Read the content (e.g.
{"status": "approved"} or {"status": "rejected"}).
- Delete the response file
agent_approval_response.json.
- If approved, proceed to execute the command/action.
- If rejected, skip the action and report that the user rejected it on their mobile phone.
- If the server is offline or the file-based handshake fails, run the CLI helper fallback (which may prompt on the desktop):
python -m antigravity_remote.agent_approve --type command --target "<command or action>"
- If it exits with code
0 (APPROVED), proceed.
- If it exits with code
1 (REJECTED), skip the action and report rejection.
- If it exits with code
2 (TIMEOUT), report timeout.
- If it exits with code
3 (OFFLINE), bypass the helper and run the command directly (this will prompt on the desktop).
- Once the task is finished, post the final response to the server. To avoid executing shell commands, write the response directly to
agent_response.json in the workspace:
{
"status": "completed",
"output": "Completed successfully: [Brief description of what was done]"
}
The running FastAPI server will automatically pick up this file, update the server prompt state, and delete the file.
- Update
agent_status.json to:
{"status": "idle", "task": ""}
- Start the daemon listener again (see Step 2) and end your turn.
-
If it does NOT exist:
- The agent is idle. Start the daemon listener to wait for new remote prompts.
2. Spawning the Daemon Listener
To listen for new remote prompts while you are idle, run the daemon script in the background:
antigravity-mobile daemon
Note: If antigravity-mobile is not in the system/user PATH, run python -m antigravity_remote.agent_daemon. Make sure to launch this command in the background (using run_command with high async wait time). Once launched, do not call any more tools and end your turn. The IDE will automatically wake you up when the daemon detects a prompt and exits.