[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C32AVYJ24CHQM030ESYKMT":3,"skill-same:01M6C32AVYJ24CHQM030ESYKMT":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":55,"linkOnly":56,"markdownContent":57,"markdownBody":58,"frontMatter":59,"refName":70,"commitSha":71,"skillDirectory":72,"forksCount":73,"repositoryHtmlUrl":74,"repositoryHomepageUrl":6,"ownerHtmlUrl":75,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":76,"install":77,"resources":90},"01M6C32AVYJ24CHQM030ESYKMT","codex-exec-pitfalls",null,"Pitfalls when using `codex exec` to drive a third-party CLI tool, skill, plugin, or workflow\n(NOT for using Codex as a coding agent — see the bundled `codex` skill for that).\nClass-level skill. Triggers when the task involves driving any external tool via `codex exec`,\nespecially when: (a) the tool needs an env var to gate a network call or feature flag,\n(b) the tool needs stdin to receive a secret or code, (c) the agent must follow a multi-phase\nprotocol (preflight → enroll → hand-off → poll), or (d) you want the agent to run scripts\nthat you could just as easily run yourself.\n\nAnti-trigger: pure coding tasks (\"add dark mode\", \"fix this bug\") → use the bundled `codex` skill.\nAnti-trigger: one-shot shell commands you can run directly → skip `codex exec` entirely.","jleechanorg\u002Fjleechan-skills","jleechanorg","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F221404966?v=4","01M6C1VJ99XG950X1DWPEBCBGX","01M6C1VJDK5YVDNT3362RT5WSB",6,"MIT","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002Fhermes\u002Fskills\u002Fautonomous-ai-agents\u002Fcodex-exec-pitfalls\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],"codex","codex exec","codex exec pitfalls","exec","pitfalls","hand","fix","use","build plugin","end","you","just","mode","login","scrub","phase","when","cli","coding","direct","tool","preflight","shell","network","cloud","protocol","code","run","tasks","plugin","workflow","coding agent","2026-11-10 10:12:30",false,"---\nname: codex-exec-pitfalls\nversion: 1.0.0\ndescription: |\n  Pitfalls when using `codex exec` to drive a third-party CLI tool, skill, plugin, or workflow\n  (NOT for using Codex as a coding agent — see the bundled `codex` skill for that).\n  Class-level skill. Triggers when the task involves driving any external tool via `codex exec`,\n  especially when: (a) the tool needs an env var to gate a network call or feature flag,\n  (b) the tool needs stdin to receive a secret or code, (c) the agent must follow a multi-phase\n  protocol (preflight → enroll → hand-off → poll), or (d) you want the agent to run scripts\n  that you could just as easily run yourself.\n  \n  Anti-trigger: pure coding tasks (\"add dark mode\", \"fix this bug\") → use the bundled `codex` skill.\n  Anti-trigger: one-shot shell commands you can run directly → skip `codex exec` entirely.\n\nmetadata:\n  hermes:\n    tags: [codex, codex-exec, pitfalls, env-scrub, login-shell, gate]\n    verified: 2026-07-16 (Cloud Build plugin via codex exec — 3 runs, 2 gate fires, 1 successful end-to-end via direct-script path)\n---\n\n# Codex exec pitfalls\n\n`codex exec` is a useful primitive for letting an LLM agent drive an external tool, but it has several gotchas that bite in non-obvious ways. This skill encodes the lessons from driving a third-party plugin (Cloud Build) via `codex exec`, plus the generalizable patterns.\n\n## Pitfall 1 — `bash -lc` login-shell env scrub (THE big one)\n\n**Symptom:** you set an env var in the outer process that launches `codex exec` (or via `-c env={...}` on the codex CLI), but the agent's bash subprocess cannot see it. The tool the agent runs reports \"env var not set\" or returns a gate failure.\n\n**Cause:** `codex exec` runs every shell command as `bash -lc '\u003Ccmd>'` — a login shell that re-sources `~\u002F.bash_profile`\u002F`~\u002F.profile`\u002F`~\u002F.bashrc`. Two specific paths that DO NOT propagate env vars to the agent's bash:\n\n1. **Outer-process env vars:** Python `subprocess.run([\"codex\", \"exec\", ...], env={\"FOO\": \"1\"})` — the `env=...` dict is set on the codex subprocess but is NOT inherited by the agent's `bash -lc` shell. The login shell starts from a fresh env table, re-sources profile scripts, and only keeps vars those scripts export.\n2. **`-c 'env={\"FOO\":\"1\"}'` config layer on the codex CLI:** this adds to codex's own config (model selection, sandbox settings) but does NOT add to the agent's bash env.\n\n**Verified:** 2026-07-16, Cloud Build plugin. Setting `CLOUD_HERMETIC_CONFIRMED=1` via both methods above had no effect — the cloud-build skill's `preflight-local.sh` still reported `preflight FAIL: set CLOUD_HERMETIC_CONFIRMED=1`.\n\n**Workarounds (in priority order):**\n\n1. **Have the agent export the var in its own prompt.** Add to the prompt: \"Env var `FOO=1` is required. Run `export FOO=1` before any other commands.\" The agent will run the export first; the var persists for the rest of the session because `bash -lc` evaluates each command in the same shell session.\n2. **Drive the underlying tool directly from your gateway.** If the env var is gating a network call (SSH enrollment, API auth, etc.), the most reliable path is to invoke the underlying scripts yourself rather than asking the agent. Example: `bash scripts\u002Fpreflight-local.sh \u003Cdir> \u003Cplan>` → `bash scripts\u002Fcb-client-setup.sh` (with code on stdin) → `bash scripts\u002Flib-client.sh cloud_build_handoff ...`. This bypasses Codex's bash-scrub entirely.\n3. **Add a `~\u002F.bash_profile.d\u002F` shim that re-exports your vars.** Heavy-handed; only do this for session-wide defaults.\n\n**How to verify:** at the top of the agent's prompt, ask it to run `echo \"FOO=$FOO\"` and report the value. If it's empty, the env scrub is biting. Don't waste time debugging downstream tools before confirming the var is actually visible.\n\n## Pitfall 2 — Code on stdin can be hard to inject\n\n**Symptom:** the tool requires a secret\u002Fcode on stdin (an enrollment code, an OAuth code, a one-time password), but `codex exec` doesn't expose a clean stdin injection point. Your first runs end with the agent saying \"I tried to pipe the code in but couldn't\" or the tool hanging on `read -r` because stdin is the terminal, not the pipe.\n\n**Cause:** `codex exec` doesn't have a `--stdin \u003Cfile>` flag. The agent either types the code into its prompt (then has to pipe it through `printf` etc.) or `bash -lc` consumes stdin in unexpected ways.\n\n**Workarounds:**\n\n1. **Append the code to the prompt as a `\u003Cstdin>` block.** Codex automatically reads stdin and appends it as a `\u003Cstdin>` block in the user message. The agent can then run `printf '%s\\n' '\u003Ccode>' | bash setup.sh`.\n2. **Have the agent write the code to a temp file**, then `bash setup.sh \u003C temp_file` — works but creates a small attack surface (code persists in `\u002Ftmp`).\n3. **Drive the tool directly from your gateway** (recommended for sensitive one-time codes). Pass the code on your own subprocess stdin.\n\n**Verified:** 2026-07-16, Cloud Build enrollment. Codex appended the code correctly and the agent successfully ran `printf '\u003Ccode>' | bash scripts\u002Fcb-client-setup.sh`.\n\n## Pitfall 3 — Multi-phase protocols need explicit phase boundaries in the prompt\n\n**Symptom:** the tool has a multi-phase protocol (preflight → enroll → hand-off → poll → land) and the agent burns tokens re-reading the SKILL.md, gets confused about which phase it's in, or skips phases entirely.\n\n**Cause:** the SKILL.md is usually verbose (8-15 KB). The agent reads it, summarizes it, then loses the exact phase ordering.\n\n**Workarounds:**\n\n1. **Restate the phases explicitly in the prompt** as a numbered list. Example: \"Follow these phases in order: Phase 1: preflight. Phase 2: enroll. Phase 3: hand-off. Phase 4: poll. Phase 5: stop after first poll.\" The agent treats the prompt as authoritative.\n2. **Set a clear stop condition** — e.g. \"After the first successful poll, print the full status JSON and stop. Do not poll again.\" Without this, the agent will loop indefinitely to \"be thorough.\"\n3. **Reference the SKILL.md by section, not whole document** — \"Follow section 3 of `skills\u002Fcloud-build\u002FSKILL.md` for the handoff, then section 4 for the follow loop. Skip section 5 (abort) and section 6 (land) — I'll do those.\"\n\n## Pitfall 4 — Long sessions burn budget on redundant work\n\n**Symptom:** `codex exec` runs for 30+ tool calls but the actual progress is 2-3 substantive operations. The token usage report shows 28k+ tokens for what should have been a 5-step flow.\n\n**Cause:** the agent reads the SKILL.md multiple times (once per phase), re-lists the project files each time, and re-explains what it's about to do before each command.\n\n**Workarounds:**\n\n1. **Use `--ephemeral`** to skip session file writes — won't help with token burn but reduces disk noise.\n2. **Drive the underlying tool yourself.** If your gateway can run the same scripts the agent would (and you can verify the output), skip `codex exec` entirely. The session in question drove the cloud-build library directly for the final run, after 3 codex-exec attempts burned 28k+ tokens each.\n3. **Tell the agent explicitly \"Do not re-read SKILL.md after Phase 1\"** — sometimes works, often doesn't.\n\n## Pitfall 5 — Codex without `--dangerously-bypass-approvals-and-sandbox` will refuse most tool calls\n\n**Symptom:** `codex exec \"do X\"` returns immediately with \"approval required for: \u003Ccommand>\" without running anything. The agent loop never gets past the first action.\n\n**Cause:** Codex defaults to a sandbox that requires approval for each shell command. Non-interactive runs have no human to approve.\n\n**Workarounds:**\n\n1. **Use `--dangerously-bypass-approvals-and-sandbox` and `-s danger-full-access`** for fully-automated workflows. The `-s` flag sets the sandbox mode; `--dangerously-bypass-approvals-and-sandbox` skips the per-command approval prompt. Both are required for headless automation.\n2. **Read the run in your terminal instead** with `codex` (interactive TUI) — for debugging only, not for automation.\n\n**Verified:** 2026-07-16 — without these flags, every codex exec call returned immediately with approval errors.\n\n## Pitfall 6 — ChatGPT account model restriction\n\n**Symptom:** `codex exec -m gpt-5 ...` returns `ERROR: The 'gpt-5' model is not supported when using Codex with a ChatGPT account.`\n\n**Cause:** Codex authenticated via ChatGPT (not OpenAI API key) has a restricted model set. `gpt-5` may be API-only.\n\n**Workarounds:**\n\n1. **Drop the `-m` flag** — let Codex pick the default. The default usually works for ChatGPT accounts.\n2. **Use `-m gpt-4o` or `-m o3`** for ChatGPT-authenticated runs.\n3. **Re-authenticate Codex with an OpenAI API key** (`codex auth login`) for full model access.\n\n## Pitfall 7 — Codex on a non-git directory refuses to start\n\n**Symptom:** `codex exec ...` fails with \"Not inside a trusted directory\" or \"directory is not a git repo.\"\n\n**Cause:** Codex's sandbox requires the workdir to be a git repo. Bare `\u002Ftmp\u002Ffoo` won't work.\n\n**Workarounds:**\n\n1. **`cd $(mktemp -d) && git init -q && codex exec ...`** — create a throwaway git repo for scratch work.\n2. **`--skip-git-repo-check`** — bypasses the check but the agent may still complain about file operations.\n\n## When to skip `codex exec` and drive the tool yourself\n\n`codex exec` adds value when:\n- The tool's protocol is poorly documented and the agent can read the source to figure it out\n- The user wants the agent to make judgment calls (which test to run, which file to inspect)\n- You want the agent to handle errors gracefully and decide whether to retry or fail\n\nSkip `codex exec` when:\n- The protocol is documented and deterministic (the cloud-build library is a good example — all scripts have well-defined inputs\u002Foutputs)\n- The user wants proof the tool works, not proof the agent can figure it out\n- Token cost matters (driving scripts directly uses 0 tokens)\n- You need to inject secrets via stdin or env vars and Pitfalls 1+2 would both bite\n\n**Rule of thumb:** if you can describe the entire flow as a 10-line bash one-liner, run it yourself. Use `codex exec` when the flow needs LLM judgment between steps.\n\n## Reference: full env-scrub diagnostic\n\nIf you suspect the env-scrub is biting:\n\n```bash\n# Ask the agent to verify env vars\nprompt = \"\"\"At the START of the session, before doing anything else, run:\n   echo \"FOO=${FOO:-UNSET}\"\n   echo \"BAR=${BAR:-UNSET}\"\nReport the exact output. If either is UNSET, the env scrub is biting — do NOT proceed.\"\"\"\n\n# Or drive the tool yourself from your gateway\nimport os, subprocess\nenv = os.environ.copy()\nenv[\"FOO\"] = \"1\"\nenv[\"BAR\"] = \"bar_value\"\nr = subprocess.run([\"bash\", \"-lc\", f\"cd {tool_dir} && bash {script} '{arg}'\"],\n                   env=env, capture_output=True, text=True, timeout=120)\nprint(r.stdout)\n```\n\nIf the bash -lc path works from your gateway but doesn't work via the agent, you've confirmed the env-scrub is biting. Switch to direct-script driving.\n\n## Pairing with other skills\n\n- **`evidence-attach-to-slack`** — when the run produced a binary artifact (MP4, screenshot, log) that needs to land in the user's Slack thread.\n- **`autonomous-ai-agents\u002Fcodex`** — bundled coding-agent Codex skill (different scope; this skill covers Codex-as-driver, not Codex-as-coder).\n- **`dispatch-task`** — for AO-based dispatch instead of `codex exec` (when you need a full git worktree + branch + PR lifecycle).","# Codex exec pitfalls\n\n`codex exec` is a useful primitive for letting an LLM agent drive an external tool, but it has several gotchas that bite in non-obvious ways. This skill encodes the lessons from driving a third-party plugin (Cloud Build) via `codex exec`, plus the generalizable patterns.\n\n## Pitfall 1 — `bash -lc` login-shell env scrub (THE big one)\n\n**Symptom:** you set an env var in the outer process that launches `codex exec` (or via `-c env={...}` on the codex CLI), but the agent's bash subprocess cannot see it. The tool the agent runs reports \"env var not set\" or returns a gate failure.\n\n**Cause:** `codex exec` runs every shell command as `bash -lc '\u003Ccmd>'` — a login shell that re-sources `~\u002F.bash_profile`\u002F`~\u002F.profile`\u002F`~\u002F.bashrc`. Two specific paths that DO NOT propagate env vars to the agent's bash:\n\n1. **Outer-process env vars:** Python `subprocess.run([\"codex\", \"exec\", ...], env={\"FOO\": \"1\"})` — the `env=...` dict is set on the codex subprocess but is NOT inherited by the agent's `bash -lc` shell. The login shell starts from a fresh env table, re-sources profile scripts, and only keeps vars those scripts export.\n2. **`-c 'env={\"FOO\":\"1\"}'` config layer on the codex CLI:** this adds to codex's own config (model selection, sandbox settings) but does NOT add to the agent's bash env.\n\n**Verified:** 2026-07-16, Cloud Build plugin. Setting `CLOUD_HERMETIC_CONFIRMED=1` via both methods above had no effect — the cloud-build skill's `preflight-local.sh` still reported `preflight FAIL: set CLOUD_HERMETIC_CONFIRMED=1`.\n\n**Workarounds (in priority order):**\n\n1. **Have the agent export the var in its own prompt.** Add to the prompt: \"Env var `FOO=1` is required. Run `export FOO=1` before any other commands.\" The agent will run the export first; the var persists for the rest of the session because `bash -lc` evaluates each command in the same shell session.\n2. **Drive the underlying tool directly from your gateway.** If the env var is gating a network call (SSH enrollment, API auth, etc.), the most reliable path is to invoke the underlying scripts yourself rather than asking the agent. Example: `bash scripts\u002Fpreflight-local.sh \u003Cdir> \u003Cplan>` → `bash scripts\u002Fcb-client-setup.sh` (with code on stdin) → `bash scripts\u002Flib-client.sh cloud_build_handoff ...`. This bypasses Codex's bash-scrub entirely.\n3. **Add a `~\u002F.bash_profile.d\u002F` shim that re-exports your vars.** Heavy-handed; only do this for session-wide defaults.\n\n**How to verify:** at the top of the agent's prompt, ask it to run `echo \"FOO=$FOO\"` and report the value. If it's empty, the env scrub is biting. Don't waste time debugging downstream tools before confirming the var is actually visible.\n\n## Pitfall 2 — Code on stdin can be hard to inject\n\n**Symptom:** the tool requires a secret\u002Fcode on stdin (an enrollment code, an OAuth code, a one-time password), but `codex exec` doesn't expose a clean stdin injection point. Your first runs end with the agent saying \"I tried to pipe the code in but couldn't\" or the tool hanging on `read -r` because stdin is the terminal, not the pipe.\n\n**Cause:** `codex exec` doesn't have a `--stdin \u003Cfile>` flag. The agent either types the code into its prompt (then has to pipe it through `printf` etc.) or `bash -lc` consumes stdin in unexpected ways.\n\n**Workarounds:**\n\n1. **Append the code to the prompt as a `\u003Cstdin>` block.** Codex automatically reads stdin and appends it as a `\u003Cstdin>` block in the user message. The agent can then run `printf '%s\\n' '\u003Ccode>' | bash setup.sh`.\n2. **Have the agent write the code to a temp file**, then `bash setup.sh \u003C temp_file` — works but creates a small attack surface (code persists in `\u002Ftmp`).\n3. **Drive the tool directly from your gateway** (recommended for sensitive one-time codes). Pass the code on your own subprocess stdin.\n\n**Verified:** 2026-07-16, Cloud Build enrollment. Codex appended the code correctly and the agent successfully ran `printf '\u003Ccode>' | bash scripts\u002Fcb-client-setup.sh`.\n\n## Pitfall 3 — Multi-phase protocols need explicit phase boundaries in the prompt\n\n**Symptom:** the tool has a multi-phase protocol (preflight → enroll → hand-off → poll → land) and the agent burns tokens re-reading the SKILL.md, gets confused about which phase it's in, or skips phases entirely.\n\n**Cause:** the SKILL.md is usually verbose (8-15 KB). The agent reads it, summarizes it, then loses the exact phase ordering.\n\n**Workarounds:**\n\n1. **Restate the phases explicitly in the prompt** as a numbered list. Example: \"Follow these phases in order: Phase 1: preflight. Phase 2: enroll. Phase 3: hand-off. Phase 4: poll. Phase 5: stop after first poll.\" The agent treats the prompt as authoritative.\n2. **Set a clear stop condition** — e.g. \"After the first successful poll, print the full status JSON and stop. Do not poll again.\" Without this, the agent will loop indefinitely to \"be thorough.\"\n3. **Reference the SKILL.md by section, not whole document** — \"Follow section 3 of `skills\u002Fcloud-build\u002FSKILL.md` for the handoff, then section 4 for the follow loop. Skip section 5 (abort) and section 6 (land) — I'll do those.\"\n\n## Pitfall 4 — Long sessions burn budget on redundant work\n\n**Symptom:** `codex exec` runs for 30+ tool calls but the actual progress is 2-3 substantive operations. The token usage report shows 28k+ tokens for what should have been a 5-step flow.\n\n**Cause:** the agent reads the SKILL.md multiple times (once per phase), re-lists the project files each time, and re-explains what it's about to do before each command.\n\n**Workarounds:**\n\n1. **Use `--ephemeral`** to skip session file writes — won't help with token burn but reduces disk noise.\n2. **Drive the underlying tool yourself.** If your gateway can run the same scripts the agent would (and you can verify the output), skip `codex exec` entirely. The session in question drove the cloud-build library directly for the final run, after 3 codex-exec attempts burned 28k+ tokens each.\n3. **Tell the agent explicitly \"Do not re-read SKILL.md after Phase 1\"** — sometimes works, often doesn't.\n\n## Pitfall 5 — Codex without `--dangerously-bypass-approvals-and-sandbox` will refuse most tool calls\n\n**Symptom:** `codex exec \"do X\"` returns immediately with \"approval required for: \u003Ccommand>\" without running anything. The agent loop never gets past the first action.\n\n**Cause:** Codex defaults to a sandbox that requires approval for each shell command. Non-interactive runs have no human to approve.\n\n**Workarounds:**\n\n1. **Use `--dangerously-bypass-approvals-and-sandbox` and `-s danger-full-access`** for fully-automated workflows. The `-s` flag sets the sandbox mode; `--dangerously-bypass-approvals-and-sandbox` skips the per-command approval prompt. Both are required for headless automation.\n2. **Read the run in your terminal instead** with `codex` (interactive TUI) — for debugging only, not for automation.\n\n**Verified:** 2026-07-16 — without these flags, every codex exec call returned immediately with approval errors.\n\n## Pitfall 6 — ChatGPT account model restriction\n\n**Symptom:** `codex exec -m gpt-5 ...` returns `ERROR: The 'gpt-5' model is not supported when using Codex with a ChatGPT account.`\n\n**Cause:** Codex authenticated via ChatGPT (not OpenAI API key) has a restricted model set. `gpt-5` may be API-only.\n\n**Workarounds:**\n\n1. **Drop the `-m` flag** — let Codex pick the default. The default usually works for ChatGPT accounts.\n2. **Use `-m gpt-4o` or `-m o3`** for ChatGPT-authenticated runs.\n3. **Re-authenticate Codex with an OpenAI API key** (`codex auth login`) for full model access.\n\n## Pitfall 7 — Codex on a non-git directory refuses to start\n\n**Symptom:** `codex exec ...` fails with \"Not inside a trusted directory\" or \"directory is not a git repo.\"\n\n**Cause:** Codex's sandbox requires the workdir to be a git repo. Bare `\u002Ftmp\u002Ffoo` won't work.\n\n**Workarounds:**\n\n1. **`cd $(mktemp -d) && git init -q && codex exec ...`** — create a throwaway git repo for scratch work.\n2. **`--skip-git-repo-check`** — bypasses the check but the agent may still complain about file operations.\n\n## When to skip `codex exec` and drive the tool yourself\n\n`codex exec` adds value when:\n- The tool's protocol is poorly documented and the agent can read the source to figure it out\n- The user wants the agent to make judgment calls (which test to run, which file to inspect)\n- You want the agent to handle errors gracefully and decide whether to retry or fail\n\nSkip `codex exec` when:\n- The protocol is documented and deterministic (the cloud-build library is a good example — all scripts have well-defined inputs\u002Foutputs)\n- The user wants proof the tool works, not proof the agent can figure it out\n- Token cost matters (driving scripts directly uses 0 tokens)\n- You need to inject secrets via stdin or env vars and Pitfalls 1+2 would both bite\n\n**Rule of thumb:** if you can describe the entire flow as a 10-line bash one-liner, run it yourself. Use `codex exec` when the flow needs LLM judgment between steps.\n\n## Reference: full env-scrub diagnostic\n\nIf you suspect the env-scrub is biting:\n\n```bash\n# Ask the agent to verify env vars\nprompt = \"\"\"At the START of the session, before doing anything else, run:\n   echo \"FOO=${FOO:-UNSET}\"\n   echo \"BAR=${BAR:-UNSET}\"\nReport the exact output. If either is UNSET, the env scrub is biting — do NOT proceed.\"\"\"\n\n# Or drive the tool yourself from your gateway\nimport os, subprocess\nenv = os.environ.copy()\nenv[\"FOO\"] = \"1\"\nenv[\"BAR\"] = \"bar_value\"\nr = subprocess.run([\"bash\", \"-lc\", f\"cd {tool_dir} && bash {script} '{arg}'\"],\n                   env=env, capture_output=True, text=True, timeout=120)\nprint(r.stdout)\n```\n\nIf the bash -lc path works from your gateway but doesn't work via the agent, you've confirmed the env-scrub is biting. Switch to direct-script driving.\n\n## Pairing with other skills\n\n- **`evidence-attach-to-slack`** — when the run produced a binary artifact (MP4, screenshot, log) that needs to land in the user's Slack thread.\n- **`autonomous-ai-agents\u002Fcodex`** — bundled coding-agent Codex skill (different scope; this skill covers Codex-as-driver, not Codex-as-coder).\n- **`dispatch-task`** — for AO-based dispatch instead of `codex exec` (when you need a full git worktree + branch + PR lifecycle).",{"name":5,"version":60,"metadata":61,"description":69},"1.0.0",{"hermes":62},{"tags":63,"verified":68},[23,64,27,65,66,67],"codex-exec","env-scrub","login-shell","gate","2026-07-16 (Cloud Build plugin via codex exec — 3 runs, 2 gate fires, 1 successful end-to-end via direct-script path)","Pitfalls when using `codex exec` to drive a third-party CLI tool, skill, plugin, or workflow\n(NOT for using Codex as a coding agent — see the bundled `codex` skill for that).\nClass-level skill. Triggers when the task involves driving any external tool via `codex exec`,\nespecially when: (a) the tool needs an env var to gate a network call or feature flag,\n(b) the tool needs stdin to receive a secret or code, (c) the agent must follow a multi-phase\nprotocol (preflight → enroll → hand-off → poll), or (d) you want the agent to run scripts\nthat you could just as easily run yourself.\n\nAnti-trigger: pure coding tasks (\"add dark mode\", \"fix this bug\") → use the bundled `codex` skill.\nAnti-trigger: one-shot shell commands you can run directly → skip `codex exec` entirely.\n","main","42ccd02cbf5e8e47839dc3eab6fc754dc6b339cf","hermes\u002Fskills\u002Fautonomous-ai-agents\u002Fcodex-exec-pitfalls",0,"https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills","https:\u002F\u002Fgithub.com\u002Fjleechanorg","2026-11-14 14:55:35",{"source":8,"skillName":5,"commands":78,"prompt":88,"zipAvailable":89},[79,82,85],{"tool":80,"command":81},"npx","npx skills add jleechanorg\u002Fjleechan-skills --skill codex-exec-pitfalls",{"tool":83,"command":84},"bunx","bunx skills add jleechanorg\u002Fjleechan-skills --skill codex-exec-pitfalls",{"tool":86,"command":87},"pnpm","pnpm dlx skills add jleechanorg\u002Fjleechan-skills --skill codex-exec-pitfalls","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002Fhermes\u002Fskills\u002Fautonomous-ai-agents\u002Fcodex-exec-pitfalls\u002FSKILL.md",true,[91],{"path":92,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fcloud-build-plugin-wire-shape.md","REFERENCE","参考文档",9090,"https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002Fhermes\u002Fskills\u002Fautonomous-ai-agents\u002Fcodex-exec-pitfalls\u002Freferences\u002Fcloud-build-plugin-wire-shape.md",[98,106,113,121,129,138],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":105},"01M7DRVZXXMGY4G81K5GVF4V20","disk-reclaim-playbook","Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdisk-reclaim-playbook\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":105},"01M7B63PNTT2TY78RFKHD8SP3X","claudea-bench","Compare `claudea` and normal `claude` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fclaudea-bench\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":120},"01M7622KQJ32AV4K5BXEMVSSEB","pr","Alias for the canonical pr-lifecycle PR workflow skill (\u002Fpr-workflow, \u002Fprw).","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fpr\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":128},"01M7432W92AKC4D1TKJ00VCMMT","whisper","OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwhisper\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":133,"licenseFileUrl":134,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":128},"01M7432T6BN1A9SHB8RBQR5EMP","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":128},"01M7432NDC7S6C6MX7M6RW8CTT","pr-report","This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, \u002Fpr-report, or wants per-PR summary with delta files\u002Flines. Generates a structured report for one or more open PRs covering purpose, files changed, +\u002F− line counts, \u002Fcode-standards + \u002Fthermo review findings, \u002Fponytail simplification opportunities, file-overlap combination candidates, and \u002Fgreen status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fpr-report\u002FSKILL.md",[],[]]