pi-auto-reload

Reload a pi session automatically, when idle, after the installed pi packages change (e.g. after kempt update or pi update).

Packages

Package details

extension

Install pi-auto-reload from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-auto-reload
Package
pi-auto-reload
Version
0.2.2
Published
Oct 17, 2026
Downloads
378/mo · 201/wk
Author
schuettc
License
MIT
Types
extension
Size
19.7 KB
Dependencies
0 dependencies · 0 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-auto-reload

Reloads a pi session automatically, when it is idle, after the installed pi packages change on disk. That covers updates from pi update, pi install, or a tool that manages pi packages for you, such as kempt. It also reloads when the program behind a channels.tools channel server is upgraded, so the session restarts that server on the new version.

Why

A running pi session keeps the code it loaded at startup, but it loads anything it needs later from the files on disk. After an in-place package update, a session can run a mix of old and new code until you type /reload. That's easy to miss when you have several sessions open.

How it works

  • At session start it records a fingerprint: the packages list in settings.json, plus the version and modification time of each installed npm package, plus the modification time of each channel server's executable. The channel servers are read from ~/.pi/agent/channels.json and the project's .pi/channels.json, and a bare command name is looked up on PATH.
  • Every 15 seconds, and whenever the agent finishes a run, it checks the fingerprint again. When it changes, the status bar shows update installed · reloading when idle.
  • It reloads only when the session is idle: no response streaming, no queued messages, no permission or other prompt open, and no pi-subagents agent running or queued (a reload would abort them). A busy session reloads when it finishes.
  • The reload is pi's own /reload: the extension runs a hidden /auto-reload-now command that calls reload(). Nothing is sent to the model, and a half-typed draft in the editor is kept.

Install

pi install npm:pi-auto-reload

Testing it

Set PI_AUTO_RELOAD_EXTRA to a comma-separated list of extra files to watch. Touching one of them counts as a package update:

PI_AUTO_RELOAD_EXTRA=/tmp/pi-auto-reload-probe pi
# in another terminal
touch /tmp/pi-auto-reload-probe

PI_CODING_AGENT_DIR is honored for the location of settings.json and installed packages.

License

MIT