{"slug":"codex-exec-4","title":"codex-exec","summary":"Run one caller-supplied Codex command non-interactively and capture evidence. Triggers: \"run Codex headless\", \"capture Codex evidence\".","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-08T21:44:54.746943Z","repo":{"url":"https://github.com/boshu2/agentops","stars":445,"forks":41,"license":"Apache-2.0","updatedAt":"2026-09-24T01:09:16Z"},"bodyHtml":"<hr>\n<p>name: codex-exec\ndescription: 'Run one caller-supplied Codex command non-interactively and capture evidence. Triggers: \"run Codex headless\", \"capture Codex evidence\".'\nskill_api_version: 1\nuser-invocable: false\nhexagonal_role: driving-adapter\npractices:</p>\n<ul>\n<li>pragmatic-programmer\nconsumes:</li>\n<li>codex-command-packet\nproduces:</li>\n<li>codex-run-output\ncontext_rel:</li>\n<li>kind: supplier-to\nwith: validate\ncontext:\nwindow: inherit\nintent:\nmode: none\nsections:\nexclude:\n<ul>\n<li>HISTORY\nmetadata:\ncapabilities: [codex_exec]\neffects: [run_codex_process, sandbox_tiered_workspace_and_network_effects]\ncanonical_status: canonical\ndisposition: keep_optional_adapter\ntier: orchestration\ndependencies: []\nstability: stable\noutput_contract: process exit status and captured Codex output artifact</li>\n</ul>\n</li>\n</ul>\n<hr>\n<h1>Codex Exec — one-shot runtime adapter</h1>\n<p>Run exactly one caller-supplied Codex prompt and capture its result. This skill\ndoes not choose work, retry failures, validate by itself, or control continuation.</p>\n<p>One prompt, one process, one captured artifact is what makes the run auditable:\nwhen nothing loops, every byte of output traces to exactly one invocation, and\na disagreement about what happened is settled by the artifact.</p>\n<p>Named failure mode — <strong>stdin hang</strong>: a non-TTY run left waiting forever on an\nopen stdin nobody will write to; always pipe the prompt or close the stream.</p>\n<p>Anti-pattern: granting workspace-write or network access \"in case the prompt\nneeds it\". Corrective: match the sandbox to the declared effects; a review\nprompt runs read-only, full stop.</p>\n<h2>Procedure</h2>\n<ol>\n<li>Confirm the intended executable, profile, and caller-supplied prompt.</li>\n<li>Set the working root explicitly with <code>-C</code>.</li>\n<li>Match the sandbox to the requested effects: read-only for offline review,\nworkspace-write for authorized edits, and broader access only when the caller\nexplicitly requires network or external effects.</li>\n<li>Use <code>scripts/lib/codex-exec.sh</code> and <code>codex_exec_guarded</code>. Pipe the prompt,\nprovide a prompt file/argument, or close stdin in non-TTY execution.</li>\n<li>Supply <code>CODEX_EXEC_TIMEOUT</code> as positive finite seconds or inherit an\nabsolute <code>CODEX_EXEC_DEADLINE_EPOCH</code>. There is no fixed ten-minute default:\nwithout an explicit timeout, use the deadline's remaining time; with both,\nthe earlier bound wins, including capability probes and prompt preparation.\nPass the same deadline to successive calls; a new invocation cannot renew\nit. Missing both bounds, or empty, zero, negative or malformed explicit\nvalues, prevents launch. An expired deadline times out before dispatch.</li>\n<li>Capture stdout with <code>CODEX_EXEC_OUT_FILE</code> and optionally separate stderr with\n<code>CODEX_EXEC_STDERR_FILE</code>. <code>CODEX_EXEC_MAX_OUTPUT_BYTES</code> defaults to <strong>10 MiB</strong>\n(10485760 bytes) and must be a positive finite integer. It caps stdout and\nstderr <strong>combined</strong>; file-prompt copies and AGY/local-mlx stdin preparation\neach use the same cap. Capture sinks must be regular files (or <code>/dev/null</code>).\nReviewer workspace writes, including files it writes with <code>-o</code>, are outside\nthis capture cap.</li>\n<li>Report the typed run result, then stop: the process exit status, the captured\nartifact path, the timeout/deadline and capture cap applied, and whether\ncleanup was triggered. Cancellation is the caller's; this skill neither\nretries nor continues on its own.</li>\n</ol>\n<p>The supported host must have <code>/usr/bin/perl</code> with its core POSIX, IO<span>Select,\nFcntl, and Time</span>HiRes modules, a monotonic clock, process-group signalling,\nand a resolved <code>timeout</code>/<code>gtimeout</code> supporting <code>--foreground</code>. Missing capability\nfails closed. The embedded adapter mechanism establishes one owned process\ngroup before launching the reviewer. It sends TERM then KILL after 200 ms on\nexpiry, cancellation, excess output, or direct-parent exit; it bounds pipe\ndraining to a further short cleanup window rather than waiting indefinitely\nfor descendants to close inherited pipes. This includes ordinary descendants\nleft by a successful parent and TERM-resistant children. It does <strong>not</strong> promise\ncleanup of processes that deliberately escape the owned group or session.\nGroup members remaining after direct-parent exit are reported as <code>rep-survivor</code>\n(exit 122): the run remains degraded even when cleanup subsequently succeeds.\nAfter its cleanup window the adapter checks whether the owned group still\nexists. Remaining membership, including zombies it cannot independently reap,\nis reported as <code>CLEANUP-UNVERIFIED</code> (exit 2), never successful cleanup.</p>\n<p><code>CODEX_EXEC_WRAP</code> remains Codex-only: the sealed launch order is wrapper →\nresolved timeout → reviewer, with Codex's sandbox bypass only when the external\nwrapper supplies the sandbox. The capture/cleanup supervisor runs outside that\nsealed launch. No process-wide file-size limit restricts reviewer work products.</p>\n<p>Terminal outcomes are explicit: <strong>unavailable/invalid limits</strong> → 2;\n<strong>descendants left after direct-parent exit</strong> → 122;\n<strong>capture/input limit</strong> → 123; <strong>deadline expiry or empty consumed output</strong> →\n124; <strong>prompt echo</strong> → 125; <strong>cancellation</strong> → 128 + signal number. Other genuine\nreviewer exit codes are preserved. These reserved codes describe runtime\nevidence, never a semantic verdict. On timeout, cancellation, or excess output,\npartial capture stays in caller-provided files; an adapter-owned output sink is\nstreamed before removal. Failed prompt preparation reports its preserved partial\ninput path. The caller decides whether to launch another invocation.</p>\n<h2>Example</h2>\n<pre><code># REVIEW_TIMEOUT_SECONDS is selected by the caller. Alternatively export\n# CODEX_EXEC_DEADLINE_EPOCH once and omit CODEX_EXEC_TIMEOUT below; retain\n# that same absolute deadline for every invocation in its scope.\n. \"$AGENTOPS_ROOT/scripts/lib/codex-exec.sh\"\nCODEX_EXEC_DIR=\"$WORKSPACE\" CODEX_EXEC_SANDBOX=read-only \\\nCODEX_EXEC_PROMPT_ARG=\"$PROMPT\" CODEX_EXEC_TIMEOUT=\"$REVIEW_TIMEOUT_SECONDS\" \\\nCODEX_EXEC_MAX_OUTPUT_BYTES=10485760 CODEX_EXEC_OUT_FILE=\"$OUTPUT\" \\\n  codex_exec_guarded &lt;/dev/null\n</code></pre>\n<p>For a validator, the prompt must name the acceptance digest, exact subject\nmanifest digest, author context ID, evidence, and required checked/not-checked\nreport. The validator context ID must be distinct from the author's before a\n<code>PASS</code> verdict is possible. When the caller elects a cross-model fresh\nvalidator, record model identities per\nthe <code>agent-native</code> model-dispatch recipe and match the sandbox to\ndeclared effects.</p>\n","files":[{"path":"SKILL.md","sizeBytes":7088,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-16T15:56:30.079255Z","sha256":"B5C936208591ADD3C527C827F1F5A5911EB7705E6597C7D9184EB913FCACE5A3","sizeBytes":3461},"review":null,"source":{"repositoryUrl":"https://github.com/boshu2/agentops","path":"images/gemini/skills/codex-exec","license":"Apache-2.0","commit":"c3fe161dce0b85d1e0490df757bbb841d22e4ea1","subtreeSha":"B91A2566519578998F75D2F9B0B7FEB2B02309242660A881594E97979190642A","lastSyncedAt":"2026-09-24T06:48:55.360254Z"},"reviewedAt":"2026-09-16T16:03:34.526366Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/boshu2/agentops/tree/main/images/gemini/skills/codex-exec"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install boshu2-agentops@llmmart"},{"target":"git","command":"git clone https://github.com/boshu2/agentops.git"}]}