pi-pstack-workflow-kit0.6.0
Native pstack and Team Kit workflows for Pi
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
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
Install Pi, if you do not have it yet:
npm install -g --ignore-scripts @earendil-works/pi-coding-agentAdd pstack to Pi:
pi install npm:pi-pstack-workflow-kitCheck 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:
/setup-pstackto pick which AI models do which jobs. You can skip this. pstack picks good ones for you./poteto-mode --onto turn on the careful way of working.- 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 this | What it does |
|---|---|
/poteto-mode --on |
Turn the careful way of working on for this session branch. |
/poteto-mode --off |
Turn it off for this session branch. |
/poteto-mode fix the parser |
Use it for one job only. |
/poteto-mode new task fix the parser |
Clear the previous plan and loop, then route the new task. |
/loop 60 10 check if CI is green |
Wake Pi every 60 seconds, up to 10 times, to check on something. |
/loop stop |
Stop waking Pi. |
/pstack-pause |
Stop the loop and local workers and save a resume note. |
/setup-pstack |
Pick models. /setup-pstack show shows what you picked. |
Run a skill directly with Pi's /skill:<name> command. For example, use /skill:arena to compare implementations, /skill:tdd to follow test-driven development, or /skill:why to trace a decision. The workflow guide explains which skill to use.
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
piprocess - 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.
Write workers can request named project MCP servers with mcpServers. Pi must trust the parent project, and you must approve the entries shown for this call. The worker's checkout stays untrusted. Read-only workers and Benny delegates cannot request these grants.
Set runtime: "sdk" to run a local worker as an in-process Pi SDK session instead of a separate pi process. Remote workers and mcpServers grants need the default subprocess runtime.
A foreground worker has a 30-minute run deadline. A background worker has no deadline. A completed batch can wake the parent once. On Linux and macOS, an independent guard stops the local Pi process group if its parent dies. A saved worker can resume only after its prior writer is proven gone. Use pstack_workers to list, wait for or stop a worker. Use pstack_delegate with a worker's sessionDir as resume to continue after confirmed shutdown. If an SDK host exits without confirming shutdown, start a fresh worker instead. Exit older Pi hosts before resuming workers with an upgraded package. A delegate with an explicit base gets a detached checkout at that revision even when it is read-only. For read-only work on a separately provisioned machine, configure a remote worker target. Pstack never falls back to local execution when you request that target.
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, under $PI_CODING_AGENT_DIR if set. Setup can read and migrate the old pstack-models.json without deleting it.
Pstack looks for the configured role model or a supported fallback. auto and inherit-parent use the parent model and thinking level, capped at xhigh. If Pi does not support that level on the worker model, pstack selects a supported lower level. The original Cursor -fast tiers are not supplied by Pi's thinking level.
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_shiprequires approval for exact GitHub PR heads and their trunk base. It stops if a head or base changes. The Shipping playbook checks patch identity and handles retargeting before the next PR.pstack_watch_prruns the bundled read-only GitHub watcher withghand Bun. The npm install provides itscommanderdependency. The watcher never installs anything or writes to the package when it starts. To run the skill outside this package, runbun install --frozen-lockfile --ignore-scriptsonce inskills/poteto-mode/scripts. For an Origin repository, useforge: "origin"to runorigin pr view --checksororigin pr checks --watch. Both integrations save evidence and can wake the parent in TUI or RPC mode. Usepstack_watch_prwithaction: "list"and the watchidto retrieve a recent background result on the same branch.pstack_shipdoes not merge on Origin.- The
ci-watcherworker can run commands in your own folder, so it can check your pull requests.
Host an Autopilot-full root
Approve the queue in Pi and let Autopilot-full arm
pstack_wakeat 3,600 seconds. Record the run ID frompstack_plan showand the session file frompstack_history.Close the interactive Pi process normally. Do not open the same session in two clients.
In the same project, have a trusted RPC client launch Pi under a service that can restart it. Keep the RPC input pipe open.
PSTACK_SUPERVISE_RUN="$RUN_ID" pi --mode rpc --session "$SESSION_FILE"
The installed extension restores the existing wake only when the named run is active, its queue approval is on the selected branch, and no other RPC host owns the wake. A restart does not grant new approvals. A due tick checks the actual owners and their evidence. To stop the queue, send /loop stop to the active host as an RPC prompt. It saves a hold and cancels local delegates and watches. Killing or restarting the hosting service alone does not revoke approval.
Benny: help with bug reports (optional)
Benny is an extra you can set up. It watches a Slack channel for bug reports.
- When someone posts a report, Benny sorts it: is it a bug, a slow spot, or something else?
- If it is a real bug, a second job tries to make the bug happen again and records proof.
- If it can, it suggests a small fix as a draft pull request. It never merges anything.
To set it up, point Pi at automations/benny/FOR_AGENTS.md and say which project to use. Pi walks you through the rest.
Benny's coordinator handles the work without delegates. The runner cannot prove that a local delegate has no Slack access, so it removes pstack_delegate from Benny jobs, including older job files. Use a dedicated computer or account if you leave Benny 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 checkchecks formatting, lint, and TypeScript.npm testruns the unit, integration, and end-to-end projects undertest/and checks coverage per source file.- Run
python3 scripts/generate.py --checkto check the native todo steps against the authored playbooks. Omit--checkto refresh the generated steps. npm run benchmeasures todo initialization for Feature and Autopilot-full.npm run verifyalso runs coverage, audits dependencies, inspects the package, and runs the package smoke test. It stops at the first failed check.npm run test:packagechecks 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. Usenpm run test:package -- 1.6.0to check Pi 1.6.0.- Statechart draws TLA+ state graphs and Lean 4.34.1 proof charts. Live checks run trusted project code and need the matching toolchain. The root suite also tests both modes offline. From
skills/statechart/scripts,npm testandnpm run test:coveragerun standalone Node tests. - The root Vitest suite includes the bundled
watch-prtests. To check that the same tests also pass under the standalone runtime, use Bun 1.4.5. Inskills/poteto-mode/scripts, runbun install --frozen-lockfile --ignore-scripts,bun run typecheck, andbun 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:
- In GitHub, restrict the
npmActions environment to deployments from themainbranch. - In the npm package settings, add a GitHub Actions trusted publisher. Enter owner
just-joshn, repositorypi-pstack, workflowstage-npm.yml, and environmentnpm. - Allow only
npm stage publish. Disable direct publishing and dist-tag management for this publisher. Remove any legacy publisher forrelease.yml. Require 2FA and disallow package publishing tokens. Remove the old GitHubNPM_TOKENsecret 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:
| Folder | What is in it |
|---|---|
extensions/pstack.ts |
Pi extension entry point. |
src/ |
Core extension modules (mode, models, todos, workers, loop, state, verification, ui) and internal helpers. |
skills/ |
The 77 skills and the 22 plans (in poteto-mode/playbooks/). |
agents/ |
Instructions for the different kinds of workers. |
upstream/ |
Pinned upstream revisions and Team Kit rules. |
docs/guide/ |
The guide. |
automations/benny/ |
Benny. |
docs/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 bundled skills, plans, agents, guide and Benny come from the upstream projects. Preserve runtime-independent wording when making a port. The flowchart audit distinguishes shipped behavior from conditional and unverified parity.
Where it came from
This package is built from two projects in cursor/plugins:
- pstack, by Lauren Tan. The audit compares the port with the pinned 0.15.50 source.
- 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 licenses/, with a list of which files came from where.