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

@rupertsworld/pi-dynamic-context

v0.2.0

Published

Per-turn refresh of pi's system prompt and context files, with template variables

Downloads

67

Readme

@rupertsworld/pi-dynamic-context

Keeps a pi session's system prompt live and appends user-configured context files. It re-reads prompt resources before every agent turn, so edits and template values take effect without /reload.

pi install npm:@rupertsworld/pi-dynamic-context

Template variables

The extension renders variables in SYSTEM.md, APPEND_SYSTEM.md, startup-loaded AGENTS.md/CLAUDE.md files, and configured additional files:

  • {{ DATE }} — local date as YYYY-MM-DD
  • {{ TIME }} — local time as HH:mm:ss
  • {{ TZ }} — host IANA time zone, or its UTC offset when no name is available
  • {{ CWD }} — session working directory

Whitespace inside the braces is optional. Unknown uppercase variable names warn once per session and remain unchanged. Other brace content is not treated as a token. Pi's default system prompt is not rendered.

Additional context files

Declare files in <agent-dir>/dynamic-context.json and, for trusted projects, <cwd>/<pi-config-dir>/dynamic-context.json (.pi by default):

{
  "files": [
    "docs/conventions.md",
    "~/notes/global-style.md",
    "/abs/path/also-fine.md"
  ]
}

Relative paths resolve from the agent directory for the global config and from the session working directory for the project config. Global files come first, followed by project files; duplicate resolved paths are included only at their first position.

Both configs and their files are re-read each turn. Readable files are appended to the system prompt in a <dynamic_context> section. A missing config is treated as empty, a malformed config warns once and is treated as empty, and an unreadable configured file warns once and is omitted for that turn.

Refresh and status

Startup-loaded prompt and context files are re-read each turn. If one becomes unreadable, the extension warns once and keeps its last successfully read content. If a startup-loaded file was empty and later gains content, the extension warns once and suggests /reload to pick it up. Pi's startup discovery does not re-run, so a new AGENTS.md or CLAUDE.md still requires /reload or a new session.

/dynamic-context reports current variable values and the last-read result for startup-loaded and configured additional files.

Implementation constraint: exact-content substitution via before_agent_start — it never pattern-matches pi's prompt layout, and leaves pieces alone that another extension rewrote.

spec/pi-dynamic-context/index.md is the authority on behavior.