pi-env-reload

Reload .env credentials in a running Oh My Pi or Pi session

Packages

Package details

extension

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

$ pi install npm:pi-env-reload
Package
pi-env-reload
Version
0.2.0
Published
Sep 6, 2026
Downloads
474/mo · 175/wk
Author
loneexile
License
MIT
Types
extension
Size
16.9 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

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

README

pi-env-reload

npm version npm downloads CI license

Reload API credentials from a dotenv file in a running Oh My Pi or Pi session, without a restart.

Install

Oh My Pi

omp plugin install npm:pi-env-reload

Pi

pi install npm:pi-env-reload

Start a new session after installing the package. Extensions are discovered when the session starts.

Use

Edit the dotenv file for your harness, then run this command in the active session:

/env-reload

The command waits for any active request to finish, reloads the file into the running process, and rebuilds the model registry. This supports credentials referenced by static models.yml entries, including custom providers whose apiKey points at a variable such as REFRESHER_ANTHROPIC_KEY.

The command reports only a generic success or error message. It never prints credential values.

Which dotenv file?

  • Oh My Pi: ~/.omp/.env (or the active profile's .env).

  • Pi: set PI_ENV_RELOAD_CONFIG_DIR to the Pi config directory holding the dotenv file, e.g. ~/.pi/agent:

    PI_ENV_RELOAD_CONFIG_DIR=$HOME/.pi/agent pi
    

    Without the override the extension reads the ~/.omp default, so Pi users must set it once (export it in your shell profile).

Auto reload

The reload stays explicit by default. To pick up rotated credentials without running /env-reload, opt in with PI_ENV_RELOAD_AUTO in the dotenv file:

PI_ENV_RELOAD_AUTO=5m

Every tick compares the dotenv file's mtime and size against the last applied reload, so an unchanged file costs nothing. On a change the extension applies the values while the agent is idle, rebuilds the model registry, and shows one (auto) notification. Accepted formats: 5m, 30s, 1h, or a bare number of seconds (300). off (or unsetting the variable) disables it, and values below a 30-second floor are clamped.

Scope and limitations

  • The extension reloads the dotenv file at the configured config root: ~/.omp/.env on OMP (or the active profile's .env), and the PI_ENV_RELOAD_CONFIG_DIR path on Pi.
  • Pi support requires PI_ENV_RELOAD_CONFIG_DIR; without it Pi reads the ~/.omp default, which does not match Pi's ~/.pi/agent layout.
  • It updates the current process only. Child shells and future OMP processes use their own environment.
  • Values supplied by a !command entry in models.yml remain subject to OMP's command-result cache.
  • Auto reload never mutates the environment or rebuilds the registry during an active request; the change is picked up on a later tick once the agent is idle. A manual /env-reload still waits for the active request to finish.

Develop

npm install
npm run typecheck
npm test
npm pack --dry-run