pi-loops
Repeat-send a prompt to the pi agent on a fixed interval. Each repeat arrives as a user message with a Loop header (created time / repeat count / user task). Adds /loop commands and a loop tool.
Package details
Install pi-loops from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-loops- Package
pi-loops- Version
0.1.0- Published
- Jun 26, 2026
- Downloads
- not available
- Author
- primp9053
- License
- MIT
- Types
- extension
- Size
- 17.4 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-loops
Repeat-send a prompt to the pi agent on a fixed interval.
Each repeat is delivered to the agent as a real user message with a header describing the loop, so the agent can tell it is part of a repeating task:
Initial Loop created time: 2026-06-25 14:30:00
Repeat Time: 3 of 10 times
User Task: Run the test suite and report failures.
Initial Loop created time— when the loop was created (local time).Repeat Time— current repeat count (3 of 10 timeswhen finite,3 timeswhen the loop is infinite).User Task— the prompt you asked to repeat.
The first repeat fires immediately, then every <interval> after that.
Install
pi install npm:pi-loops
Or from git:
pi install git:github.com/primp9053/pi-loops
Then restart pi (or run /reload).
Commands
/loop start <interval> <count> <prompt...> create a loop
/loop list list active loops
/loop stop <id|all> stop one or all loops
/loop help show help
interval—30s,5m,1h, or a bare number of seconds (90). Min 1s.count— positive integer (number of repeats), or0/inffor infinite.prompt— the rest of the line is the task to repeat.
Examples
/loop start 30s 5 Run the test suite and report failures.
/loop start 1m 0 Check git status and summarize changes.
/loop start 2m inf Summarize the latest log lines from /tmp/app.log.
/loop list
/loop stop loop-1
/loop stop all
Tool (for the LLM)
The extension also registers a loop tool the agent can call directly:
| action | parameters | description |
|---|---|---|
create |
interval, count, prompt |
start a new loop |
list |
— | list active loops |
stop |
id (or "all") |
stop one or all loops |
stopAll |
— | stop every active loop |
For create, count is a positive integer, or 0 for infinite.
Behavior notes
- Loops are in-memory and scoped to the current session. They are cleared on
/reload,/new,/resume, and on quit. State is not persisted across restarts. - If the agent is busy when a repeat fires, the message is queued as a follow-up (delivered after the agent finishes its current work) instead of interrupting mid-stream. If the agent is idle, it triggers a turn immediately.
- The active loop count is shown in the footer status line (
2 loops active). - Minimum interval is 1 second to prevent runaway flooding.
License
MIT