From d11f90fd667bbc8f4c8fbb9ae68205a68c5d28df Mon Sep 17 00:00:00 2001 From: laily Date: Tue, 7 Jul 2026 01:45:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(ack):=20worker=20=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E4=B8=8E=20worktree=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=20(v0.6.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kits/ack/VERSION | 2 +- kits/ack/adoption-checklist.md | 3 ++- kits/ack/core/closed-loop.md | 44 +++++++++++++++++++++++++++++++++- kits/ack/core/model-routing.md | 15 ++++++++++++ kits/ack/core/orca-adapter.md | 29 ++++++++++++++++++++++ 5 files changed, 90 insertions(+), 3 deletions(-) diff --git a/kits/ack/VERSION b/kits/ack/VERSION index a918a2a..b616048 100644 --- a/kits/ack/VERSION +++ b/kits/ack/VERSION @@ -1 +1 @@ -0.6.0 +0.6.2 diff --git a/kits/ack/adoption-checklist.md b/kits/ack/adoption-checklist.md index fe64082..292522e 100644 --- a/kits/ack/adoption-checklist.md +++ b/kits/ack/adoption-checklist.md @@ -41,7 +41,8 @@ - [ ] 决定用 Orca(`kit/core/orca-adapter.md`)还是手动模式(`kit/core/closed-loop.md`)。 - [ ] Orca:`orca status`、`terminal list` 可用,Coordinator / Developer / Test 三个终端都在,回报能发回 Coordinator。 -- [ ] 决定用当前 worktree 还是隔离 worktree。 +- [ ] 决定子任务放当前 worktree 起子 agent,还是新建隔离 worktree(决策速查见 `kit/core/closed-loop.md` §「子任务放哪」)。 +- [ ] 多 worktree 时确认 `tasks.yaml`(SSOT)只保留一个权威副本,由 Coordinator 单写。 ## 6. 验证命令 diff --git a/kits/ack/core/closed-loop.md b/kits/ack/core/closed-loop.md index 5cbdff8..9aa5771 100644 --- a/kits/ack/core/closed-loop.md +++ b/kits/ack/core/closed-loop.md @@ -28,7 +28,9 @@ ```text Coordinator 发现或读取 open 任务 -> prepare:写/补全 tasks.yaml 验收信号 - -> dispatch 给 Developer + -> 决定 worktree:当前 worktree 起子 agent,还是新建隔离 worktree(见下节「子任务放哪」) + -> 起 worker:按档位建 worker 终端(如 cursor-agent --model auto,见 model-routing.md) + -> dispatch 给 Developer(--to ) -> wait:Developer 的 worker_done / escalation -> writeback fixed_by_dev -> dispatch 给 Test(retesting) @@ -41,6 +43,46 @@ Coordinator 发现或读取 open 任务 ``` 一次派发只修一个明确问题(细则见 `optimization-method.md` §「每轮派发只修一个明确问题」)。 +「决定 worktree」「起 worker」两步的决策见下节与 `model-routing.md` / `orca-adapter.md`。 + +--- + +## 子任务放哪:新 worktree 还是当前 worktree + +Coordinator 派发前先决定 Developer/Test 在哪工作。两种方式: + +**方式 1:当前 worktree 起子 agent(终端)** + +```bash +orca terminal create --worktree active --command "cursor-agent --model auto" --json +``` + +- 适合:串行闭环、一次一个 Developer 任务、小改动、Test 要复测的正是 Developer 改的那棵树。 +- 优点:单一服务实例、无跨 worktree 对齐困扰、开销小。 +- 风险:多个 agent 同时改同一棵树会互相踩(半构建状态、git 冲突)。 + +**方式 2:新建隔离 worktree,再在其中起子 agent** + +```bash +orca worktree create --name --base-branch --json +# 然后在新 worktree 内 orca terminal create --worktree path: --command "cursor-agent --model auto" +``` + +- 适合:并行多个互不依赖的子任务、大/高风险/实验性改动、要保持基线分支干净(如 prod 不动、feature 走独立分支)、要独立 build 或跑独立服务实例、best-of-N 尝试。 +- 优点:隔离 + 并行 + 易回滚(删 worktree 即可)。 +- 成本:各自 build/依赖、服务要用不同端口、必须处理下节的 worktree/服务对齐。 + +**决策速查:** + +| 情况 | 选择 | +|------|------| +| 一次一个任务、串行修复 | 当前 worktree 子 agent | +| 多个任务并行、互不依赖 | 每个任务一个新 worktree | +| 高风险 / 实验 / 可能整体丢弃 | 新 worktree | +| 要保持基线分支干净 | 新 worktree(feature 分支)| +| 小改动、追求快 | 当前 worktree | + +**任务板(SSOT)只落一处**:无论开几个 worktree,`tasks.yaml` 只认一个权威副本(通常在基线/协调所在 worktree),由 Coordinator 单写。不要每个 worktree 各留一份会分叉的任务板。模型固定方式见 `model-routing.md` 与 `orca-adapter.md`。 --- diff --git a/kits/ack/core/model-routing.md b/kits/ack/core/model-routing.md index 345ce0e..0b18f85 100644 --- a/kits/ack/core/model-routing.md +++ b/kits/ack/core/model-routing.md @@ -55,6 +55,21 @@ --- +## 如何给 worker 指定模型(编排相关) + +**模型不由编排层设置。** Orca 的 `orchestration task-create` / `dispatch` 没有 `--model` 参数——`dispatch` 只是把任务投递给一个已存在的终端 handle。**模型在创建 worker 终端、启动 agent CLI 时用 CLI 自带的 flag 固定**,之后该终端的所有 dispatch 都用这个模型。 + +因此「档位 → 具体模型」的映射是 **agent 相关** 的,落地方式见 `orca-adapter.md` §「给 worker 终端固定模型」。常见 CLI: + +| Agent CLI | 指定模型的方式 | +|-----------|----------------| +| Cursor (`cursor-agent`) | `cursor-agent --model `;`--model auto` 让 Cursor 自动选(推荐给 Test/Developer worker) | +| 其它(codex / opencode 等) | 用各自 CLI 的模型参数或配置 | + +**本 kit 对 Cursor 的默认建议**:Test 与 Developer worker 用 `cursor-agent --model auto`(自动选型,天然偏向高效模型,符合"中低档位"意图);需要更强时改成具体强模型(如 `--model claude-opus-4-8-thinking-high`)。Coordinator 作为强模型脑,通常就是发起编排的那个会话本身。 + +--- + ## 成本原则 强模型产出高密度、可复用的产物:需求、架构决策、验收信号、任务拆分、失败复盘。 diff --git a/kits/ack/core/orca-adapter.md b/kits/ack/core/orca-adapter.md index cab9269..228d0a6 100644 --- a/kits/ack/core/orca-adapter.md +++ b/kits/ack/core/orca-adapter.md @@ -27,6 +27,35 @@ orca orchestration inbox --limit 20 --json --- +## 给 worker 终端固定模型 + +**编排层不设模型。** `task-create` / `dispatch` 都没有 `--model`;`dispatch --to ` 只是把任务投给一个已存在的终端,用的是那个终端里 agent 会话启动时的模型。要固定模型,就在 **创建 worker 终端** 时用 agent CLI 的模型参数: + +```bash +# Cursor:Test / Developer worker 用 auto 模型(自动选型) +orca terminal create --worktree path: \ + --command "cursor-agent --model auto" --title "DEV" --json + +# 需要更强模型时改成具体模型 +orca terminal create --worktree path: \ + --command "cursor-agent --model claude-opus-4-8-thinking-high" --title "DEV" --json +``` + +拿到返回的 handle 后再 `task-create` + `dispatch --to `。模型档位与选型策略见 `model-routing.md`。 + +需要隔离/并行时,先建新 worktree 再在其中起 worker(是否新建见 `closed-loop.md` §「子任务放哪」): + +```bash +orca worktree create --name --base-branch --json +orca terminal create --worktree path: --command "cursor-agent --model auto" --json +``` + +- `cursor-agent --list-models` 可列出合法模型;`auto` 表示由 Cursor 自动选型。 +- 其它 CLI(codex / opencode 等)用各自的模型参数或配置,`--command` 相应替换。 +- 若 worker 是已在跑的会话(用 `--inject` 投递),模型已由该会话启动时决定,无法在 dispatch 时改;要换模型需新建终端。 + +--- + ## 创建父任务 ```bash