@arnavpadwal/pi-universal-sessions
Universal session switch for pi — browse, switch, delete, and rename sessions from ANY project
Package details
Install @arnavpadwal/pi-universal-sessions from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@arnavpadwal/pi-universal-sessions- Package
@arnavpadwal/pi-universal-sessions- Version
1.0.0- Published
- May 12, 2026
- Downloads
- 44/mo · 17/wk
- Author
- arnavpadwal
- License
- MIT
- Types
- extension
- Size
- 12.1 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./extensions/pi-universal-sessions.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-universal-sessions
Universal session switch for pi — like opencode's session_list (<leader>l).
Browse, switch, delete, and rename sessions from all your projects in one place.
Installation
pi install npm:@arnavpadwal/pi-universal-sessions
# or from source:
pi install /path/to/pi-universal-sessions
Or just copy extensions/pi-universal-sessions.ts to ~/.pi/agent/extensions/.
Usage
| Command | Description |
|---|---|
/sessions |
Open the universal session browser |
Features
- List all sessions — Scans all projects under
~/.pi/agent/sessions/viaSessionManager.listAll() - Smart grouping — Current-project sessions shown first, others grouped by directory, sorted by most recent
- Switch session — Pick one to switch; queues a
cd <dir>so the agent's bash shell lands in the right project directory - Delete sessions — Select "🗑 Delete a session" → pick one → confirm with details → permanently removed
- Rename sessions — Select "✏️ Rename a session" → pick one → input a new display name
Workflow
/sessions
→ See all sessions from all projects
→ Pick a session to switch to it
→ Or pick "Delete/ Rename" actions at the top
→ After delete/rename, the list refreshes automatically
How it works
The extension uses SessionManager.listAll() (a built-in pi API) to discover every session file across all project directories. It groups them by cwd and shows them sorted by most recently modified.
- Switch:
ctx.switchSession()+replacedCtx.sendUserMessage("cd ...") - Delete:
fs.unlink()on the session.jsonlfile - Rename: appends a
session_infoentry to the JSONL file
Note on directory switching
Pi's extension API doesn't expose a chdir() — ctx.cwd is read-only. When you switch to a session from another project, the extension queues a cd <dir> instruction in the agent's bash session so tool executions work in the right directory. You may need to cd manually in your terminal for a fully clean state.
Publishing
cd pi-universal-sessions
npm publish --access public
# or push to GitHub and install via:
pi install git:github.com/arnavpadwal/pi-universal-sessions