@amolith/pi-handoff
Use subagents to transfer pi session context to a new session and query past sessions
Package details
Install @amolith/pi-handoff from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@amolith/pi-handoff- Package
@amolith/pi-handoff- Version
0.1.0- Published
- Jun 5, 2026
- Downloads
- 619/mo · 619/wk
- Author
- amolith
- License
- unknown
- Types
- extension
- Size
- 40.3 KB
- Dependencies
- 0 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@amolith/pi-handoff
Get to the end of the thing you're doing, then use a subagent to extract
relevant bits from the current session and create a new one from them with
/handoff thorough goal description. You can tell Pi to hand something off
because it has a handoff tool too.
After extraction, whether triggered by you or Pi, the draft handoff goes in the new session's prompt editor and an auto-submit countdown starts that's cancelled by pressing most any key.
Install
pi install npm:@amolith/pi-handoff
If you try it and find that it doesn't behave as expected, please send me your session file, the goal, and the resulting handoff so I can debug. Contact me via the methods listed at the bottom of my website, or if you know me elsewhere, you're welcome to DM me there.
Do it yourself
Run /handoff with whatever the next session should do:
/handoff finish the release notes and publish both packages
If you omit the goal, Pi asks for one. Before the new session starts, the extension opens the generated handoff draft in the editor so you can review or tweak it. After the session switch, it starts an auto-submit countdown and pressing most any key cancels it.
To use a different model in the new session, pass -model provider/modelId:
/handoff -model neuralwatt/glm-5.1 finish the release notes
Let the agent do it
The package also registers a handoff tool. The agent should only use it when
you explicitly ask for a handoff. It accepts:
goal: the goal for the new sessionmodel: optionalprovider/modelIdfor the new session
The handoff happens after the current agent turn completes and still opens the editor so you can tweak before starting the new session.
Configure the extraction model
It uses the current session model by default. Interactively select a cheaper/faster model by running:
/handoff:set-extraction-model
It opens Pi's model picker and saves the selected model in
$PI_CODING_AGENT_DIR/settings.json as handoffExtractionModel.
You can also set a provider/modelId with one of these:
- Startup flag:
--handoff-extraction-model provider/modelId - Env var:
$PI_HANDOFF_EXTRACTION_MODEL - Settings value:
handoffExtractionModelin$PI_CODING_AGENT_DIR/settings.json
If you set more than one, that list is the precedence order.
Example settings:
{
"handoffExtractionModel": "neuralwatt/qwen3.6-35b-fast"
}
If the configured value is malformed or doesn't match a registered model, the extension falls back to the current session model.
Ask about the old session
New handoff prompts include the parent session path when available. The package
registers a session_query tool so the next agent can ask focused questions
about that prior session when the handoff summary isn't enough.