2.3 KiB
2.3 KiB
created, type, tags, source
| created | type | tags | source | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 2026-04-14 23:07 | zettel |
|
Claude Code Agent tool 参数: isolation |
Agent 工具 worktree 隔离是 Windows 原生并行的关键
ECC 的 dmux-workflows、scripts/orchestrate-worktrees.js 都依赖 tmux,Windows 原生环境跑不了。绕过这个限制最干净的方案不是切 WSL,是用 Claude Code 内置 Agent 工具的 isolation: "worktree" 参数。
机制
Agent 工具在 spawn 子代理时接受 isolation: "worktree"——平台会自动为该子代理建一个临时 git worktree,子代理在隔离分支上做修改,无改动时自动清理,有改动则把 path 和 branch 返还给主代理,由主代理决定合并还是丢弃。
这和 claude-devfleet 的 worktree 策略本质一致,只是调度层从 HTTP MCP 变成主代理自己。
为什么重要
- 零外部依赖 — 不需要 tmux、不需要额外服务,Claude Code 开箱即用
- 天然隔离 — git worktree 保证多个子代理改同一个仓库也不会互相踩脚
- 失败可丢弃 — 改坏了直接扔掉 worktree,主会话干净无污染
- 和现有 agent 生态复用 — 任何
subagent_type(general-purpose、csharp-reviewer、security-reviewer……)都能套 worktree
适用边界
- ✅ 互相独立的迁移任务、并行审查、多模块改造
- ✅ 想在 Windows 上复刻 dmux 「多 pane 并行」效果
- ❌ 跨模块强耦合、子代理需要实时看到彼此中间状态
- ❌ 需要长时间运行、跨会话存活(用
claude-devfleet或autonomous-agent-harnesscrons)
和其他编排方式的关系
| 需求 | 用这个 |
|---|---|
| 几个独立子任务,当前会话内搞定 | Agent + isolation: worktree(本 zettel) |
| DAG 依赖、跨会话、自动 merge | claude-devfleet(MCP) |
| Linux/WSL 上可视化多 pane | dmux-workflows |
| 定时 / 长周期无人值守 | autonomous-agent-harness + crons |
Related
- ECC 编排替代方案 (orchestrate 迁移)
- dmux 多Agent并行编排
- Autonomous Agent Harness 自主代理框架
- Everything Claude Code Agent 编排模式
Source
- Claude Code
Agenttool 原生参数isolation - ECC
skills/claude-devfleet/SKILL.md的 worktree 隔离策略(同源思路)