Git Worktrees
Kangentic uses git worktrees to give each agent an isolated copy of your repository. This lets multiple agents work on different tasks simultaneously without stepping on each other’s changes.
What Are Git Worktrees?
Section titled “What Are Git Worktrees?”A git worktree is a linked working copy of your repository that shares the same .git directory. Each worktree can have a different branch checked out, so multiple branches can be worked on at the same time without cloning the repo multiple times.
How Kangentic Uses Worktrees
Section titled “How Kangentic Uses Worktrees”When an agent is spawned for a task with worktrees enabled, Kangentic:
- Creates a new branch from the configured base branch (e.g.,
fix-websocket-a1b2c3d4) - Creates a worktree in
.kangentic/worktrees/{slug}-{id}/inside your project - Launches the agent in the worktree directory
The agent makes all its changes in the worktree. Your main working directory is never touched.
Per-Task Toggle
Section titled “Per-Task Toggle”Each task has a Main / Worktree toggle that overrides the global worktree setting. Use this when you want a specific task to run directly in your main working directory (e.g., a quick config change) while keeping worktrees enabled for everything else.
Set this when creating a task or in the task detail dialog.
Branch Naming
Section titled “Branch Naming”Auto-generated branch names depend on whether the task’s base branch matches the project default:
<task-slug>-<8-char-id><flattened-base-branch>/<task-slug>-<8-char-id>When the base branch equals the project default (e.g., both main), the name is plain:
fix-websocket-a1b2c3d4add-user-auth-d4e5f678
When the base branch differs from the default, it is encoded as a namespace prefix (any / in the base is flattened to -), so git branch and GitHub’s branch list group work by base:
- base
release/1.2+ defaultmainproducesrelease-1.2/fix-regression-g7h8i9j0 - base
bugfix/inacc-adjustments+ defaultmainproducesbugfix-inacc-adjustments/task-title-ab12cd34
The 8-character ID prevents collisions when tasks have similar titles. The resolved base branch is also shown in the task detail dialog so you can confirm what the worktree branched from without leaving the app.
Base Branch
Section titled “Base Branch”The branch each worktree is created from follows a priority order:
- Task’s base branch — per-task override set in the task creation dialog
- Action config’s base branch — per-transition override
- Global
defaultBaseBranch— project or global setting (default:main)
Worktree Lifecycle
Section titled “Worktree Lifecycle”| Task Action | Session | Worktree | Branch |
|---|---|---|---|
| Move to active column | Spawns/resumes | Created (if new) | Created (if new) |
| Move to Backlog | Killed | Kept (code stays on disk) | Kept |
| Move to Done / Archive | Suspended | Kept (code stays on disk) | Kept |
| Delete task | Killed | Removed | Removed |
Moving a task to Backlog or Done does not delete the worktree — your code stays on disk. Only deleting the task removes the worktree, branch, and session data.
Reviewing Changes
Section titled “Reviewing Changes”When an agent completes its task, review the changes before merging:
# See what the agent changedgit diff main..fix-websocket-a1b2c3d4
# Merge when satisfiedgit merge fix-websocket-a1b2c3d4Working with Worktrees Manually
Section titled “Working with Worktrees Manually”Since Kangentic uses standard git worktrees, you can interact with them using normal git commands:
# List all worktreesgit worktree list
# Navigate to a worktreecd .kangentic/worktrees/fix-websocket-a1b2c3d4/PR Auto-Detection
Section titled “PR Auto-Detection”When an agent runs gh pr create or gh pr view in a worktree session, Kangentic automatically detects the PR URL from the terminal output and links it to the task. You can also link PRs manually using the kangentic_update_task MCP tool from within an agent session.