codex_spawn
Dispatch a task to a Codex subagent and get an 8-digit task ID instantly. Run multiple tasks in parallel, then retrieve or steer results automatically.
Instructions
把一个任务派给 Codex 子代理,立即返回 8 位任务 id(wait_s>0 时先等一会儿,等到就直接给结果)。可以连续派多个,它们在同一个常驻 Codex 进程里并行执行。任务完成后结果会自动送回本会话;也可以用 codex_wait 主动等、codex_status 看进度、codex_steer 中途改方向、codex_interrupt 中断。传 thread_id 可在旧任务的上下文上续问;该 thread 上不能有仍在运行的任务。默认无沙箱、不审批:Codex 会直接改文件、跑命令。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | 工作目录(绝对路径),默认当前目录 | |
| model | No | 仅用户明确指定时填,默认 gpt-6-sol | |
| detach | No | true = 不关心结果的后台任务;Claude 结束回合时不会因为它被拦下 | |
| effort | No | 推理强度,默认 high;简单任务可降到 low/medium | |
| prompt | Yes | 任务说明:目标、改动范围、完成标准(要跑什么验证)、返回格式(结论 + 文件:行号,不贴大段代码) | |
| wait_s | No | 先同步等待这么多秒;估计几分钟内能完成的任务填 120~300 可直接拿到结果,长任务填 0 立即返回 | |
| persist | No | 把会话持久化到 Codex 历史,以便下次 Claude 会话还能用 thread_id 续问;默认不持久化 | |
| sandbox | No | 默认 danger-full-access(无沙箱);只读分析用 read-only | |
| worktree | No | 在独立 git worktree(分支 codex-sub/<id>)里执行,多任务并行改同一仓库时用,完成后自行合并分支 | |
| thread_id | No | 续问:在之前某个任务的 thread 上继续,保留全部上下文,只发增量指令 |