cowboylogic/ai-dev/agent-creator-codex
Claude Code and agent skill by cowboylogic/ai-dev
- community
Checking that the SKILL.md file is still in the repository.
Guide for creating custom subagents for OpenAI Codex (standalone TOML files in .codex/agents/ or ~/.codex/agents/, each with name, description, and developer_instructions). Use this skill whenever a user wants to build, configure, review, or modify a Codex agent, choose fields (model, model_reasoning_effort, developer_instructions, and the other keys a role file can actually set), tune the [agents] table in config.toml (concurrency, default subagent model), or troubleshoot a Codex agent that is not found, never spawned, on the wrong model, or unexpectedly writing files or missing MCP servers. ALWAYS load this skill before writing or debugging Codex agent files.
Install
npx vskill@latest install cowboylogic/ai-dev/agent-creator-codexSKILL.md
The same SKILL.md was published earlier as cowboylogic/ai-dev/agent-creator-codex.
Codex Agent Creator
Codex custom agents ("subagents") are standalone TOML files. Each file defines one agent and is loaded as a configuration layer for the sessions Codex spawns. Unlike Claude Code and Copilot agents there is no Markdown body: the system prompt is the developer_instructions string inside the TOML.
[!IMPORTANT]A role file customizes the child; it never replaces the parent session's authority.Codex applies only a bounded set of keys from it (see What a Role File Can Set).sandbox_mode,approval_policy, andmcp_serversparse without error but areignored. The child runs under the parent session's sandbox, approvals, and MCP servers.Codex only delegates when asked. It never spawns a subagent on its own initiative unlessthe prompt, an applicableAGENTS.md, or a skill requests delegation. An agent file thatloads correctly can still sit unused. See Invocation.The official subagents page says the same:sandbox_mode,approval_policy,model_provider, andmcp_serversin a custom agent file "don't override the parentconfiguration". The Codex source and its tests atrust-v0.163.0agree: a role "must notcontrol" them. See What a Role File Can Set.
Verified against Codex CLI 0.166.0 (released 2026-10-29, the latest stable release when this skill was last reviewed on 2026-11-01). Role-file behavior was re-checked in the source at rust-v0.166.0 against rust-v0.163.0; the CLI behavior checks with codex doctor were run on 0.163.0 and the 0.166.0 binary was not run.
Official docs: <https://developers.openai.com/codex/subagents> (redirects to learn.chatgpt.com/docs/agent-configuration/subagents). Config keys: <https://developers.openai.com/codex/config-reference>.
When to Use This Skill
- Creating a new Codex agent file
- Choosing or fixing fields, and knowing which ones Codex actually applies
- Setting spawn limits and defaults in the
[agents]table ofconfig.toml - Diagnosing an agent that is not found, never delegated to, or running with the wrong model
or permissions
- Reviewing an agent file before committing it to a repository
For Codex settings generally (approvals, profiles, providers, hooks), read the Codex config reference. For repository-wide instructions, use AGENTS.md, not an agent file.
Quick Decision Guide
| Need | Approach | |
|---|---|---|
| Isolated context, narrower tools, or a different model for a side task | Custom agent (this skill) | |
| Instructions every session in a repo should follow | AGENTS.md | |
| Reusable procedure the main agent loads on demand | Skill (SKILL.md) | |
| Parallel work with no custom behavior | Built-in default, worker, or explorer | |
| A role defined next to other config in one file | [agents.<name>] table in config.toml |
Agent File Format
Required fields. A file that omits or blanks any of them is ignored with a warning, not rejected loudly (see Load Failures):
| Field | Purpose | |
|---|---|---|
name | The identifier Codex uses to spawn or refer to the agent. Authoritative over the filename | |
description | Guidance shown when Codex chooses an agent: what it does and when to use it | |
developer_instructions | The agent's system-prompt-level instructions. Must not be blank |
Everything else is optional. Load references/config-reference.md for the full field list and the [agents] table.
Rules that avoid load failures:
- Valid TOML. Use
"""multi-line strings fordeveloper_instructions. - Keep
nameunique across project and personal scope (files are discovered recursively). Usesnake_caseorkebab-case
consistently and match the filename to it (pr_explorer.toml).
- Top-level keys go before any
[table]header. A key placed after a[table]header
belongs to that table, not to the agent.
- Field names are
snake_case, and unknown keys make the whole file invalid. Do not carry
over disallowedTools, tools, or permissionMode; Codex has no such keys.
What a Role File Can Set
Verified in the Codex source at tag rust-v0.163.0 (codex-rs/core/src/agent/role.rs, described there as "bounded agent-role overrides"), and by the upstream test codex-rs/core/src/agent/role_tests.rs, which asserts the role layer holds none of openai_base_url, chatgpt_base_url, model_provider, approval_policy, sandbox_mode, notify, apps, or mcp_servers:
| Key | Effect on the spawned agent | |
|---|---|---|
developer_instructions | Replaces the role's instructions | |
model, model_reasoning_effort | Applied, and locked: the spawn UI tells the model these "cannot be changed" | |
model_reasoning_summary, model_verbosity, personality | Applied | |
features.<name> = false | Disables only shell_tool, apps, plugins, memories (legacy key memory_tool), request_permissions_tool | |
skills.config entries with enabled = false, skills.bundled.enabled = false, skills.include_instructions = false | Disables inherited skills. Cannot enable anything |
Every other key, including sandbox_mode, approval_policy, mcp_servers, web_search, features.<name> = true, and service_tier, is dropped. The spawn code applies the root session's service tier after the role, so a role-file service_tier never survives (the official page says the same: "The service tier also follows the root session's preference"). The file still loads, so nothing warns you. Configure sandbox, approvals, and MCP servers on the parent session or its config.
Where Agent Files Live
| Scope | Location | |
|---|---|---|
| Project | .codex/agents/ (loaded only when the project is trusted) | |
| Personal | ~/.codex/agents/ ($CODEX_HOME/agents/) | |
| Config table | [agents.<name>] in config.toml, with config_file pointing at a TOML layer |
Built-in agents default, worker, and explorer can be overridden by defining a custom agent with the same name.
[!NOTE]Two files with the samenamein one directory: Codex warns and drops the duplicate.The samenamein project and personal scope raises no warning, and the winner could notbe observed without a model call. Keep names unique across scopes.
Model and Reasoning Effort
Precedence: the role file's model and model_reasoning_effort are applied after the spawn-time and [agents] values, so they win over an explicit spawn value and over agents.default_subagent_model / agents.default_subagent_reasoning_effort. Those defaults only apply to roles that do not set the field. A role file that sets only model keeps the effort already resolved (spawn value, then [agents] default, then the parent's, or the chosen model's default effort when a spawn value or [agents] default selected the model without one), so set model_reasoning_effort too when that model does not support the inherited level. If an agent runs on an unexpected model, the usual causes are a different role being spawned, the role file failing to load (check the startup warnings), or the model or effort being rejected by the account.
Valid model names and effort levels depend on the account and Codex build. Run codex debug models to list the catalog and each model's supported effort levels.
Sandbox, Approvals, and MCP
A role file cannot set any of these. Codex copies the parent's live runtime policy onto the child, so:
- The child inherits the parent's sandbox policy, approval mode, and MCP servers.
--yoloand/permissionschanges on the parent apply to spawned agents.sandbox_modein a role file parses (an invalid value still produces a load warning) and
then has no effect. A "read-only" reviewer is read-only only if the parent session is.
- MCP servers a role needs must be configured in the parent's
config.toml. List them as a
prerequisite in the agent's documentation, and name them in developer_instructions.
- To keep a role from writing, say so in
developer_instructionsand start the parent
read-only (codex --sandbox read-only). To keep it from running commands at all, set features.shell_tool = false in the role file.
- In interactive CLI sessions, approval requests from inactive agent threads can surface in
the main view. Press o to inspect the request before approving.
Avoid danger-full-access on any parent session that spawns agents you did not write.
Invocation
Codex delegates when one of these is true:
- Explicit request. Ask for it: "Spawn one
pr_explorerper module and summarize." - Instruction-based. An applicable
AGENTS.mdor skill tells Codex to delegate.
In ChatGPT Work (the hosted web surface), Ultra intelligence level can also delegate proactively. The subagents page says local Codex releases spawn agents only after a direct request or applicable project or skill instructions.
To make an agent get used, name it in the request or in AGENTS.md, and write a description that names the trigger. Good: "Read-only reviewer. Use after any change under src/auth/". Bad: "Helps with code".
Global limits live in config.toml:
agents.max_threads is the legacy alias for max_concurrent_threads_per_session; the public config reference lists it. agents.interrupt_message (default true) controls whether a model-visible message is recorded when an agent turn is interrupted. agents.max_depth limits nesting for V1 agent threads and is ignored by V2. agents.job_max_runtime_seconds is a removed setting kept as a no-op. Neither of those two is in the public config reference; both are accepted without error in 0.163.0.
[!WARNING]Under[agents], any key Codex does not know is parsed as a role table. A typo such asmax_thread = 3is a fatal startup error (failed to load bootstrap configuration,caused by `invalid type: integer3, expected struct AgentRoleToml inagents`),unlike a bad agent file, which is only skipped.
Writing the Prompt (developer_instructions)
The agent sees this text plus whatever the spawn request passes it. It does not see the parent conversation. Write it so it works from a delegation message alone:
- Role in one sentence.
- Scope: what it reads, what it may change, what it must not touch.
- Method: the steps or checks, in order of importance.
- Return format: exactly what the parent needs back (findings with
path:line, a diff
summary, pass/fail).
- Stop conditions: when to return instead of continuing.
Narrow, opinionated agents work best. Split a "does everything" agent into a reader and a writer. Load references/agent-examples.md for complete files.
Creating an Agent: Step-by-Step
Step 1: Plan
- One sentence for the role, and what it does not do.
- Scope: project (
.codex/agents/, committed for the team) or personal (~/.codex/agents/). - Model and effort (cheaper and lower for read-heavy exploration; stronger for design and
review), then what the parent session must provide: sandbox policy and MCP servers.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agent-creator-codex/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cowboylogic/ai-dev/agent-creator-codex)