warmtree
A pool of pre-warmed git worktrees for parallel AI coding agents.
git worktree add is fast. Everything after it is slow: installing
dependencies, rebuilding caches, copying the .env files git does not track.
On a large repo that cold start is minutes, and with several agents working in
parallel you pay it several times a day. warmtree keeps a few worktrees already
checked out, warmed, and ready, so warmtree take <branch> hands you a
workspace in under a second.
Measured on a private TypeScript app (457 packages, 664 MB of node_modules):
a cold git worktree add + npm ci took 6.6 s even with a fast machine and
network; warmtree take handed over a warm slot in 0.15 s.
warmtree owns the create and release steps only. Everything in between is ordinary git, so your editor, hooks, and other worktree tools work on a pooled worktree unchanged.
Status
Early. Stable enough to dogfood, and dogfooded daily on a large private repo.
Install
Requires Python 3.12+ and git. No other runtime dependencies.
From a clone, for dogfooding while the code is still changing:
uv tool install --editable .
Or straight from GitHub:
uv tool install git+https://github.com/dcolliervb23/warmtree
Or from PyPI: uvx warmtree works on a machine with nothing but Python
and git.
Quick start
Run these from inside the repo you want to pool.
warmtree init # writes .warmtree.toml with defaults
# edit .warmtree.toml: add your install command to [warm] run
warmtree fill # creates and warms the slots, two by default
warmtree status # see them
Take a slot when you need an isolated workspace, work in it, then release it:
cd "$(warmtree take feature/login)" # bash / zsh
# ... commit, push, open a PR ...
warmtree release feature/login
PowerShell:
cd (warmtree take feature/login)
warmtree release feature/login
take prints only the slot path on stdout. Everything else it says goes to
stderr, so the cd idiom works.
Keep slots current with a nightly warmtree refresh from cron or Task
Scheduler, after whatever pulls your base branch.
Commands
| Command | What it does |
|---|---|
warmtree init [--force] [--no-skill] |
Write a starter .warmtree.toml. Pre-fills lockfiles from what it finds in the repo. Never guesses your install command. Installs the agent skill for any coding agent it detects. |
warmtree skill [--tool T] [--force] |
Install or refresh the agent skill in the tool folders this repo uses, or in the ones named with --tool. Never overwrites an edited copy without --force. |
warmtree fill |
Create slots until size are ready. Each slot is a worktree with a detached HEAD at the base branch, with copy files copied in and run commands executed. |
warmtree take <branch> [--from REF] |
Claim the oldest ready slot. Creates <branch> there (from REF or the base branch) or checks it out if it already exists. Prints the path, then refills the pool. |
warmtree take ... --no-refill |
Skip the refill. |
warmtree take ... --refill-background |
Refill in a detached process and return immediately. |
warmtree release <branch> [--keep-branch] [--force] |
Park the slot back on the base branch and mark it ready. Refuses a dirty tree unless --force. Deletes the branch if it is merged; an unmerged branch is always kept. |
warmtree refresh |
Move every waiting slot to the current base commit and re-copy files. Re-runs run only in slots whose lockfile hashes changed or whose last warm failed. Skips taken slots. |
warmtree size [N] |
Show the configured size and a count of slots by state. With N, write the new size to .warmtree.toml and grow or shrink the pool to match. Shrinking removes ready slots only. |
warmtree which |
Name the slot the current directory is inside, as slot-N <state> <branch>. Exit 1 if not in a slot. |
warmtree remove [SLOT...] [--all] [--force] |
Delete slots and their worktree registrations. Taken slots need --force. |
warmtree status [--json] |
Table of slots: name, state, branch, age, last warm, path. --json for scripts and agents. |
Slot states:
ready: parked on base, warm, free to take.taken: a branch is checked out and someone is working in it.warming:runcommands are executing right now, infillorrefresh.stale: the last warm failed.refreshretries it.takenever hands out a stale slot.
If no slot is ready, take falls back to a normal git worktree add, tells
you on stderr, and the new worktree joins the pool as a taken slot. An empty
pool is a slow path, never an error.
Configuration
.warmtree.toml at the repo root. Every key has a default; an empty file or
no file at all means a pool of two on the repo's default branch with nothing
to warm.
[pool]
size = 2 # slots to keep ready; taken slots do not count
# base = "main" # branch slots park on; default: the repo's default branch
# dir = "../.warmtree/app" # where slots live; default: ../.warmtree/<repo name>
lockfiles = ["package-lock.json", "uv.lock"] # re-warm only when one of these changes
[warm]
run = ["npm ci"] # commands run inside a slot at fill and refresh time
copy = [".env", ".env.local"] # untracked files copied from the main worktree
env = true # write WARMTREE_SLOT=<n> into the copied env files
Details worth knowing:
runcommands go through the shell, in order, inside the slot, withWARMTREE_SLOT=<n>in the environment. Output is captured and shown only when a command fails. warmtree has no idea what npm or dotnet are; you do.copypaths are relative to the repo root. Files missing from the main worktree are skipped. Withenv = true, copied files named like.env,.env.local, orapp.envget aWARMTREE_SLOT=<n>line appended, so your project can derive a per-slot port or database name from it.lockfilesare hashed inside the slot after each warm.refreshre-runsrunonly when a hash differs.warmtree size Nedits thesizeline in place. Your comments and other keys are left alone.- Unknown keys are errors, so a typo never silently disables warming.
Using it with coding agents
warmtree ships an Agent Skill: a short set of
instructions an agent loads when the task calls for an isolated workspace. It
tells the agent to check whether it is already in a slot (warmtree which),
check capacity before fanning out (warmtree size), take a slot instead of
running git worktree add, and release it when the branch is merged.
warmtree init installs it automatically wherever it sees signs of a coding
agent in the repo, and prints each path it wrote:
| Found in the repo | Skill installed at |
|---|---|
CLAUDE.md or .claude/ |
.claude/skills/warmtree/SKILL.md (Claude Code) |
.github/copilot-instructions.md |
.github/skills/warmtree/SKILL.md (GitHub Copilot) |
AGENTS.md or .agents/ |
.agents/skills/warmtree/SKILL.md (Codex and others) |
.cursor/ |
.cursor/skills/warmtree/SKILL.md (Cursor) |
Commit those folders so every agent on the project gets the skill. To install for a tool that was not detected, or to refresh the copies after upgrading warmtree:
warmtree skill --tool claude # claude, copilot, codex, or cursor; repeatable
warmtree skill # re-detect and refresh
warmtree skill --force # replace a copy you edited by hand
A copy you have edited is never overwritten without --force. Pass
--no-skill to init to skip all of this.
If your project uses an AGENTS.md instead, this paragraph is enough:
This repo has a warmtree pool. When you need an isolated workspace, run
warmtree take <branch>andcdinto the printed path instead ofgit worktree add. Runwarmtree whichfirst to see if you are already in a slot, andwarmtree sizeto check how many are ready before starting parallel work. When the branch is merged, runwarmtree release <branch>.
Claude Code's built-in worktree feature is not intercepted. The skill is the integration.
With worktrunk
worktrunk covers the rest of the worktree lifecycle: hooks, port allocation, cleanup of merged branches. The two fit together because warmtree only touches create and release.
- Use
warmtree takeinstead ofwt switch --createto get a warm checkout. - Inside the slot, worktrunk's commands work as they do in any worktree.
- When the branch is merged, run
warmtree release <branch>rather than worktrunk's remove, so the slot goes back to the pool instead of being deleted.
How it works
- Slots are detached worktrees parked on the base branch. A branch is only
created at
take, so a slot is never on a branch someone else is using and git's one-branch-per-worktree rule never bites the pool. - Release resets, it does not delete.
releasechecks out the base branch detached and runsgit clean -fd, which removes untracked files but keeps ignored ones.node_modules,.venv, and friends survive, so the slot is still warm for the next take. - Warming never holds the lock. A slot is marked
warmingunder the pool lock, the slow commands run with the lock released, and the result is written under the lock again. A three-minutenpm ciin one slot never blockstakeon another. - State is one JSON file with a file lock.
state.jsonlives in the pool directory and is rewritten atomically.takeholds an OS file lock while it picks a slot, so two agents callingtakeat the same moment get two different slots. - Standard library only. warmtree has to run before your project's own dependencies exist. That is the whole point.
The pool directory defaults to a sibling of your repo named after it, for
example ~/dev/.warmtree/myapp/slot-1, so repos that share a parent folder
never share a pool.
Development
uv sync # creates .venv with Python 3.12, pytest, ruff
uv run pytest -q # the whole suite, about a minute
uv run ruff check .
uv run ruff format --check .
Those three commands are exactly what CI runs on Ubuntu and Windows. Tests
create real temporary git repos; nothing about git is mocked, so git must
be on your PATH.
Useful variations:
uv run pytest -q tests/test_lifecycle.py # one file
uv run pytest -q -k concurrent # tests whose name matches
uv run pytest -x # stop at the first failure
uv run pytest -v # show every test name
uv run ruff format . # fix formatting instead of checking
Releasing
Releases go to PyPI through GitHub Actions trusted publishing; no API token is
stored anywhere. One-time setup on pypi.org: add a trusted publisher for owner
dcolliervb23, repository warmtree, workflow publish.yml, environment
pypi. Then:
uv version 0.1.0 # sets the version in pyproject.toml
git commit -am "chore: release 0.1.0"
git tag v0.1.0
git push && git push --tags
The workflow refuses to publish if the tag and the package version disagree.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file warmtree-0.1.0.tar.gz.
File metadata
- Download URL: warmtree-0.1.0.tar.gz
- Upload date:
- Size: 155.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01e7c750fef83f524f36a7666adcf9010e1f25f3ad81ffe935c4d849f0a6ba05
|
|
| MD5 |
4761577ff08327922a3e0c50c0fa50a5
|
|
| BLAKE2b-256 |
1eb6cb0c08e84f42c07f0666e532e47047702b663e5153a606b4e4c6d681c90d
|
Provenance
The following attestation bundles were made for warmtree-0.1.0.tar.gz:
Publisher:
publish.yml on dcolliervb23/warmtree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warmtree-0.1.0.tar.gz -
Subject digest:
01e7c750fef83f524f36a7666adcf9010e1f25f3ad81ffe935c4d849f0a6ba05 - Sigstore transparency entry: 2744441765
- Sigstore integration time:
-
Permalink:
dcolliervb23/warmtree@8ef74aed55bd56a4e6d5c7ac5f596566b5830643 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dcolliervb23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ef74aed55bd56a4e6d5c7ac5f596566b5830643 -
Trigger Event:
push
-
Statement type:
File details
Details for the file warmtree-0.1.0-py3-none-any.whl.
File metadata
- Download URL: warmtree-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb25b04a5266ab3c842d610b7341cbb18f4ef995789133bbe0acec6980af980c
|
|
| MD5 |
a5f35dcada78112022ce316ed295115e
|
|
| BLAKE2b-256 |
990d25fd62a9168654a7290a36fcd3a577e4369c2aa451b0b5987235dfd08ffb
|
Provenance
The following attestation bundles were made for warmtree-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on dcolliervb23/warmtree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warmtree-0.1.0-py3-none-any.whl -
Subject digest:
cb25b04a5266ab3c842d610b7341cbb18f4ef995789133bbe0acec6980af980c - Sigstore transparency entry: 2744441787
- Sigstore integration time:
-
Permalink:
dcolliervb23/warmtree@8ef74aed55bd56a4e6d5c7ac5f596566b5830643 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dcolliervb23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ef74aed55bd56a4e6d5c7ac5f596566b5830643 -
Trigger Event:
push
-
Statement type: