Problem
Original text:
「要能夠平行做很哆idd才可以,不然現在在agent teams的時候會衝突,這是很重要的,可能不能只用branch還要用worktree才可以吧?要考慮怎麼讓多個idd不會彼此衝突的方法」
— Source: 直接貼文字(/idd-issue 對話)
要在 agent teams 場景下平行執行多個 IDD pipeline。目前多個 IDD 同時跑會互相衝突 —— 它們共享同一個 git working tree / branch / 暫存檔。使用者推測單靠 branch 隔離不夠,可能需要 git worktree 才能讓每個 IDD 有獨立工作目錄。核心需求:設計一套讓多個 IDD 不彼此衝突的隔離機制。
Type
enhancement(architecture / exploration seed)
Priority
使用者明確標示「這是很重要的」—— importance 高,是 #164 agent-teams 探索能否落地的前置 blocker(沒有隔離機制,平行化無從談起)。但仍屬 exploration,等 trigger 才 implement。
為什麼這是 #164 的具體子問題
#164 問的是「IDD 如何搭配 agent teams(verify ensemble / orchestration)」這個大方向。本 issue 從中切出最硬的工程約束:
- agent teams 的價值來自平行 → 但 IDD 的 stateful 操作(branch checkout、working-tree edit、commit、
.claude/.idd/ 暫存、attachment staging)預設都假設單一序列執行者。
- 兩個 IDD 同時
git checkout 不同 branch → 後者覆蓋前者的 working tree。
- 兩個 IDD 同時寫 attachment staging / run-log → race。
兩個 case(user clarified 2026-05-30)
User clarification (verbatim):
「#167 的確我要分成兩個case,就是一個claude code視窗呼叫agent teams;另外一個是多個視窗每一個視窗可以跑一個idd」
平行的真正軸線是執行拓樸(execution topology),不是 pipeline 粒度(原 Clarity Surface 候選 a/b/c 軸選錯,已 resolved)。兩個 case 隔離難度不同:
Case A — 單一 Claude Code 視窗 → 呼叫 agent teams(within-window 平行)
- 平行單位 = 同一 session 內的 sub-agents(
Agent tool / superpowers:dispatching-parallel-agents / TeamCreate)。
- 它們共享同一 process + 同一 cwd + 同一 working tree → 隔離最硬:不能靠「不同視窗不同目錄」。
- 可能解:每個 agent 用
Agent(isolation: "worktree")(harness 原生支援 per-agent worktree,跑完未變更會自動清除);或限制平行只在 read-heavy phase(diagnose / verify 不碰 working tree),write phase(implement / commit)序列化。
- Orchestrator = 主 session,負責分派 + 收斂 + 臨界區守門。
Case B — 多個 Claude Code 視窗 → 每視窗跑一個 IDD(across-window 平行)
- 平行單位 = 獨立 Claude Code session(不同視窗),各自獨立 process。
- 但若多視窗指向同一 repo 目錄 → 仍 working-tree 互相覆蓋。
- 可能解:每視窗開在自己的 git worktree(
.claude/worktrees/idd-<N>/)或獨立 clone;EnterWorktree / idd-implement --cwd 直接適用。
- 比 Case A 容易:視窗本就獨立 process,只要目錄分開、無共享 in-process 狀態。
兩 case 共用下方衝突面,但 severity 不同:Case A 連 .claude/.idd/ in-process staging 都共享、最硬;Case B 只要目錄隔離就解大半。
衝突面盤點(待 diagnose 時細化)
| 衝突資源 |
單序列下 |
平行下風險 |
Case A |
Case B |
| Git working tree |
✅ 安全 |
🔴 checkout 互相覆蓋 |
🔴 |
🔴(同目錄時) |
| Branch HEAD |
✅ 安全 |
🔴 各自 commit 到同 branch |
🔴 |
🔴(同目錄時) |
.claude/.idd/ 暫存 |
⚠ ms-nonce 部分緩解(#76) |
🟡 staging dir race |
🔴 in-process 共享 |
🟢 目錄分開即解 |
| Attachment release upload |
✅ 安全 |
🟡 --clobber 同名互蓋 |
🟡 |
🟡 |
| GitHub issue/PR state |
✅ 安全 |
🟢 GitHub 端 atomic,低風險 |
🟢 |
🟢 |
候選方向(不預設答案,留 diagnose)
- git worktree per IDD — 每個 IDD 在
.claude/worktrees/idd-<N>/ 有獨立 working tree + branch。對應現有 superpowers:using-git-worktrees skill + idd-implement --cwd flag。(Case B 主力解;Case A 用 per-agent worktree 變體)
- isolation 改 process/container 層 — 各 IDD 跑在獨立 sandbox(重,但徹底)。
- orchestrator 序列化臨界區 — read-heavy(diagnose/verify)平行,write-heavy(implement/commit)走 lock / queue。(Case A 主力解)
- 混合 — read 階段平行、write 階段隔離 worktree。
既有 prior art(diagnose 起點)
Agent(isolation: "worktree"):harness 原生 per-agent worktree 隔離 —— 直接對著 Case A。
EnterWorktree harness tool:Claude Code 原生支援 .claude/worktrees/ 隔離 —— 對著 Case B。
idd-implement --cwd / idd-verify --cwd:已支援在指定 local clone 上操作(references/cross-repo-cwd.md 的 substitution rule)。worktree 隔離可視為「同 repo 多 clone」特例。
idd-all-chain:已做「ONE cluster branch + ONE review PR」的 spawn-manifest orchestration —— 但那是單序列遞迴,不是平行。
Out of scope
Clarity Surface
| Type |
Term |
Concern |
Candidates |
Status |
| ambiguity |
「平行做很多 idd」 |
平行的粒度未定 |
(a) 平行整條 pipeline(issue→close)/ (b) 只平行 read-heavy phase(diagnose/verify)/ (c) 平行不同 root issue 的 idd-all-chain |
resolved @ 2026-05-30 — user 校正:軸選錯,真正軸是執行拓樸(Case A within-window agent teams / Case B across-window 多視窗)。原 a/b/c 是次級子問題。見「兩個 case」section |
| missing-context |
「agent teams」 |
指 Claude Code TeamCreate/SendMessage 原語,還是泛指多 agent?沿用 #164 同一 ambiguity |
見 #164 candidates |
resolved @ 2026-05-30 — Case A 把「agent teams」定義為單視窗內呼叫的平行 sub-agent 原語(Agent tool / dispatching-parallel-agents / TeamCreate),非泛指。同步釐清 #164 該 row |
Linked-Context Siblings
Parent: #164(本 issue 是其工程約束子問題)
Current Status
Phase: closed
Last updated: 2026-05-30 by /idd-diagnose
Key Decisions
- 平行軸 = 執行拓樸(Case A within-window agent teams / Case B across-window 多視窗),非 pipeline 粒度(/idd-clarify 校正)
- Complexity = Spectra(Layer 2 新 published surface + Layer 3 cross-spec impact + architectural decision)
- 關鍵發現:git worktree 同時解 working-tree +
.claude/.idd/ staging 兩衝突面;硬點轉移到「收斂」(N worktree branch 的 merge-back)
- Case B 先做(CP 值高、reuse 現有原語);Case A 後做(orchestrator 收斂協定難)
Scope Changes
Blocking
Commits
- (none — exploration seed, no implementation)
Problem
要在 agent teams 場景下平行執行多個 IDD pipeline。目前多個 IDD 同時跑會互相衝突 —— 它們共享同一個 git working tree / branch / 暫存檔。使用者推測單靠 branch 隔離不夠,可能需要 git worktree 才能讓每個 IDD 有獨立工作目錄。核心需求:設計一套讓多個 IDD 不彼此衝突的隔離機制。
Type
enhancement(architecture / exploration seed)
Priority
使用者明確標示「這是很重要的」—— importance 高,是 #164 agent-teams 探索能否落地的前置 blocker(沒有隔離機制,平行化無從談起)。但仍屬 exploration,等 trigger 才 implement。
為什麼這是 #164 的具體子問題
#164 問的是「IDD 如何搭配 agent teams(verify ensemble / orchestration)」這個大方向。本 issue 從中切出最硬的工程約束:
.claude/.idd/暫存、attachment staging)預設都假設單一序列執行者。git checkout不同 branch → 後者覆蓋前者的 working tree。兩個 case(user clarified 2026-05-30)
平行的真正軸線是執行拓樸(execution topology),不是 pipeline 粒度(原 Clarity Surface 候選 a/b/c 軸選錯,已 resolved)。兩個 case 隔離難度不同:
Case A — 單一 Claude Code 視窗 → 呼叫 agent teams(within-window 平行)
Agenttool /superpowers:dispatching-parallel-agents/ TeamCreate)。Agent(isolation: "worktree")(harness 原生支援 per-agent worktree,跑完未變更會自動清除);或限制平行只在 read-heavy phase(diagnose / verify 不碰 working tree),write phase(implement / commit)序列化。Case B — 多個 Claude Code 視窗 → 每視窗跑一個 IDD(across-window 平行)
.claude/worktrees/idd-<N>/)或獨立 clone;EnterWorktree/idd-implement --cwd直接適用。衝突面盤點(待 diagnose 時細化)
.claude/.idd/暫存--clobber同名互蓋候選方向(不預設答案,留 diagnose)
.claude/worktrees/idd-<N>/有獨立 working tree + branch。對應現有superpowers:using-git-worktreesskill +idd-implement --cwdflag。(Case B 主力解;Case A 用 per-agent worktree 變體)既有 prior art(diagnose 起點)
Agent(isolation: "worktree"):harness 原生 per-agent worktree 隔離 —— 直接對著 Case A。EnterWorktreeharness tool:Claude Code 原生支援.claude/worktrees/隔離 —— 對著 Case B。idd-implement --cwd/idd-verify --cwd:已支援在指定 local clone 上操作(references/cross-repo-cwd.md的 substitution rule)。worktree 隔離可視為「同 repo 多 clone」特例。idd-all-chain:已做「ONE cluster branch + ONE review PR」的 spawn-manifest orchestration —— 但那是單序列遞迴,不是平行。Out of scope
/idd-diagnose。Clarity Surface
Linked-Context Siblings
Parent: #164(本 issue 是其工程約束子問題)
Current Status
Phase: closed
Last updated: 2026-05-30 by /idd-diagnose
Key Decisions
.claude/.idd/staging 兩衝突面;硬點轉移到「收斂」(N worktree branch 的 merge-back)Scope Changes
Blocking
Commits