@whypeople/pi-wt

A Pi extension for creating, switching, listing, and cleaning Git worktrees.

Packages

Package details

extension

Install @whypeople/pi-wt from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@whypeople/pi-wt
Package
@whypeople/pi-wt
Version
0.2.0
Published
Aug 16, 2026
Downloads
206/mo · 23/wk
Author
whypeople
License
MIT
Types
extension
Size
47.8 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-wt

pi-wt manages Git worktrees from pi. Its worktrees and bookkeeping are stored beside the extension in worktrees/; the directory is excluded from Git. It also discovers existing t3code worktrees under ~/.t3/worktrees/<canonical-project-name>/.

Commands

  • /wt <name> creates a branch and a managed worktree. With no name, pi prompts for one.
  • /wt-new <name> creates a branch and managed worktree, then switches Pi's active runtime and session to it with a fresh transcript. With no name, Pi prompts for one.
  • /wt-fork [--yes] <name> creates a branch and managed worktree, forks the current transcript into it, then switches Pi to the fork. It requires at least one user or assistant message. At the configured context threshold (50% by default), Pi asks for confirmation because the first request may miss provider prompt cache; --yes bypasses this for automation.
  • /wt-switch <name> switches pi's active runtime and session to that worktree. With no name, it opens a picker with the active worktree highlighted and a name input. t3code worktrees are addressed by their Git branch, not their directory name.
  • /wt-list displays each managed worktree, highlighting the active one and showing its latest recorded or Git activity. Discovered t3code worktrees are marked [t3code].
  • /wt-delete <names...> deletes named managed worktrees. With no names, it opens a multi-select picker.
  • /wt-cleanup deletes non-active managed worktrees inactive for at least the configured threshold (default three days).
  • /wt-settings opens a settings form for the /wt-cleanup inactive-time threshold, auto-cleanup-on-startup toggle, and /wt-fork context threshold and warning style. Fork confirmation defaults to 50% of the active model context and can be set to confirm before forking, warn after forking, or turned off. Settings can be set per project or as the global default; a project setting overrides the global default. Outside the interactive TUI, it prints the current resolved settings read-only.

Worktree names may contain normal slash-separated Git branch components, such as feature/login, but cannot be absolute paths, options, or contain empty, . or .. components.

Install

Install the published @whypeople/pi-wt package from npm:

pi install npm:@whypeople/pi-wt@latest

To install the latest Git revision instead:

pi install git:git@github.com:mhayes853/pi-wt.git

For local development, keep this directory at ~/.pi/agent/extensions/pi-wt/; Pi auto-discovers index.ts. Reload extensions with /reload after changes.

Development

npm install
npm test
npm run typecheck

test/e2e.test.ts creates an isolated Git repository, invokes Pi with this extension, and verifies /wt creates a real Git worktree.