@mcowger/pi-strip-volatile

A pi extension that prevents volatile runtime data from being persisted to settings.json

Packages

Package details

extension

Install @mcowger/pi-strip-volatile from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mcowger/pi-strip-volatile
Package
@mcowger/pi-strip-volatile
Version
0.2.1
Published
Jul 10, 2026
Downloads
185/mo · 159/wk
Author
mcowger
License
MIT
Types
extension
Size
8.5 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

strip-volatile

A pi.dev extension that strips volatile runtime data from settings.json on exit, preventing it from being persisted across sessions.

What it strips

By default, these keys are stripped:

Key Why it's volatile
defaultModel Set whenever you change models — leaks the last model used
defaultProvider Set alongside defaultModel
lastChangelogVersion Written on every version bump to control changelog display

Custom keys

You can configure which keys are stripped by adding a stripVolatileKeys array to your settings.json:

{
  "stripVolatileKeys": ["defaultModel", "defaultProvider", "lastChangelogVersion", "someOtherKey"]
}

When stripVolatileKeys is present and non-empty, only the keys listed in that array are stripped. The stripVolatileKeys setting itself is preserved so it can remain in settings.json as persistent configuration. If the array is missing or empty, the built-in defaults above are used. This means you can add or remove keys without any code changes.

Install

pi install git:github.com/mcowger/pi-strip-volatile

Or add to your settings.json:

{
  "packages": ["git:github.com/mcowger/pi-strip-volatile"]
}

How it works

The extension reads settings.json, removes the configured (or default) volatile keys, and writes the file back using the same lock strategy as Pi 0.80.6. It runs on session_start, agent_start, agent_end, and session_shutdown so volatile keys are cleaned up both during the session and on exit.

Respects PI_CODING_AGENT_DIR if set (with ~ expansion), otherwise defaults to ~/.pi/agent.

Requires Pi 0.80.6 or later.

Develop

bun install
bun run check       # lint + typecheck + test
pi -e .             # load extension locally

License

MIT