pi-agent-loop
v0.1.1
Published
General-purpose agent loop extension for pi. Supports goal loops (repeat until done), fixed-pass loops, and multi-stage pipelines via /loop goal, /loop passes, and /loop pipeline commands.
Readme
🔄 Agent Loop
General-purpose loop extension for pi. Repeats agent turns automatically in three modes: until a goal is met, for a fixed number of passes, or through a sequence of named pipeline stages.
Install
pi install npm:pi-agent-loopWhat it does
Registers a /loop command and a loop_control tool. On each iteration, the agent does its work then calls loop_control to either advance to the next iteration (next) or declare the goal complete (done). The loop context is injected into the system prompt automatically so the agent always knows where it is.
Commands
| Command | Description |
|---|---|
| /loop goal <description> | Repeat until the LLM declares the goal met (open-ended) |
| /loop passes <N> <task> | Run exactly N passes |
| /loop pipeline <s1\|s2\|s3> <goal> | Run named stages sequentially, stop after the last |
| /loop-stop | Stop the active loop immediately |
Shortcut
| Shortcut | Description |
|---|---|
| Ctrl+Shift+X | Emergency abort — stops the loop and cancels the current turn |
Tool: loop_control
The LLM calls this tool to signal progress. It is only active during a loop.
| Parameter | Type | Description |
|---|---|---|
| status | "next" \| "done" | Advance to next iteration or declare completion |
| summary | string | Brief summary of what was accomplished this iteration |
| reason | string? | Why the goal is met (used with "done") |
Examples
/loop goal Refactor all test files to use the new assertion API
/loop passes 3 Review and improve the README
/loop pipeline analyze|implement|test Write and test the new auth moduleTUI widget
While a loop is active, a status bar entry and widget show the current mode, goal, and iteration count.
