Wrapper around codex CLI for non-interactive runs (prompt via args/file/stdin) with resume support. Outputs session_id for conversation continuation.
From agentic-coding-toolsnpx claudepluginhub thesylvester/agentic-coding-tools --plugin read-transcriptThis skill is limited to using the following tools:
scripts/codex-agentSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
This script runs synchronously and returns output directly. Do NOT run it in the background.
When invoking via Bash, you MUST:
timeout: 600000 (10 minutes) — codex runs can take several minutesrun_in_background)Example Bash invocation:
Bash(command: "~/.claude/skills/codex-agent/scripts/codex-agent Your prompt here", timeout: 600000)
Thin wrapper around codex CLI (OpenAI Codex) for non-interactive use:
PROMPT_FILE, or stdin--model or CODEX_MODEL env var--resume or CODEX_SESSION env var~/.codex/auth.json) or API keysCodex CLI v0.80.0+ required:
npm install -g @openai/codex@latest
codex --version # should be 0.80.0 or higher
Authentication (one of these):
codex login for ChatGPT OAuth (creates ~/.codex/auth.json)OPENAI_API_KEY environment variableCODEX_API_KEY environment variable (exec mode only)# Arguments
~/.claude/skills/codex-agent/scripts/codex-agent Your prompt here
# File via env var
PROMPT_FILE=task.md ~/.claude/skills/codex-agent/scripts/codex-agent
# Stdin
cat task.md | ~/.claude/skills/codex-agent/scripts/codex-agent
# Resume most recent session
~/.claude/skills/codex-agent/scripts/codex-agent --resume latest "Follow-up question"
# Resume by UUID (find in ~/.codex/sessions/)
~/.claude/skills/codex-agent/scripts/codex-agent --resume 019bf3a2-40ce-7923-b501-3d4ebd00aed3 "Continue"
# Via environment variable
CODEX_SESSION=latest ~/.claude/skills/codex-agent/scripts/codex-agent "Follow-up"
# Via flag
~/.claude/skills/codex-agent/scripts/codex-agent --model gpt-5.2-codex "Your prompt"
# Via environment variable
CODEX_MODEL=gpt-5.2-codex ~/.claude/skills/codex-agent/scripts/codex-agent "Your prompt"
| Variable | Description |
|---|---|
PROMPT_FILE | Read prompt from this file |
CODEX_MODEL | Model to use (passed as --model) |
CODEX_SESSION | Session to resume (latest or UUID) |
OPENAI_API_KEY | API key authentication |
CODEX_API_KEY | API key for exec mode |
Returns plain text response followed by the session ID:
<response text>
[session_id: <uuid>]
Capture the session ID to continue the conversation with --resume <uuid>.
Diagnostics are shown automatically on any failure. You can also run:
~/.claude/skills/codex-agent/scripts/codex-agent --version
Common issues:
codex login to set up OAuth, or set OPENAI_API_KEYnpm install -g @openai/codex~/.codex/sessions/ for valid UUIDscodex exec --dangerously-bypass-approvals-and-sandbox (YOLO mode)--skip-git-repo-check to allow running outside git repos~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonlcodex app-server directly (JSON-RPC)