codex-exec

Run Codex CLI non-interactively for automated tasks, code generation, and code reviews

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "codex-exec" with this command: npx skills add gswangg/codex-exec/gswangg-codex-exec-codex-exec

Codex Exec - Non-Interactive Codex CLI

codex exec (alias: codex e) runs Codex in non-interactive mode, suitable for automation, scripting, and CI/CD pipelines.

Preferred Defaults

Unless otherwise specified, use these settings:

codex exec --full-auto -m gpt-5.3-codex -c model_reasoning_effort=high "your prompt"
  • --full-auto - Low-friction sandboxed automatic execution
  • -m gpt-5.3-codex - Preferred model
  • -c model_reasoning_effort=high - High reasoning level

Basic Usage

# With inline prompt
codex exec "your prompt here"

# Read prompt from stdin
echo "your prompt" | codex exec -

# Read prompt from file
codex exec - < prompt.txt

Key Options

Model Selection

-m, --model <MODEL>        # Specify model (e.g., "gpt-5.3-codex", "o3")

Sandbox Modes

-s, --sandbox <MODE>
ModeDescription
read-onlyNo write access
workspace-writeCan write to workspace
danger-full-accessFull system access

Execution Modes

--full-auto                # Combines -a on-request with --sandbox workspace-write
--dangerously-bypass-approvals-and-sandbox  # Skip all prompts (DANGEROUS - only for externally sandboxed environments)

Working Directory

-C, --cd <DIR>            # Set working root directory
--add-dir <DIR>           # Additional writable directories
--skip-git-repo-check     # Allow running outside git repos

Output Control

--json                    # Output events as JSONL to stdout
-o, --output-last-message <FILE>  # Write agent's final message to file
--output-schema <FILE>    # JSON Schema file for structured response
--color <always|never|auto>  # Color output control

Configuration

-c, --config <key=value>  # Override config.toml values
-p, --profile <PROFILE>   # Use named profile from config.toml
--enable <FEATURE>        # Enable feature flag
--disable <FEATURE>       # Disable feature flag

Config override examples:

  • -c model="o3"
  • -c 'sandbox_permissions=["disk-full-read-access"]'
  • -c shell_environment_policy.inherit=all

Images

-i, --image <FILE>...     # Attach image(s) to prompt

Web Search

--search                  # Enable live web search tool

Subcommands

Resume a Session

codex exec resume [SESSION_ID] [PROMPT]
codex exec resume --last [PROMPT]
OptionDescription
SESSION_IDUUID of session to resume
--lastResume most recent session
PROMPTAdditional prompt after resuming (use - for stdin)

Code Review

codex exec review [OPTIONS] [PROMPT]
OptionDescription
--uncommittedReview staged, unstaged, and untracked changes
--base <BRANCH>Review changes against a base branch
--commit <SHA>Review changes from a specific commit
--title <TITLE>Commit title for review summary
PROMPTCustom review instructions (use - for stdin)

JSON Output Format

When using --json, events are emitted as JSONL with these types:

Event TypeDescription
thread.startedSession begins, includes thread_id
turn.startedAgent turn begins
item.completedItem completed (reasoning, agent_message, tool calls, etc.)
turn.completedTurn finished, includes usage with token counts
turn.failedTurn failed with error object
errorError or status message

The item.completed event includes an item object with:

  • id - Item identifier
  • type - One of: reasoning, agent_message, tool-related types
  • text - Content of the item

Common Patterns

Default Invocation

codex exec --full-auto -m gpt-5.3-codex -c model_reasoning_effort=high "your task"

With Output Capture

codex exec --full-auto -m gpt-5.3-codex -c model_reasoning_effort=high -o result.txt "your task"

Structured Output with Schema

codex exec --output-schema schema.json "generate data matching schema"

Code Review Against Main Branch

codex exec review --base main

Review Uncommitted Changes

codex exec review --uncommitted

With Additional Config Overrides

codex exec --full-auto -m gpt-5.3-codex -c model_reasoning_effort=high -c 'sandbox_permissions=["disk-full-read-access"]' "your task"

Notes

  • Prompts can be passed as arguments or via stdin (use - to read from stdin)
  • Running outside a git repository requires --skip-git-repo-check
  • The --full-auto flag is a convenience alias for low-friction sandboxed execution
  • Use --dangerously-bypass-approvals-and-sandbox only in externally sandboxed environments

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

codex-exec

No summary provided by upstream source.

Repository SourceNeeds Review
General

inspect-claude-source

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated