zai-org / zai-org/feedback

[Feature] 原生 /worktree 命令 + 并行隔离工作模式(worktree as a first-class platform primitive)

Open
#220 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: 功能建议
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

工具调用 / MCP · Tool use / MCP

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

使用场景 · Use case

我已经看过issue 132,我们说的不是第一个东西

类别 · Category

功能需求 / Feature request · 平台能力(Platform capability)

是否已有相关 issue

相关但不重复:#132。#132 聚焦于给现有 using-git-worktrees skill 补 UX(worktree
切换器 + 减少权限弹窗),其原文也指出 "No native worktree tool available in ZCode
platform"。本 issue 的诉求更根本:希望 worktree 成为平台一等公民,而不仅是 skill
并提供原生命令与"并行工作模式"。

背景与动机 · Motivation

当前要在 ZCode 里并行跑多个 agent(不同特性、实验性改动、长任务),它们会共享同一个
工作目录与 git 索引,极易互相覆盖文件、争抢同一分支。git worktree 是解决这类并行隔离
的事实标准,但目前在 ZCode 中:

  • 没有原生命令,只能依赖 skill 用 git fallback 拼出来;
  • 该 fallback 会触发 4+ 次连续权限弹窗(见 #132);
  • 每个 worktree 也没有与 agent 上下文 / 后台任务的一等绑定,隔离体验割裂。

结果:用户要么放弃并行,要么手动在终端建 worktree 再 File → Open Folder 打开,发现性
和可用性都很差,无法体现 ZCode 作为 ADE(Agentic Development Environment)在多 agent
编排上的优势。

建议方案 · Proposal

期望 · Proposed Behavior

提供原生 /worktree 命令族(不依赖 skill 的 git fallback),并把 worktree 作为
"并行工作模式"的基础单元,且提供给LLM对它的调用能力(参考ClaudeCode的WorkTree相关功能):

  • /worktree create [<name>] [-b <branch>]:创建隔离工作树(单次授权完成"建树 + 切分支
    • 项目初始化"),消除多段权限弹窗。
  • /worktree list:列出当前仓库的所有 worktree 及其绑定状态(分支、关联 agent / 任务)。
  • /worktree switch <name>:在 app 内一等切换(非 Open Folder)。
  • /worktree remove <name>:清理工作树与分支(带保护:有未提交改动时阻断或提示)。
  • /worktree run <name> ...(进阶):在指定 worktree 中启动一个独立 agent / 后台任务,
    实现"一个 worktree 绑一个 agent 上下文"的并行隔离。

配套的"并行工作模式"开关:进入后,新开的 agent 默认落到独立 worktree,互不干扰,状态/
日志在统一的 worktree 面板里聚合查看。

与现有能力的衔接

  • subagent / 后台任务 / 任务调度 协同:每个 worktree 作为独立执行环境,绑定独立
    agent 上下文与权限作用域。
  • #132 互补:#132 的 worktree 切换器与批量授权可作为该原生能力的 UI 呈现层;
    本 issue 提供底层的原生命令与并行模式。

参考 · References

  • #132(worktree skill UX,相关项)
  • devflowinc/uzi:CLI 用 git worktree + tmux 并行跑多个 coding agent
  • Claude Code / Codex 社区中 worktree 并行隔离的成熟用法

环境 · Environment

  • ZCode Desktop,Windows
  • 模型:builtin:bigmodel-coding-plan/GLM-5.2
预期价值 · Expected value

将明显加快开发速度

一般的使用情况是,在同一个目录里,一个Agent在修改代码的时候,其他Agent往往不能并行修改,如果有了worktree来进行隔离,那么多个功能就可以同时开展,当完成后把它们合并到主分支当中即可。我就可以一次做更多的事情,而不需要我手动创建副本分支目录再去对应目录里启动Agent了

你认为的优先级 · Your perceived priority

高 · High

你使用的 ZCode 版本 / 环境 · ZCode version / environment

Windows/ 8月6日的最新版本,工具未提及具体版本号

补充材料 · Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The proposal names the existing using-git-worktrees skill and related issue #132, but no source files or tests are identified. Start by reviewing that skill and the implementation behind current agent, background-task, and worktree handling. Done would require an agreed scope and native create, list, switch, and remove commands, with agent binding and parallel-mode behavior defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
desktop, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.