spawn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Spawn a separate full Claude Code session in a tmux window, never a subagent. The work gets its own context window, its own tools, and a pane the user can join.
  1. Write the briefing to
    docs/spawn/<slug>.md
    :
    • With arguments: brief that task. Without arguments: hand this conversation off, then stop working the task here; two sessions on one task collide.
    • The session starts blank, so reference artifacts by path (specs, files, commits, issues) rather than pointing back to this conversation.
    • Name the skills the session should run, as slash commands. Do not restate what a skill already enforces; one line ("run
      /debug
      on it,
      /verify
      before done") replaces a paragraph.
    • Fence the collision zone: name the files and branches this session is using that the spawned one must not touch.
    • No secrets. Keys, tokens, and credentials never enter a briefing.
  2. Ask the user, in one round: where the session goes (a pane beside the current work, or its own window), and how much permission it gets (
    --dangerously-skip-permissions
    , or not; not means
    --permission-mode auto
    ). Then spawn without stealing focus, from the project root, with the chosen flag as
    <perm>
    :
    • Window:
      tmux new-window -d -n <slug> -c <root> 'claude <perm> "$(cat docs/spawn/<slug>.md)"'
    • Pane:
      tmux split-window -d -h -c <root> 'claude <perm> "$(cat docs/spawn/<slug>.md)"'
      Outside tmux, wrap the window command in
      tmux new-session -d -s <slug>
      and tell the user to
      tmux attach -t <slug>
      .
  3. Report where the session lives (window name, or pane in the current window) and one line on what it will do, then return to the current work. The spawned session is the user's to join, steer, or kill.
Working a draft spec (a
docs/specs/<slug>.md
that still has
## Open decisions
): offer one spawn per open, unblocked decision. This is how the draft's decisions parallelize:
drill
works one decision per session, and each spawned session claims its own, so that rule holds across all of them. Claim the decision in the spec before its session spawns; the briefing carries the spec path and the decision name, nothing the spec already says.
在tmux窗口中启动独立的完整Claude Code会话,而非子agent。该会话将拥有独立的上下文窗口、专属工具,以及可供用户加入的面板。
  1. 将任务简报写入
    docs/spawn/<slug>.md
    • 若携带参数:简要描述任务。若未携带参数:移交当前对话,随后停止在此处理该任务;同一任务的两个会话会产生冲突。
    • 会话启动时为空白状态,因此需通过路径引用工件(规格说明、文件、提交记录、问题),而非回溯至当前对话。
    • 指定会话应运行的技能,以斜杠命令形式书写。无需重复技能已强制执行的规则;一行内容(如“对其运行
      /debug
      ,完成前执行
      /verify
      ”)即可替代一段说明。
    • 界定冲突区域:列出当前会话正在使用、且新启动会话不得触碰的文件和分支。
    • 禁止包含机密信息。密钥、令牌和凭证绝不能出现在简报中。
  2. 一次性询问用户两个问题:会话的位置(当前工作区旁的面板,还是独立窗口),以及权限等级(是否使用
    --dangerously-skip-permissions
    ;不使用则默认
    --permission-mode auto
    )。随后在不抢占焦点的情况下,从项目根目录启动会话,将所选标记作为
    <perm>
    • 窗口模式:
      tmux new-window -d -n <slug> -c <root> 'claude <perm> "$(cat docs/spawn/<slug>.md)"'
    • 面板模式:
      tmux split-window -d -h -c <root> 'claude <perm> "$(cat docs/spawn/<slug>.md)"'
      若未处于tmux环境中,需将窗口命令包裹在
      tmux new-session -d -s <slug>
      中,并告知用户执行
      tmux attach -t <slug>
      来连接会话。
  3. 报告会话的位置(窗口名称,或当前窗口中的面板),以及一行关于其任务内容的说明,随后返回当前工作。新启动的会话由用户自行决定是否加入、引导或终止。
处理草稿规格说明(即仍包含
## Open decisions
docs/specs/<slug>.md
文件)时:可为每个未阻塞的待决议项启动一个独立会话。这是实现草稿决议并行处理的方式:
drill
工具在每个会话中处理一个决议项,每个新启动的会话都会认领专属的决议项,确保该规则在所有会话中均有效。在启动会话前,需在规格说明中标记已认领的决议项;简报中只需包含规格说明路径和决议项名称,无需重复规格说明中已有的内容。