@usirin/pi-loop
Claude Code-style /loop command for pi-coding-agent.
Package details
Install @usirin/pi-loop from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@usirin/pi-loop- Package
@usirin/pi-loop- Version
0.1.0- Published
- May 18, 2026
- Downloads
- not available
- Author
- usirin
- License
- MIT
- Types
- extension
- Size
- 14.8 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/loop.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-loop
Claude Code-style /loop command for pi.
pi-loop adds an autonomous loop command that keeps sending follow-up turns until the agent reports completion, gets blocked, or hits a max-iteration guardrail.
Install
From npm:
pi install npm:@usirin/pi-loop
Try without installing:
pi -e npm:@usirin/pi-loop
Install from git:
pi install git:github.com/usirin/pi-loop
Install from a local checkout:
pi install /path/to/pi-loop
After install, restart pi or run:
/reload
Usage
/loop <objective>
/loop 3m <objective>
/loop --interval 30s <objective>
/loop --max 10 <objective>
/loop 10 <objective>
/loop status
/loop pause
/loop resume
/loop stop
Examples:
/loop --max 8 inspect this repo, add the smallest useful test/build setup, and stop when everything passes
/loop 5 fix the failing tests, running the relevant test command after each change
Run every three minutes, like Claude Code's interval form:
/loop 3m take a look at these prs and fix the reviews
How it stops
A loop stops when one of these happens:
- the assistant calls the
loop_donetool - the assistant includes
LOOP_DONEin its response - you run
/loop stop - the max iteration count is reached
- the session shuts down
Default max iterations: 25.
How it works
The extension registers:
/loopslash commandloop_donetool for the model to stop the loop explicitly- a status/widget display showing the active loop objective and iteration count
Each iteration instructs the model to do exactly one useful slice of work. If the model does not stop the loop, the extension queues the next follow-up turn. When an interval is provided, the first turn starts immediately and subsequent turns wait for that interval. Interval loops treat each turn as a recurring scheduled tick, so the model is instructed not to stop merely because one tick succeeded.
Package metadata
This is a pi package. The extension is declared in package.json:
{
"keywords": ["pi-package"],
"pi": {
"extensions": ["./extensions/loop.ts"]
}
}
Development
Run from a checkout without installing:
pi -e ./extensions/loop.ts
Check the npm tarball contents:
npm run pack:dry-run
Security
Pi extensions run with your full system permissions. Review any extension source before installing it.