從已知 base 啟動隔離工作
Worktree session 使用 ~/.grok/worktrees 下的真實 git checkout。預設從 current HEAD 開始且包含 uncommitted changes;需要乾淨、具名 base 時使用 --ref。
替 worktree 命名可讓 discovery 與 cleanup 更清楚。每個 checkout 在 base commit 上是 detached,成果仍需透過一般 git review、commit 與 integration 落地。
grok -w
grok --worktree=feat "refactor module X"
grok -w --ref main "fix the flaky test" 把有邊界的問題交給 subagents
Subagents 是具有獨立 context 的 child sessions,完成後向 parent 回傳 summary。內建 general-purpose 有完整能力;explore 只能 read、list、search,沒有 shell/edit;plan 可草擬實作計畫,同樣沒有 shell/edit。
依獨立 ownership 切分工作,例如 package、hypothesis、test surface 或 review concern。給每個 child 明確 output contract,並要求 parent 驗證 evidence,而不是只串接 summaries。
- 用 explore 建立 repository map。
- 用 plan 產生獨立 implementation proposals。
- Child 可能編輯檔案時使用 worktree。
有意識地 fork、檢查與清理
用 /fork --worktree 把目前 conversation 分支到隔離 checkout。Session 結束後 worktree 仍會保留,garbage collection 也只在明確呼叫時執行,因此 housekeeping 是 workflow 的一部分。
移除前先 list 與 inspect。rm subcommand 支援 --dry-run;先解析 exact target,再只刪除已整合或確定放棄的 worktree。
/fork --worktree
grok worktree list
grok worktree show <id>
grok worktree rm --dry-run <id>
grok worktree gc --max-age 7d