/operators:remote-codex-execfrom operators
Steer a detached Codex CLI on a remote machine over ssh, typically a Mac with a GUI session, for computer use, screen capture, browser and GUI automation that cannot be driven over ssh. Use when asked to run remote codex, launch codex exec detached on another box, do screen or browser work on a Mac, or hand a long task to a bigger machine.
Ships in operators. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Do not drive a remote screen over ssh. ssh into the machine, start a detached
codex exec process with a written brief, and steer it like any other CLI
agent: launch, watch the log, read the report, resume for follow-ups.
Placeholders: <mac> is the ssh host alias of the remote machine, <workdir>
is a directory on the remote (for example ~/jobs/task-1). Keep real
hostnames, IPs and account names out of anything you commit.
Write the brief locally, then copy it into the per-run workdir (never a shared
/tmp/brief.md: concurrent jobs would overwrite each other). Use an absolute
<workdir>; every remote path below is double-quoted inside the single-quoted
ssh command, so a workdir with spaces works; neither <workdir> nor <label> may contain ', ", $, or
backticks.
ssh <mac> 'mkdir -p "<workdir>"'
scp brief.md "<mac>:<workdir>/brief-run1-<label>.md"
The brief must end with a report contract and stop conditions:
Report contract:
- Write <workdir>/REPORT-run1-<label>.md when finished or stopped.
- Its first line is exactly `STATUS: DONE` or `STATUS: BLOCKED (<reason>)`.
- Name every deliverable by full path in that report.
Stop conditions:
- Never type passwords.
- If a login is missing, stop and write `LOGIN_REQUIRED` in that report.
- If a macOS permission is missing, stop and write `PERMISSION_REQUIRED: <which>`.
- If macOS demands the account password (for example "Privacy & Security is
trying to modify your system settings"), stop and write
`PASSWORD_REQUIRED: <setting>`.
Do not stop for confirmations inside this brief; stop only for credentials or
out-of-scope actions.
A non-interactive codex exec ends the session whenever the model asks for
confirmation, so the last line above matters. Keep one log per run
(codex-run<N>-<label>.log), brief (brief-run<N>-<label>.md) and report
(REPORT-run<N>-<label>.md); a stale report from an earlier run can never read
as DONE for the current one. Steps 2-4 use run 1 (bump N per run, and edit the
report name in the brief).
Keep secrets out of the brief.
ssh <mac> 'nohup sh -c "cat \"<workdir>/brief-run1-<label>.md\" | codex --dangerously-bypass-approvals-and-sandbox exec --skip-git-repo-check -c model_reasoning_effort=high -C \"<workdir>\" > \"<workdir>/codex-run1-<label>.log\" 2>&1" >/dev/null 2>&1 &'
--yolo is the short alias for --dangerously-bypass-approvals-and-sandbox;
the long flag is what codex exec --help lists on codex-cli 0.154. Always pass
-c model_reasoning_effort=high: without it the run came out at effort low.
A process started from ssh has no macOS TCC permissions (Screen Recording, Accessibility). Symptoms: ffmpeg screen capture returns an input error, and Codex's computer-use helper fails with "native pipe startup failed". Launch inside the Mac's login session instead.
Write <workdir>/run.command (zsh, same pipeline), make it executable, open it
with Terminal:
ssh <mac> 'cat > "<workdir>/run.command"' <<'SCRIPT'
#!/bin/zsh
cat "<workdir>/brief-run1-<label>.md" | codex --dangerously-bypass-approvals-and-sandbox exec --skip-git-repo-check -c model_reasoning_effort=high -C "<workdir>" > "<workdir>/codex-run1-<label>.log" 2>&1
SCRIPT
ssh <mac> 'chmod +x "<workdir>/run.command" && open -a Terminal "<workdir>/run.command"'
Terminal is the TCC principal, but launching from Terminal is not enough on
its own. Validated on a first GUI run: the codex still reported
PERMISSION_REQUIRED: Screen Recording (ffmpeg avfoundation "cannot configure
display capture", screencapture "could not create image from display") and
the computer-use helper failed with "Sky Computer Use native pipe startup
failed".
Before the first GUI run, the human must grant Terminal both Screen Recording and Accessibility under System Settings, Privacy & Security, plus any Codex/ChatGPT helper that appears in those lists. On macOS 26 the pane is named "Screen & System Audio Recording", a separate entry from Accessibility; grant both. If the machine is remote, do this through a screen-sharing client. The permission prompt may or may not appear automatically, so open the panes by hand if it does not. After that every future run inherits the grants.
When a computer-use agent toggles a principal in that pane, macOS can demand the
account password. The agent must stop with PASSWORD_REQUIRED: <setting>
(never type it); expect a human tap via screen sharing, then resume.
ssh <mac> 'd=$(mktemp -d) && cat > "$d/c.command" <<EOF
#!/bin/zsh
screencapture -x "$d/c.png" && echo CAPTURE_OK > "$d/r.txt" || echo CAPTURE_DENIED > "$d/r.txt"
EOF
chmod +x "$d/c.command"; open -a Terminal "$d/c.command"; sleep 5; cat "$d/r.txt"; rm -rf "$d"'
Dispatch the GUI task only on CAPTURE_OK. On CAPTURE_DENIED (or no output),
stop and ask the human to grant the permissions above, then re-run the check.
ssh <mac> 'pgrep -fl "codex.*exec"; tail -n 20 "<workdir>/codex-run1-<label>.log"; head -1 "<workdir>/REPORT-run1-<label>.md"'
Poll every 20-30 s from a background task, not in a foreground loop. The log
prints session id: <uuid> near the top. Continue the same session for a
follow-up directive with codex exec resume <id> (same cwd rule as the local
codex-implement skill: run it from the original working directory).
Extract the id from the previous run's log BEFORE truncating or overwriting it,
and never run : > codex.log before that copy:
ssh <mac> 'grep -m1 "session id:" "<workdir>/codex-run1-<label>.log"'
An EMPTY id is dangerous: codex exec resume with no id silently starts a NEW
session whose only context is the directive. Check the id is non-empty before
resuming. Write the next run to a fresh log (codex-run2-<label>.log).
When you resume to answer a confirmation the previous run stopped on, re-state the remaining steps in the directive; the resumed run should not be assumed to carry the plan forward.
When head -1 of the current run's report shows STATUS: DONE, bring deliverables back:
scp "<mac>:<workdir>/<deliverable>" ./
On LOGIN_REQUIRED or PERMISSION_REQUIRED: <which>, ask the human to fix it,
then relaunch or resume.
pkill -f inside an ssh one-liner can match its own command line. Use a
bracket trick: pkill -f 'chrome-cd[p]'.ssh <mac> who.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub claudes-world/plugins --plugin operators2 skills in this plugin