npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-session-merge

v0.1.3

Published

Pi Coding Agent Extension to import summarized context from another session.

Readme

pi-session-merge

A Pi Coding Agent Extension that adds /merge, allowing you to import summarized context from another Pi session into your current session.

pi-session-merge performs a safe context merge instead of rewriting or raw-merging session history. It lets you pick a source session, previews a structured summary of its goals, decisions, files, commands, constraints, risks, and TODOs, and then inserts that reviewed summary into the current session as contextual information.

Features

  • Adds a /merge slash command to Pi
  • Lists candidate sessions from the current working directory by default
  • Supports searching all known sessions with /merge --all
  • Excludes the current session from candidates
  • Builds a deterministic structured summary
  • Shows an editable preview before insertion
  • Requires confirmation before writing anything
  • Inserts a clearly labeled Imported Session Context block
  • Does not modify the source session
  • Does not raw-merge or rewrite Pi JSONL session files

Installation / Usage

Install it as a Pi package so Pi uses the package name instead of showing the extension as src.

Install from npm:

pi install npm:pi-session-merge

Or install from GitHub:

pi install git:github.com/robbirob/pi-session-merge

For local development from a checkout, install the package directory instead of pointing Pi at src/index.ts:

pi install /path/to/pi-session-merge

Use pi -e ./index.ts only for quick one-off testing.

Then inside Pi:

/merge

Useful variants:

/merge --all
/merge --cwd ~/work/some-project
/merge <session-id-or-name-fragment>

Troubleshooting

Windows/npm spawn error during pi install

If Pi fails with an error like this while installing or updating the package:

Error: spawn C:\Program Files\nodejs\npm ENOENT

that is an npm launcher resolution issue in Pi/Node on Windows, not a session-merge runtime error. Configure Pi to call the Windows npm command shim explicitly by adding npmCommand to your Pi settings file, for example ~/.pi/agent/settings.json:

{
  "npmCommand": ["C:\\Program Files\\nodejs\\npm.cmd"]
}

If npm is installed elsewhere, use the path from where npm and prefer the .cmd entry.

As a temporary workaround for local development, you can also install from a local checkout:

pi install /path/to/pi-session-merge

How It Works

When /merge runs, the extension:

  1. Finds other Pi sessions for the current working directory.
  2. Lets you select a source session.
  3. Reads the selected session safely.
  4. Extracts useful messages from the active/latest branch.
  5. Builds a structured context summary.
  6. Opens an editable preview.
  7. Asks for confirmation.
  8. Inserts the reviewed summary into the current session as a custom context message.

The inserted block is marked as imported context and includes source metadata.

Safety Notes

This extension intentionally does not perform a raw session merge. Pi session files can contain branches, parent/child relationships, tool calls, compactions, labels, model metadata, and other internal state. Raw-merging those files risks corruption or misleading context.

For the MVP, pi-session-merge only imports a summarized context block.

It will not:

  • mutate the source session
  • rewrite current session history
  • copy raw JSONL entries
  • delete, compact, rename, or relabel sessions
  • apply file patches or Git merges

Development

Run tests:

npm test

Project structure:

src/
  index.ts
  commands/
  sessions/
  merge/
  ui/
  utils/
test/

The core session parsing and digest-building logic is kept in pure functions where possible so it can be tested without depending on your real ~/.pi session directory.

License

MIT