Skip to content

adjohn/pstack

v0.15.36MIT

if you want to go fast, go deep first. pstack helps you write less, but higher quality code. rigorous agent workflows you can parallelize with confidence. Ported from cursor/plugins.

pstack

this is an unofficial fork of pstack, built for Claude Code and actively maintained. the original is Lauren Tan's Cursor plugin. ported from cursor lists what moved, and contributing says where to file issues and pull requests.

the introduction below is adapted from poteto's original readme. only the cursor references changed.

i'm poteto. i'm not a president or ceo, but i've worked with millions of lines of code at Meta, Netflix, and Cursor. i'm also on the react core team where i help build and maintain react compiler.

there's a growing sense that ai writes too much slop code. i agree. i don't want to ship like a team of twenty slop artists. throughput without quality is not a goal i aspire to. if you want to go fast, go deep first.

pstack is my answer. these are the same skills i use every day to ship high quality code at Cursor. this turns claude code into a real engineering team. the goal is not to maximize loc, in fact it's the opposite. pstack helps you write less, but higher quality code.

pstack gives you fearless parallelism. when you can go deep on one agent and trust it to write good, verifiable code, you can truly parallelize with confidence. start multiple agents up with poteto-mode and trust that they'll apply rigorous engineering principles to their work.

claude code gives you the best of all worlds. every claude model tier has its strengths and weaknesses. use any model with pstack. in fact, many of my skills use multi-tier workflows to take advantage of each tier's unique strengths.

fork it. improve it. make it yours. PRs are welcome!

ported from cursor

pstack was written by Lauren Tan as a Cursor IDE plugin. the original lives at cursor/plugins (MIT). this repository is that plugin ported for Claude Code: the workflows, playbooks, and principles are unchanged, and only the Cursor-specific plumbing moved.

in the original (Cursor)in this port (Claude Code)
model config at ~/.cursor/rules/pstack-models.mdc (alwaysApply rule)~/.claude/pstack-models.md, always loaded via @~/.claude/pstack-models.md in ~/.claude/CLAUDE.md
multi-vendor model slugs (sol, grok, fable, opus)claude tiers: fable, opus, sonnet, haiku
/setup-pstack budget rewrites the effort suffix of every slugbudget sets effortLevel in ~/.claude/settings.json
per-spawn effort and speed in the slug (claude-opus-5-5-xhigh, -fast)the agent tool's effort parameter; no per-spawn fast mode
readonly: true subagents (ask mode, strips MCP)read-only by instruction in the prompt; subagents keep MCP tools
/poteto-mode as a Custom Mode (option+enter)a skill stays in context once invoked; optional always-on import (below)
Cursor Projects; cloud subagents (/in-cloud)a long-lived or cloud (claude.ai/code) coordinator session; worktree-isolated subagents
AskQuestion tool; Task subagent launcherAskUserQuestion tool; Agent subagent launcher
transcripts under ~/.cursor/projects/<slug>/agent-transcripts/~/.claude/projects/<slug>/<session-uuid>.jsonl
cursor-team-kit's /deslop, control-cli/control-uibuilt-in /simplify; the project's verify-<app> skill
cursor-agent headless CLI; Cursor Automationsclaude -p; /schedule routines or GitHub Actions
/make-bot-ui (Cursor webhook routines waking a Grok Bot)not ported; no Claude Code counterpart
docs/harness/claude-code.md, upstream's runtime name map for its own Claude Code buildnot shipped; this port rewrites the names in place, so the map would contradict it

syncing with upstream

the port tracks upstream as a vendor branch so git carries the Claude Code changes forward. to pick up a new upstream version:

scripts/sync-upstream.sh runs steps 1 to 3 and the tests, and leaves the merge staged for review. it exits 3 when upstream has nothing new, and 1 when something needs a person. by hand:

  1. check out upstream-vendor (its commits are pure upstream snapshots), copy upstream's pstack/ directory over it, commit.
  2. check out main and merge upstream-vendor. resolve each conflict region to upstream's side, except in the hand-maintained files of step 4 and in fork-only code (skills/poteto-mode/scripts/worktree-audit.sh, the test script in skills/poteto-mode/scripts/package.json), which keep main's side. delete what the port does not ship: .cursor-plugin/, assets/, skills/make-bot-ui/, and docs/harness/.
  3. run scripts/port-from-cursor.sh. it rewrites the Cursor plumbing above to Claude Code plumbing, then exits nonzero and lists any Cursor-specific text it left behind. add a rule for each line, or hand-fix it.
  4. hand-check README.md, .claude-plugin/plugin.json, plugin.json, and skills/setup-pstack/SKILL.md, which the port rewrote wholesale. bump both manifest versions to upstream's.
  5. land it with a merge commit, never a squash, so main keeps the vendor lineage the next sync merges against.
  6. to release, add release-notes/v<version>.md to main. the release workflow tags that commit and creates the GitHub release from the file.

install

from your shell:

claude plugin marketplace add adjohn/pstack
claude plugin install pstack@pstack

or from an interactive claude code session:

/plugin marketplace add adjohn/pstack
/plugin install pstack@pstack

claude plugin list shows pstack@pstack as enabled after the install.

or paste this into claude code and let it do the install:

install the pstack plugin from https://github.com/adjohn/pstack. run `claude plugin marketplace add adjohn/pstack`, then `claude plugin install pstack@pstack`, then `claude plugin list` to confirm. check that `node` and `gh` are on my PATH and tell me if either is missing. then tell me to restart claude code and run /setup-pstack.

prerequisites:

  • claude code 2.x.
  • node.js on your PATH. the pr size hook runs on node. without it, gh pr create and gt submit are refused until you install node or prefix the command with PSTACK_PR_SIZE_OK=1. commits are unaffected.
  • the gh cli, for the pr playbooks (opening a pr, babysit, shipping).
  • graphite's gt, optional, for stacked prs.

contributors install from a local clone instead. claude plugin marketplace add /absolute/path/to/pstack registers the checkout as a marketplace (the path is the directory containing .claude-plugin/marketplace.json), then claude plugin install pstack@pstack installs from it. the marketplace name in pstack@pstack comes from the name field in marketplace.json.

get started

two steps:

  1. run /setup-pstack, pick a reasoning budget, and choose which models you want. then start a new session. the config applies to new sessions.
  2. use /poteto-mode whenever you're doing anything that requires rigor.

/pstack:setup-pstack and /pstack:poteto-mode are the same commands with the plugin prefix. the bare forms work too. use the prefixed form when another plugin defines a skill with the same name.

new here? the pstack guide walks you through a first real task, from setup and prompting through verification and overnight runs. stuck, or unsure which skill fits? ask /poteto-help.

that's it. the other skills are situational, and the mode skill uses them for you as needed. out of the box the mode splits work by model strength: code delegates (feature, refactoring, bug fix, perf, hillclimb) go to haiku, while the hardest changes, prose, and judgment go to opus. the default panel is opus / haiku. each spawn also picks its reasoning level through the agent effort parameter. /setup-pstack changes any of it.

always on

optional. to have poteto mode on in every session, add this to ~/.claude/CLAUDE.md. it needs a git clone of pstack, because the github install lands under a versioned cache path (~/.claude/plugins/cache/pstack/pstack/<version>/) that changes on every update.

@/absolute/path/to/pstack/skills/poteto-mode/SKILL.md

Poteto mode is on by default in every session. Relative paths in the poteto-mode skill above (`playbooks/*.md`, `references/*.md`) resolve against `/absolute/path/to/pstack/skills/poteto-mode/`. Leaf `principle-*` skills are the pstack plugin skills of the same name.

the pr size gate

the plugin ships a hook (hooks/hooks.json) that watches every Bash call. after each git commit, gt create, gt modify, or gt absorb it prints the running size of the pr. it denies gh pr create and gt submit when the diff goes over either limit of the budget, 20 files or 800 added lines. set PSTACK_PR_MAX_FILES and PSTACK_PR_MAX_LINES in the env block of ~/.claude/settings.json to change the numbers. prefix the create command with PSTACK_PR_SIZE_OK=1 to pass the gate for one pr. the full rule is in references/pr-budget.md.

usage

use /poteto-mode at the start of a task. it reads your request, picks from a set of playbooks, and runs the other skills as the steps need them.

just use /poteto-mode

this skill is the main shortcut. i use it whenever i need the agent to do rigorous engineering work. it comes with twenty-three playbooks:

/poteto-mode this pr has a subtle bug where the scroll drifts every 750ms even when idle. repro
first, then fix and verify.
/poteto-mode i'm going to bed. land the stack even if ci flakes. i want everything merged by
morning.

the twenty-three playbooks

playbookfor
investigationa read-only question. how does x work, why was y built this way, are we sure.
bug fixreproduce a defect, root-cause it, and fix with runtime evidence.
perftrace a measured slowness and improve it against a baseline.
hillclimbsustained, scientific improvement of one metric against a target, looping hypotheses with before/after measurement and one commit per accepted win.
runtime forensicsdiagnose a live symptom (leak, idle-cpu spin, glitch) from instrumentation.
trace forensicsdiagnose a captured profiling artifact (cpuprofile, trace, spindump, heap snapshot).
featurenew or changed behavior, built from a named data shape.
refactoringa behavior-preserving change to structure or shape.
prototypea throwaway sketch to make a design or behavioral decision cheaply, or to settle an empirical fork by observing it.
visual paritypixel-exact ui equivalence between two implementations.
authoring a skillwriting or editing a SKILL.md.
evaltest how a skill or prompt change affects agent behavior, blinded.
babysitdrive a pr or a stack to merge-ready: conflicts, review threads, ci.
shippingindependently verify a green stack, then land the contiguous verified run bottom-up through github by default or origin when available.
autonomous rundrive a long task to completion without stopping.
orchestratea standing project handed to one coordinator chat: multi-day, many stacked prs, fleets of subagents.
autopilot-fullrun independent prs to merged with one owner per pr. a swarm verifies each code-ready head, and every later change to the patch gets a fresh check.
autopilot-stackautopilot-full without the merge. build and verify prs for the operator to review and land, stacking a pr only on a pr it builds on.
session pickupresume or take over a prior agent's in-flight work.
pause safelysuspend in-flight work cleanly so it can be resumed later.
multi-phase planwork that spans phases or stacked PRs.
worktree cleanupreclaim disk by pruning merged or abandoned worktrees and stale ios simulators, safety-gated.
opening a propen a ready pr from small ordered commits with a conventional commits title and a briefing-style body. invoked at the end of every other playbook.

when invoked it:

  1. matches your task to a playbook and opens a todo list whose first items are its steps, copied in verbatim.
  2. routes to the other skills as the steps fire.
  3. writes unslopped replies framed for the consumer and the maintainer.

the full rules and playbooks live in skills/poteto-mode/SKILL.md.

/poteto-mode is also a sticky mode: once entered it stays on across turns, applying itself when a playbook matches or the task needs rigor and staying out of the way otherwise. opt out any time by saying so.

/poteto-mode works extremely well with claude code's /loop command. you can make claude code work for many hours without sacrificing rigor.

skills

/poteto-mode runs most of these for you when a step needs them (how, why, architect, arena, swarm, interrogate, unslop, no-comments, technical-writing, tdd, and the principles). the table below is for when you want one directly:

/how do we cancel runs? do we have an n+1 when we look up every run to cancel?
/interrogate review this pr.

all skills

skilluse it when
/poteto-modedefault entry point for any non-trivial task.
/poteto-helpyou're new to pstack, or unsure which skill, playbook, or principle fits. finds out what you're trying to do, answers that part, and hands you a prompt to type. runs only when you type /poteto-help.
/in-your-own-wordsyou want the agent to play back your goal and the problem before it starts. runs only when you type /in-your-own-words.
/sharpenyou want a prompt made deeper, not bigger, before you send it: what a top professional would do that you didn't ask for, the raw material they'd start from, their methods and tools, and an outside check that the result is right. hands back the rewritten prompt and leaves your choices open. doesn't do the task. runs only when you type /sharpen.
/howyou want a walkthrough of how a subsystem works.
/whyyou want to know why something was built this way. discovers available MCPs at run time and queries each evidence category in parallel (source control, issue tracker, long-form docs, real-time chat, infra observability, error tracking, analytics warehouse).
/recallyou're starting or resuming work and want your recent context on a topic rebuilt from your own chat history and the shared record, handed back as a tight current-state brief.
/ketchupyou want what changed in this chat since your last message, in plain words and small visuals, with every item waiting on you listed and decidable from the reply alone, even when that makes the reply long.
/ketchup-videoyou want the /ketchup catch-up as a short subtitled video of slides, with the calls waiting on you as text under it.
/blast-radiusyou have a small-looking change and want to know what else it could break, with the one fact it's safe because of proven by running code, not asserted.
/architectyou're about to write code that crosses a function boundary and want the caller's usage, types, and module shape settled first.
/arenayou want N parallel attempts at the same thing, then to grab the best parts of each.
/swarmyou want N parallel workers across different slices or races, then one aggregated report.
/interrogateyou have a diff and want different models to try to break it, keeping only findings a run proves.
/automate-meyou want your own -mode skill, drafted from how you've actually worked.
/setup-pstackyou want to pick which models pstack uses per role. detects your models and writes a config file.
/reflecta long task landed and you want the recipe captured as a skill edit.
/correctyou keep correcting agents for the same mistakes. mines history for mistake classes, fixes each at the highest level that works (architecture, then types, lint, and ci, then tests, with docs last), and keeps a table pairing each rule with what enforces it.
/teachyou want to actually understand a change or subsystem, not just have it summarized. runs how + why and weaves one plain explanation, built up diagram by diagram.
/tddyou're fixing a bug and there's a cheap local test path. write the failing test first, then the fix.
/benchmark-checklistyou ran a benchmark or measured a speedup or regression. vets the number (limiter, tuning, errors, repeat runs, end-to-end relevance) before you report or act on it.
/no-commentsstrip comments before review; spawns Comment Sicko, fixes accepted findings, offers encodings for claimed constraints.
/typescript-best-practicesyou're reading or editing typescript. grounds the type-system-discipline principle in syntax.
/figure-it-outno bundled playbook fits. designs a rigorous, auditable playbook for the task.
/show-me-your-workyou want a reviewable decision trail. logs decisions to a tsv you can commit.
/create-verification-skillyour project has no scripted way to prove app behavior. generates a project-local verify skill with a feature map, for any language or platform.
/maintain-verification-skillyour verify skill's feature map has drifted from the app. source wave + one live pass, at most one PR of proven corrections.
/create-formal-verification-skilltests can't reach the case that breaks a race, retry, state machine, parser, or unsafe code. verifies one property with the tool that fits and generates a project-local skill to recheck it on every change.
/maintain-formal-verification-skillcode your formal verification covers has changed since it was last checked. updates the model, harness, or properties to match the code, reruns, and says whether each failure is drift in the verification or a bug in the code.
/statechartsomeone who owns the behavior needs to see it, not read a spec. checks a tla+ model, draws what the user sees as a mermaid statechart, marks each state that breaks a rule, and gives the shortest path to each one.
/unslopyou're cleaning up writing. removes AI tells.
/broyou want the last message restated in plain human language, no jargon.
/technical-writinglayered doc standard (Diátaxis + Google developer style + STE + Global English) for docs, RFCs, readmes, PR descriptions, commit messages.

examples

mostly i type /poteto-mode at the start of a task and let it route to a playbook. the other skills fire as the steps need them. a few i reach for directly.

all the examples

bug fix:           /poteto-mode this pr has a subtle bug where the scroll drifts every 750ms even
                   when idle. repro first, then fix and verify.
perf:              /poteto-mode a big list takes a second or two to load even though we virtualize.
                   run a cpu trace and tell me why.
feature:           /poteto-mode build a small feature behind a feature flag. verify it really works.
prototype:         /poteto-mode build two prototypes of the markdown renderer so we can compare.
                   spawn an agent for each.
multi-phase:       /poteto-mode open source these skills as a plugin. nothing internal leaks, work
                   in a temp dir, show me the dependency graph first.
overnight run:     /poteto-mode i'm going to bed. land the stack even if ci flakes. i want
                   everything merged by morning.
babysit:           /poteto-mode check on pr 123. anything outstanding?
visual parity:     /poteto-mode the row spacing is too tall when this flag is on. the second image
                   is correct. repro and fix until it matches.
figure it out:     /poteto-mode i'm stepping away. migrate every caller from the synchronous store
                   to the new async one, keeping behavior identical. i want to trust it was done
                   right when i'm back.
how:               /how do we cancel runs? do we have an n+1 when we look up every run to cancel?
why:               /why is this feature flag not on yet?
architect:         design this instrumentation to be high signal with no false positives. /architect
                   this first.
arena:             /arena take my prompt to the arena verbatim. i want to compare their proposals
                   with yours.
swarm:             /swarm check every package under packages/ against its check.sh. one worker per
                   package. one report.
interrogate:       /interrogate review this pr.
tdd:               /tdd implement
unslop:            can we unslop and tighten the new changes?
reflect:           /reflect that took too long. capture what we learned so the next run doesn't
                   repeat it.
correct:           /correct
show-me-your-work: /show-me-your-work keep a decision trail i can review when i'm back.
automate-me:       /automate-me
help:              /poteto-help which skill should i use to review this branch?

the poteto-agent and Comment Sicko subagents

/poteto-mode runs in the chat that receives it. that chat owns the playbook, the todo list, and every subagent spawn.

pstack also ships subagent_type: "pstack:poteto-agent" as the wrapper for delegates spawned during a run. it reads poteto-mode in full, including its inline principles index, before doing any work. substituting general-purpose skips that read and drifts. do not spawn poteto-agent to run the playbook itself.

pstack also ships Comment Sicko, a read-only comment reviewer available as subagent_type: "pstack:comment-sicko". usually invoke it through /no-comments, not directly.

principles

twenty-four short skills, one principle each. poteto-mode indexes them inline and reads that index at task start. the standalone files are there so other skills can reference a principle by name, and so the index can point at the full rule for each.

all twenty-four principles

principlegrouprule
laziness-protocolcoreBias toward deletion and the smallest change that solves the problem.
foundational-thinkingcoreApply before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share. Get the data structures right so downstream code becomes obvious.
redesign-from-first-principlescoreRedesign as if the requirement had been a foundational assumption from day one, instead of bolting it on.
attack-the-premisecoreApply when two or more fixes that share one premise have failed the same gate. Write the premise down and test it directly before you write another fix that assumes it.
subtract-before-you-addcoreRemove dead weight, redundant validators, and stub references first, then build on the simpler base.
minimize-reader-loadcoreCount layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope.
outcome-oriented-executioncoreApply during planned rewrites and migrations with explicit phase boundaries. Converge on the target architecture; don't preserve smooth intermediate states with throwaway compatibility code.
experience-firstcoreChoose user delight over implementation convenience; ship fewer polished features over more rough ones.
exhaust-the-design-spacecoreBuild 2-3 competing prototypes and compare side by side before committing.
build-the-levercoreApply to any non-trivial work, not just bulk work: edits, migrations, analyses, checks. Build the tool that does it or proves it (codemod, script, generator, or a skill your subagents follow) instead of working by hand. The tool is the artifact a reviewer can rerun.
model-the-domainarchitectureEncode the domain in a structure instead of scattered conditionals.
boundary-disciplinearchitectureConcentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions.
type-system-disciplinearchitectureMake illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, exhaust variants, derive from authoritative schemas.
make-operations-idempotentarchitectureConverge to the same end state regardless of partial prior runs.
migrate-callers-then-delete-legacy-apisarchitectureMigrate callers and delete the old API in the same wave instead of preserving compatibility layers.
separate-before-serializing-shared-statearchitectureEliminate the sharing first; serialize structurally only when one shared writer is a real invariant.
prove-it-worksverificationApply after completing a task, before declaring done. Verify against the real artifact (run the feature, read the actual value, inspect the diff), not a proxy, self-report, or 'it compiles.'.
fix-root-causesverificationTrace each symptom back to the first place the system went wrong and fix it there. A guard is a fix only when the state it handles is legitimate.
sequence-verifiable-unitsverificationApply to multi-step work (sweeps, migrations, runs of similar edits) and to how you stack commits and PRs. Break work into small units that each end in a verifiable state, check each before the next, and order delivery so the sequence proves itself to a reviewer.
test-behavior-not-implementationverificationApply when you write, change, or keep a test. Assert what the code's users can observe, so the test fails when that behavior breaks and keeps passing when only the internals change.
explain-the-numberverificationApply before you trust, report, or act on a number you measured: a speedup, a regression, a throughput, a latency, or an eval result. Find what limits it, and rule out that it measured something other than the work you think.
guard-the-context-windowdelegationRoute bulk to subagents; keep summaries in the main thread, not raw payloads.
never-block-on-the-humandelegationProceed, present the result, let the human course-correct after the fact; reserve confirmation for irreversible actions.
encode-lessons-in-structuremetaEncode the rule as a lint, metadata flag, runtime check, or script instead of more text.

not shipped here

a few things poteto-mode references but doesn't bundle:

  • /simplify is a claude code built-in. it covers what the original's deslop skill (from cursor-team-kit) did.
  • scripted app-driving comes from your project's verification skill (verify-<app>), generated by /create-verification-skill. the original leaned on cursor-team-kit's control-cli and control-ui for this.
  • skill authoring routes through the skill-creator skill if you have it installed (from anthropics/skills); otherwise the playbook authors the SKILL.md directly. pr-status requests route through the bundled babysit playbook.

why are there no planning skills?

claude code already has a great plan mode which works great with pstack. but personally, i don't believe in planning. the best spec is code. if you do want to make a plan, /poteto-mode covers it, but it's not a default.

make it yours

poteto-mode is my style. you may not want exactly that.

type /automate-me. it mines your recent transcripts, drafts a <your-name>-mode skill from how you've actually worked, and routes through pstack underneath. you keep pstack as the base and end up with your own routing skill alongside poteto-mode.

models are configurable too. type /setup-pstack. it detects the models you have access to and writes a small always-loaded config file (~/.claude/pstack-models.md) mapping each role (code, judgment, the review panels) to a model. every skill reads it and falls back to sensible defaults when the file is absent, so you override only what you want.

when a default changes, a file written before the change still pins the old default. delete those role lines, or delete the file, then run /setup-pstack again. a rerun keeps any role whose model differs from the default.

automations

pstack also ships a dormant benny automation pack. benny triages slack issue reports, then reproduces and fixes confirmed bugs with real ui evidence. its files are not registered as slash skills.

to set it up, point claude code at FOR_AGENTS.md. setup copies the pack into the target repository at .claude/automations/benny/, enables pstack there for shared skills, and keeps user configuration outside the copied pack.

contributing

file issues and pull requests at this fork. upstream lives at cursor/plugins. the upstream-vendor branch tracks it, and port changes go on main on top of it. an improvement that is not specific to claude code is welcome upstream too.

license

MIT