pi-current-time
Pi extension that injects the current local date/time into each agent turn without breaking prompt cache
Package details
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
- On
before_agent_start, format the local time (plus ISO UTC). - Return a
custommessage withdisplay: falseso it is sent to the model but not shown in the TUI. - Emit
current-time:nowonpi.eventsfor 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
/timecommand 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