worktree-sessions
Share pi coding-agent sessions across linked git worktrees by storing them in the main worktree.
Package details
Install worktree-sessions from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:worktree-sessions- Package
worktree-sessions- Version
0.1.2- Published
- Jun 6, 2026
- Downloads
- not available
- Author
- inteist
- License
- unknown
- Types
- extension
- Size
- 393 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./dist/pi/index.js"
],
"image": "https://github.com/inteist/worktree-sessions/raw/main/worktree-sessions.png"
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README

worktree-sessions
Package/Extension that makes linked git worktrees share one session store.
The implementation is split into shared logic and agent-specific adapters:
src/worktree-sessions.tscontains the reusable git/session-linking logic.pi/index.tsis the Pi adapter that wires the shared logic into Pi lifecycle events and the/worktree-sessionscommand.
The npm package publishes compiled JavaScript and declarations from dist/.
When Pi starts inside a git repository, the adapter finds the repository's
main worktree from git rev-parse --git-common-dir. It then uses the main
worktree's .pi/sessions directory as the physical session store and symlinks
Pi's per-worktree default session directories to it.
This means:
- sessions started in the main worktree are visible from linked worktrees;
- sessions started in linked worktrees are saved back into the main worktree;
- newly-created linked worktrees are linked automatically the first time pi is launched inside them;
- existing
.jsonlsession files in old per-worktree session buckets are moved into the shared store.
Install
From npm:
pi install npm:worktree-sessions
Command
Inside pi, run:
/worktree-sessions
The command re-runs the linking step and reports the shared session directory.
Development
npm install
npm run check
npm run build
Add the absolute package path to ~/.pi/agent/settings.json under
packages.
{
"packages": [
"~/Projects/pi-extensions/worktree-sessions/",
}
