pi-runtime-context

Cache-friendly ephemeral runtime context for the Pi coding agent.

Packages

Package details

extension

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

$ pi install npm:pi-runtime-context
Package
pi-runtime-context
Version
0.1.0
Published
Sep 12, 2026
Downloads
141/mo · 141/wk
Author
boadij
License
unknown
Types
extension
Size
5.9 KB
Dependencies
0 dependencies · 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

pi-runtime-context

Cache-friendly ephemeral runtime context for the Pi coding agent.

The extension snapshots the local runtime once per agent run and appends it as a hidden custom message at the end of Pi's model context. It does not modify the system prompt and does not persist the snapshot in session history.

Context

Always included:

  • local date and time
  • IANA timezone
  • working directory
  • Git repository root, branch or detached-HEAD state, and dirty state when inside a repository
  • OS, release, and architecture
  • Node.js version
  • running Pi version

Infrastructure identifiers are opt-in because they may disclose machine or deployment topology to the model provider:

PI_RUNTIME_CONTEXT_INFRA=1 pi

That additionally includes the hostname, Docker context, and current Kubernetes context when their CLIs are available. Commands are local, time-limited, and silently omitted on failure.

Deployment information is explicit rather than guessed:

PI_RUNTIME_CONTEXT_DEPLOYMENT=production/eu-west-1 pi

Example model context:

Runtime context (ephemeral, observational only):
{"date":"2026-09-12","time":"22:20:28","timezone":"Europe/Berlin","cwd":"/repo/packages/foo","git":{"root":"/repo","branch":"main","dirty":false},"os":"darwin 25.0.0 (arm64)","node":"v24.8.0","pi":"0.85.1"}

Install

From GitHub:

pi install git:github.com/boadij/pi-runtime-context

For local development:

npm install
pi -e ./index.ts