orchestrate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Orchestrate

任务编排

An explicit
/orchestrate <goal>
fans out a large task across parallel Cursor cloud agents. Workers don't talk to each other; they talk up through structured handoffs. The spawn, wait, and handoff loop lives in
scripts/cli.ts
. The planner writes
plan.json
, the script executes it, and the planner reads handoffs to decide what comes next. Long-running agent loops drift; a script with a JSON state file keeps its footing.
Required reading: the
cursor-sdk
skill (cursor/plugins/cursor-sdk).
Spawning, auth, and the error taxonomy live there. Don't reimplement what that skill already documents.
仅当用户明确输入
/orchestrate <goal>
时,才会将大型任务分发到多个并行的Cursor云代理中。工作者之间不会直接通信,而是通过结构化交接信息向上汇报。生成、等待和交接的循环逻辑位于
scripts/cli.ts
中。规划器负责编写
plan.json
,脚本执行该文件,之后规划器读取交接信息来决定下一步操作。长时间运行的代理循环容易偏离轨道,而带有JSON状态文件的脚本可以保持稳定运行。
必读内容:
cursor-sdk
技能(cursor/plugins/cursor-sdk)。
生成代理、身份验证以及错误分类的逻辑都在其中。请勿重复实现该技能已记录的功能。

Setup

配置步骤

  • CURSOR_API_KEY
    must be a personal/user key. Create it from Cursor Dashboard > Integrations, then read
    cursor-sdk
    Auth before using it.
  • SLACK_BOT_TOKEN
    is optional. When set, pass
    --slack-channel <id>
    to
    kickoff
    or the first
    run --root
    , or set
    SLACK_CHANNEL_ID
    . The script stores the channel in
    plan.slackChannel
    , posts the kickoff thread there, mirrors task status, and reads Andon reactions. When the token is unset, the script logs once and runs without Slack visibility; correctness does not change.
  • CURSOR_API_KEY
    必须是个人用户密钥。可从 Cursor Dashboard > Integrations 创建,使用前请阅读
    cursor-sdk
    的身份验证文档。
  • SLACK_BOT_TOKEN
    为可选配置。设置后,在执行
    kickoff
    或首次
    run --root
    时传入
    --slack-channel <id>
    ,或设置
    SLACK_CHANNEL_ID
    环境变量。脚本会将频道信息存储在
    plan.slackChannel
    中,在该频道发布启动线程,同步任务状态,并读取Andon反应。如果未设置该令牌,脚本会记录一次日志并在无Slack可见性的情况下运行;功能正确性不受影响。

Core principles

核心原则

These rules make the tree self-converging without global coordination.
  1. Planners own scopes and publish tasks. They do no coding. Writing
    plan.json
    , reading handoffs, and deciding what's next are planner work. Editing files, running
    git merge
    , and fixing conflicts inline are not. If a planner feels the urge to code, it publishes a task for a worker instead.
  2. Planners don't know who picks up their tasks. The script routes each task to a cloud agent. The planner's mental model stays at the task level.
  3. Workers are isolated. One task, one clone of the repo, no channel to any other agent. One handoff when done.
  4. Subplanners are recursive planners. A planner publishes a "subplan this slice" task; the subplanner fully owns that slice and hands back an aggregated handoff.
  5. Continuous motion via handoffs. A planner that thought it was done can receive a late handoff and replan. No "finished" state until the planner decides to stop publishing.
  6. Propagation, not synchronization. No cross-talk between siblings. No shared state between levels. Each level sees only its children's handoffs.
这些规则确保任务树无需全局协调即可自动收敛。
  1. 规划器负责范围界定并发布任务,不参与编码工作。 编写
    plan.json
    、读取交接信息以及决定下一步操作是规划器的职责。编辑文件、执行
    git merge
    以及在线解决冲突不属于规划器的工作。如果规划器需要编码,应发布一个任务交由工作者完成。
  2. 规划器无需知晓谁会承接其任务。 脚本会将每个任务路由到云代理。规划器只需关注任务层面即可。
  3. 工作者相互隔离。 一个任务对应一个仓库克隆,与其他代理无通信渠道。完成任务后仅提交一次交接信息。
  4. 子规划器是递归的规划器。 规划器发布“对此部分进行子规划”的任务;子规划器全权负责该部分,并返回汇总后的交接信息。
  5. 通过交接信息保持持续推进。 原本认为已完成的规划器可能会收到延迟的交接信息,从而重新规划。只有当规划器决定停止发布任务时,才会进入“完成”状态。
  6. 信息传播而非同步。 同级代理之间无交互。不同层级之间无共享状态。每个层级仅能看到其子级的交接信息。

Node types

节点类型

NodeRuns the loop?ScopeOutput
PlanneryesEntire user goalUser-facing message + optional PR
Subplanner (↻)yesOne slice of parent's scopeHandoff to parent
WorkernoOne concrete taskHandoff to spawning planner
VerifiernoOne target's acceptance criteriaVerdict handoff to spawning planner
Gitn/aShared mediumBranches (code) + handoffs/ (meaning)
节点类型是否运行循环?范围输出内容
Planner(规划器)用户的整个目标面向用户的消息 + 可选的PR
Subplanner(子规划器,↻)父级范围中的一个子部分向父级提交的交接信息
Worker(工作者)一项具体任务向生成它的规划器提交的交接信息
Verifier(验证器)一个目标的验收标准向生成它的规划器提交的验证结果交接信息
Git不适用共享媒介分支(代码) + 交接信息/(语义)

Role

角色

Two roles, one skill. Read your role's reference file and skip the other.
Dispatcher. You're in a local IDE session and the user typed
/orchestrate <goal>
. Your job is to kick off a cloud root planner and return its URL. See
references/dispatcher.md
. One-shot; you are not the planner.
Planner (root or sub). You were spawned with a structured prompt that opens with "You are the root planner for:" or "You are a subplanner for:". Or the user chose to run the planning loop locally. You own a scope, publish tasks, read handoffs, decide what's next. See
references/planner.md
.
disable-model-invocation: true
means this skill loads only on explicit invocation.
两种角色,对应一项技能。请阅读你所在角色的参考文件,忽略另一角色的内容。
调度员(Dispatcher):你处于本地IDE会话中,用户输入了
/orchestrate <goal>
。你的任务是启动一个云根规划器并返回其URL。请查看
references/dispatcher.md
。此为一次性任务;你并非规划器。
规划器(Planner,根或子级):你是通过结构化提示生成的,提示开头为“You are the root planner for:”或“You are a subplanner for:”。或者用户选择在本地运行规划循环。你负责一个范围,发布任务,读取交接信息,决定下一步操作。请查看
references/planner.md
disable-model-invocation: true
表示此技能仅在显式调用时加载。