pwt — Power Worktrees

One branch per worktree, one port per server, one stable workflow. For humans and AI agents working in parallel.

brew install jonasporto/pwt/pwt

Why pwt

One setup, every agent

Claude Code, Codex, Cursor and the rest each create worktrees their own way, and each has its own answer for the setup problem: a copy file here, a hook there, nothing at all in most. Define it once in a Pwtfile and every tool lands on the same ready checkout, with its own port, its own database and its own generated config.

Wiring it so an agent uses pwt by default: the how-to.

Quick start

cd ~/projects/myapp
pwt init                        # Initialize project
pwt add feat/user-auth          # Create worktree from branch
pwt feat/user-auth              # Jump to a worktree
pwt server --bg                 # Start its dev server, detached
pwt list                        # List worktrees with git status

Install

# Homebrew
brew install jonasporto/pwt/pwt

# npm
npm i -g @jonasporto/pwt

# curl
curl -fsSL https://raw.githubusercontent.com/jonasporto/pwt/main/install.sh | bash

Pwtfile: project hooks

Think Makefile, but for the worktree lifecycle. pwt stays project-agnostic; your Pwtfile defines what setup, servers, and health mean for your stack.

PORT_BASE=5001

setup() {
    pwtfile_copy ".env.local"
    pwtfile_symlink ".cache"
    ./scripts/setup
}

server() {
    case "${1:-start}" in
        start) exec env PORT="$PWT_PORT" ./scripts/dev ;;
        stop)  ./scripts/dev-stop ;;
    esac
}

Stable gateway

Each worktree gets its own port, and one stable project URL routes to whichever worktree you're testing:

pwt gateway up --port 5999
pwt gateway use feat/user-auth
open "$(pwt gateway url)"

Built for agents too

Driving pwt from an AI agent or a script? pwt skill prints the agent guide: machine-readable output (list --porcelain, state --json), a stable exit-code table, and wait primitives (pwt server wait, pwt jobs wait) that replace poll loops. See also llms.txt.

From the blog

All posts →

Documentation

README · Install guide · FAQ · Changelog · State contract · llms.txt