@artale/pi-loop

Agent loop for Pi. Goal-driven, fixed-pass, and pipeline loops with [D]/[N] gates. Inspired by pi-stories Blueprint Engine.

Package details

extension

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

$ pi install npm:@artale/pi-loop
Package
@artale/pi-loop
Version
1.0.0
Published
Mar 14, 2026
Downloads
30/mo · 2/wk
Author
artale
License
MIT
Types
extension
Size
12.5 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "src/extension.ts"
  ]
}

Security note

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

README

pi-loop

Agent loop for Pi. Goal-driven, fixed-pass, and pipeline loops with [D]/[N] deterministic gates.

Inspired by pi-stories Blueprint Engine.

Install

pi install npm:@artale/pi-loop

The [D]/[N] Pattern

Every pipeline alternates between:

  • [D] Deterministic gates — shell commands that pass or fail (tests, lint, typecheck)
  • [N] Non-deterministic steps — agent work (implement, fix, refactor)

If a gate fails, the pipeline retries the previous agent step automatically.

Commands

/loop goal <condition>                              — loop until done
/loop passes <N> <prompt>                           — repeat N times
/loop pipeline D:npm test | N:fix tests | D:lint    — [D]/[N] pipeline
/loop status                                        — show state
/loop stop                                          — stop

Examples

/loop goal all tests passing
/loop passes 5 improve test coverage
/loop pipeline D:npm test | N:fix failing tests | D:npm run lint | N:fix lint errors | D:npm run build

Tools

  • loop_done — agent calls this when goal is achieved
  • loop_status — check loop state

License

MIT