Use when asked to launch a separate headless `codex exec` session for a clearly defined task with explicit inputs and outputs, especially when the task should be decomposed with Codex's built-in multi-agent subagents.
Use this skill when the job should run in a separate non-interactive Codex session instead of inside the current conversation.
Typical triggers:
Do not use this skill for:
--model gpt-5.4.-c model_reasoning_effort=\"medium\" unless the task clearly needs higher or lower effort.codex exec--full-auto only when the delegated session must write files or run project commands.--sandbox workspace-write / --full-auto over dangerous bypass flags.--enable multi_agent for tasks that benefit from built-in subagents or when you want the run to be portable across machines/configs.codex exec -.--full-auto so the child session can write outputs inside the workspace.When the delegated Codex run should use subagents, tell it so directly. Prefer the built-in roles documented by Codex:
explorer: read-heavy repo exploration, architecture tracing, docs mining, evidence gathering.worker: focused execution or artifact-producing subtasks.default: fallback role or synthesis/cross-check work.monitor: long waits or repeated polling, if the environment/config exposes it.Ask the root agent to:
Good sub-agent uses:
Be cautious with many concurrent write-heavy agents. Prefer parallel exploration and synthesis over parallel edits unless the write scopes are clearly disjoint.
Read-only analysis:
codex exec \
--enable multi_agent \
--model gpt-5.4 \
-c model_reasoning_effort="medium" \
--sandbox read-only \
-C /abs/path/to/project \
- < prompt.txt
Artifact-producing analysis:
codex exec \
--enable multi_agent \
--model gpt-5.4 \
-c model_reasoning_effort="medium" \
--full-auto \
-C /abs/path/to/project \
- < prompt.txt
Machine-readable trace capture:
codex exec \
--enable multi_agent \
--model gpt-5.4 \
-c model_reasoning_effort="medium" \
--full-auto \
--json \
-C /abs/path/to/project \
- < prompt.txt > output/session_artifacts/exec-events.jsonl
When writing the delegated prompt:
For repeated project analyses, make the prompt include:
codex-cli 0.110.0.multi_agent is already enabled globally here, but still pass --enable multi_agent in reusable commands when you want portability and explicitness.codex exec supports --model, --full-auto, --sandbox, --json, --output-schema, --output-last-message, --ephemeral, and config overrides via -c.gpt-5.4.codex exec does not expose a dedicated reasoning flag, so set reasoning through config override: -c model_reasoning_effort=\"medium\".codex exec build does not accept a --search flag, so do not rely on that flag in headless commands here.