How It Works
Draft uses git worktrees to give each ticket its own isolated copy of the repository. This allows multiple tickets to execute in parallel without interfering with each other.Lifecycle
- Creation — When a job runs, a worktree is created at
.draft/worktrees/{ticket_id}/ - Branching — Each worktree gets a dedicated branch:
goal/{goal_id}/ticket/{ticket_id} - Execution — AI agent and verification commands run inside the worktree
- Logging — Job logs are written to
{worktree}/.draft/logs/{job_id}.log - Cleanup — When a ticket reaches
DONEorABANDONED, its worktree is automatically removed
Safety Guarantees
- Your main branch is never modified during execution
- Each ticket’s changes are isolated to its own branch
- The
WorktreeValidatorensures no operations run on protected branches (main, master, develop) - Board’s
repo_rootis always authoritative — client-provided paths are rejected
Configuration
Requirements
- The project must be a git repository
- The configured base branch must exist
- If the directory is not a git repository, jobs run without isolation (with a warning)
Cleanup
Worktrees are cleaned up automatically when:- A ticket reaches a terminal state (
DONEorABANDONED) - The configured TTL expires (default: 72 hours)
- You manually trigger cleanup via the maintenance API