In short.
Grok's Worktrees documentation is a practical guide for developers coordinating parallel coding agents, with the catch that isolated changes still require Git integration and explicit cleanup. Default sessions include current uncommitted changes, while --ref provides a clean checkout of a chosen reference. The page gives concrete commands and lifecycle rules; installation requirements, pricing, licensing and runtime reliability remain unknown or unassessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete documentation page at [https://docs.x.ai/build/features/worktrees.md], covering session creation, terminal-interface controls, checkout behavior and housekeeping. Linked Subagents, Agent Dashboard and TOML Values pages are excluded. No license notice, pricing details or version requirements appear in the supplied page. No commands were executed, and isolation, resumption, integration and cleanup behavior were not independently tested.
The overview
identity
This is xAI's documentation for Grok worktree sessions at [https://docs.x.ai/build/features/worktrees.md]. It explains a repository-isolation feature through command examples, terminal-interface controls and housekeeping instructions.
assessment
The guide is useful for understanding how to start isolated coding sessions and manage their remaining directories. Its most consequential details are that default worktrees include uncommitted changes, checkouts are detached, and ending or deleting a session leaves its worktree behind.
It is a focused feature reference. It does not provide a complete installation tutorial, a worked integration example or evidence of execution reliability.
users
The guide fits developers assigning concurrent repository tasks to coding agents, such as separate refactoring and test-fixing work. It also covers users who want to fork an existing session or resume a session in a fresh worktree.
Beginners receive usable starting commands, but will need enough Git knowledge to inspect and integrate changes. The page does not teach those integration steps.
capabilities
Documented operations include starting a worktree session, assigning a name, selecting a clean starting reference, resuming a session in a fresh worktree, and listing, inspecting or removing tracked worktrees.
In the terminal interface, /fork --worktree forks the current session. Ctrl+W opens the New Worktree dialog on the welcome screen and dispatches new agents into worktrees from the Agent Dashboard. The page also states that subagents can request worktree isolation during delegated parallel work.
Using it
requirements
A Git repository is explicitly required. The examples assume access to the grok command or its terminal interface. Supported operating systems, minimum Git and Grok versions, installation steps, authentication and account eligibility are not specified.
mechanism
Each session receives an isolated repository copy under ~/.grok/worktrees/<repo>/<name>. By default, it starts from the current HEAD, meaning the current commit, and includes uncommitted changes. The --ref option instead provides a clean checkout of the chosen reference.
The worktree is a real Git checkout detached at its base commit, meaning it is not attached to a named branch. Changes are integrated using ordinary Git operations; the page does not prescribe a particular integration procedure.
setup
Within a Git repository, the documented starting command is grok -w. The named example is grok --worktree=feat "refactor module X"; the equals-sign form keeps the prompt out of the worktree name.
The command grok -w -r <session-id> resumes a session in a fresh worktree. Whether /new and /fork offer worktrees is configurable, but the relevant settings details are on a linked page outside this resource.
example
The supplied example grok -w --ref main "fix the flaky test" requests a worktree session based on a clean checkout of main. This illustrates how to start a task without carrying current uncommitted changes into its checkout.
The page supplies no resulting patch, test output or completed integration example. The command is a documented usage example and was not executed.
Assessment & evidence
limitations
Ending or deleting a session does not remove its worktree, and garbage collection runs only when explicitly invoked. Repository-file isolation is described; isolation of credentials, network access or external services is not addressed.
The page provides no measurements of startup time, disk use, concurrency limits or reliability. All runtime behavior remains untested here.
reasoning
Separate working copies address the documented problem of parallel agents overwriting one another's files. A practical implication is that integration remains a separate responsibility: file isolation alone does not establish that independently produced changes will combine correctly.
The choice of starting state matters. Including uncommitted changes can carry existing work into a task, while a clean reference checkout provides a different starting point. Users should choose deliberately between those documented behaviors.
alternatives
The page offers several ways to enter the same workflow: command-line creation, terminal-interface forking, dashboard dispatch and session resumption in a fresh worktree. It also distinguishes inheriting current changes from starting at a clean reference.
No comparison with other coding tools or isolation approaches is supplied, so relative cost, performance and setup effort are unknown.
evidence
The complete Worktrees page supplies command syntax, keyboard controls, the storage location and lifecycle rules. These support an explanation of documented behavior, but provide no execution logs, benchmark results or demonstrated task outcomes.
Access & freshness
costs
Pricing, subscription requirements and any model-usage charges are not stated, so monetary cost is unknown. Persistent repository copies also imply local storage use, but the page gives no storage estimate or measurements.
rights
The selected page contains no license or redistribution terms. Permission to redistribute the documentation and the terms governing use of Grok are not established by this evidence.
freshness
The supplied page was captured on 23 November 2026 at 15:46:43 UTC. It states no publication date, update date or applicable Grok version. Release compatibility and changes after capture are unknown.
actions
Choose whether the task should inherit current uncommitted changes or start from a clean reference, then use the corresponding documented command. Inspect the resulting changes and integrate them through Git.
Use grok worktree list and grok worktree show <id> to inspect tracked worktrees. Preview removal with the --dry-run option to grok worktree rm <ids...>. Plain grok worktree gc removes entries whose directories are gone; adding --max-age 7d also expires idle worktrees not used by a running process. Preserve any needed changes before removal.
