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

@npm-ken/pi-prime-session

v2.3.3

Published

User-managed priming of Pi agent sessions with memories and commands

Readme

Pi Prime

Pi Prime injects user-authored Prime sources into Pi agent context.

Install

Install the package with Pi, then restart or reload Pi:

pi install npm:@kenbanks-peng/pi-prime

Protocol

On its first agent start, the extension creates this Global protocol file if it does not already exist:

~/.agents/share/prime/prime.protocol.toml

The installed file is:

version = 1

[[rule]]
glob = "*.md"
action = "memory"

[[rule]]
glob = "*.command.toml"
action = "command"

This Global protocol applies to both scopes:

| Scope | Source root | | --- | --- | | Global | ~/.agents/share/prime/ | | Project | .agents/prime/ in the current project |

To override the policy for one project, create .agents/prime/prime.protocol.toml. The Project protocol applies only to Project sources. The Global protocol continues to apply to Global sources.

Pi reads only direct regular files in each source root. It ignores subdirectories, symbolic links, and files that do not match a rule. Rules run in declaration order. Matching files run in filename order. A file can match only one rule.

Memory sources

The memory action reads the complete UTF-8 contents of matching files and injects each file as one memory.

.agents/prime/review-guidance.md

The filename controls order. Pi does not inject the filename.

Command sources

The command action reads matching *.command.toml files. Each file gives one direct executable invocation:

version = 1
argv = ["git", "status", "--short"]
cwd = "."

argv[0] is the executable. All other values are literal arguments. Pi does not use a shell.

cwd is optional. It is relative to the source root and cannot escape it. When omitted, Pi uses the source root.

On success, Pi injects UTF-8 standard output as one memory. Pi reports an error if a command fails, times out, produces invalid UTF-8, or exceeds the output limit. The fixed limits are 1,000 ms and 1,048,576 bytes of standard output.

/prime command

Run /prime to show the command interface.

  • /prime list [global|project] [memory|command] lists Prime sources.
  • /prime add [global|project] [memory|command] creates a source. The defaults are project memory. When it adds a command source, it inserts version = 1 automatically; the editor does not show this field.
  • /prime edit <id> [memory|command] edits a source. Add its type if its ID is ambiguous.
  • /prime delete <id> [memory|command] deletes a source. Add its type if its ID is ambiguous.

Examples:

/prime add global memory
/prime add global command
/prime add project command

The extension gives each added source an ID such as prime-5fdd69c9. Memory source files end in .md. Command source files end in .command.toml.

Context format

Pi resolves Global sources before Project sources. It adds this hidden message before conversation context:

<prime_session version="1">
<memory>Global guidance</memory>
<command>
<run>git status --short</run>
<output> M src/index.ts
?? test/new.test.ts</output>
</command>
</prime_session>

The run value shows the direct command invocation. Command output is inserted as text, with its original line breaks. Pi XML-escapes memory source text, command arguments, and command output. Source data cannot add XML markup.