@ogulcancelik/pi-worktree
v0.1.0
Published
Relocate the active pi session to a git worktree while preserving conversation history.
Maintainers
Readme
pi-worktree
Relocate the active pi session to a git worktree while preserving the full conversation history. When you create a new worktree and want to keep working there without losing context, this extension forks the session file, moves it to the new directory, and auto-continues.
Install
pi install npm:@ogulcancelik/pi-worktreeOr add manually to ~/.pi/agent/settings.json:
{
"packages": ["npm:@ogulcancelik/pi-worktree"]
}What it does
switch_worktree tool
Validates a git worktree path via git worktree list --porcelain, then pre-fills the editor with /switch-worktree <path>. Press Enter to confirm the relocation.
/switch-worktree command
Direct command for manual relocation. Usage:
/switch-worktree <path>How the switch works
- Validates the path is a registered git worktree
- Forks the current session file to the worktree directory via
SessionManager.forkFrom - Removes the
parentSessionreference so the forked session is standalone - Switches the active session to the new file
- Deletes the old session file
- Sends an auto-continue message so work resumes automatically
Herdr integration
When running inside herdr (HERDR_ENV is set), the extension emits herdr:blocked events so the UI can show a pending state while waiting for the user to press Enter. Outside herdr, these events are silently skipped.
Requirements
- pi v0.40+
- Git with worktree support
License
MIT
