@ogulcancelik/pi-worktree
v0.1.1
Published
Relocate the active pi session to another git working tree while preserving conversation history.
Maintainers
Readme
pi-worktree
Relocate the active pi session to another git working tree while preserving the full conversation history. When you create a new worktree or switch to another repository 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 that the target path is inside a non-bare git working tree, 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 inside a non-bare git working tree
- 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
License
MIT
