@ifi/oh-pi-extensions
v0.4.2
Published
Core pi extensions: safe-guard, git-guard, auto-session, custom-footer, and more.
Readme
@ifi/oh-pi-extensions
Core first-party extensions for pi.
Included extensions
This package includes extensions such as:
- safe-guard
- git-guard
- auto-session-name
- custom-footer
- compact-header
- auto-update
- bg-process
- usage-tracker
- scheduler
- btw / qq
- watchdog / safe-mode
Install
pi install npm:@ifi/oh-pi-extensionsOr install the full bundle:
npx @ifi/oh-piWhat it provides
These extensions add commands, tools, UI widgets, safety checks, background process handling,
usage monitoring, scheduling features, and runtime performance protection (/watchdog, /safe-mode) to pi.
Scheduler follow-ups
The scheduler extension adds recurring checks, one-time reminders, and the LLM-callable
schedule_prompt tool so pi can schedule future follow-ups like PR, CI, build, or deployment
checks. Tasks run only while pi is active and idle, and scheduler state is persisted in shared pi
storage using a workspace-mirrored path.
Package layout
extensions/Pi loads the raw TypeScript extensions from this directory.
Scheduler ownership model
scheduler now distinguishes between instance-scoped tasks and workspace-scoped tasks:
- Instance scope is the default for
/loop,/remind, andschedule_prompt.- The task stays owned by the pi instance that created it.
- Opening a second pi instance in the same repo will not auto-run that task.
- Foreign tasks are restored for review instead of being dispatched automatically.
- Workspace scope is opt-in for monitors that should survive instance changes in the same repo.
- Use
/loop --workspace ... - Use
/remind --workspace ... - Or use
schedule_prompt(..., { scope: "workspace" })
- Use
When another live instance already owns scheduler activity for the workspace, pi prompts before taking over. You can also manage ownership explicitly with:
/schedule adopt <id|all>/schedule release <id|all>/schedule clear-foreign
Use workspace scope sparingly for long-running shared checks like CI/build/deploy monitoring. For ordinary reminders and follow-ups, prefer the default instance scope.
Watchdog config
The watchdog extension reads optional runtime protection settings from a JSON config file in the pi agent directory. That config controls whether sampling is enabled, how frequently samples run, and which CPU, memory, and event-loop thresholds trigger alerts or safe-mode escalation.
Path to the optional watchdog JSON config file under the pi agent directory. This is the default location used for watchdog sampling, threshold overrides, and enable/disable settings.
~/.pi/agent/extensions/watchdog/config.jsonExample:
{
"enabled": true,
"sampleIntervalMs": 5000,
"thresholds": {
"cpuPercent": 85,
"rssMb": 1200,
"heapUsedMb": 768,
"eventLoopP99Ms": 120,
"eventLoopMaxMs": 250
}
}Watchdog helper behavior
Load watchdog config from disk and return a safe object. Missing files, invalid JSON, or malformed values all fall back to an empty config so runtime monitoring can continue safely.
Resolve the effective watchdog thresholds by merging optional config overrides onto the built-in default thresholds.
Resolve the watchdog sampling interval in milliseconds, clamping configured values into the supported range and falling back to the default interval when no valid override is provided.
Notes
This package ships raw .ts extensions for pi to load directly.
