Create and install Codex custom agent roles in ~/.codex/config.toml, generate role config files, enforce supported keys, and guide users through required role inputs (model, reasoning effort, developer_instructions).
81
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
Use this skill when the user wants to create, update, or troubleshoot custom subagent roles backed by [agents.<role>] and a role config_file.
This skill installs the role into ~/.codex/config.toml (or a user-selected project config), writes the role-specific config file, and validates key support against codex-rs/core/config.schema.json.
Default behavior is strict-minimal: configure only model, model_reasoning_effort, and developer_instructions unless the user explicitly asks for additional parameters.
Default location is ~/.codex/config.toml however, if the user asks for a project scoped role, the role will be installed in the project's .codex/config.toml. Can also be installed to subfolders in a repo.
Step 1 must always be input collection. Before running any write/install/validate command, collect and confirm:
modelmodel_reasoning_effortdeveloper_instructionsglobal or project)role_namedescriptionrole_config_file (absolute path preferred)Ask concise questions:
Which model should this role use? (recommend: gpt-5.3-codex)What reasoning effort should it use? (recommend: medium; options medium|high|xhigh)What should the role's developer instructions prioritize? (goal, boundaries, success criteria)Do you want this installed globally (~/.codex/config.toml) or in a project (.codex/config.toml)?Do you want any sandboxing, web_search, MCP, or other restrictions?What role name and description should be shown in spawn_agent?Execution gate:
web_search unless explicitly requested.config_file keys unless explicitly requested.The role creator must know the full configuration surface area, but must only apply keys the user asked for.
Role config_file is parsed as a full config layer. If a key is omitted, it generally inherits from the parent.
modelmodel_reasoning_effortmodel_reasoning_summarymodel_verbositypersonalitydeveloper_instructionssandbox_mode[sandbox_workspace_write] fields like network_access, writable_rootsweb_search (disabled|cached|live)[features] keys such as memory_tool, shell_tool[mcp_servers.<name>] entries (enabled, required, command, args, env_vars)[apps.<name>] entries (enabled)When user asks for advanced role controls, use concrete examples from:
templates/minimal-role-config.tomltemplates/restricted-role-config.tomltemplates/full-role-config.tomltemplates/frontend-architecture-role.tomlFor [agents.<role_name>], only these keys are supported:
descriptionconfig_fileDo not add anything else under [agents.<role_name>].
codex-rs/core/config.schema.jsonglobal -> ~/.codex/config.tomlproject -> <project>/.codex/config.tomlscripts/write_role_config.sh to write required fields.sandbox_mode + workspace-write settingsweb_search mode (set to disabled to prevent web search)mcp_clear, mcp_enable, mcp_disable)model_reasoning_summary, features, apps, rich MCP server definitions), start from a template under templates/ and edit manually, then run validation.Configured now: keys that were writtenAvailable but not set: relevant optional keys left to inheritscripts/install_role.sh.features.multi_agent = true[agents.<role_name>] description/config_fileconfig.toml intact.config.toml before writing.--update-existing is passed.scripts/validate_role.sh.description/config_file.{"agent_type":"<role_name>","message":"<task>"}# 1) Write role config file (required fields only; default behavior)
.codex/skills/role-creator/scripts/write_role_config.sh \
--output ~/.codex/agents/researcher.toml \
--role-name researcher \
--model gpt-5.3-codex \
--reasoning medium \
--developer-instructions "Research code and docs only; no edits; return file:line evidence."
# 1b) Optional controls (only when explicitly requested)
.codex/skills/role-creator/scripts/write_role_config.sh \
--output ~/.codex/agents/researcher.toml \
--role-name researcher \
--model gpt-5.3-codex \
--reasoning medium \
--developer-instructions "Research code and docs only; no edits; return file:line evidence." \
--sandbox-mode workspace-write \
--network-access false \
--writable-roots "/home/willr/Applications/codex1" \
--web-search disabled
# 2) Register role in ~/.codex/config.toml
.codex/skills/role-creator/scripts/install_role.sh \
--role-name researcher \
--description "Read-only codebase research specialist" \
--role-config-file ~/.codex/agents/researcher.toml
# 2b) Intentionally update an existing role definition
.codex/skills/role-creator/scripts/install_role.sh \
--role-name researcher \
--description "Updated role description" \
--role-config-file ~/.codex/agents/researcher.toml \
--update-existing
# 3) Validate role config and declaration keys
.codex/skills/role-creator/scripts/validate_role.sh \
--role-name researcher \
--config ~/.codex/config.toml \
--role-config ~/.codex/agents/researcher.toml \
--schema /home/willr/Applications/codex1/codex-rs/core/config.schema.jsonunknown agent_type, verify role exists in active config and config_file path exists/readable.agent type is currently not available, inspect role file TOML validity and unsupported keys.references/role-config-reference.mdtemplates/c810917
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.