codex-exec
1
总安装量
1
周安装量
#53042
全站排名
安装命令
npx skills add https://github.com/gswangg/codex-exec --skill codex-exec
Agent 安装分布
claude-code
1
Skill 文档
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>
| Mode | Description |
|---|---|
read-only |
No write access |
workspace-write |
Can write to workspace |
danger-full-access |
Full 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]
| Option | Description |
|---|---|
SESSION_ID |
UUID of session to resume |
--last |
Resume most recent session |
PROMPT |
Additional prompt after resuming (use - for stdin) |
Code Review
codex exec review [OPTIONS] [PROMPT]
| Option | Description |
|---|---|
--uncommitted |
Review 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 |
PROMPT |
Custom review instructions (use - for stdin) |
JSON Output Format
When using --json, events are emitted as JSONL with these types:
| Event Type | Description |
|---|---|
thread.started |
Session begins, includes thread_id |
turn.started |
Agent turn begins |
item.completed |
Item completed (reasoning, agent_message, tool calls, etc.) |
turn.completed |
Turn finished, includes usage with token counts |
turn.failed |
Turn failed with error object |
error |
Error or status message |
The item.completed event includes an item object with:
id– Item identifiertype– One of:reasoning,agent_message, tool-related typestext– 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-autoflag is a convenience alias for low-friction sandboxed execution - Use
--dangerously-bypass-approvals-and-sandboxonly in externally sandboxed environments