codex-dynamic-workflows

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI Agent Dynamic Workflows

AI Agent 动态工作流

Use this skill to turn a large task into a supervised AI-agent workflow: draft an orchestration artifact, enter goal mode when sustained execution is requested, delegate disjoint work to subagents when available, integrate results, verify the outcome, and save reusable workflow artifacts.
This skill works in agents that support skills. Do not claim that a local script can call subagent tools unless the current environment exposes such a runner. When no programmable runner exists, create a human-readable orchestration script and operate it through the available agent tools.
使用此技能将大型任务转化为受监督的AI-agent工作流:起草编排工件,当需要持续执行时进入目标模式,将独立工作委托给可用的子代理,集成结果,验证输出,并保存可复用的工作流工件。
此技能适用于支持技能的代理。除非当前环境提供此类运行器,否则不要声称本地脚本可以调用子代理工具。当没有可编程运行器时,创建人类可读的编排脚本并通过可用的代理工具运行它。

Decision Rule

决策规则

Use dynamic orchestration when at least two are true:
  • The task has independent research, coding, review, migration, QA, docs, or design tracks.
  • The task is broad enough that an explicit success contract would reduce drift.
  • The task has risk: destructive edits, external writes, deploys, secrets, production data, billing, user accounts, or large repo-wide changes.
  • Verification benefits from a separate pass from implementation.
  • The workflow could become a reusable recipe for future tasks.
  • The user explicitly asks for a dynamic workflow, swarm, subagents, parallel agents, or Claude Code-style workflow.
If the task is small, do it directly and mention that full workflow orchestration was unnecessary.
当至少满足以下两个条件时,使用动态编排:
  • 任务包含独立的研究、编码、评审、迁移、QA、文档或设计环节。
  • 任务范围足够广泛,明确的成功契约可减少偏差。
  • 任务存在风险:破坏性编辑、外部写入、部署、密钥、生产数据、计费、用户账户或大型仓库范围的变更。
  • 验证工作从实施环节中独立出来会更有益。
  • 该工作流可成为未来任务的可复用模板。
  • 用户明确请求动态工作流、集群代理、子代理、并行代理或Claude Code风格的工作流。
如果任务规模较小,直接完成即可,并说明无需完整的工作流编排。

Operating Contract

操作约定

When using this skill:
  1. Restate the goal and success criteria.
  2. Create or update a workflow artifact before delegating.
  3. Ask for approval before risky, expensive, external, or destructive steps.
  4. Enter goal mode when the user explicitly requests sustained execution or when the invoked task clearly requires multi-turn completion.
  5. Split work into disjoint packets with clear ownership.
  6. Spawn subagents only when the current environment allows it and the user has authorized delegated or parallel agent work.
  7. Simulate subagents with isolated packet notes when no subagent runner is available.
  8. Integrate results explicitly; do not paste raw subagent dumps as the final answer.
  9. Verify with checks matched to the task's blast radius.
  10. Save reusable artifacts only when they will help future work.
使用此技能时:
  1. 重述目标和成功标准。
  2. 在委托工作前创建或更新工作流工件。
  3. 在执行有风险、高成本、外部或破坏性步骤前请求审批。
  4. 当用户明确要求持续执行,或调用的任务显然需要多轮完成时,进入目标模式。
  5. 将工作拆分为具有明确归属的独立工作包。
  6. 仅当当前环境允许且用户已授权委托或并行代理工作时,生成子代理。
  7. 当没有子代理运行器时,使用独立的工作包记录模拟子代理。
  8. 明确集成结果;不要将子代理的原始输出直接粘贴作为最终答案。
  9. 根据任务的影响范围匹配相应的检查来进行验证。
  10. 仅当工件对未来工作有帮助时才保存可复用工件。

Workflow Artifacts

工作流工件

Prefer creating a local run directory:
text
.workflow/<slug>/
|-- plan.md
|-- state.json
|-- orchestration.md
|-- packets/
|-- results/
`-- final-report.md
Use
scripts/new_workflow.py
to scaffold this structure:
bash
python3 /path/to/codex-dynamic-workflows/scripts/new_workflow.py "Task title"
Keep
plan.md
human-readable. Use
state.json
for status, packet IDs, approval state, and verification state. Use
orchestration.md
as the executable mental model: the sequence the agent will follow, the branching rules, and the packet prompts.
优先创建本地运行目录:
text
.workflow/<slug>/
|-- plan.md
|-- state.json
|-- orchestration.md
|-- packets/
|-- results/
`-- final-report.md
使用
scripts/new_workflow.py
搭建此结构:
bash
python3 /path/to/codex-dynamic-workflows/scripts/new_workflow.py "Task title"
保持
plan.md
为人类可读格式。使用
state.json
记录状态、工作包ID、审批状态和验证状态。将
orchestration.md
作为可执行的思维模型:代理将遵循的序列、分支规则以及工作包提示。

Orchestration Plan

编排计划

Draft a concise plan with:
text
Goal:
Success criteria:
Current context:
Constraints:
Risks:
Approval required:
Workflow artifact path:
Work packets:
Integration policy:
Verification:
Reusable artifacts:
Do not over-plan obvious work. The plan should be detailed enough to guide delegation and verification, not a substitute for execution.
起草简洁的计划,包含以下内容:
text
目标:
成功标准:
当前上下文:
约束条件:
风险:
需要审批:
工作流工件路径:
工作包:
集成策略:
验证:
可复用工件:
不要对显而易见的工作过度规划。计划应足够详细,以指导委托和验证,而不是替代执行。

Approval Gates

审批关卡

Ask one clear approval question before:
  • deleting, overwriting, mass-renaming, or force-pushing
  • running migrations or broad codemods
  • deploying, publishing, emailing, posting, or changing external systems
  • touching credentials, secrets, production data, billing, or user accounts
  • spawning many agents or long-running expensive jobs
  • making irreversible Git or repository operations
If approval is denied or unavailable, continue only with safe read-only planning, local drafts, or non-destructive checks.
Read
references/risk-gates.md
when risk is unclear.
在执行以下操作前,提出明确的审批问题:
  • 删除、覆盖、批量重命名或强制推送
  • 运行迁移或大范围代码修改
  • 部署、发布、发送邮件、发布内容或更改外部系统
  • 接触凭据、密钥、生产数据、计费或用户账户
  • 生成大量代理或长时间运行的高成本任务
  • 执行不可逆的Git或仓库操作
如果审批被拒绝或无法获得,仅继续进行安全的只读规划、本地草稿或非破坏性检查。
当风险不明确时,请阅读
references/risk-gates.md

Goal Mode

目标模式

If goal mode tools are available and the user has asked this skill to run the workflow, call goal mode with the full objective. Keep the objective intact; do not shrink it to the next step.
Do not enter goal mode for a small one-shot task, a purely advisory discussion, or when the user asks only for a plan.
如果目标模式工具可用,且用户已请求此技能运行工作流,请使用完整目标调用目标模式。保持目标完整;不要将其缩小到下一步。
对于小型一次性任务、纯咨询讨论或仅请求计划的情况,不要进入目标模式。

Work Packets

工作包

Each packet must be self-contained:
text
Packet ID:
Objective:
Context:
Files / sources:
Ownership:
Do:
Do not:
Expected output:
Verification:
Prefer packets with disjoint ownership:
  • codebase discovery
  • dependency or API research
  • implementation slice
  • tests and fixtures
  • docs and examples
  • UX or product review
  • security or risk review
  • final verification
For code-edit packets, assign non-overlapping files or modules. Tell workers they are not alone in the codebase, must not revert others' edits, and must adapt to concurrent changes.
每个工作包必须是独立的:
text
工作包ID:
目标:
上下文:
文件/来源:
归属:
需执行:
禁止执行:
预期输出:
验证:
优先选择具有独立归属的工作包:
  • 代码库发现
  • 依赖项或API研究
  • 实现切片
  • 测试和 fixtures
  • 文档和示例
  • UX或产品评审
  • 安全或风险评审
  • 最终验证
对于代码编辑工作包,分配不重叠的文件或模块。告知执行者他们并非独自处理代码库,不得回退他人的编辑,且必须适应并发变更。

Subagents

子代理

When a subagent runner is available:
  • Spawn only concrete, bounded, materially useful subtasks.
  • Keep immediate blocking work local.
  • Delegate sidecar work that can run while the main agent makes progress.
  • Avoid duplicate work across agents.
  • Ask workers to edit directly only when their write scope is disjoint and clear.
  • Wait for subagents only when their result is needed for the next critical-path step.
When no subagent runner is available:
  • Simulate the swarm with isolated packet passes.
  • Read only packet-relevant files during each pass.
  • Write packet notes under
    results/
    .
  • Integrate only after packet outputs are separate.
当子代理运行器可用时:
  • 仅生成具体、有边界、实质性有用的子任务。
  • 将即时阻塞性工作保留在本地处理。
  • 委托可在主代理推进时并行运行的辅助工作。
  • 避免代理之间的重复工作。
  • 仅当执行者的写入范围明确且独立时,才允许其直接编辑。
  • 仅当子代理的结果是下一步关键路径所需时,才等待其完成。
当没有子代理运行器时:
  • 使用独立的工作包环节模拟集群代理。
  • 在每个环节中仅读取与工作包相关的文件。
  • results/
    下写入工作包记录。
  • 仅在所有工作包输出完成后进行集成。

Integration

集成

After packets complete, synthesize:
text
Accepted:
Rejected:
Conflicts:
Decisions:
Final changes:
Remaining risks:
Resolve conflicts explicitly. If two packets disagree, inspect the authoritative source before choosing.
Use
scripts/collect_results.py
to produce an integration checklist from result files:
bash
python3 /path/to/codex-dynamic-workflows/scripts/collect_results.py .workflow/<slug>
工作包完成后,综合整理:
text
已接受:
已拒绝:
冲突:
决策:
最终变更:
剩余风险:
明确解决冲突。如果两个工作包存在分歧,在选择前检查权威来源。
使用
scripts/collect_results.py
从结果文件生成集成检查清单:
bash
python3 /path/to/codex-dynamic-workflows/scripts/collect_results.py .workflow/<slug>

Verification

验证

Run the narrowest reliable checks first, then broaden as risk warrants:
  • unit tests for touched code
  • typecheck or lint
  • build
  • browser or UI smoke test
  • script dry run
  • source citation check
  • migration dry run
  • manual checklist for non-code work
Use
scripts/verify_workflow.py
to check workflow artifact completeness:
bash
python3 /path/to/codex-dynamic-workflows/scripts/verify_workflow.py .workflow/<slug>
Report skipped checks honestly. Do not treat a workflow as complete until the evidence proves the original success criteria.
先运行最窄范围的可靠检查,然后根据风险扩大范围:
  • 受影响代码的单元测试
  • 类型检查或 lint
  • 构建
  • 浏览器或UI冒烟测试
  • 脚本试运行
  • 来源引用检查
  • 迁移试运行
  • 非代码工作的手动检查清单
使用
scripts/verify_workflow.py
检查工作流工件的完整性:
bash
python3 /path/to/codex-dynamic-workflows/scripts/verify_workflow.py .workflow/<slug>
如实报告跳过的检查。在证据证明原始成功标准已满足之前,不要认为工作流已完成。

Reusable Recipes

可复用模板

When a run produces a useful pattern, save a concise recipe in a project-appropriate location, such as
.workflow/recipes/<name>.md
or a repo docs folder. Include:
  • trigger
  • plan shape
  • packet list
  • verification checklist
  • known risks
Do not save transcripts, secrets, bulky logs, credentials, or sensitive personal details.
当某次运行产生有用的模式时,将简洁的模板保存到项目合适的位置,例如
.workflow/recipes/<name>.md
或仓库文档文件夹。内容包括:
  • 触发条件
  • 计划框架
  • 工作包列表
  • 验证检查清单
  • 已知风险
不要保存对话记录、密钥、庞大的日志、凭据或敏感个人信息。

References

参考资料

  • Read
    references/plan-schema.md
    when a machine-readable workflow plan is useful.
  • Read
    references/risk-gates.md
    before risky or ambiguous operations.
  • Read
    references/validation-examples.md
    when forward-testing or improving this skill.
  • 当需要机器可读的工作流计划时,请阅读
    references/plan-schema.md
  • 在执行有风险或不明确的操作前,请阅读
    references/risk-gates.md
  • 当进行前瞻测试或改进此技能时,请阅读
    references/validation-examples.md