codex-specialized-subagents
Artifact-first sub-agent delegation for Codex CLI, enabling multi-step parallel work with durable logging via specialized sub-agents.
README
codex-specialized-subagents
Artifact-first sub-agent delegation for Codex CLI (MCP server).
This repo provides a local (stdio) MCP server that exposes:
delegate_autopilot— decide whether to delegate and, if yes, orchestrate one or morecodex execsub-agent runsdelegate_run— run a single specialist sub-agent viacodex execdelegate_resume— resume a prior sub-agent thread viacodex exec resume
Each tool call writes a run directory under ${CODEX_HOME:-$HOME/.codex}/delegator/runs/<run_id>/ containing the prompt, selected skills, event stream, and structured results (artifact-first debugging).
When to use
- You want parallelism and specialization for multi-step / cross-cutting work.
- You want durable artifacts (logs + outputs) to debug and review what happened.
Requirements
- Node.js
>=20(seepackage.json#engines) npmmise(recommended): installs the pinned runtime frommise.tomlcodexCLI on your PATH and authenticated (required for real delegation runs)
Optional:
- Python 3 (only for helper scripts under
.agent/)
Install & quickstart (from source)
From the repo root (installs deps + builds dist/):
# Recommended: install the pinned runtime (see mise.toml)
mise install
# Drift check (lockfiles + pins)
./toolchain-check.sh
# Install deps from lockfile
npm ci
# Build
npm run build
Configure Codex (recommended, prevents timeouts)
Delegated runs can take minutes. Set this server’s MCP tool timeout to 1200 seconds (20 minutes) in your Codex config ($HOME/.codex/config.toml):
mkdir -p "$HOME/.codex"
cat >> "$HOME/.codex/config.toml" <<'EOF'
[mcp_servers.codex-specialized-subagents]
tool_timeout_sec = 1200
EOF
If you already have a [mcp_servers.codex-specialized-subagents] section, edit the existing tool_timeout_sec instead of appending a duplicate.
Common gotcha: tool_timeout_sec is not an env var. If you put it under mcp_servers.codex-specialized-subagents.env.*, Codex will error with “expected a string” (env values must be strings).
If you see a TOML parse error about a “duplicate key” for [mcp_servers.codex-specialized-subagents], you have that table declared twice — keep only one header and put tool_timeout_sec = 1200 inside it.
Register with Codex (recommended defaults)
From the repo root (includes per-job reasoning-effort overrides for delegate_autopilot):
codex mcp add codex-specialized-subagents \
--env CODEX_AUTOPILOT_REASONING_EFFORT_LOW=low \
--env CODEX_AUTOPILOT_REASONING_EFFORT_MEDIUM=medium \
--env CODEX_AUTOPILOT_REASONING_EFFORT_HIGH=high \
-- node "$(pwd)/dist/cli.js"
Verify:
codex mcp get codex-specialized-subagents
Remove:
codex mcp remove codex-specialized-subagents
Usage
Interactive autopilot (recommended)
In Codex interactive mode, delegate_autopilot can split a request into jobs (scan / implement / verify) and run specialist sub-agents.
To make delegation feel automatic in interactive mode, install the included delegation-autopilot skill globally:
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills/delegation-autopilot"
cp .codex/skills/delegation-autopilot/SKILL.md \
"${CODEX_HOME:-$HOME/.codex}/skills/delegation-autopilot/SKILL.md"
Then try prompts like:
- “Refactor the MCP server and update tests + README.”
- “Audit the repo docs and propose improvements.”
Optional: delegate_autopilot assigns each job a thinking_level (low | medium | high). You can set CODEX_AUTOPILOT_REASONING_EFFORT_LOW|MEDIUM|HIGH on the MCP server process to override Codex model_reasoning_effort per job (see docs/usage.md). (Legacy/advanced: CODEX_AUTOPILOT_MODEL_LOW|MEDIUM|HIGH overrides model name.)
Manual tool calls
If you prefer explicit tool usage, tell Codex to call one of:
delegate_autopilot(multi-agent orchestration)delegate_run(single sub-agent run)delegate_resume(resume a prior sub-agent thread)
Optional (advanced): for delegate_run / delegate_resume, you can pass reasoning_effort (maps to codex exec -c model_reasoning_effort="...") or raw config_overrides (maps to codex exec -c <override>). If you want a default for manual runs, set CODEX_DELEGATE_REASONING_EFFORT on the MCP server process (only applies when reasoning_effort is omitted and config_overrides does not already set model_reasoning_effort).
Skills
Sub-agent runs can load Codex skills from:
- repo-local
.codex/skills(nearest ancestor of the delegatedcwd) - global
${CODEX_HOME:-$HOME/.codex}/skills
Note: this repo’s delegation-autopilot skill is marked delegator_exclude: true (parent-only) to prevent delegation recursion.
Artifacts (run directories)
Each tool call writes a run directory under ${CODEX_HOME:-$HOME/.codex}/delegator/runs/<run_id>/.
Documentation
Start with docs/README.md (index), then:
docs/usage.md— how to use the tools effectivelydocs/troubleshooting.md— common failure modes (timeouts, missingcodex, etc.)docs/development.md— local development and test matrixdocs/reference/tools.md— full tool schemas (inputs/outputs)docs/reference/run-directories.md— run directory layout and artifact meaning
Development
npm test
npm run lint
npm run dev
Integration tests (requires Codex CLI + auth):
RUN_CODEX_INTEGRATION_TESTS=1 npm test
Contributing: CONTRIBUTING.md.
Security
- Don’t commit secrets (
.envis gitignored; use.env.exampleas a template). - Run directories can contain sensitive prompts/output; treat
${CODEX_HOME:-$HOME/.codex}/delegator/runsas sensitive.
Reporting: SECURITY.md.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。