← Catalog

pi-pstack-workflow-kit

Map-driven pstack and Team Kit workflows for Pi

Package

Install

Install with PiG

pig install npm:pi-pstack-workflow-kit

Install with Pi

pi install npm:pi-pstack-workflow-kit
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "skills": [
    "src/skills"
  ],
  "extensions": [
    "src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.5.3 (README.md). PiG does not review it.

Pi pstack workflow kit

What is this?

Pi is a coding helper. You type what you want, and it reads and writes code for you.

This package teaches Pi a careful way to work. It is called pstack.

With pstack, Pi does these things:

  • It makes a plan before it starts.
  • It does one small step at a time.
  • It checks that each step really works.
  • It can ask other helpers to work at the same time.

pstack was first made by Lauren Tan for a different coding tool, called Cursor. This package brings the same instructions to Pi, so you do not need Cursor.

What you need

  • Pi 1.6.0, 1.6.1, or 1.7.0
  • Node.js 22.23.5 or later in the 22.x line, 24.22.3 or later in the 24.x line, or 26.13.1 or later in the 26.x line. We support Linux and macOS. CI also runs Windows checks, but Windows is not supported.
  • Git, if you want helpers to work on their own copy of your code
  • The GitHub tool gh, if you want Pi to work with pull requests

Install it

  1. Install Pi, if you do not have it yet:

    npm install -g --ignore-scripts @earendil-works/pi-coding-agent
    
  2. Add pstack to Pi:

    pi install npm:pi-pstack-workflow-kit
    
  3. Check that it is there:

    pi list
    

Just want to try it once? Run pi -e npm:pi-pstack-workflow-kit. Nothing is installed.

Only want it in one project? Add --local to the install line.

Your first steps

Start Pi, then type these:

  1. /setup-pstack to pick which AI models do which jobs. You can skip this. pstack picks good ones for you.
  2. /poteto-mode on to turn on the careful way of working.
  3. Ask for something, like: "Fix the login bug and show me it works."

When you want to stop, type /poteto-mode off.

Commands you can type

Type thisWhat it does
/poteto-mode onTurn the careful way of working on.
/poteto-mode offTurn it off.
/poteto-mode fix the parserUse it for one job only.
/pstack-run bug-fix fix the loginPick the plan yourself. Here the plan is bug-fix.
/pstack-statusSee the goal and the to-do list.
/pstack-goal all tests passSet a goal that Pi keeps in mind.
/pstack-loop 60 10 check if CI is greenWake Pi every 60 seconds, up to 10 times, to check on something.
/pstack-loop stopStop waking Pi.
/pstack-pauseStop for now, and save a note on where you were.
/pstack-clearThrow away the plan and goal. Saved files stay.
/pstack-mapLook around everything pstack knows.
/setup-pstackPick models. /setup-pstack show shows what you picked.

There are also 53 named skills, like /deslop, /tdd and /why. Each one is a set of instructions for one kind of job. Every skill also works as /skill:<name>. The guide in src/docs/guide/ explains them.

The to-do list

When Pi works on something, it keeps a to-do list. Each time the list changes, Pi shows it in the chat:

figure-it-out 1/3
[x] 1. Reproduce the bug
[ ] 2. Write a failing test
[ ] 3. Fix the root cause

The bar at the bottom of the screen shows how far along it is. Pi can only call the job finished when every item is done, or skipped for a reason.

Helpers

Pi can start other copies of itself to help. We call them workers.

  • One worker does one job.
  • A swarm is many workers, each doing its own job.
  • An arena is many workers doing the same job. A judge picks the best answer.
  • Interrogate sends workers to try to break your idea, so you find the weak spots early.

Read-only workers start with read and search tools. Workers that write start in detached Git worktrees. Review their work before applying it to your checkout.

Subagent features

Foreground workers in pstack_delegate follow Pi's subagent example.

  • Isolated context: Each subagent runs in a separate pi process
  • Streaming output: See tool calls and progress as they happen
  • Parallel streaming: All parallel tasks stream updates simultaneously
  • Markdown rendering: Final output rendered with proper formatting (expanded view)
  • Usage display: Shows turns, tokens, cost, and context usage inside each subagent result
  • Abort support: Ctrl+C propagates to kill subagent processes

Use Pi's expand binding, Ctrl+O by default, to read the Markdown report. Usage counts the current invocation. Context usage is the token count from the latest assistant turn that reported it. Child usage does not count toward the parent's footer totals. One Ctrl+C cancels active and queued foreground work without quitting Pi. Escape still cancels.

Each worker saves a transcript, a bounded report, and private diagnostics. A failed single worker returns a tool error. Swarms return one result per task in task order.

A foreground worker has a 30-minute run deadline. A background worker has no deadline, but Pi stops it when the parent session closes. Use pstack_workers to list or stop background workers. Use pstack_delegate with a worker's sessionDir as resume to continue that worker after it exits.

Picking models

Different jobs can use different AI models. For example, a big model for hard bugs and a quick one for small edits.

Type /setup-pstack to choose. Your choices are saved in ~/.pi/agent/pstack-models.json.

If you never choose, pstack uses the models its original author picked. If you do not have one of them, it uses the closest one you do have.

Please be careful

  • Workers run on your computer, with your computer's permissions. A worktree keeps their changes apart, but it is not a locked box. Do not give pstack secrets or code you do not trust.
  • pstack only merges pull requests after you say yes. It shows you exactly what it will merge first.
  • The ci-watcher worker can run commands in your own folder, so it can check your pull requests.

Benny: help with bug reports (optional)

Benny is an extra you can set up. It watches a Slack channel for bug reports.

  1. When someone posts a report, Benny sorts it: is it a bug, a slow spot, or something else?
  2. If it is a real bug, a second job tries to make the bug happen again and records proof.
  3. If it can, it suggests a small fix as a draft pull request. It never merges anything.

To set it up, point Pi at src/automations/benny/FOR_AGENTS.md and say which project to use. Pi walks you through the rest.

Benny runs on your own computer. Use a computer or account just for Benny if you leave it running alone. If the watcher reports an unconfirmed run, inspect its runs/ directory before retrying. Benny does not replay a claim that may already have changed Slack or the tracker.

Set PSTACK_PI_BIN to override the Pi executable. An absolute .js, .mjs, or .cjs entry runs with Node.js. A supervisor that starts run-job.mjs with Node IPC can send { "type": "stop" } to request shutdown and let the runner record its result.

Working on this package

Use npm 12.2.3 to work on this package.

Check everything still works:

npm ci --ignore-scripts
npm run verify
  • npm run check checks formatting, lint, and TypeScript. npm test runs the unit, integration, and end-to-end projects under test/ and checks coverage per source file.
  • The catalog consistency test uses Python 3. Run python3 scripts/generate.py --check to check the generated catalog. Run it without --check to regenerate the files.
  • npm run bench measures catalog search and dependency-view construction.
  • npm run verify also runs coverage, audits dependencies, inspects the package, and runs the package smoke test. It stops at the first failed check.
  • npm run test:package checks the tarball for nested installs and local credential or Pi state files. It then installs the tarball in a temporary directory and loads the extension without making model calls. The default host is the pinned Pi version. Use npm run test:package -- 1.6.0 to check Pi 1.6.0.
  • Statechart tests run offline in the root suite. From src/skills/statechart/scripts, npm test and npm run test:coverage run standalone Node tests from the development checkout.
  • The root Vitest suite includes the bundled watch-pr tests. To check that the same tests also pass under the standalone runtime, use Bun 1.4.5. In src/skills/poteto-mode/scripts, run bun install --frozen-lockfile --ignore-scripts, bun run typecheck, and bun run test.

Release on npm

Before 1.0, use a minor release for breaking changes and a patch release for compatible fixes. Update CHANGELOG.md, package.json, and package-lock.json in the release pull request.

Set up trusted publishing once after stage-npm.yml is on main:

  1. In GitHub, restrict the npm Actions environment to deployments from the main branch.
  2. In the npm package settings, add a GitHub Actions trusted publisher. Enter owner just-joshn, repository pi-pstack, workflow stage-npm.yml, and environment npm.
  3. Allow only npm stage publish. Disable direct publishing and dist-tag management for this publisher. Remove any legacy publisher for release.yml. Require 2FA and disallow package publishing tokens. Remove the old GitHub NPM_TOKEN secret if it is no longer used.

Stage and approve the first version within two days of adding the trusted publisher. If the version on main is unpublished, use Run workflow to stage it without another version bump.

Merge the release pull request. A stable version increase on main runs the release checks, verifies one tarball on the supported Pi versions, and stages it on npm. Other pushes skip staging. Once CI passes, open Staged Packages on npmjs.com. Review the version and tag, click Approve, and complete 2FA. You do not need to run a local release command or create a tag.

If a run fails before staging, use Re-run jobs on its GitHub Actions run. If the artifact expired, rerun all jobs to rebuild it. If the version is still on main, you can also open Stage npm package in Actions and click Run workflow. Select main and enter the exact version in its package.json. For an older release, select backfill to leave the latest tag unchanged. The workflow cannot recover missing source or assign a new version to existing source. If npm already has a staged entry for the version, review that entry instead of staging it again. If the entry has the wrong tag, reject it on npmjs.com before you rerun the workflow.

Sync GitHub releases

After npm publishes an approved version, the Sync GitHub releases workflow checks for missing GitHub releases once an hour. It starts at 0.5.0. It verifies npm signatures and provenance from stage-npm.yml on main, then uses the verified commit for the tag and changelog. It never writes to npm or moves a Git tag. Keep immutable GitHub releases enabled.

To sync without waiting, open Sync GitHub releases in Actions, click Run workflow, and select main. Select Preview to see which versions would be released without writing any tags or releases.

If any candidate fails provenance or changelog verification, the sync writes nothing for that run. Inspect the run before retrying after a verification failure, conflicting tag, or draft. If GitHub refuses to create a tag with the workflow token, a maintainer can create it at the verified commit shown in the run and rerun the sync. Do not substitute the tip of main.

Find your way around:

FolderWhat is in it
src/Everything the installed package uses.
src/skills/The 77 skills and the 22 plans (in poteto-mode/playbooks/).
src/agents/Instructions for the different kinds of workers.
src/docs/guide/The guide.
src/automations/benny/Benny.
src/jobs/The parts that run Benny without you watching.
src/reference/Notes on what matches the original and what does not.
test/Vitest suites and standalone Statechart checks.
tests/Test fixtures and the release writer shell check.

The skills, plans, agents, guide and Benny are copied from the original pstack, word for word. Only the sentences that named a Cursor feature were changed, to name the Pi feature that does the same thing. Please keep it that way.

Where it came from

This package is built from two projects in cursor/plugins:

  • pstack 0.15.48, by Lauren Tan
  • Cursor Team Kit 1.2.0, by Cursor

License

This package's own code uses the MIT License. See LICENSE.

The parts copied from pstack and Cursor Team Kit also use the MIT License. Their license notices are in src/licenses/, with a list of which files came from where.