{"_id":"@asm3r96/pi-loops","_rev":"3-4a52df4b0e7199cae6d3df5334d88849","name":"@asm3r96/pi-loops","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@asm3r96/pi-loops","version":"0.1.0","keywords":["pi-package","pi-extension","pi-loops","coding-agent","automation","workflow"],"author":{"name":"Asm3r96"},"license":"MIT","_id":"@asm3r96/pi-loops@0.1.0","maintainers":[{"name":"asm3r96","email":"asm3r96@gmail.com"}],"homepage":"https://github.com/Asm3r96/pi-loops#readme","bugs":{"url":"https://github.com/Asm3r96/pi-loops/issues"},"pi":{"image":"https://raw.githubusercontent.com/Asm3r96/pi-loops/main/assets/example-loop-ui.png","skills":["./skills"],"extensions":["./src/index.ts"]},"dist":{"shasum":"b1284b1840efef7aaac6cf1ef97853499d7d57e8","tarball":"https://registry.npmjs.org/@asm3r96/pi-loops/-/pi-loops-0.1.0.tgz","fileCount":11,"integrity":"sha512-09tjb/8xjQpA+1SYHsJNe7jg4CU0VJ8tWDz+665Sc1oMreFgTGnl6Z7AbKJZ052FcBwUUjoOQDvYOBCdwrHN3g==","signatures":[{"sig":"MEYCIQCKgNF/2j6+hwI87IS0L9EI3Vy3j1x2om5pG0ldLA3EnQIhAIE8M+OVYpvKI4ffV4jkTgaaiIuhZNjT6zIzgovfpwZa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":81503},"main":"src/index.ts","type":"module","engines":{"node":">=20.0.0"},"exports":{".":"./src/index.ts","./nodes":"./src/nodes.ts","./state":"./src/state.ts","./tools":"./src/tools.ts","./types":"./src/types.ts","./runtime":"./src/runtime.ts","./evidence":"./src/evidence.ts","./loops/github-issue":"./src/loops/github-issue/definition.ts"},"gitHead":"2fc36bbee25d854ada120b5779e1e2bdbfeeeb8e","scripts":{"test":"echo \"No tests yet\"","start":"pi -e ."},"_npmUser":{"name":"asm3r96","email":"asm3r96@gmail.com"},"repository":{"url":"git+https://github.com/Asm3r96/pi-loops.git","type":"git"},"_npmVersion":"10.9.7","description":"A reusable Pi extension that adds a supervised loop harness around the normal Pi coding agent. Supports bounded LLM nodes, deterministic gates, steering, evidence collection, and composable workflow definitions.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"typebox":"*","@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-loops_0.1.0_1782066637548_0.4688647090631013","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@asm3r96/pi-loops","version":"0.1.1","keywords":["pi-package","pi-extension","pi-loops","coding-agent","automation","workflow"],"author":{"name":"Asm3r96"},"license":"MIT","_id":"@asm3r96/pi-loops@0.1.1","maintainers":[{"name":"asm3r96","email":"asm3r96@gmail.com"}],"homepage":"https://github.com/Asm3r96/pi-loops#readme","bugs":{"url":"https://github.com/Asm3r96/pi-loops/issues"},"pi":{"image":"https://raw.githubusercontent.com/Asm3r96/pi-loops/main/assets/example-loop-ui.png","skills":["./skills"],"extensions":["./src/index.ts"]},"dist":{"shasum":"b4d0f85f816a2ddf4f34548012f40fc518951f75","tarball":"https://registry.npmjs.org/@asm3r96/pi-loops/-/pi-loops-0.1.1.tgz","fileCount":14,"integrity":"sha512-qyM0MnQTCALKebJJxWOhugx0zZfjTAcP3CSuIVI9DJ5nxdsnmFh7vHjIjGgbOBYSna4pqDPsEwEj/1Aye4A8NQ==","signatures":[{"sig":"MEUCIQCo/J6WVJvvdgctHmWOl5wT2NHxR582Q8wywb76Z80OggIgXZE3tUSFKiElalPZaumJQqD2n+jsBJh5pSy16rO/occ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":186252},"main":"src/index.ts","type":"module","engines":{"node":">=20.0.0"},"exports":{".":"./src/index.ts","./nodes":"./src/nodes.ts","./state":"./src/state.ts","./tools":"./src/tools.ts","./types":"./src/types.ts","./runtime":"./src/runtime.ts","./evidence":"./src/evidence.ts"},"gitHead":"2fc36bbee25d854ada120b5779e1e2bdbfeeeb8e","scripts":{"test":"echo \"No tests yet\"","start":"pi -e ."},"_npmUser":{"name":"asm3r96","email":"asm3r96@gmail.com"},"repository":{"url":"git+https://github.com/Asm3r96/pi-loops.git","type":"git"},"_npmVersion":"10.9.7","description":"A reusable Pi extension that adds a supervised loop harness around the normal Pi coding agent. Supports bounded LLM nodes, deterministic gates, steering, evidence collection, and composable workflow definitions.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"typebox":"*","@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-loops_0.1.1_1782242338517_0.46809653209367363","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@asm3r96/pi-loops","version":"0.2.0","description":"A reusable Pi extension that adds a supervised loop harness around the normal Pi coding agent. Supports bounded LLM nodes, deterministic gates, steering, evidence collection, and composable workflow definitions.","keywords":["pi-package","pi-extension","pi-loops","coding-agent","automation","workflow"],"homepage":"https://github.com/Asm3r96/pi-loops#readme","bugs":{"url":"https://github.com/Asm3r96/pi-loops/issues"},"license":"MIT","author":{"name":"Asm3r96"},"repository":{"type":"git","url":"git+https://github.com/Asm3r96/pi-loops.git"},"type":"module","main":"src/index.ts","exports":{".":"./src/index.ts","./types":"./src/types.ts","./runtime":"./src/runtime.ts","./nodes":"./src/nodes.ts","./tools":"./src/tools.ts","./state":"./src/state.ts","./evidence":"./src/evidence.ts"},"scripts":{"test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","start":"pi -e ."},"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-coding-agent":"*","@earendil-works/pi-tui":"*","typebox":"*"},"engines":{"node":">=20.0.0"},"pi":{"extensions":["./src/index.ts"],"skills":["./skills"],"image":"https://raw.githubusercontent.com/Asm3r96/pi-loops/main/assets/example-loop-ui.png"},"publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^26.0.1","typescript":"^6.0.3","vitest":"^4.1.9"},"_id":"@asm3r96/pi-loops@0.2.0","gitHead":"9e3dd5a5b9939e177a5c110ebb2f31bec33cbf1e","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-SzJYxrc/3j+Wy7T7W6uJnvNSCkfKXbkLz5UaYyl6cEiM6ozgqf9zgaIOpIAt2a3cIIJ68kY09GZGpru0oAnLAw==","shasum":"b79a4929b099c8009f1186359ec3f67f1afd2dd6","tarball":"https://registry.npmjs.org/@asm3r96/pi-loops/-/pi-loops-0.2.0.tgz","fileCount":15,"unpackedSize":201255,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDU3jqHOQoTpQ1ZkxUNtN8kreNDPuANp18znN4OZIEN8gIhAPsGLHFSOq1M6vSHinUu29LWfC7eimuTSxiU7XZveNEi"}]},"_npmUser":{"name":"asm3r96","email":"asm3r96@gmail.com"},"directories":{},"maintainers":[{"name":"asm3r96","email":"asm3r96@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-loops_0.2.0_1782904125470_0.5159376309649386"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-21T18:30:37.401Z","modified":"2026-07-01T11:08:45.727Z","0.1.0":"2026-06-21T18:30:37.686Z","0.1.1":"2026-06-23T19:18:58.735Z","0.2.0":"2026-07-01T11:08:45.615Z"},"bugs":{"url":"https://github.com/Asm3r96/pi-loops/issues"},"author":{"name":"Asm3r96"},"license":"MIT","homepage":"https://github.com/Asm3r96/pi-loops#readme","keywords":["pi-package","pi-extension","pi-loops","coding-agent","automation","workflow"],"repository":{"type":"git","url":"git+https://github.com/Asm3r96/pi-loops.git"},"description":"A reusable Pi extension that adds a supervised loop harness around the normal Pi coding agent. Supports bounded LLM nodes, deterministic gates, steering, evidence collection, and composable workflow definitions.","maintainers":[{"name":"asm3r96","email":"asm3r96@gmail.com"}],"readme":"# pi-loops\n\nA reusable [Pi](https://pi.dev) extension that adds a **supervised loop harness** around the Pi coding agent.\n\nThe agent still works as normal — it thinks, investigates, edits files, runs tools, and writes code. The loop extension owns the **workflow around the agent**: state, node order, tool scope, steering, evidence, validation, approvals, and completion.\n\n**This extension ships with no pre-built loops.** It gives you the runtime and tooling to build your own workflows. Add your loops in `src/loops/` and the agent will help you design them.\n\n## Features\n\n- **Generic loop runtime** — sequence typed nodes (code, LLM, gate, approval, finalizer)\n- **Bounded LLM nodes** — each node has scoped tools, timeout, model assignment, and steering rules\n- **Deterministic gates** — validate artifacts and evidence without LLM cost\n- **Evidence collection** — every tool call, command, and file change tracked automatically\n- **Steering** — the loop detects stalls, over-research, repeated failures and nudges the agent\n- **Context cleaning** — sanitize tool-call noise between nodes via code handlers\n- **Session persistence** — loop state survives Pi session restarts\n- **Per‑node model routing** — assign different models and thinking levels to different nodes\n- **`loop_report` tool** — structured agent-to-loop handoff\n\n## Installation\n\n```bash\n# Install for all projects\npi install npm:@asm3r96/pi-loops\n\n# Or install from git\npi install git:github.com/Asm3r96/pi-loops\n\n# Or load directly\npi -e ./src/index.ts\n```\n\nAfter install, the extension auto-loads on Pi startup. The agent will also discover the bundled `pi-loops` skill from `skills/pi-loops/`, so it can guide users through designing and creating their own loops.\n\n## Quick start — build your first loop\n\nAfter installing, ask the agent:\n\n```text\nHelp me build a loop that does X.\n```\n\nThe agent will read the bundled skill and walk you through creating:\n\n1. A loop definition in `src/loops/my-loop/definition.ts`\n2. Optional code handlers in `src/loops/my-loop/handlers.ts`\n3. Registration in `src/loops/index.ts`\n4. Reload and run\n\nThe skill also includes a plain-text design reference at `skills/pi-loops/references/github-issue.md`. This is not runnable loop code; it is a walkthrough the agent can read to understand how a real multi-node loop can be structured.\n\n\n## Available commands\n\n| Command | Description |\n|---------|-------------|\n| `/loop start <definition> [input...]` | Start a new loop |\n| `/loop status` | Show current run state |\n| `/loop list` | List available loop definitions |\n| `/loop cancel` | Cancel active run |\n| `/loop pause` | Pause active run |\n| `/loop resume` | Resume paused/idle loop |\n\n## Architecture\n\n```text\nsrc/\n├── index.ts              Extension entry: commands, events, tool registration\n├── types.ts              Loop/workflow type definitions\n├── runtime.ts            Generic loop runtime engine\n├── nodes.ts              Code handler registry + gate/LLM execution\n├── state.ts              Session persistence (save/restore via Pi session entries)\n├── evidence.ts           Tool observation + steering triggers\n├── tools.ts              loop_report custom tool\n└── loops/\n    └── index.ts          Add your loops here\n```\n\n## Key node types\n\n| Type | Description |\n|------|-------------|\n| `code` | Deterministic logic (fetch, transform, validate, side-effect) |\n| `llm` | Agent works inside bounded scope, reports via `loop_report` |\n| `gate` | Validates artifacts and evidence deterministically |\n| `approval` | Pauses for user decision |\n| `finalizer` | Writes final result |\n\n## The `loop_report` tool\n\nLLM nodes signal completion by calling `loop_report`. The report includes a summary, artifacts, changed files, and confidence. It is a **proposal** — the next gate decides whether to pass, request a retry, or fail.\n\n## Adding a new loop\n\n1. `src/loops/my-loop/definition.ts` — export a `LoopDefinition`\n2. `src/loops/my-loop/handlers.ts` — write code handlers and register them\n3. `src/loops/index.ts` — import and register\n\n```typescript\n// loops/index.ts\nimport { createMyLoopDefinition } from \"./my-loop/definition.ts\";\nimport { registerMyLoopHandlers } from \"./my-loop/handlers.ts\";\n\nexport function registerLoopPackages(registerDefinition) {\n  registerDefinition(createMyLoopDefinition());\n  registerMyLoopHandlers();\n}\n```\n\nReload Pi and run:\n\n```text\n/reload\n/loop start my-loop input=value\n```\n\n\n## License\n\nMIT\n\nBuilt with [Pi](https://pi.dev).\n","readmeFilename":"README.md"}