ask-codex
Analyze, review, edit, or generate code using OpenAI models. Supports file references, model selection, reasoning effort, and structured edits for efficient code tasks.
Instructions
Use OpenAI Codex to analyze, review, edit, or generate code. Call this tool whenever the user mentions "codex", "use codex", or wants to leverage OpenAI models (GPT-5.4, GPT-5.3-codex, etc.) for code tasks. Supports file references with @ syntax (e.g. @src/), model selection, reasoning effort control, and structured edits via changeMode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Task or question. Use @ to include files (e.g., '@largefile.ts explain'). | |
| model | No | Model ID to use. IMPORTANT: Use exact IDs listed below, do NOT invent or modify model names. Recommended (use in this order): gpt-5.4 (default, best), gpt-5.3-codex (best coding), gpt-5.3-codex-spark (instant, Pro only), gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1-codex, gpt-5.1, gpt-5, gpt-5-mini, gpt-5-nano. Large context (1M): gpt-4.1, gpt-4.1-mini, gpt-4.1-nano. | |
| reasoningEffort | No | Reasoning effort level. Controls depth of internal reasoning. Values: none, minimal, low, medium (default), high, xhigh. Higher = deeper analysis but slower and more expensive. Not all models support all levels. gpt-5.4 supports: none/low/medium/high/xhigh. gpt-5.3-codex supports: low/medium/high/xhigh. o3/o4-mini support: low/medium/high. | |
| sandbox | No | Quick automation mode: enables workspace-write + on-failure approval. Alias for fullAuto. | |
| fullAuto | No | Full automation mode | |
| approvalPolicy | No | Approval: never, on-request, on-failure, untrusted | |
| approval | No | Approval policy: untrusted, on-failure, on-request, never | |
| sandboxMode | No | Access: read-only, workspace-write, danger-full-access | |
| yolo | No | ⚠️ Bypass all safety (dangerous) | |
| cd | No | Working directory | |
| workingDir | No | Working directory for execution | |
| changeMode | No | Return structured OLD/NEW edits for refactoring | |
| chunkIndex | No | Chunk index (1-based) | |
| chunkCacheKey | No | Cache key for continuation | |
| image | No | Optional image file path(s) to include with the prompt | |
| config | No | Configuration overrides as 'key=value' string or object | |
| profile | No | Configuration profile to use from ~/.codex/config.toml | |
| timeout | No | Maximum execution time in milliseconds (optional) | |
| includeThinking | No | Include reasoning/thinking section in response | |
| includeMetadata | No | Include configuration metadata in response | |
| search | No | Enable web search by activating web_search_request feature flag. Requires network access - automatically sets sandbox to workspace-write if not specified. | |
| oss | No | Use local Ollama server (convenience for -c model_provider=oss). Requires Ollama running locally. Automatically sets sandbox to workspace-write if not specified. | |
| enableFeatures | No | Enable feature flags (repeatable). Equivalent to -c features.<name>=true | |
| disableFeatures | No | Disable feature flags (repeatable). Equivalent to -c features.<name>=false |