Hand off a task to Codex CLI for autonomous execution. Use when a task would benefit from a capable subagent to implement, fix, investigate, or review code. Codex has full codebase access and can make changes.
83
Quality
76%
Does it follow best practices?
Impact
99%
2.67xAverage score across 3 eval scenarios
Advisory
Suggest reviewing before use
Optimize this skill with Tessl
npx tessl skill review --optimize ./data/skills-md/0xbigboss/claude-code/codex/SKILL.mdHand off a task to Codex CLI for autonomous execution. Codex is a capable coding agent that can implement features, fix bugs, refactor code, investigate issues, and review changes.
Session ID: ${CLAUDE_SESSION_ID}
Output directory: ~/.claude/codex/${CLAUDE_SESSION_ID}/
Output files:
progress-{timestamp}.jsonl - Streaming JSONL events (for monitoring)summary-{timestamp}.txt - Final agent message only (for results)Arguments: $ARGUMENTS
Parse the arguments:
--model <model> or -m <model>: Override model (only if explicitly requested)--sandbox <mode>: Override sandbox mode (only if explicitly requested)Available models (only pass if user explicitly requests):
gpt-5.2-codex - Default for Codex CLI, optimized for agentic coding (user's current config)gpt-5.2 - Flagship model, best for complex professional tasksgpt-5-mini - Fast, cost-efficient (replaces o4-mini)o3 - Deep reasoning model for complex multi-step problemsSandbox modes (only pass if user explicitly requests):
read-only - No file modifications allowedworkspace-write - Can modify files in workspacedanger-full-access - Full system access (use with caution)Default behavior: Omit --model and --sandbox flags to use the user's ~/.codex/config.toml preferences.
If no task description provided, ask the user what they want Codex to do.
Based on the task description, determine context depth:
Minimal context (single file fix, simple query):
Medium context (feature work, multi-file change):
Full context (architectural, investigation, unclear scope):
pwd
git rev-parse --show-toplevel 2>/dev/null || echo "Not a git repo"
git branch --show-current 2>/dev/null || echo "N/A"
git status --short 2>/dev/null | head -20git diff --stat 2>/dev/null | tail -20
git log --oneline -5 --since="4 hours ago" 2>/dev/null || echo "No recent commits"Summarize relevant session context:
Create a prompt using CTCO structure (Context → Task → Constraints → Output format) optimized for GPT-5.2.
Structure:
<context>
Working directory: {cwd}
Repository: {repo_name}
Branch: {branch}
{git_status if relevant}
{recent_changes if medium/full context}
{session_summary if full context}
</context>
<task>
{task description from arguments}
</task>
<constraints>
- Implement EXACTLY and ONLY what is requested
- No extra features, refactoring, or "improvements" beyond the task
- Read relevant files before making changes
- Run tests/linters if available to validate changes
- If task is ambiguous, state your interpretation before proceeding
</constraints>
<output>
After completing the task, provide a structured summary (≤5 bullets):
- **What changed**: Files modified and nature of changes
- **Where**: Specific locations (file:line when relevant)
- **Validation**: Tests run, linters passed, manual verification
- **Risks**: Any potential issues or edge cases to watch
- **Next steps**: Follow-up work if any (or "None")
</output>First, ensure output directory exists:
mkdir -p ~/.claude/codex/${CLAUDE_SESSION_ID}Check if we're in a git repo:
git rev-parse --show-toplevel 2>/dev/null && echo "IN_GIT_REPO" || echo "NOT_GIT_REPO"Build and run the command:
codex exec --json \
-o ~/.claude/codex/${CLAUDE_SESSION_ID}/summary-{timestamp}.txt \
{required_flags} \
{optional_flags} \
- <<'CODEX_PROMPT'
{generated_prompt}
CODEX_PROMPT > ~/.claude/codex/${CLAUDE_SESSION_ID}/progress-{timestamp}.jsonlOutput handling:
--json streams progress events to stdout → redirected to progress-{timestamp}.jsonl-o writes only the final message → summary-{timestamp}.txtFlag rules:
--skip-git-repo-check (required)--full-auto (enables workspace-write sandbox + auto-approval)--sandbox read-only instead of --full-auto-m <model>--sandbox danger-full-access instead of --full-autoRun via Bash tool.
Always background tasks that might take >30 seconds:
Use run_in_background: true in the Bash tool call.
After backgrounding:
Foreground only for trivial tasks (<30 seconds expected):
Two files are created:
progress-*.jsonl - Streaming JSONL (verbose, for progress checking)summary-*.txt - Final message only (clean, for results)Token-efficient monitoring (CRITICAL):
# Check if still running (line count growing = active)
wc -l < ~/.claude/codex/${CLAUDE_SESSION_ID}/progress-*.jsonl
# Quick progress check - last 3 events only
tail -n 3 ~/.claude/codex/${CLAUDE_SESSION_ID}/progress-*.jsonl
# Check if summary exists (means Codex finished)
ls ~/.claude/codex/${CLAUDE_SESSION_ID}/summary-*.txt 2>/dev/nullDo NOT:
tail -f (streams indefinitely, wastes context)When checking on background tasks:
wc -l on progress file to confirm activitytail -n 3 on progress for current statusWhen Codex completes:
cat ~/.claude/codex/${CLAUDE_SESSION_ID}/summary-*.txtFormat:
## Codex Result
**Status:** {success/error/partial}
**What changed:**
- {file1}: {change summary}
- {file2}: {change summary}
**Validation:** {tests/linters run, results}
**Risks/Notes:** {if any, otherwise omit}
**Next steps:** {if any, otherwise "None"}Keep the summary concise. If Codex produced verbose output, distill to essentials.
/codex fix the null pointer in utils/parser.ts line 42Minimal context, quick execution.
/codex add rate limiting to the /api/submit endpointMedium context, may take a few minutes.
/codex investigate why the CI build fails on arm64Full context, potentially long-running, consider backgrounding.
/codex --model o3 design a caching strategy for the database queries/codex --sandbox read-only review the authentication implementationSkips --full-auto, uses read-only sandbox for safe exploration.
5342bca
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.