Pi
Save Pi sessions with the SpecStory CLI.
Before you start
Install Pi and the SpecStory CLI. Pi needs SpecStory CLI 2.11.0 or later, and sessions created with Pi 0.85.1 or later. Open your project folder in a terminal and run specstory check pi.
Run with SpecStory
bash
specstory run pi
Use Pi as usual. SpecStory saves the conversation in .specstory/history/. Cloud sync can run when you are logged in; add --no-cloud-sync to keep the session local.
Export existing sessions
bash
specstory list pi
specstory sync pi
# Export a single session
specstory sync pi -s <session-id>
SpecStory reads Pi's session history from ~/.pi/agent/sessions/ and matches it to your project. You can export conversations even if you did not start them through SpecStory. Pi records branching conversations; an export follows the session's active branch and keeps its compaction context and tool results.
If you point Pi at another directory with PI_CODING_AGENT_SESSION_DIR or PI_CODING_AGENT_DIR, set the same variable for SpecStory so it reads the same sessions. Pi's own --session-dir flag and its settings.json setting are not discovered automatically.
Capture in the background
bash
specstory watch pi
Leave this running while using Pi directly. Stop watching with Ctrl+C.
Find and resume a session
Run specstory search to find saved work or specstory resume to choose a previous session. Pi continues one of its own sessions in place, and can receive a session from another agent as reconstructed conversation text. See search and resume for the picker and supported handoffs.
Troubleshooting
If Pi is not detected, check that pi is on your PATH. If your CLI does not list Pi in specstory run --help, update SpecStory. To launch Pi from another location, set pi_cmd in your config or pass specstory run pi -c "~/bin/pi". If no sessions appear, run the commands from the project where you used Pi, use the same session directory variables you set for Pi, and confirm that its local history still exists.
See the CLI reference for custom commands, configuration, and debug logging.