Loading...
Loading...
Run OpenAI's Codex CLI agent in non-interactive mode using `codex exec`. Use when delegating coding tasks to Codex, running Codex in scripts/automation, or when needing a second agent to work on a task in parallel.
npx skill4agent add sundial-org/skills codexcodex execcodex exec review# Analysis (read-only, default)
codex exec "describe the architecture of this codebase"
# Allow file edits
codex exec --full-auto "fix the failing tests"
# Code review
codex exec review --uncommitted
codex exec review --base main
# Structured JSON output
codex exec --output-schema schema.json -o result.json "extract metadata"
# Continue previous session (inherits original sandbox settings)
codex exec resume --last "now add tests"codex exec "summarize the repo" 2>/dev/null > summary.txtcodex exec "generate changelog" 2>&1 | tee output.txt| Mode | Flag | Behavior |
|---|---|---|
| Read-only | (default) | Reads anywhere, writes/commands blocked |
| Workspace-write | | Pre-approves edits and commands in workspace |
| Full access | | No restrictions. Use in isolated environments only |
--full-auto--yolo~/.codex/config.tomlgpt-5.2-codex-mcodex exec -m gpt-5 "explain this code"CODEX_API_KEYCODEX_API_KEY=sk-... codex exec "task"# Review uncommitted changes
codex exec review --uncommitted
# Review against a base branch
codex exec review --base main
# Review a specific commit
codex exec review --commit abc123--output-schemaadditionalProperties: falsecodex exec --output-schema schema.json -o result.json "extract API endpoints"{
"type": "object",
"properties": {
"name": { "type": "string" },
"endpoints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"method": { "type": "string" }
},
"required": ["path", "method"],
"additionalProperties": false
}
}
},
"required": ["name", "endpoints"],
"additionalProperties": false
}# Start a task
codex exec --full-auto "implement rate limiter"
# Continue later (inherits --full-auto from original)
codex exec resume --last "add unit tests"
# Or resume by session ID
codex exec resume <SESSION_ID> "follow-up task"--full-auto--jsoncodex exec --json "analyze code" 2>/dev/null | jq -c 'select(.type == "item.completed")'tail -f <output_file># Good: Focused, single-purpose tasks
codex exec --full-auto "add star ratings to the skill cards"
codex exec --full-auto "add a search filter to the toolbar"
# Avoid: Multi-feature requests in one task
codex exec --full-auto "add ratings, search, filters, modal, and animations"--full-autoadditionalProperties: falsegpt-5.2-codexAGENTS.md~/.codex/AGENTS.md<repo>/AGENTS.md# AGENTS.md
- Run `npm test` after modifying JS files
- Use pnpm for dependencies