Role Creator
Overview
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.
Non-Negotiable Inputs
Step 1 must always be input collection. Before running any write/install/validate command, collect and confirm:
model
model_reasoning_effort
developer_instructions
- install scope (
global or project)
role_name
description
role_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:
- Do not infer missing required values.
- Do not start Step 2 (writing files) until all required inputs above are explicitly provided or explicitly accepted as defaults by the user.
Default Policy For Optional Parameters
- Do not set sandbox flags unless explicitly requested.
- Do not set
web_search unless explicitly requested.
- Do not set MCP flags/entries unless explicitly requested.
- Do not add any other optional
config_file keys unless explicitly requested.
- If user intent is ambiguous, ask a short clarification question before adding optional keys.
Knowledge vs Application Rule
The role creator must know the full configuration surface area, but must only apply keys the user asked for.
- Required behavior:
- Explain available optional categories when helpful.
- Provide specific examples/templates when user asks what is possible.
- Keep generated config minimal by default.
- Add optional keys only with explicit user request.
- If user says "keep defaults/inherit", omit optional keys rather than setting explicit values.
Role Config Surface Area (What Can Be Customized)
Role config_file is parsed as a full config layer. If a key is omitted, it generally inherits from the parent.
- Model and reasoning:
model
model_reasoning_effort
model_reasoning_summary
model_verbosity
personality
- Core behavior:
developer_instructions
- Sandboxing and permissions:
sandbox_mode
[sandbox_workspace_write] fields like network_access, writable_roots
- Web search:
web_search (disabled|cached|live)
- Feature toggles:
[features] keys such as memory_tool, shell_tool
- MCP servers:
[mcp_servers.<name>] entries (enabled, required, command, args, env_vars)
- Apps/connectors:
[apps.<name>] entries (enabled)
When user asks for advanced role controls, use concrete examples from:
templates/minimal-role-config.toml
templates/restricted-role-config.toml
templates/full-role-config.toml
templates/frontend-architecture-role.toml
Supported Role Declaration Keys
For [agents.<role_name>], only these keys are supported:
Do not add anything else under [agents.<role_name>].
Workflow
- Collect and confirm required inputs (hard gate).
- Ask for model, reasoning, developer instructions, install scope, role name, description, and role config file path.
- Confirm whether to use defaults only if user explicitly agrees.
- Do not write files in this step.
- Validate environment and resolved paths.
- Ensure repo schema exists:
codex-rs/core/config.schema.json
- Resolve config target from scope:
global -> ~/.codex/config.toml
project -> <project>/.codex/config.toml
- Create or update role config file.
- Use
scripts/write_role_config.sh to write required fields.
- Add optional controls only if the user explicitly requested them.
- Optional controls supported by script:
sandbox_mode + workspace-write settings
web_search mode (set to disabled to prevent web search)
- MCP controls (
mcp_clear, mcp_enable, mcp_disable)
- If user wants options beyond script flags (for example
model_reasoning_summary, features, apps, rich MCP server definitions), start from a template under templates/ and edit manually, then run validation.
- Communicate clearly in output:
Configured now: keys that were written
Available but not set: relevant optional keys left to inherit
- Install role in main config.
- Use
scripts/install_role.sh.
- This writes/updates:
features.multi_agent = true
[agents.<role_name>] description/config_file
- Additive safety:
- Installer only mutates role-related keys and keeps the rest of
config.toml intact.
- Installer always creates a timestamped backup of the target
config.toml before writing.
- Existing role definitions are not overwritten unless
--update-existing is passed.
- Validate before reporting success.
- Use
scripts/validate_role.sh.
- Confirm required role-config fields are present.
- Confirm role declaration keys are only
description/config_file.
- Confirm top-level role config keys are valid against schema.
- Share runnable spawn example.
{"agent_type":"<role_name>","message":"<task>"}
Commands
# 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.json
Guardrails
- If runtime returns
unknown agent_type, verify role exists in active config and config_file path exists/readable.
- If runtime returns
agent type is currently not available, inspect role file TOML validity and unsupported keys.
- Keep instructions role-specific and operational (scope, do/don't, deliverable format).
- Do not claim success without running validation.
References
- Role key matrix and runtime behavior:
references/role-config-reference.md
- Reusable templates:
templates/
1---2name: role-creator3description: 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).4---56# Role Creator78## Overview910Use this skill when the user wants to create, update, or troubleshoot custom subagent roles backed by `[agents.<role>]` and a role `config_file`.1112This 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`.1314Default behavior is strict-minimal: configure only `model`, `model_reasoning_effort`, and `developer_instructions` unless the user explicitly asks for additional parameters.1516Default 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.1718## Non-Negotiable Inputs1920Step 1 must always be input collection. Before running any write/install/validate command, collect and confirm:2122- `model`23- `model_reasoning_effort`24- `developer_instructions`25- install scope (`global` or `project`)26- `role_name`27- `description`28- `role_config_file` (absolute path preferred)2930Ask concise questions:31321. `Which model should this role use?` (recommend: `gpt-5.3-codex`)332. `What reasoning effort should it use?` (recommend: `medium`; options `medium|high|xhigh`)343. `What should the role's developer instructions prioritize?` (goal, boundaries, success criteria)354. `Do you want this installed globally (~/.codex/config.toml) or in a project (.codex/config.toml)?`365. `Do you want any sandboxing, web_search, MCP, or other restrictions?`376. `What role name and description should be shown in spawn_agent?`3839Execution gate:4041- Do not infer missing required values.42- Do not start Step 2 (writing files) until all required inputs above are explicitly provided or explicitly accepted as defaults by the user.43444546## Default Policy For Optional Parameters4748- Do not set sandbox flags unless explicitly requested.49- Do not set `web_search` unless explicitly requested.50- Do not set MCP flags/entries unless explicitly requested.51- Do not add any other optional `config_file` keys unless explicitly requested.52- If user intent is ambiguous, ask a short clarification question before adding optional keys.5354## Knowledge vs Application Rule5556The role creator must know the full configuration surface area, but must only apply keys the user asked for.5758- Required behavior:59- Explain available optional categories when helpful.60- Provide specific examples/templates when user asks what is possible.61- Keep generated config minimal by default.62- Add optional keys only with explicit user request.63- If user says "keep defaults/inherit", omit optional keys rather than setting explicit values.6465## Role Config Surface Area (What Can Be Customized)6667Role `config_file` is parsed as a full config layer. If a key is omitted, it generally inherits from the parent.6869- Model and reasoning:70- `model`71- `model_reasoning_effort`72- `model_reasoning_summary`73- `model_verbosity`74- `personality`75- Core behavior:76- `developer_instructions`77- Sandboxing and permissions:78- `sandbox_mode`79- `[sandbox_workspace_write]` fields like `network_access`, `writable_roots`80- Web search:81- `web_search` (`disabled|cached|live`)82- Feature toggles:83- `[features]` keys such as `memory_tool`, `shell_tool`84- MCP servers:85- `[mcp_servers.<name>]` entries (`enabled`, `required`, `command`, `args`, `env_vars`)86- Apps/connectors:87- `[apps.<name>]` entries (`enabled`)8889When user asks for advanced role controls, use concrete examples from:9091- `templates/minimal-role-config.toml`92- `templates/restricted-role-config.toml`93- `templates/full-role-config.toml`94- `templates/frontend-architecture-role.toml`9596## Supported Role Declaration Keys9798For `[agents.<role_name>]`, only these keys are supported:99100- `description`101- `config_file`102103Do not add anything else under `[agents.<role_name>]`.104105## Workflow1061071. Collect and confirm required inputs (hard gate).108- Ask for model, reasoning, developer instructions, install scope, role name, description, and role config file path.109- Confirm whether to use defaults only if user explicitly agrees.110- Do not write files in this step.1111122. Validate environment and resolved paths.113- Ensure repo schema exists: `codex-rs/core/config.schema.json`114- Resolve config target from scope:115- `global` -> `~/.codex/config.toml`116- `project` -> `<project>/.codex/config.toml`1171183. Create or update role config file.119- Use `scripts/write_role_config.sh` to write required fields.120- Add optional controls only if the user explicitly requested them.121- Optional controls supported by script:122- `sandbox_mode` + workspace-write settings123- `web_search` mode (set to `disabled` to prevent web search)124- MCP controls (`mcp_clear`, `mcp_enable`, `mcp_disable`)125- If user wants options beyond script flags (for example `model_reasoning_summary`, `features`, `apps`, rich MCP server definitions), start from a template under `templates/` and edit manually, then run validation.126- Communicate clearly in output:127- `Configured now:` keys that were written128- `Available but not set:` relevant optional keys left to inherit1291304. Install role in main config.131- Use `scripts/install_role.sh`.132- This writes/updates:133- `features.multi_agent = true`134- `[agents.<role_name>] description/config_file`135- Additive safety:136- Installer only mutates role-related keys and keeps the rest of `config.toml` intact.137- Installer always creates a timestamped backup of the target `config.toml` before writing.138- Existing role definitions are not overwritten unless `--update-existing` is passed.1391405. Validate before reporting success.141- Use `scripts/validate_role.sh`.142- Confirm required role-config fields are present.143- Confirm role declaration keys are only `description/config_file`.144- Confirm top-level role config keys are valid against schema.1451466. Share runnable spawn example.147- Example:148```json149{"agent_type":"<role_name>","message":"<task>"}150```151152## Commands153154```bash155# 1) Write role config file (required fields only; default behavior)156.codex/skills/role-creator/scripts/write_role_config.sh \157 --output ~/.codex/agents/researcher.toml \158 --role-name researcher \159 --model gpt-5.3-codex \160 --reasoning medium \161 --developer-instructions "Research code and docs only; no edits; return file:line evidence."162163# 1b) Optional controls (only when explicitly requested)164.codex/skills/role-creator/scripts/write_role_config.sh \165 --output ~/.codex/agents/researcher.toml \166 --role-name researcher \167 --model gpt-5.3-codex \168 --reasoning medium \169 --developer-instructions "Research code and docs only; no edits; return file:line evidence." \170 --sandbox-mode workspace-write \171 --network-access false \172 --writable-roots "/home/willr/Applications/codex1" \173 --web-search disabled174175# 2) Register role in ~/.codex/config.toml176.codex/skills/role-creator/scripts/install_role.sh \177 --role-name researcher \178 --description "Read-only codebase research specialist" \179 --role-config-file ~/.codex/agents/researcher.toml180181# 2b) Intentionally update an existing role definition182.codex/skills/role-creator/scripts/install_role.sh \183 --role-name researcher \184 --description "Updated role description" \185 --role-config-file ~/.codex/agents/researcher.toml \186 --update-existing187188# 3) Validate role config and declaration keys189.codex/skills/role-creator/scripts/validate_role.sh \190 --role-name researcher \191 --config ~/.codex/config.toml \192 --role-config ~/.codex/agents/researcher.toml \193 --schema /home/willr/Applications/codex1/codex-rs/core/config.schema.json194```195196## Guardrails197198- If runtime returns `unknown agent_type`, verify role exists in active config and `config_file` path exists/readable.199- If runtime returns `agent type is currently not available`, inspect role file TOML validity and unsupported keys.200- Keep instructions role-specific and operational (scope, do/don't, deliverable format).201- Do not claim success without running validation.202203## References204205- Role key matrix and runtime behavior: `references/role-config-reference.md`206- Reusable templates: `templates/`