# Codex

Operate OpenAI Codex CLI in non-interactive headless environments.

- Repository: https://github.com/XiaomiMiMo/MiMo-Code (13741 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add XiaomiMiMo/MiMo-Code --skill codex -g -a claude-code -y`
Codex: `npx skills add XiaomiMiMo/MiMo-Code --skill codex -g -a codex -y`
Cursor: `npx skills add XiaomiMiMo/MiMo-Code --skill codex -g -a cursor -y`
Gemini CLI: `npx skills add XiaomiMiMo/MiMo-Code --skill codex -g -a gemini-cli -y`

## Description

Operate OpenAI Codex CLI in non-interactive headless environments. Load only when the user explicitly authorizes this skill or names Codex / codex. Before any command, confirm the `codex` binary is available; if missing, stop and give install or auth guidance. Covers `codex exec` automation in Bash or PowerShell, native Windows or WSL2, scripts, CI/CD, Docker, Kubernetes, remote servers, agent harnesses, sandbox and approval modes, JSONL events, session resume, and stdin prompts.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Codex CLI

Use Codex CLI as a deterministic, non-interactive worker suitable for automation and agent orchestration.

## Operating Rules

1. Use `codex exec`, not the interactive `codex` TUI.
2. Pass the task as the positional `PROMPT` argument. Do not use `-p` for the prompt; `-p` selects a profile.
3. For ordinary unattended code changes, prefer:

```bash
codex exec \
  -C /path/to/repo \
  --sandbox workspace-write \
  --ask-for-approval never \
  "<TASK>"
```

4. Use `--yolo` only inside an externally hardened and disposable runner. It disables Codex approvals and sandboxing.
5. For harnesses and CI, prefer `--json` plus `--output-last-message`.
6. Do not make the run depend on a human answering questions. Resolve ambiguity using repository evidence and conservative defaults.
7. Treat credentials as secrets. Inject `CODEX_API_KEY` only into the single `codex exec` process when possible.
8. Before giving version-sensitive advice, inspect `codex exec --help` or current official Codex documentation if available.
9. On Windows, choose one execution environment per task: native PowerShell for Windows toolchains or WSL2 for Linux toolchains. Do not casually mix paths, installations, or authentication across them.

## Choose the Execution Mode

### Read-only analysis

Use when the task must not modify files:

```bash
codex exec \
  -C /path/to/repo \
  --sandbox read-only \
  --ask-for-approval never \
  "Analyze the repository and report risks. Do not modify files."
```

### Workspace-scoped implementation

Use as the default for autonomous repository work:

```bash
codex exec \
  -C /path/to/repo \
  --sandbox workspace-write \
  --ask-for-approval never \
  "Implement the task, run relevant tests, and report unresolved blockers."
```

### Externally isolated unrestricted execution

Use only when the enclosing container, VM, or sandbox enforces the real security boundary:

The rest: https://github.com/XiaomiMiMo/MiMo-Code/blob/HEAD/packages/cli/src/skill/builtin/.bundle/codex/SKILL.md
