其他
创建/更新/排查 Codex 自定义 agent 的独立…
在需要通过独立 TOML 文件创建、更新或排查 Codex 自定义 agent 角色时,按明确输入、最小配置、验证路径与语法、返回调用示例的流程操作。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 40/100 ×0.15
适用场景
创建/更新/排查 Codex 自定义 a特定
解决思路
- 将每个自定义 agent 定义为独立 TOML 文件:全局路径 ~/.codex/agents/<agent-name>.toml;项目路径 <project>/.codex/agents/<agent-name>.toml。
- 把 agent 文件作为角色的唯一事实来源。
- 不要把 per-role 注册写进 ~/.codex/config.toml;该文件仅用于全局/运行时设置,例如 [agents] 线程限制。
- 写文件前第 1 步必须收集并确认必填输入:name,即 agent_type 使用的角色标识。
- 必填输入:description,简短的人类可读用途。
- 必填输入:developer_instructions。
- 必填输入:model;除非另有要求,推荐 gpt-5.3-codex。
- 必填输入:model_reasoning_effort,允许值为 none|minimal|low|medium|high|xhigh。
- 必填输入:角色范围 role scope,取值为 global 或 project。
- 必填输入:输出 TOML 路径;优先使用规范绝对路径。
- 必填输入:是否包含 nickname_candidates 以及确切值。
- 执行规则:不要推断必填值。
- 执行规则:在必填输入被明确确认前不要写文件。
- 按当前 Codex custom agent 文档契约,必需键为 name、description、developer_instructions。
- 可选键包括 nickname_candidates、model、model_reasoning_effort、sandbox_mode、web_search、mcp_servers、skills.config 等。
- name 是 spawn 标识符和事实来源。
- description + developer_instructions 定义行为和使用边界。
- nickname_candidates 可选,仅用于显示。
- 若提供 nickname_candidates,必须是非空且值唯一的列表。
- nickname_candidates 允许字符:ASCII 字母、数字、空格、连字符、下划线。
- 默认不添加 sandboxing/MCP/web-search/model 额外配置,除非用户要求。
- 默认保持生成文件最小化。
- 如果用户说 inherit defaults,省略可选键,而不是显式设置值。
- 工作流 1:收集并确认必填输入。
- 工作流 2:解析输出路径:global → ~/.codex/agents/<name>.toml;project → <project>/.codex/agents/<name>.toml。
- 工作流 3:用必需键直接创建或更新文件。
- 工作流 4:验证 TOML 可解析且必需键存在。
- 工作流 5:返回可直接运行的示例调用:{"agent_type":"<name>","message":"<task>"}。
- 使用脚本写独立 custom-agent 文件:/home/willr/Applications/skills/skills/role-creator/scripts/write_role_config.sh --output ~/.codex/agents/reviewer.toml --role-name reviewer --description "PR reviewer focused on correctness, security, and risk." --model gpt-5.4 --reasoning high --developer-instructions "Review code like an owner. Lead with concrete findings and residual risks."
- 可选:包含显示用 nickname 候选:/home/willr/Applications/skills/skills/role-creator/scripts/write_role_config.sh --output ~/.codex/agents/reviewer.toml --role-name reviewer --description "PR reviewer focused on correctness, security, and risk." --model gpt-5.4 --reasoning high --developer-instructions "Review code like an owner. Lead with concrete findings and residual risks." --nickname-candidates "Atlas,Delta,Echo" --sandbox-mode read-only --web-search disabled
- 若运行时返回 unknown agent_type,验证当前激活范围,并确认文件存在于预期路径。
- 先用 tomlq 或 tomlq -C 检查语法。
- 保持角色指令可操作且范围狭窄,以避免漂移。
- 参考 Codex subagents 文档:https://developers.openai.com/codex/subagents。
- 参考显示昵称文档:https://developers.openai.com/codex/subagents#display-nicknames。
- 参考可复用模板:templates/。
适用边界 · 注意事项
- 不适用于非 Codex 自定义 agent、其他平台子代理/角色配置或普通 Codex 全局设置修改。
- 必填输入未明确确认前不要使用;不要推断缺失的 name、description、developer_instructions、model、reasoning effort、scope 或输出路径。
- 不要把 per-role 注册写到 ~/.codex/config.toml;它只用于全局/运行时设置。