feat: carry pi sessions through node export/import - #339
Merged
Merged
Conversation
pi keeps one JSONL per session under ~/.pi/agent/sessions/<cwd slug>/, named <timestamp>_<id>.jsonl, whose header line names the id and cwd. Export carries that file (locally by the banked id, remotely through the same tar-over-ssh fetch Claude uses); restore rewrites the header's id to a fresh UUID and its cwd to the target, installs it under the target's slug, and banks the fresh id so --session <id> resumes it. The slug must be the target's own: pi only offers an interactive fork prompt for a session it finds under another project. The layout and file-plumbing helpers move to SessionTransplant+Layouts so the enum body stays under swiftlint's type_body_length limit, which the base branch already exceeded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KBuQWNV3dpDAtb6SnGN15P
Owner
Author
|
Gate on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #338. An exported pi loop now carries its conversation, and the imported loop resumes it instead of starting fresh.
What changed
~/.pi/agent/sessions/<cwd slug>/<timestamp>_<id>.jsonl) travels with the loop. Local loops find it by the banked id. Remote loops fetch it over the same tar-over-ssh path Claude sessions use.pi --session <id>resumes it. This works for both local and remote projects.SessionTransplant+Layouts.swift. The enum was already over swiftlint'stype_body_lengthlimit on the base branch.Verified against pi 0.85.1
SessionManagerunder a throwaway HOME, with the right id, cwd and entries.pi --session <that id>gets past session lookup to the model call. An unknown id printsNo session found.Tests
PiSessionTransplantTests: header rewrite, refusal of files that aren't pi sessions, slug encoding, filename shape, and the remote install script run through/bin/shunder a fake HOME (lands at the Swift-computed slug, banks the id).Refs #214