AI & Developer Tools
Worktrunk: Keep AI Coding Tasks from Colliding in Git
Explore worktree management through two concurrent changes, with attention to local environments, shared services, review, and safe cleanup.
Rommel Clarino 3 min read
At a glance
Worktrunk simplifies managing Git worktrees for parallel coding workflows. Separate directories help keep edits apart, while integration still requires review of shared assumptions, database changes, and behavior. Start with two bounded tasks and make their operating environments explicit.
Two useful tasks can still interfere
An agent is changing a profile form while another investigates a pagination bug. In a shared directory, each can see files the other has partially edited. Even an ordinary build may combine unfinished work from both tasks. A separate working directory gives each task a clearer view of its own change.
Worktrunk is a CLI for Git worktree management. Its documentation describes creating and switching worktrees, inspecting their status, and automating local setup. This article proposes a workflow around those capabilities; the example is illustrative rather than a report of agents run for this article.
Give each change a clear boundary
For the profile task, define the fields and validation behavior that may change. For pagination, identify the affected listing and the expected behavior at its boundaries. Keep both tasks tied to the same known base so the eventual comparison is understandable.
The documented command pattern below illustrates creating the two worktrees and inspecting them. Run setup appropriate to the repository in each directory before starting work. The commands do not by themselves install dependencies or assign a separate database.
wt switch --create feature-profile
# Configure and work on the profile task here.
wt switch --create fix-pagination
# Configure and work on pagination here.
wt listSeparate files do not separate every dependency
Two development servers may still want the same port. Both directories may connect to the same local database or write generated output outside the repository. Map those resources before treating a worktree as a fully isolated environment.
Use explicit ports and clearly named data stores where independent state is necessary. Review setup hooks before enabling them: an automatic command runs with the permissions of the local workflow. Make the initial setup visible enough that you can reproduce it without remembering which terminal performed an undocumented step.
| Resource | Question |
|---|---|
| Server port | Can both applications run at once? |
| Database | Can one task alter the other's schema or fixtures? |
| Generated files | Are outputs contained in the expected directory? |
| Credentials | Which environment does this task reach? |
Integration is where the changes meet
A clean textual merge can still combine incompatible behavior. Suppose the profile task changes a response field while pagination introduces a client that expects its older shape. Git can accept both patches without understanding that dependency.
Review the first change, integrate it through the repository's normal process, then bring the second task up to date and inspect the combined behavior. Check the shared interfaces and user flows directly. The unit of progress is a reviewed result that works with the current codebase, rather than the number of agents kept busy.
Clean up after preserving the work
Before removing a worktree, check its changes, commits, and remote status. Include useful untracked files in the review instead of assuming every untracked path is disposable. Confirm that the work has reached its intended branch or review destination.
Worktrunk is worth considering when worktree administration itself becomes repetitive. Evaluate it with two small tasks and record whether setup, navigation, and review become easier. Directory separation helps organize concurrent work; clear ownership and deliberate integration make that organization valuable.