What problem does it solve?
Pi-sessions ensures extensions preserve and reconstruct state correctly across branching, forks, and compaction in Pi sessions, preventing state divergence and stale UI or data when the conversation tree changes.
Core Features & Use Cases
- Branch-aware State Reconstruction: Rebuild in-memory extension state by scanning the current session branch for toolResult and custom entries on session events.
- Compaction Control & Customization: Intercept, cancel, or replace automatic compaction summaries and manage proactive compaction to protect important context.
- Extension-only Persistence: Persist UI preferences or bookmarks using custom, non-LLM-visible entries to avoid polluting LLM context while keeping state in the session tree.
- Use Case: A stateful panel extension can reliably restore its list, preferences, and bookmarks after a user navigates branches, forks a session, or when automatic compaction runs.
Quick Start
Use pi-sessions to reconstruct extension state after a session switch by scanning the branch for toolResult and custom entries and then initialize your UI from the resulting snapshot.