Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Route every task to the right skill by enforcing skill discovery and invocation before any action
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/codex-tools.md
1# Codex Tool Mapping23Skills speak in actions ("dispatch a subagent", "create a todo", "read a file"). On Codex these resolve to the tools below.45| Action skills request | Codex equivalent |6|----------------------|------------------|7| Read a file | `shell` (e.g., `cat`, `head`, `tail`) — Codex reads files via shell |8| Create / edit / delete a file | `apply_patch` (structured diff for create, update, delete) |9| Run a shell command | `shell` |10| Search file contents | `shell` (e.g., `grep`, `rg`) |11| Find files by name | `shell` (e.g., `find`, `ls`) |12| Fetch a URL | `shell` with `curl` / `wget` — Codex has no native fetch tool |13| Search the web | `web_search` (enabled by default; configurable in `config.toml` via the top-level `web_search` setting — `live`, `cached`, or `disabled`) |14| Invoke a skill | Skills load natively — just follow the instructions |15| Dispatch a subagent (`Subagent (general-purpose):` template) | `spawn_agent` (see [Subagent dispatch requires multi-agent support](#subagent-dispatch-requires-multi-agent-support)) |16| Multiple parallel dispatches | Multiple `spawn_agent` calls in one response |17| Wait for subagent result | `wait_agent` |18| Free up subagent slot when done | `close_agent` |19| Task tracking ("create a todo", "mark complete") | `update_plan` |2021## Instructions file2223When a skill mentions "your instructions file", on Codex this is **`AGENTS.md`** at the project root. Codex also reads `~/.codex/AGENTS.md` for global context, and an `AGENTS.override.md` (in the project tree or `~/.codex/`) takes precedence when present. Codex walks from the project root down to the current working directory, concatenating `AGENTS.md` files it finds along the way, up to `project_doc_max_bytes` (32 KiB by default).2425## Personal skills directory2627User-level skills live at **`$CODEX_HOME/skills/`** (default `~/.codex/skills/`). Codex also reads the cross-runtime path **`~/.agents/skills/`** (shared with Copilot CLI and Gemini CLI). When both directories exist at the same scope, Codex loads them both as separate skill catalogs — Codex's docs don't currently document a precedence between them. Each skill is a subdirectory containing a `SKILL.md` (with `name` and `description` frontmatter).2829## Subagent dispatch requires multi-agent support3031Add to your Codex config (`~/.codex/config.toml`):3233```toml34[features]35multi_agent = true36```3738This enables `spawn_agent`, `wait_agent`, and `close_agent` for skills like `dispatching-parallel-agents` and `subagent-driven-development`.3940Legacy note: Codex builds before `rust-v0.115.0` exposed spawned-agent41waiting as `wait`. Current Codex uses `wait_agent` for spawned agents. The42`wait` name now belongs to code-mode `exec/wait`, which resumes a yielded exec43cell by `cell_id`; it is not the spawned-agent result tool.4445## Environment Detection4647Skills that create worktrees or finish branches should detect their48environment with read-only git commands before proceeding:4950```bash51GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)52GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)53BRANCH=$(git branch --show-current)54```5556- `GIT_DIR != GIT_COMMON` → already in a linked worktree (skip creation)57- `BRANCH` empty → detached HEAD (cannot branch/push/PR from sandbox)5859See `using-git-worktrees` Step 0 and `finishing-a-development-branch`60Step 1 for how each skill uses these signals.6162## Codex App Finishing6364When the sandbox blocks branch/push operations (detached HEAD in an65externally managed worktree), the agent commits all work and informs66the user to use the App's native controls:6768- **"Create branch"** — names the branch, then commit/push/PR via App UI69- **"Hand off to local"** — transfers work to the user's local checkout7071The agent can still run tests, stage files, and output suggested branch72names, commit messages, and PR descriptions for the user to copy.73