The brief

Docker Sandboxes provide three methods for organizing an agent's code: shared mounts, Git worktrees, and clone mode. Shared mounts allow the agent to work on a checkout from the host, while Git worktrees give each task a separate directory and branch. Clone mode, on the other hand, provides the agent with a separate checkout, allowing for independent branch changes and dependency installations. When using shared mounts, the agent can make changes to the code, and these changes are reflected in the host's local editor through hot reload.

Git worktrees enable each task to have its own working directory, and the agent's edits appear in the worktree. However, there is a Git limitation when mounting only a linked worktree, as the .git file points to metadata outside the mount, making it inaccessible to the agent. Clone mode addresses this issue by giving the agent a separate checkout with Git available inside the sandbox, allowing for a handoff of changes through Git remote or push to the repository's remote.