pi-agent-loop

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.

Package details

extension

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

$ pi install npm:pi-agent-loop
Package
pi-agent-loop
Version
0.1.1
Published
Mar 13, 2026
Downloads
75/mo ยท 20/wk
Author
pierre-mike
License
MIT
Types
extension
Size
16 KB
Dependencies
0 dependencies ยท 1 peer
Pi manifest JSON
{
  "extensions": [
    "."
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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-loop

What 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 module

TUI widget

While a loop is active, a status bar entry and widget show the current mode, goal, and iteration count.