What a worktree isolates
A worktree is a second checkout of the same repository in its own folder. Each one has its own branch, its own working files and its own index. Two agents can edit the same file name in two worktrees without touching each other's work.
What a worktree does not separate is everything outside git:
- the processes each agent starts, which all run on the same cores;
- the memory those processes hold;
- the disk they write build output and caches to.
So worktrees solve the file problem of parallel agents. They leave the machine problem exactly where it was.
Why heavy commands collide
A coding agent spends most of its time waiting for its model, which costs little. The expensive moments are the checks it runs: a full test suite, a whole-project type check, a production build, an end-to-end run.
Test runners and build tools start a pool of workers to finish faster, so one suite may already keep most cores busy. When three agents reach “run the tests” at about the same moment, three pools compete for the same cores and memory.
Each agent sees only its own run, so none can tell that the cause is the machine, not the code.
What it looks like
- Timeouts in tests that pass alone. A test with a time limit fails because it waited for a core, not because the code is wrong.
- Failures that come and go. The same commit passes on one run and fails on the next.
- A slow, swapping machine. The load average climbs far above the number of cores, and memory pressure pushes data to disk.
- Wasted fixes. An agent reads a timeout as a bug and changes code that was never broken, then runs the whole suite again on the same busy machine.
The project's published measurement shows the effect on purpose: 4 agents start the same suite at once, asking for twice the CPU there is. Started directly, 400 of 400 tests failed on the first try in every run. Through the queue, none did.
One queue for the whole machine
DeployOnTime's machine queue is one waiting line for every heavy command on the computer, whichever worktree or project it comes from. A job started through it:
- waits for one of the slots, 2 by default;
- waits while the computer is short of room: high load with a busy CPU, less than 20% free memory, less than 10 GB free disk, or a low battery;
- runs under a time limit learned from earlier passed runs, and is stopped with everything it started at that limit;
- leaves a line in the journal, which later runs and
dotime-queue historyread.
The line lives in one state folder, ~/.dotime, so all worktrees of all projects of your user account share it. Only commands started through the queue are queued. See how it works for the full path of a job.
Set it up
Install the package once. It needs macOS or Linux, Node 22 or newer and git 2.31 or newer, and it has no dependencies.
npm install -g deployontimedotime-queue statusThen add the queue instruction to the repository's agent files:
dotime-queue setup # shows what it would add, and changes nothingdotime-queue setup --write # adds itIt adds a marked block to AGENTS.md, CLAUDE.md or .claude/CLAUDE.md, creating AGENTS.md if none exists. Commit it, and every worktree gives its agent the same instruction:
Start every test run, build and other heavy command through the queue:dotime-queue run --label "<project>: <task>" -- <command>Agents that speak MCP can use the MCP server instead of the shell command.
A worktree per job: run --isolate
The queue can also make the worktree. run --isolate runs a job in a git worktree of its own, on a new branch, from a clean tree. A passing job's changes are committed there; a failed one is kept for a look. integrate merges the branch in a temporary worktree, runs the check through the queue, and fast-forwards your branch only on a pass.
dotime-queue run --isolate --label "shop-api: rename price field" -- <agent or edit command>dotime-queue integrate <id> -- npm testWorktree details worth knowing
- One project name. Without a project in the label, a linked worktree counts as its main repository, so run limits and history stay together.
- Skips stay per folder. A test or lint check that already passed on the same clean commit is skipped, but only in the same folder. A pass in another worktree never counts, because its files may differ.
- Not across machines. A state folder may only be shared by processes that see the same process list. An agent in a container or a virtual machine gets a queue of its own.
~/.dotime. The source is on GitHub (opens in a new tab).Next: getting started, or how many agents one machine can run.