每个智能体一个 worktree
两个智能体同时修改同一个检出目录,会互相干扰。--worktree 给智能体一个独立的 git worktree :同一仓库的另一个检出目录,位于它自己的分支上。
cd ~/code/shop
nsq run claude "fix the flaky checkout test" --worktree --name checkout-fix
nsq run codex "update the API docs" --worktree --name api-docs- 分支名为
nsq/<智能体名称>——上例中是nsq/checkout-fix。 - 检出目录位于
~/.neurosquad-cli/worktrees/,而不在你的仓库里。 nsq ls显示每个智能体的分支;nsq diff <agent>显示它改了什么。- 在仪表盘里,启动对话框(c)中有 worktree 开关。
像平常一样审查并合并这个分支——它就是一个普通的 git 分支。
移除
nsq rm checkout-fix # 移除智能体,保留 worktree 和分支
nsq rm checkout-fix --worktree # 同时删除 worktree 文件夹--worktree 会连同未提交的改动一起删除该文件夹——请先提交想要保留的内容。
不加 --worktree 时,nsq 会告诉你 worktree 在哪里并保留它,避免意外丢失工作。无论哪种情况,分支本身都会留在仓库里;不再需要时用 git 删除即可。