agent-worktree
A local Git worktree manager isolates AI coding tasks, supports interactive review or headless automation, and preserves failed runs for inspection.
agent-worktree is a command-line tool for developers running AI coding agents on parallel tasks in one repository. Each task gets a separate Git working directory so agents can work without sharing the same files.
- Task workflow: Create a worktree, run an agent inside it, then keep or merge the result through one workflow.
- Interactive decisions: After an agent exits, choose to merge committed work, reopen the agent if changes remain uncommitted, or retain the worktree for later.
- Headless automation: Run tasks through CI or an agent orchestrator with a predefined policy for keeping or merging successful work and JSON results for automation.
- Failure recovery: Failed runs retain their worktrees for inspection, while runs with no changes clean up automatically; a failed or conflicting merge also restores the main repository's HEAD.
- Project integration: Use regular or squash merges, run project checks through pre-merge hooks, and copy local files into task workspaces.
The tool runs locally and is open source under the MIT license. It supports Windows and includes shell integration, which headless runs don't require. It runs your chosen agent command; model access and network requirements depend on that agent.