Git worktrees
What is a worktree?
A git worktree is a linked working copy of your repository. Unlike switching branches (which changes files inside a single directory), a worktree gives each branch its own complete directory on disk. Your main workspace stays untouched while an agent works in its own copy.- No file conflicts — each agent edits its own copy of your files.
- True parallel work — multiple agents run simultaneously without waiting for each other.
- Easy comparison — diff the agent’s branch against yours at any time.
- Safe experimentation — delete a worktree if you don’t like the result, with no impact on main.
Worktree storage locations
Configure where Agentastic creates worktrees in Settings > Agents:Creating a worktree
- From Agent Home
- From Settings
- From the terminal
1
Open Agent Home
Click the Home icon in the Navigator sidebar.
2
Write your prompt and set a branch name
Enter your task and choose a branch name. A random suggestion is provided.
3
Click Send
Agentastic creates the worktree automatically before launching the agent.
Switching between worktrees
You can also click directly on any worktree in the Agents tab of the Navigator (
Cmd+4).
Removing a worktree
- From Settings — open Settings > Agents, right-click the worktree, and select Remove.
- From the terminal — run
git worktree remove path/to/worktree. - Clean up stale references — run
git worktree pruneafter manual deletion.
Docker containers
For maximum isolation, you can run agents inside Docker containers. Each container has its own filesystem, network stack, and pre-installed tooling, with your worktree mounted at/workspace.
Enabling containers
1
Install Docker Desktop
Download and install Docker Desktop. Start it and wait for it to finish initializing.
2
Open Agent Home
Click the Home icon in the Navigator sidebar.
3
Switch mode to Container
Toggle Mode from “Worktree” to “Container”.
4
Select a container image
Choose a pre-defined image or enter a custom one.
5
Launch
Click Send. Agentastic pulls the image if needed and starts the container.
Available images
Container mounts
Agentastic automatically mounts the following paths into every container:Network modes
Change the network mode in Settings > Agents > Network Mode.
All built-in agents
Agentastic ships with 33 built-in agent definitions and auto-discovers them when their CLI is installed and available in yourPATH.
Custom agents
Add any terminal-based AI agent in Settings > Connections. The command must accept a prompt (either as an argument or interactively).Agent lifecycle
From launch to cleanup, every agent follows this lifecycle:Best practices
Use descriptive branch names
Names likefeature-user-auth, fix-login-bug, and refactor-api-client make it clear what each agent is working on when you have several running in parallel.
One task per agent
Keep each agent’s scope focused. Rather than asking one agent to “build the whole feature,” split it into:- “Add the database schema for users”
- “Create the API endpoints”
- “Build the frontend components”
Always review before merging
Before merging any agent’s work:- Open the Diff Viewer to inspect changes.
- Run AI code review for automated feedback.
- Test the changes in the agent’s environment.
- Confirm there are no regressions.
Clean up regularly
Remove old worktrees to free disk space, keep the agent list manageable, and avoid branch name conflicts. Use Settings > Agents or rungit worktree prune in the terminal.
Troubleshooting
"Branch already checked out" error
"Branch already checked out" error
A branch can only exist in one worktree at a time. Either remove the existing worktree that has the branch checked out, or choose a different branch name for the new agent.
Container won't start
Container won't start
- Verify Docker Desktop is running.
- Check that the image exists locally:
docker images. - Review container logs in Settings > Agents.
Agent not discovered in Agent Home
Agent not discovered in Agent Home
Agentastic discovers agents by scanning your
PATH. Ensure the agent CLI is:- Installed globally (not just locally in a project).
- Accessible in your
PATH— confirm withwhich <agent-name>. - Executable (
chmod +xif needed).