Back to Skills

codex-cli

Reference for Codex CLI usage patterns. Consult before calling codex via Bash.

5starsUpdated 2/27/2026

Security Assessment

Safe(100/100)
Security Score100/100

About codex-cli

The Codex CLI (Command Line Interface) is a tool designed for interacting with Codex through Bash commands. It streamlines the execution of various tasks by providing a simple, non-interactive mode for making requests to the Codex system. The tool allows users to perform complex AI-driven analysis and reasoning tasks, automating workflows while preventing unnecessary manual intervention. The Codex CLI helps overcome limitations in traditional systems by allowing direct control over AI models, such as GPT-5.2, and offering robust options for managing session continuity, reasoning effort, and sandboxed execution environments.

Key features of Codex CLI include model selection, reasoning effort adjustments, session resumption, and sandboxed execution. It supports essential flags such as `--sandbox` to control file access, `--ask-for-approval` to control user interaction, and various timeout and session management settings to ensure smooth execution. By using the CLI, users can automate tasks that would otherwise require manual input, such as complex data analysis, decision-making processes, and content generation. This tool is highly suitable for advanced users who need to integrate Codex into their automation pipelines or interact with it from a server environment.

The Codex CLI is ideal for developers, data scientists, and machine learning engineers who want to integrate Codex into their workflows without requiring a GUI. It is particularly useful for tasks that demand high reasoning effort or require session continuity over time. This tool caters to users who need fast, repeatable results from Codex models, offering both power and flexibility for complex task execution and debugging. Additionally, its detailed flags and options make it suitable for both simple and advanced use cases, including those that require strict sandboxing and authentication protocols.

FAQ

How do I execute a task using Codex CLI?

You can execute a task using the `codex exec` command with a prompt and specific flags. For example: `codex exec '[prompt]' -m gpt-5.2 --reasoning-effort high --sandbox read-only --ask-for-approval never 2>&1`.

Can I resume a previous session with Codex CLI?

Yes, you can resume a previous session by using the `codex resume [session-id] '[prompt]' --sandbox read-only --ask-for-approval never 2>&1` command, where `[session-id]` is the ID returned by Codex.

What safety precautions should I take when using Codex CLI?

Avoid using dangerous flags such as `--dangerously-bypass-approvals-and-sandbox` and `--sandbox danger-full-access`, as these are forbidden due to potential security risks.

Is Codex CLI compatible with all versions of Codex?

Codex CLI is designed to work with Codex models, specifically including the GPT-5.2 model. Make sure to use the correct model flag for compatibility.

What should I do if I encounter a timeout issue?

If you encounter a timeout, especially for complex tasks, increase the timeout value to 300000ms or more to allow enough time for the analysis.

Install codex-cli

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill