pi-green-loop

Keep the build green: an autonomous test/lint/typecheck feedback loop for AI coding agents. Use as a CLI, an MCP server, a Claude/Cursor skill, or a pi extension.

Packages

Package details

extensionskill

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

$ pi install npm:pi-green-loop
Package
pi-green-loop
Version
0.1.1
Published
Jun 19, 2026
Downloads
112/mo · 112/wk
Author
vaibhav290797
License
MIT
Types
extension, skill
Size
51.3 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "dist/pi/extension.js"
  ],
  "skills": [
    "skills"
  ]
}

Security note

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

README

pi-green-loop

Keep the build green. An autonomous test / lint / typecheck / build feedback loop for AI coding agents. After code changes, pi-green-loop runs your project's checks and — when something is red — hands the failing output back to the agent so it fixes it, looping until green.

One core engine, four ways to run it:

Surface How
CLI npx pi-green-loop check · pi-green-loop watch
MCP server npx pi-green-loop mcp (use from Claude, Cursor, any MCP client)
Claude / Cursor skill drop skills/pi-green-loop into your skills dir
pi extension import piGreenLoop from "pi-green-loop/pi" — closed loop on the pi event bus

Status: M1 complete. Core, CLI, and MCP server are built, tested (11 tests), and verified; the pi extension typechecks against pi and awaits an in-harness run. See docs/plan.md and IDEAS.md.

Install into pi

pi install git:github.com/vaibhav-patel/pi-green-loop   # extension (agent_end loop + /green) and skill
# once published to npm:
pi install npm:pi-green-loop

import … from "pi-green-loop/pi" is for embedding in your own SDK app — pi users should pi install instead.

Quick start

npm install
npm run build

# what would run?
node dist/cli/index.js detect      # (or: npm run dev -- detect)

# run the checks once
node dist/cli/index.js check

How it decides what to run

  1. A pi-green-loop.json (or .pi-green-loop.json) in the project root, if present, wins.
  2. Otherwise it reads package.json scripts and picks up typecheck, lint, test, build (with npm/pnpm/yarn/bun auto-detected).

Generate a starter config from what's detected:

node dist/cli/index.js init
// pi-green-loop.json
{
  "timeoutMs": 300000,
  "checks": [
    { "name": "typecheck", "kind": "typecheck", "command": "npm run typecheck" },
    { "name": "test",      "kind": "test",      "command": "npm test" }
  ]
}

The loop (pi extension)

The pi adapter listens for agent_end, runs the checks, and on failure injects the failing output back as a follow-up so the agent fixes it — capped by maxAttempts to avoid runaway loops.

Development

npm install
npm run build      # tsc -> dist/
npm test           # node --test suite
npm run typecheck  # tsc --noEmit

pi-green-loop checks itself: node dist/cli/index.js check runs its own typecheck + test + build.

License

MIT — see LICENSE.