pi-mono-loop

Pi extension that runs a prompt or slash command on a recurring interval

Package details

extension

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

$ pi install npm:pi-mono-loop
Package
pi-mono-loop
Version
1.7.2
Published
Apr 23, 2026
Downloads
992/mo · 152/wk
Author
emanuelcasco
License
unknown
Types
extension
Size
21.4 KB
Dependencies
0 dependencies · 1 peer
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

loop extension

Runs a prompt or slash command on a recurring interval.

Adapted from the /loop skill in claude-code. The original relied on Claude Code's Kairos cron system; this version uses JS timers and pi.sendUserMessage() instead.

Usage

/loop [interval] <prompt>

Intervals use a number followed by a unit suffix: s (seconds), m (minutes), h (hours), d (days). If no interval is given, it defaults to 10m.

Subcommands

Command Description
/loop list Show all active loops with their IDs and fire counts
/loop stop Cancel all active loops
/loop stop <id> Cancel a specific loop by ID

Examples

/loop 5m /review
/loop 30m check the deploy
/loop 1h run the tests and report failures
/loop check the deploy            # defaults to 10m
/loop check the deploy every 20m  # trailing "every" clause
/loop list
/loop stop loop-1
/loop stop

Interval parsing

Arguments are parsed using this priority order:

  1. Leading token — if the first word matches \d+[smhd] it is the interval (e.g. 5m /review)
  2. Trailing "every" clause — if the input ends with every <N><unit>, that is the interval (e.g. check the deploy every 20m)
  3. Default — no interval found; uses 10m and the full input is the prompt

Behaviour

  • The prompt is executed immediately on the first invocation, then repeated at the given interval
  • If the agent is busy when a timer fires, the next prompt is queued as a follow-up rather than interrupting the current turn
  • Minimum interval is 10 seconds
  • Loops auto-expire after 7 days
  • All timers are cleaned up on session shutdown

Files

  • index.ts — extension entry point