Grok WorldGrok Build CLI field station
SIGNAL LOCKED
NAV

GROK BUILD CLI / 08

Parallelize with worktrees and subagents

Parallel agents increase throughput only when ownership, isolation, evidence, and merge responsibility are explicit.

CHANNELPARALLEL ENGINEERING / ADVANCED / 12 MIN
SOURCES CHECKED2026-07-26
ORIGINOFFICIAL DOCS / PRIMARY

Start isolated work from a known base

A worktree session uses a real git checkout under ~/.grok/worktrees. By default it starts from current HEAD and includes uncommitted changes; use --ref when you need a clean, named base.

A named worktree keeps discovery and cleanup understandable. Each checkout is detached at its base, so landing the result still uses normal git review, commits, and integration.

grok -w
grok --worktree=feat "refactor module X"
grok -w --ref main "fix the flaky test"

Delegate bounded questions to subagents

Subagents are independent child sessions with their own context and return a summary to the parent. The built-in general-purpose type has full capabilities; explore can read, list, and search without shell or edits; plan drafts without shell or edits.

Split work by independent ownership: a package, hypothesis, test surface, or review concern. Give each child a concrete output contract and ask the parent to verify evidence rather than concatenating summaries.

  • Use explore for repository mapping.
  • Use plan for independent implementation proposals.
  • Use a worktree when a child may edit files.

Fork, inspect, and clean up deliberately

Use /fork --worktree to branch the current conversation into an isolated checkout. Worktrees persist after a session ends, and garbage collection runs only when invoked, so housekeeping is part of the workflow.

List and inspect before removal. The rm subcommand supports --dry-run; use it to resolve exact targets, then remove only worktrees whose changes have been integrated or intentionally abandoned.

/fork --worktree

grok worktree list
grok worktree show <id>
grok worktree rm --dry-run <id>
grok worktree gc --max-age 7d