{"id":"codex-exec","name":"codex-exec","summary":"非対話的に発信者から提供されたCodexコマンドを1回実行し、証拠をキャプチャします。トリガー:「コデックスの首なしを走らせる」「コデックスの証拠を捕獲する」。","body":"# Codex Exec — one-shot runtime adapter\n\nRun exactly one caller-supplied Codex prompt and capture its result. This skill\ndoes not choose work, retry failures, validate by itself, or control continuation.\n\nOne 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.\n\nNamed failure mode — **stdin hang**: a non-TTY run left waiting forever on an\nopen stdin nobody will write to; always pipe the prompt or close the stream.\n\nAnti-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.\n\n## Procedure\n\n1. Confirm `codex login status` for the intended profile.\n2. Set the working root explicitly with `-C`.\n3. Match the sandbox to the requested effects: read-only for offline review,\n   workspace-write for authorized edits, and broader access only when the caller\n   explicitly requires network or external effects.\n4. Pipe the prompt to stdin (or close stdin) in non-TTY execution so the process\n   cannot wait indefinitely for input.\n5. A wall-clock **deadline is mandatory** — never run codex unbounded. Use the\n   caller's deadline, or the declared default of **600s (10 min)** when the\n   caller supplies none, and record which one applied. Enforce it so the whole\n   process **tree** is reaped, not just the direct child: run codex in its own\n   process group and kill the group on expiry: `setsid` (own process group) +\n   `kill -KILL -<pgid>` on the group; `--kill-after` only escalates TERM→KILL\n   and plain `timeout <secs> codex …` signals only the direct child. If the\n   wrapper cannot guarantee process-group reaping, **do not execute** — that\n   host lacks the cleanup capability this skill requires (capability\n   unavailable, fail closed). Deadline expiry is\n   **fail-closed**: the run is killed and reported as timed-out / not proven,\n   partial output preserved — never a completed review.\n6. Capture the final response with `-o`, JSONL, or an output schema.\n7. Report the typed run result, then stop: the process exit status, the captured\n   artifact path, which deadline applied and whether it fired, that the\n   process tree was reaped (a run without guaranteed reaping never starts), and whether\n   the `codex` binary was present at all. Cancellation is the caller's; this\n   skill neither retries nor continues on its own.\n\nTerminal outcomes are explicit: **binary absent** (no `codex` on PATH) → report\nunavailable and stop; **deadline expiry** → fail-closed, report the kill and\npreserved partial output, never a completed review; **nonzero exit** → runtime\nevidence, not a semantic verdict. The caller decides whether to launch another\ninvocation.\n\n## Example\n\n```bash\n# Deadline mandatory; default 600s. `setsid` puts codex in its own process\n# group so expiry kills the whole tree, with `--kill-after` escalating\n# TERM->KILL. No setsid (or equivalent group kill) available -> do not run:\n# fail closed as capability-unavailable.\nprintf '%s\\n' \"$PROMPT\" | setsid timeout --kill-after=10s \"${CODEX_TIMEOUT:-600}\" \\\n  codex exec -C \"$WORKSPACE\" -s read-only -o \"$OUTPUT\" -\n```\n\nFor 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`PASS` verdict is possible. When the caller elects a cross-model fresh\nvalidator, record model identities per\nthe `agent-native` model-dispatch recipe and match the sandbox to\ndeclared effects.","author":"@boshu2","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/boshu2/agentops/tree/main/images/gemini/skills/codex-exec","license":"Apache-2.0","category":"writing","lang":"en","tokens":871,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}