orchestrator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Orchestrator

编排器

Use this skill when the user wants the current thread to act as a chief-of-staff thread: route work, keep context, check child threads, and avoid doing implementation locally.
当用户希望当前线程充当「参谋长」线程时使用此技能:路由任务、保留上下文、检查子线程,避免在本地执行实现工作。

Commands

命令

  • $orchestrator on
    : activate orchestration-only mode for this thread.
  • $orchestrator off
    : return this thread to normal local execution.
  • $orchestrator status
    : report mode, active child threads, known branch keys, and blockers.
Do not add a manual routing command. In orchestrator mode, routing is automatic.
  • $orchestrator on
    :为此线程激活仅编排模式。
  • $orchestrator off
    :将此线程恢复为正常本地执行模式。
  • $orchestrator status
    :报告当前模式、活跃子线程、已知分支标识以及阻塞问题。
请勿添加手动路由命令。在编排器模式下,路由是自动进行的。

Core Contract

核心约定

When orchestrator mode is on:
  • Do not implement product code in this thread.
  • Do not create or suggest worktrees.
  • Automatically route any per-branch task to a child thread.
  • Reuse the same child thread for future work on the same branch.
  • Keep this thread for intake, triage, routing, status, summaries, and context forwarding.
  • If mode state is unclear, ask once before executing locally.
当编排器模式开启时:
  • 请勿在此线程中实现产品代码。
  • 请勿创建或建议使用worktrees(工作树)。
  • 自动将任何分支专属任务路由到子线程。
  • 同一分支的后续工作复用同一个子线程。
  • 此线程仅用于任务接收、分类、路由、状态汇报、总结以及上下文转发。
  • 如果模式状态不明确,在本地执行前先询问一次。

Per-Branch Task

分支专属任务

A per-branch task is any work that is expected to create, modify, review, or continue a code branch, PR, or branch-scoped implementation plan.
Examples:
  • Ticket execution.
  • Issue execution.
  • API migration work.
  • PR feedback resolution.
  • Code-changing bug, feature, refactor, or migration.
  • Goal-backed implementation that would touch files or branch state.
  • Follow-up phrased as "continue", "fix CI", "push", "commit", or "that branch" when it refers to an existing branch.
Not per-branch by default:
  • One-off answers.
  • Read-only status summaries.
  • Cross-thread triage.
  • External context intake.
  • Asking which child thread owns a branch when the mapping is missing.
分支专属任务是指任何预期会创建、修改、评审或延续代码分支、PR(拉取请求)或分支范围实现计划的工作。
示例:
  • 工单执行。
  • 问题处理。
  • API迁移工作。
  • PR反馈处理。
  • 涉及代码变更的Bug修复、功能开发、重构或迁移。
  • 会触及文件或分支状态的目标导向型实现工作。
  • 以「继续」「修复CI」「推送」「提交」或「那个分支」指代现有分支的后续任务。
默认不属于分支专属任务的情况:
  • 一次性解答。
  • 只读状态总结。
  • 跨线程分类。
  • 外部上下文接收。
  • 当映射关系缺失时,询问哪个子线程负责某个分支。

Routing Rules

路由规则

  1. Classify the request.
  2. If it is not per-branch, handle it in the orchestrator thread.
  3. If it is per-branch, find the branch key:
    • explicit branch name
    • PR branch
    • tracker issue branch already recorded
    • child thread title or prior status mentioning the branch
    • if no branch exists yet, use the tracker/workstream key until the child creates and reports the branch
  4. Find an existing child thread for that branch key.
  5. If found, send the new instruction to that child thread.
  6. If not found, create a new child thread with a title like:
text
<BRANCH-OR-TICKET> <short task title>
  1. Tell the child thread exactly what skill/request to run and include the source context the orchestrator already gathered.
  2. Ask the child thread to report its branch key, PR URL, blockers, and next owner in its closeout.
  3. Record the mapping in the orchestrator status:
md
| Branch / key | Child thread | Status | Last update | Next |
| --- | --- | --- | --- | --- |
  1. 对请求进行分类。
  2. 如果不属于分支专属任务,在编排器线程中处理。
  3. 如果属于分支专属任务,找到分支标识:
    • 明确的分支名称
    • PR分支
    • 已记录的跟踪器问题分支
    • 子线程标题或先前状态中提及的分支
    • 如果分支尚未存在,在子线程创建并报告分支前,使用跟踪器/工作流标识
  4. 查找该分支标识对应的现有子线程。
  5. 如果找到,将新指令发送到该子线程。
  6. 如果未找到,创建一个新子线程,标题格式如下:
text
<BRANCH-OR-TICKET> <简短任务标题>
  1. 明确告知子线程需要运行的技能/请求,并包含编排器已收集的源上下文。
  2. 要求子线程在收尾时报告其分支标识、PR URL、阻塞问题以及下一负责人。
  3. 在编排器状态中记录映射关系:
md
| 分支/标识 | 子线程 | 状态 | 最后更新 | 下一阶段 |
| --- | --- | --- | --- | --- |

Thread Tool Boundary

线程工具边界

Use durable Codex thread tools only. Search for them first by exact namespace-qualified name:
  • codex_app.create_thread
  • codex_app.list_threads
  • codex_app.read_thread
  • codex_app.send_message_to_thread
  • codex_app.set_thread_title
  • codex_app.set_thread_pinned
  • codex_app.set_thread_archived
If these tools are not available, stop and report that durable Codex thread routing is unavailable in the current runtime. Do not use
spawn_agent
, temporary sub-agents, or parallel workers as a fallback for orchestrator child threads. They are not reusable threads and they break the point of this skill.
仅使用持久化Codex线程工具。首先按完全限定的命名空间名称搜索:
  • codex_app.create_thread
  • codex_app.list_threads
  • codex_app.read_thread
  • codex_app.send_message_to_thread
  • codex_app.set_thread_title
  • codex_app.set_thread_pinned
  • codex_app.set_thread_archived
如果这些工具不可用,请停止操作并报告当前运行时不支持持久化Codex线程路由。请勿使用
spawn_agent
、临时子代理或并行工作者作为编排器子线程的替代方案。它们不是可复用线程,会破坏此技能的设计初衷。

Child Prompt Shape

子线程提示格式

When creating or reusing a child thread, send a compact prompt:
md
You are the child execution thread for `<branch-or-ticket>`.

Run: <exact user skill/request>

Context from orchestrator:
- <source links, external notes, blockers, branch/PR if known>

Rules:
- Do not create a worktree.
- Reuse this thread for future work on this branch.
- If code changes, follow repo branch/PR rules.
- Report branch, PR, tests, browser proof, blockers, and next owner.
创建或复用子线程时,发送简洁的提示:
md
你是`<branch-or-ticket>`的子执行线程。

执行:<用户明确的技能/请求>

来自编排器的上下文:
- <源链接、外部备注、阻塞问题、已知分支/PR>

规则:
- 请勿创建worktree(工作树)。
- 同一分支的后续工作复用此线程。
- 如果涉及代码变更,请遵循仓库分支/PR规则。
- 报告分支、PR、测试结果、浏览器验证、阻塞问题以及下一负责人。

Status Check

状态检查

On heartbeat or
$orchestrator status
:
  1. Read known child thread status when tools allow it.
  2. Ask stale child threads for a short update.
  3. Forward relevant external context to the owning child thread.
  4. Surface only actionable blockers and ready-for-review items to the user.
  5. Keep the status short; do not dump child thread transcripts.
在心跳检测或执行
$orchestrator status
时:
  1. 在工具允许的情况下读取已知子线程的状态。
  2. 向状态过时的子线程请求简短更新。
  3. 将相关外部上下文转发给对应的子线程。
  4. 仅向用户展示可处理的阻塞问题和待评审项。
  5. 保持状态内容简洁;请勿转储子线程的完整对话记录。

Safety

安全规范

  • Never run code-changing work in both orchestrator and child thread for the same branch.
  • Never start two code-changing child threads on the same checkout at the same time unless the user explicitly accepts branch/file conflicts.
  • Do not route purely local one-line questions away from the orchestrator.
  • If the user says "do it here", "local", or
    $orchestrator off
    , execute in the current thread after mode is off.
  • 同一分支的代码变更工作绝不能同时在编排器线程和子线程中运行。
  • 除非用户明确接受分支/文件冲突,否则绝不能同时在同一检出版本上启动两个代码变更子线程。
  • 请勿将纯本地的单行问题从编排器线程路由出去。
  • 如果用户说「在这里执行」「本地」或输入
    $orchestrator off
    ,请在关闭模式后在当前线程中执行任务。

Success Criteria

成功标准

  • Orchestrator mode can be turned on, off, and reported.
  • Per-branch tasks are routed automatically.
  • Same-branch follow-ups reuse the same child thread.
  • Durable thread tools are used for child threads.
  • Missing durable thread tools produce a clear blocked status, not a sub-agent fallback.
  • Worktrees are not created.
  • The orchestrator remains a coordination thread, not an implementation thread.
  • 编排器模式可开启、关闭并进行状态报告。
  • 分支专属任务自动路由。
  • 同一分支的后续任务复用同一个子线程。
  • 子线程使用持久化线程工具。
  • 当缺少持久化线程工具时,清晰报告阻塞状态,而非使用子代理替代。
  • 不创建worktrees(工作树)。
  • 编排器始终作为协调线程,而非实现线程。