npx skills add https://github.com/boshu2/agentops --skill codex-team团队领导负责编排,Codex 代理负责执行。每个代理专注于一项任务。团队领导在生成代理前就防止文件冲突——编排器本身就是锁管理器。
为了与 Claude 运行时功能兼容(代理/钩子/工作树/设置),当此技能回退到 /swarm 时,请使用 ../shared/references/claude-code-latest-features.md。
不要使用的情况: 任务需要紧密的共享状态协调。对于依赖关系复杂的波浪式编排,请使用 /swarm。
按以下顺序选择后端:
spawn_agent 可用 -> Codex 实验性子代理(首选)codex exec ...)skill 工具是只读的(OpenCode)-> — 广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
task(subagent_type="general", prompt="<task prompt>")/swarm# 使用 Codex CLI 后端生成代理前必须执行
if ! which codex > /dev/null 2>&1; then
echo "Codex CLI not found. Install: npm i -g @openai/codex"
# 回退:使用 /swarm
fi
# 模型可用性测试(使用用户配置的 Codex 默认模型)
if ! codex exec --full-auto -C "$(pwd)" "echo ok" > /dev/null 2>&1; then
echo "Default Codex model unavailable. Falling back to /swarm."
fi
codex exec --full-auto -C "$(pwd)" -o <output-file> "<prompt>"
使用用户的默认 Codex 模型。仅当你有意要固定使用特定模型时,才在 -C 前添加 -m "<model>"。
标志顺序:--full-auto -> -C -> -o -> 提示(仅在覆盖模型时在 -C 前插入 -m)。
有效标志: --full-auto, -m, -C, -o, --json, --output-schema, --add-dir, -s
不要使用: -q, --quiet(不存在)
当任务涉及多个仓库/目录时,使用 --add-dir 授予访问权限:
codex exec --full-auto -C "$(pwd)" --add-dir /path/to/other/repo -o output.md "prompt"
--add-dir 标志可重复使用以添加多个额外目录。
添加 --json 以将 JSONL 事件流式传输到 stdout 进行实时监控:
codex exec --full-auto --json -C "$(pwd)" -o output.md "prompt" 2>/dev/null
关键事件:
turn.started / turn.completed — 跟踪进度turn.completed 包含令牌 usage 字段使用 -s 控制沙箱:
| 级别 | 标志 | 使用时机 |
|---|---|---|
| 只读 | -s read-only | 评审、审查(无需文件写入) |
| 工作区写入 | -s workspace-write | 使用 --full-auto 时的默认值 |
| 完全访问 | -s danger-full-access | 仅在外部沙箱环境中使用 |
对于代码审查和分析任务,优先使用 -s read-only 而不是 --full-auto。
将工作分解为专注的任务。每个任务 = 一个 Codex 代理(除非合并)。
在生成代理之前,识别每个任务将要编辑哪些文件。 Codex 代理是无头的——它们无法协商锁或等待轮次。所有冲突预防都在此步骤完成。
对于每个任务,列出目标文件。然后应用正确的策略:
| 文件重叠情况 | 策略 | 操作 |
|---|---|---|
| 所有任务都修改同一文件 | 合并 | 合并成一个包含所有修复的代理 |
| 部分任务共享文件 | 多波次 | 共享文件的任务跨波次顺序执行 |
| 无重叠 | 并行 | 同时生成所有代理 |
# 决策逻辑(团队领导在脑中执行):
tasks = [
{name: "fix spec_path", files: ["cmd/zeus.go"]},
{name: "remove beads field", files: ["cmd/zeus.go"]},
{name: "fix dispatch counter", files: ["cmd/zeus.go"]},
]
# 所有任务都修改 zeus.go → 合并为 1 个代理
tasks = [
{name: "fix auth bug", files: ["pkg/auth.go"]},
{name: "add rate limiting", files: ["pkg/auth.go", "pkg/middleware.go"]},
{name: "update config", files: ["internal/config.go"]},
]
# 任务 1 和 2 共享 auth.go → 多波次(1+3 并行,然后 2)
# 任务 3 是独立的 → 与任务 1 一起在第 1 波执行
tasks = [
{name: "fix auth", files: ["pkg/auth.go"]},
{name: "fix config", files: ["internal/config.go"]},
{name: "fix logging", files: ["pkg/log.go"]},
]
# 无重叠 → 并行(所有 3 个同时执行)
策略:并行(无文件重叠)
Codex 子代理后端(首选):
spawn_agent(message="Fix the null check in pkg/auth.go:validateToken around line 89...")
spawn_agent(message="Add timeout field to internal/config.go:Config struct...")
spawn_agent(message="Fix log rotation in pkg/log.go:rotateLogFile...")
Codex CLI 后端:
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/auth-fix.md "Fix the null check in pkg/auth.go:validateToken around line 89..."', run_in_background=true)
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/config-fix.md "Add timeout field to internal/config.go:Config struct..."', run_in_background=true)
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/logging-fix.md "Fix log rotation in pkg/log.go:rotateLogFile..."', run_in_background=true)
策略:合并(同一文件)
将所有修复合并到单个代理提示中:
spawn_agent(message="Fix these 3 issues in cmd/zeus.go: (1) rename spec_path to spec_location in QUEST_REQUEST payload (2) remove beads field (3) fix dispatch counter increment location")
# CLI 等效命令:
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/zeus-fixes.md \
"Fix these 3 issues in cmd/zeus.go: \
(1) Line 245: rename spec_path to spec_location in QUEST_REQUEST payload \
(2) Line 250: remove the spurious beads field from the payload \
(3) Line 196: fix dispatch counter — increment inside the loop, not outside"', run_in_background=true)
一个代理,一个文件,不可能产生冲突。
策略:多波次(部分重叠)
# 第 1 波:非重叠任务(子代理后端)
spawn_agent(message='Fix null check in pkg/auth.go:89...')
spawn_agent(message='Add timeout to internal/config.go...')
# 等待第 1 波完成(子代理后端)
wait(ids=["<id-1>", "<id-2>"], timeout_ms=120000)
# 第 1 波:非重叠任务(CLI 后端)
Bash(command='codex exec ... -o .agents/codex-team/auth-fix.md "Fix null check in pkg/auth.go:89..."', run_in_background=true)
Bash(command='codex exec ... -o .agents/codex-team/config-fix.md "Add timeout to internal/config.go..."', run_in_background=true)
# 等待第 1 波完成
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
# 读取第 1 波结果 — 了解更改内容
Read(.agents/codex-team/auth-fix.md)
git diff pkg/auth.go
# 第 2 波:与第 1 波共享文件的任务(子代理后端)
spawn_agent(message='Add rate limiting to pkg/auth.go and pkg/middleware.go. Note: validateToken now has a null check at line 89. Build on current file state.')
# 第 2 波:CLI 后端等效命令
Bash(command='codex exec ... -o .agents/codex-team/rate-limit.md \
"Add rate limiting to pkg/auth.go and pkg/middleware.go. \
Note: pkg/auth.go was recently modified — the validateToken function now has a null check at line 89. \
Build on the current state of the file."', run_in_background=true)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
团队领导综合第 1 波的结果,并将相关上下文注入到第 2 波的提示中。不要直接转储原始差异——描述发生了什么变化以及为什么这对下一个任务很重要。
# 子代理后端:
wait(ids=["<id-1>", "<id-2>", "<id-3>"], timeout_ms=120000)
# CLI 后端:
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
.agents/codex-team/ 读取输出文件git diff 查看每个代理所做的更改mkdir -p .agents/codex-team
输出文件:.agents/codex-team/<task-name>.md
好的 Codex 提示是具体且自包含的:
# 好的:具体文件、行号、确切更改
"Fix in cmd/zeus.go line 245: rename spec_path to spec_location in the QUEST_REQUEST payload struct"
# 差的:模糊,需要探索
"Fix the spec path issue somewhere in the codebase"
在每个提示中包含:
对于多波次的第 2 波及以后的提示,还需包含:
timeout 参数增加时间如果 Codex 不可用,则委托给 /swarm,它会自动选择最佳可用后端(具有消息传递/重定向/优雅关闭功能的本机团队,或作为最后手段的后台任务):
Skill(skill="swarm")
注意:
/codex-team将 Codex CLI 进程作为后台 shell 命令运行——这没问题(独立的操作系统进程)。对于 Claude 代理编排,请使用/swarm,它使用你运行时的本机多代理原语。
| 项目 | 值 |
|---|---|
| 模型 | 用户配置的 Codex 默认模型(使用 -m "<model>" 固定一个) |
| 命令 | codex exec --full-auto -C "$(pwd)" -o <file> "prompt" |
| 输出目录 | .agents/codex-team/ |
| 每波最大代理数 | 建议 6 个 |
| 超时 | 默认 120 秒 |
| 策略 | 并行(无重叠)、合并(同一文件)、多波次(部分重叠) |
| 回退 | /swarm(运行时原生) |
用户说: 使用 /codex-team 修复 auth.go、config.go 和 logging.go 中的三个错误
发生的情况:
.agents/codex-team/*.mdgit diff 和测试验证结果结果: 三个错误在并行中修复,零文件冲突。
用户说: 修复 zeus.go 中的三个问题:重命名字段、移除未使用字段、修复计数器
发生的情况:
结果: 一个代理,一个文件,不可能产生冲突。
用户说: 修复 auth.go,为 auth.go + middleware.go 添加速率限制,更新 config.go
发生的情况:
结果: 顺序波次执行防止冲突,上下文向前传递。
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 找不到 Codex CLI | codex 未安装或不在 PATH 中 | 运行 npm i -g @openai/codex 或使用回退 /swarm |
| 默认 Codex 模型不可用 | 账户/配置不匹配或不支持的默认模型 | 验证 codex exec --full-auto -C "$(pwd)" "echo ok" 是否有效,或使用 -m "<model>" 固定一个支持的模型 |
| 代理产生文件冲突 | 多个代理编辑同一文件 | 使用文件目标分析并应用合并或多波次策略 |
| 代理超时且无输出 | 任务太复杂或提示太模糊 | 分解为更小的任务,添加具体的文件:行指令 |
| 输出文件为空或缺失 | -o 路径无效或权限被拒绝 | 检查 .agents/codex-team/ 目录是否存在且可写 |
每周安装次数
224
仓库
GitHub Stars
197
首次出现
2026年2月7日
安全审计
安装于
opencode223
codex220
gemini-cli219
github-copilot218
cursor214
kimi-cli213
The lead orchestrates, Codex agents execute. Each agent gets one focused task. The team lead prevents file conflicts before spawning — the orchestrator IS the lock manager.
For Claude-runtime feature compatibility (agents/hooks/worktree/settings), use ../shared/references/claude-code-latest-features.md when this skill falls back to /swarm.
Don't use when: Tasks need tight shared-state coordination. Use /swarm for dependency-heavy wave orchestration.
Select backend in this order:
spawn_agent available -> Codex experimental sub-agents (preferred)codex exec ...)skill tool is read-only (OpenCode) -> OpenCode subagents — task(subagent_type="general", prompt="<task prompt>")/swarm# REQUIRED before spawning with Codex CLI backend
if ! which codex > /dev/null 2>&1; then
echo "Codex CLI not found. Install: npm i -g @openai/codex"
# Fallback: use /swarm
fi
# Model availability test (uses the user's configured Codex default)
if ! codex exec --full-auto -C "$(pwd)" "echo ok" > /dev/null 2>&1; then
echo "Default Codex model unavailable. Falling back to /swarm."
fi
codex exec --full-auto -C "$(pwd)" -o <output-file> "<prompt>"
Uses the user's default Codex model. Add -m "<model>" before -C only when you intentionally want to pin a specific model.
Flag order: --full-auto -> -C -> -o -> prompt (insert -m before -C only when overriding the model).
Valid flags: --full-auto, -m, -C, -o, --json, --output-schema, --add-dir, -s
DO NOT USE: -q, --quiet (don't exist)
When tasks span multiple repos/directories, use --add-dir to grant access:
codex exec --full-auto -C "$(pwd)" --add-dir /path/to/other/repo -o output.md "prompt"
The --add-dir flag is repeatable for multiple additional directories.
Add --json to stream JSONL events to stdout for real-time monitoring:
codex exec --full-auto --json -C "$(pwd)" -o output.md "prompt" 2>/dev/null
Key events:
turn.started / turn.completed — track progressturn.completed includes token usage fieldUse -s to control the sandbox:
| Level | Flag | Use When |
|---|---|---|
| Read-only | -s read-only | Judges, reviewers (no file writes needed) |
| Workspace write | -s workspace-write | Default with --full-auto |
| Full access | -s danger-full-access | Only in externally sandboxed environments |
For code review and analysis tasks, prefer -s read-only over --full-auto.
Break work into focused tasks. Each task = one Codex agent (unless merged).
Before spawning, identify which files each task will edit. Codex agents are headless — they can't negotiate locks or wait turns. All conflict prevention happens here.
For each task, list the target files. Then apply the right strategy:
| File Overlap | Strategy | Action |
|---|---|---|
| All tasks touch same file | Merge | Combine into 1 agent with all fixes |
| Some tasks share files | Multi-wave | Shared-file tasks go sequential across waves |
| No overlap | Parallel | Spawn all agents at once |
# Decision logic (team lead performs this mentally):
tasks = [
{name: "fix spec_path", files: ["cmd/zeus.go"]},
{name: "remove beads field", files: ["cmd/zeus.go"]},
{name: "fix dispatch counter", files: ["cmd/zeus.go"]},
]
# All touch zeus.go → MERGE into 1 agent
tasks = [
{name: "fix auth bug", files: ["pkg/auth.go"]},
{name: "add rate limiting", files: ["pkg/auth.go", "pkg/middleware.go"]},
{name: "update config", files: ["internal/config.go"]},
]
# Task 1 and 2 share auth.go → MULTI-WAVE (1+3 parallel, then 2)
# Task 3 is independent → runs in Wave 1 alongside Task 1
tasks = [
{name: "fix auth", files: ["pkg/auth.go"]},
{name: "fix config", files: ["internal/config.go"]},
{name: "fix logging", files: ["pkg/log.go"]},
]
# No overlap → PARALLEL (all 3 at once)
Strategy: Parallel (no file overlap)
Codex sub-agent backend (preferred):
spawn_agent(message="Fix the null check in pkg/auth.go:validateToken around line 89...")
spawn_agent(message="Add timeout field to internal/config.go:Config struct...")
spawn_agent(message="Fix log rotation in pkg/log.go:rotateLogFile...")
Codex CLI backend:
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/auth-fix.md "Fix the null check in pkg/auth.go:validateToken around line 89..."', run_in_background=true)
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/config-fix.md "Add timeout field to internal/config.go:Config struct..."', run_in_background=true)
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/logging-fix.md "Fix log rotation in pkg/log.go:rotateLogFile..."', run_in_background=true)
Strategy: Merge (same file)
Combine all fixes into a single agent prompt:
spawn_agent(message="Fix these 3 issues in cmd/zeus.go: (1) rename spec_path to spec_location in QUEST_REQUEST payload (2) remove beads field (3) fix dispatch counter increment location")
# CLI equivalent:
Bash(command='codex exec --full-auto -C "$(pwd)" -o .agents/codex-team/zeus-fixes.md \
"Fix these 3 issues in cmd/zeus.go: \
(1) Line 245: rename spec_path to spec_location in QUEST_REQUEST payload \
(2) Line 250: remove the spurious beads field from the payload \
(3) Line 196: fix dispatch counter — increment inside the loop, not outside"', run_in_background=true)
One agent, one file, no conflicts possible.
Strategy: Multi-wave (partial overlap)
# Wave 1: non-overlapping tasks (sub-agent backend)
spawn_agent(message='Fix null check in pkg/auth.go:89...')
spawn_agent(message='Add timeout to internal/config.go...')
# Wait for Wave 1 (sub-agent backend)
wait(ids=["<id-1>", "<id-2>"], timeout_ms=120000)
# Wave 1: non-overlapping tasks (CLI backend)
Bash(command='codex exec ... -o .agents/codex-team/auth-fix.md "Fix null check in pkg/auth.go:89..."', run_in_background=true)
Bash(command='codex exec ... -o .agents/codex-team/config-fix.md "Add timeout to internal/config.go..."', run_in_background=true)
# Wait for Wave 1
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
# Read Wave 1 results — understand what changed
Read(.agents/codex-team/auth-fix.md)
git diff pkg/auth.go
# Wave 2: task that shares files with Wave 1 (sub-agent backend)
spawn_agent(message='Add rate limiting to pkg/auth.go and pkg/middleware.go. Note: validateToken now has a null check at line 89. Build on current file state.')
# Wave 2: CLI backend equivalent
Bash(command='codex exec ... -o .agents/codex-team/rate-limit.md \
"Add rate limiting to pkg/auth.go and pkg/middleware.go. \
Note: pkg/auth.go was recently modified — the validateToken function now has a null check at line 89. \
Build on the current state of the file."', run_in_background=true)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
The team lead synthesizes Wave 1 results and injects relevant context into Wave 2 prompts. Don't dump raw diffs — describe what changed and why it matters for the next task.
# Sub-agent backend:
wait(ids=["<id-1>", "<id-2>", "<id-3>"], timeout_ms=120000)
# CLI backend:
TaskOutput(task_id="<id-1>", block=true, timeout=120000)
TaskOutput(task_id="<id-2>", block=true, timeout=120000)
TaskOutput(task_id="<id-3>", block=true, timeout=120000)
.agents/codex-team/git diff for changes made by each agentmkdir -p .agents/codex-team
Output files: .agents/codex-team/<task-name>.md
Good Codex prompts are specific and self-contained :
# GOOD: Specific file, line, exact change
"Fix in cmd/zeus.go line 245: rename spec_path to spec_location in the QUEST_REQUEST payload struct"
# BAD: Vague, requires exploration
"Fix the spec path issue somewhere in the codebase"
Include in each prompt:
For multi-wave Wave 2+ prompts, also include:
timeout param for larger tasksIf Codex is unavailable, delegate to /swarm which auto-selects the best available backend (native teams with messaging/redirect/graceful shutdown, or background tasks as last resort):
Skill(skill="swarm")
Note:
/codex-teamruns Codex CLI processes as background shell commands — this is fine (separate OS processes). For Claude agent orchestration, use/swarmwhich uses your runtime's native multi-agent primitives.
| Item | Value |
|---|---|
| Model | User's configured Codex default (-m "<model>" to pin one) |
| Command | codex exec --full-auto -C "$(pwd)" -o <file> "prompt" |
| Output dir | .agents/codex-team/ |
| Max agents/wave | 6 recommended |
| Timeout | 120s default |
| Strategies | Parallel (no overlap), Merge (same file), Multi-wave (partial overlap) |
| Fallback | /swarm (runtime-native) |
User says: Fix three bugs in auth.go, config.go, and logging.go using /codex-team
What happens:
.agents/codex-team/*.mdgit diff and testsResult: Three bugs fixed in parallel with zero file conflicts.
User says: Fix three issues in zeus.go: rename field, remove unused field, fix counter
What happens:
Result: One agent, one file, no conflicts possible.
User says: Fix auth.go, add rate limiting to auth.go + middleware.go, update config.go
What happens:
Result: Sequential wave execution prevents conflicts, context flows forward.
| Problem | Cause | Solution |
|---|---|---|
| Codex CLI not found | codex not installed or not on PATH | Run npm i -g @openai/codex or use fallback /swarm |
| Default Codex model unavailable | Account/config mismatch or unsupported default | Verify codex exec --full-auto -C "$(pwd)" "echo ok" works, or pin a supported model with -m "<model>" |
| Agents produce file conflicts | Multiple agents editing same file | Use file-target analysis and apply merge or multi-wave strategy |
| Agent timeout with no output | Task too complex or vague prompt |
Weekly Installs
224
Repository
GitHub Stars
197
First Seen
Feb 7, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode223
codex220
gemini-cli219
github-copilot218
cursor214
kimi-cli213
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
| Break into smaller tasks, add specific file:line instructions |
| Output files empty or missing | -o path invalid or permission denied | Check .agents/codex-team/ directory exists and is writable |