Install
Install with PiG
pig install npm:pi-gibbonInstall with Pi
pi install npm:pi-gibbonPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"image": "https://raw.githubusercontent.com/ludoroo/pi-gibbon/main/media/logo.png",
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.2.0 (README.md). PiG does not review it.

pi-gibbon
Keep your Pi session moving with your code: pi-gibbon swings the full conversation into another Git checkout, in the same repository or a different one—and, in Herdr, into its destination workspace—without missing a beat.
What it does
When a task should continue on a different branch or in another local repository, ask Pi to move the current session. pi-gibbon will:
- Resolve an existing Git checkout or create/open the requested worktree.
- Fork the complete Pi session into that checkout.
- Start the replacement session in the new working directory.
- Continue the conversation with its existing context intact.
- Clean up the source session only after the replacement is ready.
With Herdr, the replacement runs in the destination workspace. If you switch to another workspace while the jump is being prepared, pi-gibbon leaves the destination in the background instead of stealing focus. Outside Herdr, Pi switches sessions in the current process.
Worktrees can be managed through Worktrunk or native Git. In the default auto mode, pi-gibbon uses Worktrunk when available and falls back to Git.
How to use it
Ask Pi explicitly to relocate the current session:
Move this session to a new worktree on branch
fix/login-race.
You can optionally name a base ref or destination workspace:
Move this session to a new worktree on branch
experiment/cache, based onmain, and label itcache experiment.
To return to the repository's primary checkout:
Move this session back to the main checkout.
To move into an existing checkout in another local repository:
Move this session to the checkout at
/Users/me/code/other-project.
The specified checkout is used exactly as named, including when it is a linked worktree. Its branch is not changed. You can also create or open a worktree in another repository:
Move this session to a worktree on branch
fix-loginin the repository at/Users/me/code/other-project.
Only the conversation moves. Uncommitted code stays in its original checkout; repositories are not cloned. Existing same-repository requests work unchanged.
The extension deliberately acts only on explicit relocation requests. Creating a checkout or discussing worktree strategy does not move the session. Provide the destination repository path explicitly; Pi should not guess it.
Requirements
- Pi 0.85.1 or newer
- Node.js 22.19.0 or newer
- Git
- Optional: Worktrunk executable
wt - Optional: Herdr runtime and executable
Install
pi install npm:pi-gibbon
Update it later with:
pi update npm:pi-gibbon
Configuration
No configuration is required. By default, pi-gibbon automatically selects the available worktree and terminal integrations.
To override those defaults, copy pi-gibbon.example.json to pi-gibbon.json in Pi's agent directory—normally ~/.pi/agent, or PI_CODING_AGENT_DIR when set:
{
"backend": "auto",
"multiplexer": "auto"
}
Set PI_GIBBON_CONFIG to read a different configuration file.
Worktree backend
auto: prefer Worktrunk, otherwise use native Gitworktrunk: require thewtexecutablegit: use native Git worktree commands
Terminal integration
auto: use Herdr when Pi is running in a valid Herdr pane; otherwise switch in processherdr: requireHERDR_ENV=1,HERDR_PANE_ID, and theherdrexecutablenone: switch the current Pi runtime to the forked sessiontmux: reserved, currently not implemented
Adapter selection belongs to user configuration; the LLM cannot choose a backend or multiplexer.
Tool reference
pi-gibbon registers one LLM-facing tool:
worktree_jump
It accepts:
destination:new,main, orexisting; defaults tonewrepository: optional path to an existing local Git checkout; required fordestination: existing. Absolute paths and~/are supported; relative paths resolve against the current session's working directory. Specify the checkout root, not a subdirectory.branch: branch to create or open; required fordestination: newbase: optional starting ref when creating a branch; defaults to the selected checkout'sHEADlabel: optional destination workspace label forneworexisting
Without repository, new and main use the current repository as before. With repository, new creates or opens a worktree in that repository, and main targets its primary checkout. existing targets the exact checkout specified by repository, without creating a worktree or changing branches; branch and base are not allowed.
For example, to move into an existing checkout:
{ "destination": "existing", "repository": "/Users/me/code/other-project" }
To create or open a branch's worktree in that repository:
{
"destination": "new",
"repository": "/Users/me/code/other-project",
"branch": "fix-login"
}
The internal /worktree-jump command and PI_GIBBON_READY_FILE environment variable coordinate relocation. They are not user-facing configuration.
Pi loads the extension through the package manifest:
{
"pi": {
"extensions": ["./src/index.ts"],
"image": "https://raw.githubusercontent.com/ludoroo/pi-gibbon/main/media/logo.png"
}
}
Safety model
Worktree creation and session relocation are separate operations:
- The destination is validated as a local Git checkout; for
new, the selected backend resolves or creates its worktree. worktree_jumpqueues relocation after the current tool turn settles.- Pi waits for the current agent turn to become idle, ensuring its result is saved.
- If the original request was aborted, relocation stops and retains the checkout.
- Otherwise, the complete session is forked into the destination working directory.
For Herdr relocation, the destination opens without focus and replacement Pi must report ready before the source shuts down. The destination receives focus only if the originating workspace is still focused. A failed or timed-out replacement is closed while the source remains active.
For Herdr, source-session deletion and pane closure occur only after the source process exits. A cleanup timeout preserves both sessions rather than risking the live one. For in-process relocation, the source session is removed only after the replacement is activated. If switching throws during destination initialization, recovery session files are retained; Pi may exit, requiring you to resume the source session.
Cross-repository relocation does not bypass repository trust checks. Pi handles destination project resources according to its normal trust rules. With Herdr, a first-time trust prompt may appear in the background destination workspace: the startup notification identifies it. Open that workspace and answer within the 60-second readiness window, or the replacement is closed and the source remains active. You can retry after reviewing and resolving trust.
Herdr readiness requires pi-gibbon to load in the destination Pi process too. Install it at user scope (as shown above) so it is available across repositories. Loading it only in the source project or through a source-only -e flag is insufficient unless the destination also loads it.
Development
Install the locked development toolchain and run all checks:
npm ci
npm run check
The checks include:
- strict TypeScript type checking;
- adapter, configuration, Git porcelain, cancellation, and cleanup tests;
- end-to-end relocation lifecycle tests with temporary sessions and mocked adapters;
- Pi resource-loader verification for exactly one tool and command;
- a production-style package installation and isolated Pi RPC load.
Tests do not relocate the active development session. GitHub Actions runs the same checks on Ubuntu and macOS.
Origin and license
Adapted from @ogulcancelik/pi-herdr-worktree-jump v0.1.0, originally written by Can Celik.
Licensed under the MIT License. The original copyright and license notice are preserved in LICENSE and THIRD_PARTY_NOTICES.md.