codex
Runs non-interactive AI coding sessions in a target workspace to debug root causes, review code, implement fixes, and refactor multi-file changes, reporting changed git files.
Instructions
Executes a non-interactive OpenAI Codex CLI session (including GPT-6.2 Astra) in a target workspace or git worktree.
Supports both Windows native execution and WSL bridging via environment variables, unattended approval policy,
session resumption (`SESSION_ID`), reasoning effort tuning, and git `changed_files` reporting.
**Best-Fit Tasks:**
- Deep root-cause debugging and closed-loop test-fix cycles.
- Cross-model code review (`sandbox="read-only"`) for concurrency, edge cases, invariants, and security.
- High-logic / high-correctness implementation (algorithms, state machines, protocols, concurrency, data/backend logic).
- Multi-file refactoring preserving strict invariants and comprehensive test coverage.
**Collaboration Best Practices:**
- Always pass `cd` pointing to the active workspace or `/teamwork` git worktree root.
- Use `sandbox="read-only"` for analysis/reviews and `sandbox="workspace-write"` for edits/fixes.
- Reuse `SESSION_ID` on rework/follow-ups to preserve context and token cache.
- Inspect `changed_files` in the response to verify scope before finalizing.
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>",
"cd": "<cd>"
},
"name": "codex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cd | Yes | ||
| yolo | No | Bypass all approvals and sandboxing (`--dangerously-bypass-approvals-and-sandbox`). Use only in isolated environments. | |
| image | No | Optional list of image paths to attach to the prompt. | |
| model | No | Optional model override (e.g. `gpt-6.2-astra`). When empty, uses `CODEX_DEFAULT_MODEL` or the user's `~/.codex/config.toml` default. | |
| PROMPT | Yes | ||
| profile | No | ||
| sandbox | No | Sandbox policy (`read-only`, `workspace-write`, `danger-full-access`). When omitted, uses `CODEX_DEFAULT_SANDBOX` (fallback `read-only`). | |
| SESSION_ID | No | ||
| timeout_seconds | No | Optional execution timeout in seconds. Defaults to `CODEX_TIMEOUT_SECONDS` (600s). | |
| reasoning_effort | No | Optional reasoning effort override (`minimal`, `low`, `medium`, `high`, `xhigh`). When omitted, uses `CODEX_DEFAULT_REASONING_EFFORT` or Codex CLI default. | |
| return_all_messages | No | ||
| skip_git_repo_check | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |