@usirin/pi-loop
v0.1.0
Published
Claude Code-style /loop command for pi-coding-agent.
Downloads
77
Maintainers
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-loopTry without installing:
pi -e npm:@usirin/pi-loopInstall from git:
pi install git:github.com/usirin/pi-loopInstall from a local checkout:
pi install /path/to/pi-loopAfter install, restart pi or run:
/reloadUsage
/loop <objective>
/loop 3m <objective>
/loop --interval 30s <objective>
/loop --max 10 <objective>
/loop 10 <objective>
/loop status
/loop pause
/loop resume
/loop stopExamples:
/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 changeRun every three minutes, like Claude Code's interval form:
/loop 3m take a look at these prs and fix the reviewsHow 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.tsCheck the npm tarball contents:
npm run pack:dry-runSecurity
Pi extensions run with your full system permissions. Review any extension source before installing it.
