一键导入
codex-subagent
Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Delegate tasks to Google Antigravity CLI (`agy`) running as a subagent. Use this skill whenever the user says "use antigravity", "ask agy", "run this with antigravity", "delegate to agy", wants a second opinion from a different AI model, needs parallel AI execution, or wants to offload an agentic task to a separate process. Antigravity CLI is Google's successor to the Gemini CLI (Gemini CLI's free tier was retired 2026-06-18); it exposes Gemini 3.x, Claude Sonnet/Opus 4.6, and GPT-OSS models behind the single `agy` command. Also trigger when the codebase or files are too large for Claude's context window and Antigravity's large context is needed for full codebase analysis.
Use when the user asks to run Claude Code CLI non-interactively (claude -p, "spawn a claude instance", "delegate to claude", "use a fresh claude context") or when an isolated Claude Code run is needed for parallel work, scoped tool permissions, or a clean-context second pass. Also use when a Codex or Gemini/Antigravity orchestrator needs Claude's capabilities for a subtask — this skill has the exact command patterns.
Delegate tasks to Gemini CLI running as a subagent. Use this skill whenever the user says "use gemini", "ask gemini", "run this with gemini", "delegate to gemini", wants a second opinion from a different AI model, needs parallel AI execution, or wants to offload a long-running agentic task to run in the background while Claude continues working. Also trigger when the user wants to leverage Gemini's built-in Google Search, wants to compare results from two different AI models, or when the codebase or files are too large for Claude's context window and Gemini's massive context is needed for full codebase analysis.
| name | codex-subagent |
| description | Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing |
gpt-5.6-sol with reasoning effort high. Use these for every task unless the user has explicitly specified a different model or reasoning effort (e.g., "use gpt-5.6-luna", "run with effort xhigh"). Only call AskUserQuestion to confirm/collect a non-default choice when the user signals they want one. Available models: gpt-5.6-sol (flagship), gpt-5.6-terra (cheaper everyday), gpt-5.6-luna (fastest), gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.3-codex-spark, gpt-5.3-codex. Available reasoning efforts: xhigh, high, medium, low, minimal (per the official config reference — ultra/max are not valid values). ⚠️ Always pass the explicit tier id (gpt-5.6-sol), never the bare gpt-5.6 alias — the alias is rejected with a 400 ("not supported when using Codex with a ChatGPT account") on ChatGPT-account auth. If a model errors with "requires a newer version of Codex", run codex update first.--sandbox read-only unless edits or network access are necessary.--skip-git-repo-check and the < /dev/null stdin redirect are always required (see Avoiding hangs):
-m, --model <MODEL>--config model_reasoning_effort="<xhigh|high|medium|low>"--sandbox <read-only|workspace-write|danger-full-access> (use --sandbox workspace-write for edits — do not use --full-auto; it is deprecated and prints a warning)-C, --cd <DIR>--skip-git-repo-check (required on every invocation)"your prompt here" (as final positional argument)< /dev/null (redirect stdin — required on every non-resume call; without it the command can hang forever)2>"$ERRLOG" where ERRLOG=$(mktemp) (capture stderr to a file, don't discard it)codex exec --skip-git-repo-check resume --last via stdin. When resuming don't re-pass model/reasoning-effort/sandbox unless the user explicitly wants to switch — they carry over from the original session. Resume syntax: echo "your prompt here" | codex exec --skip-git-repo-check resume --last 2>"$ERRLOG". The echo | pipe supplies EOF, so this form does not need < /dev/null (verified: the piped text is used as the resumed prompt). Flag placement (per codex exec resume --help, signature codex exec resume [OPTIONS] [SESSION_ID] [PROMPT]): session-level flags like --skip-git-repo-check go before resume; resume then takes its own options (--last, --all, -c) and an optional positional prompt. If you use the positional prompt form instead of echo |, it has no piped EOF, so it must add < /dev/null: codex exec --skip-git-repo-check resume --last "your prompt" < /dev/null 2>"$ERRLOG".2>"$ERRLOG") instead of 2>/dev/null. On a clean run the stderr log holds only progress/thinking noise and you ignore it; on a non-zero exit or empty stdout you cat "$ERRLOG" and surface the real error (auth expired, rate limit, network). Blindly appending 2>/dev/null is what makes a failed or hung run look like an unexplained freeze.timeout (see Avoiding hangs), capture stdout and the stderr log, and summarize the outcome for the user.These three habits prevent the two ways a codex exec call "silently freezes" — blocking on stdin, and a hidden error behind 2>/dev/null.
< /dev/null. codex exec reads stdin whenever stdin is not a TTY (to append it as a <stdin> context block). If the harness hands the process an open pipe that never delivers bytes or EOF, read() blocks forever — the run looks frozen and no output ever appears. This is openai/codex issue #20919; the official workaround is exactly codex exec "<prompt>" < /dev/null. The only time you omit < /dev/null is when you are deliberately piping context in (e.g. git diff | codex exec "review this diff" 2>"$ERRLOG") — a real pipe supplies EOF and is safe. Never leave stdin unmanaged.timeout -k. A high-effort gpt-5.6-sol run can take minutes with no visible output. Use timeout -k 10 1200 codex exec … < /dev/null 2>"$ERRLOG": the 1200 sends SIGTERM after 20 min, and -k 10 follows with SIGKILL 10 s later so a process that ignores SIGTERM still dies — the call cannot hang indefinitely. Treat exit 124 as "timed out" (and 137 as "force-killed after the grace period") — report it plainly instead of retrying blindly. Raise the cap for genuinely large tasks; don't remove it. Verified: a timeout even survives command substitution — RESULT=$(timeout -k 10 1200 codex exec …) returns at the cap, not later.$ERRLOG below assumes you ran ERRLOG=$(mktemp) once first — a 2>"$ERRLOG" with ERRLOG unset fails with an empty-filename error and the command never runs, so define it (or substitute 2>/dev/null) when copying a snippet in isolation.Canonical safe invocation:
ERRLOG=$(mktemp)
timeout -k 10 1200 codex exec --skip-git-repo-check --sandbox read-only \
-m gpt-5.6-sol --config model_reasoning_effort="high" \
"your prompt here" < /dev/null 2>"$ERRLOG"
rc=$? # not `status`: that name is read-only in fish/zsh
if [ "$rc" -ne 0 ]; then echo "codex failed (exit $rc):"; cat "$ERRLOG"; fi
rm -f "$ERRLOG"
Every non-resume row assumes the invocation ends with < /dev/null 2>"$ERRLOG" (stdin redirect + captured stderr). --full-auto is deprecated — use --sandbox workspace-write.
| Use case | Sandbox mode | Key flags |
|---|---|---|
| Read-only review or analysis | read-only | --sandbox read-only "prompt" < /dev/null 2>"$ERRLOG" |
| Apply local edits | workspace-write | --sandbox workspace-write "prompt" < /dev/null 2>"$ERRLOG" |
| Permit network or broad access | danger-full-access | --sandbox danger-full-access "prompt" < /dev/null 2>"$ERRLOG" |
| Resume recent session | Inherited from original | echo "prompt" | codex exec --skip-git-repo-check resume --last 2>"$ERRLOG" (don't re-pass model/effort; echo | supplies EOF so no < /dev/null) |
| Run from another directory | Match task needs | -C <DIR> plus other flags, < /dev/null 2>"$ERRLOG" |
| Pipe context in deliberately | Match task needs | git diff | codex exec "review" 2>"$ERRLOG" (real pipe supplies EOF; omit < /dev/null) |
codex command, immediately use AskUserQuestion to confirm next steps, collect clarifications, or decide whether to resume with codex exec resume --last.echo "new prompt" | codex exec resume --last 2>"$ERRLOG". The resumed session automatically uses the same model, reasoning effort, and sandbox mode from the original session.Codex is powered by OpenAI models with their own knowledge cutoffs and limitations. Treat Codex as a colleague, not an authority.
echo "This is Claude (<your current model name>) following up. I disagree with [X] because [evidence]. What's your take on this?" | codex exec --skip-git-repo-check resume --last 2>"$ERRLOG"
codex --version or a codex exec command exits non-zero; request direction before retrying. Always cat "$ERRLOG" first — the real cause (auth expired, rate limit, network, bad flag) is in the captured stderr, not stdout.timeout fired (SIGTERM), and 137 means -k had to SIGKILL a run that ignored SIGTERM. Either way the run was killed, not answered. Report it as a timeout and consider a larger cap or a lower reasoning effort — do not silently retry.< /dev/null was present and check $ERRLOG for Reading additional input from stdin....--sandbox workspace-write, --sandbox danger-full-access, --skip-git-repo-check) ask the user for permission using AskUserQuestion unless it was already given. (--full-auto is deprecated; use --sandbox workspace-write instead.)AskUserQuestion.