@sherif-fanous/pi-session-slice

Pi extension that starts a new session from a chosen range of the current one

Packages

Package details

extension

Install @sherif-fanous/pi-session-slice from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@sherif-fanous/pi-session-slice
Package
@sherif-fanous/pi-session-slice
Version
0.2.0
Published
Sep 30, 2026
Downloads
223/mo · 19/wk
Author
sherif-fanous
License
MIT
Types
extension
Size
27.2 KB
Dependencies
1 dependency · 3 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

pi-session-slice

A Pi extension that starts a new session from a chosen range of the current one.

Why

A long session can cover several unrelated topics. While working on one project, you find a bug in another and spend a few turns investigating it. You want to continue that investigation separately without bringing the rest of the conversation along or explaining everything again.

Session Slice copies the part you choose into a new session, including the replies and tool results. Your original session stays unchanged.

Requirements

  • Tested only against the latest stable release of Pi

Install

pi install npm:@sherif-fanous/pi-session-slice

Or try it without installing:

pi -e npm:@sherif-fanous/pi-session-slice

To uninstall:

pi remove npm:@sherif-fanous/pi-session-slice

Usage

  1. Run /slice when Pi has finished replying.
  2. Choose the first message you want to keep.
  3. Choose the first message you want to leave out, or select Keep everything to the end.

Pi opens the new session. If you chose a message to leave out, its text appears in the editor so you can edit or send it again. Press Esc in either picker to cancel without creating a session.

For example, choosing your third message as the start and your fifth as the end keeps your third and fourth messages, along with Pi's replies and any tool activity between them. Your fifth message goes into the editor; it is not part of the copied conversation.

Use /resume to return to the original session. The new session starts without a name; use /name to give it one.

Commands

Command What it does
/slice Opens the pickers that choose the range to copy. It needs Pi's interactive terminal UI.

The pickers

The start and end pickers list your messages in the current conversation. Both use the same keys:

Key Action
↑ / ↓ Move the selection
PgUp / PgDn Move one page
Enter Select the message
Esc Cancel without creating a session

If you have remapped Pi's keys, the pickers follow your bindings.

Configuration

Session Slice has no configuration file. Each slice is a new Pi session, and your original session stays unchanged.

Troubleshooting

/slice explains in a notification when it can't run. It needs a saved session, so it doesn't work in sessions started with --no-session. Wait until Pi has finished replying, and make sure the conversation has at least one of your messages.

License

MIT