ask-codex
Runs Codex CLI prompts for file analysis, multi-turn coding tasks, sandboxed workspace edits, and structured change output with model and safety controls.
Instructions
Execute Codex CLI with file analysis (@syntax), skills ($syntax), model selection, and safety controls. Supports changeMode.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "ask-codex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cd | No | Working directory | |
| 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. | |
| yolo | No | ⚠️ Bypass all safety (dangerous) | |
| image | No | Optional image file path(s) to include with the prompt | |
| model | No | Optional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml). Specify only to override. | |
| config | No | Configuration overrides as 'key=value' string or object | |
| prompt | Yes | Task or question. Use @ to include files (e.g., '@largefile.ts explain'). | |
| search | No | Enable web search using native --search flag (v0.52.0+). Requires network access - automatically sets sandbox to workspace-write if not specified. | |
| addDirs | No | Additional writable directories beyond workspace (e.g., ["/tmp", "/var/log"]). Useful for monorepos and multi-directory projects. | |
| profile | No | Config profile (-p <name>): layers $CODEX_HOME/<name>.config.toml over the base config. Legacy [profiles.<name>] tables in config.toml make the CLI refuse the run. | |
| sandbox | No | Quick automation mode: enables workspace-write with approval=never. Sandboxing remains active. | |
| timeout | No | Maximum execution time in milliseconds (optional) | |
| approval | No | Deprecated alias for approvalPolicy — both map to --ask-for-approval. Prefer approvalPolicy. Values: on-request, never | |
| fullAuto | No | Compatibility alias for workspace-write with approval=never (not --yolo) | |
| ephemeral | No | Run without persisting Codex session files to disk | |
| sessionId | No | Session ID for conversation continuity. Enables native Codex resume. | |
| changeMode | No | Return structured OLD/NEW edits for refactoring | |
| chunkIndex | No | Chunk index (1-based) | |
| workingDir | No | Working directory for execution | |
| ignoreRules | No | Ignore user and project execpolicy .rules files for this run | |
| personality | No | Communication style: pragmatic (concise, machine-friendly), friendly (conversational) or none (no personality instructions) | |
| sandboxMode | No | Access: read-only, workspace-write, danger-full-access | |
| outputSchema | No | JSON Schema path or inline schema to constrain output format (Codex CLI v0.95.0+) | |
| resetSession | No | Clear session context before execution. Starts fresh conversation. | |
| responseMode | No | Response verbosity: "clean" returns only the final answer (default), "full" returns the complete execution log including thinking, tool calls, and agent activity | clean |
| strictConfig | No | Fail when config.toml contains fields unknown to the installed Codex CLI | |
| chunkCacheKey | No | Cache key for continuation | |
| localProvider | No | Specify which local provider to use (lmstudio or ollama). Automatically enables --oss if not set. If omitted with --oss, uses config default or shows selection. | |
| approvalPolicy | No | Approval policy (-a): never, on-request. Note: non-interactive `codex exec` runs report `approval: never` even with on-request, since nobody can answer a prompt. | |
| enableFeatures | No | Enable feature flags (repeatable). Equivalent to -c features.<name>=true | |
| bypassHookTrust | No | DANGEROUS: run enabled hooks without persisted hook trust | |
| disableFeatures | No | Disable feature flags (repeatable). Equivalent to -c features.<name>=false | |
| includeMetadata | No | Include configuration metadata in response | |
| includeThinking | No | Include reasoning/thinking section in response | |
| reasoningEffort | No | Reasoning depth. Omit to use the CLI default. max/ultra are model-dependent GPT-6/GPT-5.6 options; ultra may delegate to subagents. | |
| ignoreUserConfig | No | Ignore $CODEX_HOME/config.toml for this run; authentication is still loaded | |
| skipGitRepoCheck | No | Skip git repository validation. Useful for non-git directories (Codex CLI v0.75.0+) | |
| outputLastMessage | No | Write final Codex message to file path. Useful for CI/CD result capture (Codex CLI v0.95.0+) | |
| toolOutputTokenLimit | No | Maximum tokens for tool outputs (100-10,000). Controls response verbosity. |