pi-current-time

Pi extension that injects the current local date/time into each agent turn without breaking prompt cache

Packages

Package details

extension

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

$ pi install npm:pi-current-time
Package
pi-current-time
Version
0.1.0
Published
Aug 5, 2026
Downloads
198/mo · 16/wk
Author
vernhe
License
MIT
Types
extension
Size
4.7 KB
Dependencies
0 dependencies · 2 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-current-time

A pi extension that injects the current local date and time into each agent turn.

LLMs do not know wall-clock time by default. This extension appends a small context message after each user prompt so the model can answer time-sensitive questions accurately.

Unlike putting the clock into the system prompt, this approach leaves the system prompt unchanged and only appends a trailing message — so existing prompt-cache prefixes stay valid.

Installation

pi install npm:pi-current-time
# or
pi install git:github.com/VernHe/pi-current-time

Try without installing:

pi -e npm:pi-current-time
pi -e git:github.com/VernHe/pi-current-time

Usage

Automatic: every user turn gets a hidden context message like:

Current local time: Wednesday, 08/05/2026, 10:05:32 GMT+8 (ISO: 2026-08-05T02:05:32.000Z)

Manual: run /time to show the current local time in the UI.

How it works

  1. On before_agent_start, format the local time (plus ISO UTC).
  2. Return a custom message with display: false so it is sent to the model but not shown in the TUI.
  3. Emit current-time:now on pi.events for other extensions.

The system prompt is never modified.

Features

  • Zero configuration
  • Cache-friendly (does not rewrite the system prompt)
  • Fresh time on every user turn
  • /time command for a quick UI check
  • No runtime dependencies, no network I/O

Related

  • pi-today — injects the calendar date once per session via the system prompt

License

MIT