@trevonistrevon/pi-loop
A pi extension for cron/event-based agent re-wake loops and background process monitoring.
Package details
Install @trevonistrevon/pi-loop from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@trevonistrevon/pi-loop- Package
@trevonistrevon/pi-loop- Version
0.1.5- Published
- May 26, 2026
- Downloads
- not available
- Author
- trevonistrevon
- License
- MIT
- Types
- extension
- Size
- 130.1 KB
- Dependencies
- 1 dependency · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Install
pi install @trevonistrevon/pi-loop
Quick start
LoopCreate trigger="5m" prompt="Check if the build passed"
LoopCreate trigger="tool_execution_start" prompt="Log the tool being used" triggerType="event"
LoopList
LoopDelete id="1"
MonitorCreate command="tail -n0 -f build.log" description="Watch build"
MonitorCreate command="python train.py" onDone="Analyze results and report best loss"
MonitorList
MonitorStop monitorId="1"
Commands
/loop [interval] [prompt] — interactive loop creation.
/loop # menu
/loop 5m check the deploy # 5-minute cron loop
Tools
| Tool | What it does |
|---|---|
LoopCreate |
Schedule a prompt on a cron timer, a pi event, or both with debounce |
LoopList |
Show active loops with IDs, triggers, and next-fire times |
LoopDelete |
Delete or pause a loop |
MonitorCreate |
Run a background command, stream output as monitor:output events. Use onDone for auto-notify on completion |
MonitorList |
Show monitors with status, uptime, and output line count |
MonitorStop |
Stop a monitor (SIGTERM → 5s → SIGKILL) |
Trigger types: cron (5m, 1h, 0 9 * * 1-5), event (any pi event source), or hybrid (both, debounced).
pi-tasks
Works with @tintinweb/pi-tasks. Pass autoTask: true on LoopCreate and each loop fire auto-creates a tracked task. Detection happens over pi's event bus — no manual wiring.
Widget
Active loops and monitors show in a persistent TUI widget above the editor.
Configuration
| Variable | Effect | Default |
|---|---|---|
PI_LOOP |
Store path. off to disable, absolute or project-relative path |
.pi/loops/loops.json |
PI_LOOP_SCOPE |
memory (ephemeral), session (per-session file), project (shared) |
session |
PI_LOOP_DEBUG |
Debug logging to stderr | unset |
Limits
25 active loops, 25 running monitors. Recurring loops expire after 7 days.
Development
npm run typecheck
npm run lint
npm test
npm run build
See CONTRIBUTING.md.
License
MIT — LICENSE