diff --git a/harness/pstack/README.md b/harness/pstack/README.md index 560eae632..07e17d8a9 100644 --- a/harness/pstack/README.md +++ b/harness/pstack/README.md @@ -1,7 +1,7 @@ # pstack harness tree -This folder is generated from `pstack/skills`, `pstack/agents`, `pstack/docs/harness/claude-code.md`, `pstack/LICENSE`, and `pstack/plugin.json`. Do not edit it by hand. +This folder is generated from `pstack/skills`, `pstack/agents`, `pstack/docs/guide`, `pstack/docs/harness/claude-code.md`, `pstack/README.md`, `pstack/LICENSE`, and `pstack/plugin.json`. Do not edit it by hand. -Cursor uses `pstack/` directly, and Claude Code installs `claude-code/`. The tree leaves out the rest of `pstack/docs` and `pstack/README.md`. A relative link to a pstack file that the tree leaves out points at that file on GitHub `main` instead. +Cursor uses `pstack/` directly, and Claude Code installs `claude-code/`. The tree leaves out the rest of `pstack/`, such as `pstack/automations` and `pstack/assets`. A relative link to a pstack file that the tree leaves out points at that file on GitHub `main` instead. After editing those sources, run `node scripts/generate-pstack-harness-trees.mjs` from the repository root and commit the result. diff --git a/harness/pstack/claude-code/README.md b/harness/pstack/claude-code/README.md new file mode 100644 index 000000000..ef18f941d --- /dev/null +++ b/harness/pstack/claude-code/README.md @@ -0,0 +1,285 @@ +# pstack + +i'm [poteto](https://x.com/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 everyday to ship high quality code at Cursor. this turns cursor 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. + +**cursor gives you the best of all worlds.** every frontier model has its strengths and weaknesses. use any model with pstack. in fact, many of my skills use multi-model workflows to take advantage of each model's unique strengths. + +fork it. improve it. make it yours. PRs are welcome! + +## install + +```bash +/add-plugin pstack +``` + +in claude code: + +```bash +/plugin marketplace add cursor/plugins +/plugin install pstack@cursor-plugins +``` + +claude code prefixes plugin commands and agents, so `/poteto-mode` is `/pstack:poteto-mode`. the [claude code adapter](./docs/harness/claude-code.md) maps every other cursor name. in claude code, `/pstack:setup-pstack` writes your model choices to `~/.claude/rules/pstack-models.md`, and a step that needs a cursor-only feature, such as bugbot or automations, is skipped with a one-line note. + +claude code installs a generated copy of pstack from [`harness/pstack/`](https://github.com/cursor/plugins/tree/main/harness/pstack) at the repository root. after changing `skills/`, `agents/`, `docs/guide/`, `docs/harness/claude-code.md`, this readme, or `plugin.json`, run `node scripts/generate-pstack-harness-trees.mjs` from the repository root and commit the result. ci fails until you do. + +## get started + +two steps: + +1. run [`/setup-pstack`](./skills/setup-pstack/SKILL.md), pick a reasoning budget, and choose which models you want. +2. use [`/poteto-mode`](./skills/poteto-mode/SKILL.md) whenever you're doing anything that requires rigor. + +new here? the [pstack guide](./docs/guide/README.md) 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`](./skills/poteto-help/SKILL.md). + +that's it. the other skills are situational; 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 grok, while the hardest changes, prose, and judgment go to opus 5.5. the default panel is opus 5.5 / grok. [`/setup-pstack`](./skills/setup-pstack/SKILL.md) changes any of it. + +## usage + +use [`/poteto-mode`](./skills/poteto-mode/SKILL.md) 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. + +pick `/poteto-mode` from the `/` menu before you type your task, so cursor attaches the skill to the message. + +### just use [`/poteto-mode`](./skills/poteto-mode/SKILL.md) + +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 + +| playbook | for | +|---|---| +| [investigation](./skills/poteto-mode/playbooks/investigation.md) | a read-only question. how does x work, why was y built this way, are we sure. | +| [bug fix](./skills/poteto-mode/playbooks/bug-fix.md) | reproduce a defect, root-cause it, and fix with runtime evidence. | +| [perf](./skills/poteto-mode/playbooks/perf-issue.md) | trace a measured slowness and improve it against a baseline. | +| [hillclimb](./skills/poteto-mode/playbooks/hillclimb.md) | sustained, scientific improvement of one metric against a target, looping hypotheses with before/after measurement and one commit per accepted win. | +| [runtime forensics](./skills/poteto-mode/playbooks/runtime-forensics.md) | diagnose a live symptom (leak, idle-cpu spin, glitch) from instrumentation. | +| [trace forensics](./skills/poteto-mode/playbooks/trace-forensics.md) | diagnose a captured profiling artifact (cpuprofile, trace, spindump, heap snapshot). | +| [feature](./skills/poteto-mode/playbooks/feature.md) | new or changed behavior, built from a named data shape. | +| [refactoring](./skills/poteto-mode/playbooks/refactoring.md) | a behavior-preserving change to structure or shape. | +| [prototype](./skills/poteto-mode/playbooks/prototype.md) | a throwaway sketch to make a design or behavioral decision cheaply, or to settle an empirical fork by observing it. | +| [visual parity](./skills/poteto-mode/playbooks/visual-parity.md) | pixel-exact ui equivalence between two implementations. | +| [authoring a skill](./skills/poteto-mode/playbooks/authoring-a-skill.md) | writing or editing a SKILL.md. | +| [eval](./skills/poteto-mode/playbooks/eval.md) | test how a skill or prompt change affects agent behavior, blinded. | +| [babysit](./skills/poteto-mode/playbooks/babysit.md) | drive a pr or a stack to merge-ready: conflicts, review threads, ci. | +| [shipping](./skills/poteto-mode/playbooks/shipping.md) | independently verify a green stack, then land the contiguous verified run bottom-up through github by default or origin when available. | +| [autonomous run](./skills/poteto-mode/playbooks/autonomous-run.md) | drive a long task to completion without stopping. | +| [orchestrate](./skills/poteto-mode/playbooks/orchestrate.md) | a standing project handed to one coordinator chat: multi-day, many stacked prs, fleets of subagents. | +| [autopilot-full](./skills/poteto-mode/playbooks/autopilot-full.md) | run independent prs to merged with one owner per pr and a root swarm verdict on each round, from the code-ready head on. | +| [autopilot-stack](./skills/poteto-mode/playbooks/autopilot-stack.md) | build and verify one linear base-branch stack for the operator to review and land. | +| [session pickup](./skills/poteto-mode/playbooks/session-pickup.md) | resume or take over a prior agent's in-flight work. | +| [pause safely](./skills/poteto-mode/playbooks/pause-safely.md) | suspend in-flight work cleanly so it can be resumed later. | +| [multi-phase plan](./skills/poteto-mode/playbooks/multi-phase-plan.md) | work that spans phases or stacked PRs. | +| [worktree cleanup](./skills/poteto-mode/playbooks/worktree-cleanup.md) | reclaim disk by pruning merged or abandoned worktrees and stale ios simulators, safety-gated. | +| [opening a pr](./skills/poteto-mode/playbooks/opening-a-pr.md) | open 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](./skills/poteto-mode/playbooks/) 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`](./skills/poteto-mode/SKILL.md). + +to keep [`/poteto-mode`](./skills/poteto-mode/SKILL.md) on across turns, pick it from the `/` menu and press option+enter (mac) or alt+enter (windows) instead of enter. that makes it a [custom mode](https://cursor.com/docs/skills), which cursor offers in the agents window and the cli. it stays in context every turn, applies itself when a playbook matches or the task needs rigor, and stays out of the way otherwise. plain enter attaches it to one message only. say so to opt out, or exit the mode to turn it off. + +[`/poteto-mode`](./skills/poteto-mode/SKILL.md) works extremely well with cursor's `/loop` command. you can make cursor work for many hours without sacrificing rigor. + +## skills + +[`/poteto-mode`](./skills/poteto-mode/SKILL.md) 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 + +| skill | use it when | +|---|---| +| [`/poteto-mode`](./skills/poteto-mode/SKILL.md) | default entry point for any non-trivial task. | +| [`/poteto-help`](./skills/poteto-help/SKILL.md) | you'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-words`](./skills/in-your-own-words/SKILL.md) | you want the agent to play back your goal and the problem before it starts. runs only when you type `/in-your-own-words`. | +| [`/sharpen`](./skills/sharpen/SKILL.md) | you want a task approached the way a top expert would, aimed at what you're really after, without overspecifying it or deciding your choices for you. | +| [`/how`](./skills/how/SKILL.md) | you want a walkthrough of how a subsystem works. | +| [`/why`](./skills/why/SKILL.md) | you 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). | +| [`/recall`](./skills/recall/SKILL.md) | you'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. | +| [`/ketchup`](./skills/ketchup/SKILL.md) | you want what changed in this chat since your last message, in a few plain sentences and small visuals, with just enough context on each action item to make the call. | +| [`/blast-radius`](./skills/blast-radius/SKILL.md) | you 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. | +| [`/architect`](./skills/architect/SKILL.md) | you're about to write code that crosses a function boundary and want the caller's usage, types, and module shape settled first. | +| [`/arena`](./skills/arena/SKILL.md) | you want N parallel attempts at the same thing, then to grab the best parts of each. | +| [`/swarm`](./skills/swarm/SKILL.md) | you want N parallel workers across different slices or races, then one aggregated report. | +| [`/interrogate`](./skills/interrogate/SKILL.md) | you have a diff and want different models to try to break it, including a strict code-quality lens. | +| [`/automate-me`](./skills/automate-me/SKILL.md) | you want your own `-mode` skill, drafted from how you've actually worked. | +| [`/make-bot-ui`](./skills/make-bot-ui/SKILL.md) | you want a page or dashboard whose buttons wake a Grok Bot over a webhook, including the sender-key handoff and Tailscale. | +| [`/setup-pstack`](./skills/setup-pstack/SKILL.md) | you want to pick which models pstack uses per role. detects your models and writes a config rule. | +| [`/reflect`](./skills/reflect/SKILL.md) | a long task landed and you want the recipe captured as a skill edit. | +| [`/correct`](./skills/correct/SKILL.md) | you 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. | +| [`/teach`](./skills/teach/SKILL.md) | you 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. | +| [`/tdd`](./skills/tdd/SKILL.md) | you're fixing a bug and there's a cheap local test path. write the failing test first, then the fix. | +| [`/benchmark-checklist`](./skills/benchmark-checklist/SKILL.md) | you 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-comments`](./skills/no-comments/SKILL.md) | strip comments before review; spawns Comment Sicko, fixes accepted findings, offers encodings for claimed constraints. | +| [`/typescript-best-practices`](./skills/typescript-best-practices/SKILL.md) | you're reading or editing typescript. grounds the type-system-discipline principle in syntax. | +| [`/figure-it-out`](./skills/figure-it-out/SKILL.md) | no bundled playbook fits. designs a rigorous, auditable playbook for the task. | +| [`/show-me-your-work`](./skills/show-me-your-work/SKILL.md) | you want a reviewable decision trail. logs decisions to a tsv you can commit. | +| [`/create-verification-skill`](./skills/create-verification-skill/SKILL.md) | your 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-skill`](./skills/maintain-verification-skill/SKILL.md) | your verify skill's feature map has drifted from the app. source wave + one live pass, at most one PR of proven corrections. | +| [`/unslop`](./skills/unslop/SKILL.md) | you're cleaning up writing. removes AI tells. | +| [`/bro`](./skills/bro/SKILL.md) | you want the last message restated in plain human language, no jargon. | +| [`/technical-writing`](./skills/technical-writing/SKILL.md) | layered doc standard (Diátaxis + Google developer style + STE + Global English) for docs, RFCs, readmes, PR descriptions, commit messages. | + +
+ + + +### examples + +mostly i type [`/poteto-mode`](./skills/poteto-mode/SKILL.md) 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`](./skills/poteto-mode/SKILL.md) runs in the chat that receives it. that chat owns the playbook, the todo list, and every subagent spawn. + +pstack also ships [`subagent_type: "poteto-agent"`](./agents/poteto-agent.md) 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 `generalPurpose` skips that read and drifts. do not spawn `poteto-agent` to run the playbook itself. + +[`/poteto-mode`](./skills/poteto-mode/SKILL.md) and [`subagent_type: "poteto-agent"`](./agents/poteto-agent.md) route through the same wrapper. + +pstack also ships [Comment Sicko](./agents/comment-sicko.md), a read-only comment reviewer available as `subagent_type: "comment-sicko"`. usually invoke it through [`/no-comments`](./skills/no-comments/SKILL.md), 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 + +| principle | group | rule | +|---|---|---| +| [laziness-protocol](./skills/principle-laziness-protocol/SKILL.md) | core | Bias toward deletion and the smallest change that solves the problem. | +| [foundational-thinking](./skills/principle-foundational-thinking/SKILL.md) | core | Apply 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-principles](./skills/principle-redesign-from-first-principles/SKILL.md) | core | Redesign as if the requirement had been a foundational assumption from day one, instead of bolting it on. | +| [attack-the-premise](./skills/principle-attack-the-premise/SKILL.md) | core | Apply 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-add](./skills/principle-subtract-before-you-add/SKILL.md) | core | Remove dead weight, redundant validators, and stub references first, then build on the simpler base. | +| [minimize-reader-load](./skills/principle-minimize-reader-load/SKILL.md) | core | Count layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope. | +| [outcome-oriented-execution](./skills/principle-outcome-oriented-execution/SKILL.md) | core | Apply 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-first](./skills/principle-experience-first/SKILL.md) | core | Choose user delight over implementation convenience; ship fewer polished features over more rough ones. | +| [exhaust-the-design-space](./skills/principle-exhaust-the-design-space/SKILL.md) | core | Build 2-3 competing prototypes and compare side by side before committing. | +| [build-the-lever](./skills/principle-build-the-lever/SKILL.md) | core | Apply 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-domain](./skills/principle-model-the-domain/SKILL.md) | architecture | Encode the domain in a structure instead of scattered conditionals. | +| [boundary-discipline](./skills/principle-boundary-discipline/SKILL.md) | architecture | Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions. | +| [type-system-discipline](./skills/principle-type-system-discipline/SKILL.md) | architecture | Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, exhaust variants, derive from authoritative schemas. | +| [make-operations-idempotent](./skills/principle-make-operations-idempotent/SKILL.md) | architecture | Converge to the same end state regardless of partial prior runs. | +| [migrate-callers-then-delete-legacy-apis](./skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md) | architecture | Migrate callers and delete the old API in the same wave instead of preserving compatibility layers. | +| [separate-before-serializing-shared-state](./skills/principle-separate-before-serializing-shared-state/SKILL.md) | architecture | Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant. | +| [prove-it-works](./skills/principle-prove-it-works/SKILL.md) | verification | Apply 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-causes](./skills/principle-fix-root-causes/SKILL.md) | verification | Trace 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-units](./skills/principle-sequence-verifiable-units/SKILL.md) | verification | Apply 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-implementation](./skills/principle-test-behavior-not-implementation/SKILL.md) | verification | Apply 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-number](./skills/principle-explain-the-number/SKILL.md) | verification | Apply 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-window](./skills/principle-guard-the-context-window/SKILL.md) | delegation | Route bulk to subagents; keep summaries in the main thread, not raw payloads. | +| [never-block-on-the-human](./skills/principle-never-block-on-the-human/SKILL.md) | delegation | Proceed, present the result, let the human course-correct after the fact; reserve confirmation for irreversible actions. | +| [encode-lessons-in-structure](./skills/principle-encode-lessons-in-structure/SKILL.md) | meta | Encode 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: + +- `/deslop` and the `deslop` skill ship in the `cursor-team-kit` plugin. +- `control-cli` (for CLIs and TUIs) and `control-ui` (for browser, Electron, web) ship in `cursor-team-kit` too. +- `/create-skill` is a cursor built-in. cursor also ships a built-in `/babysit`; inside `poteto-mode`, the [babysit playbook](./skills/poteto-mode/playbooks/babysit.md) supersedes it for pr-status requests. + +install `cursor-team-kit` alongside pstack if you want the full set. + +## why are there no planning skills? + +cursor 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`](./skills/poteto-mode/SKILL.md) 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`](./skills/automate-me/SKILL.md). it mines your recent transcripts, drafts a `-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`](./skills/setup-pstack/SKILL.md). it detects the models you have access to and writes a small always-applied rule mapping each role (code, judgment, the review panels) to a model. every skill reads it and falls back to sensible defaults when the rule is absent, so you override only what you want. + +when a default changes, a rule 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](https://github.com/cursor/plugins/tree/main/pstack/automations/benny). 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 cursor at [`FOR_AGENTS.md`](https://github.com/cursor/plugins/blob/main/pstack/automations/benny/FOR_AGENTS.md). setup copies the pack into the target repository at `.cursor/automations/benny/`, enables pstack there for shared skills, and keeps user configuration outside the copied pack. benny runs on cursor automations, so it is cursor-only. + +## license + +MIT diff --git a/harness/pstack/claude-code/docs/guide/01-setup.md b/harness/pstack/claude-code/docs/guide/01-setup.md new file mode 100644 index 000000000..62420df82 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/01-setup.md @@ -0,0 +1,62 @@ +# Set up pstack + +In this page you install the plugin, pick which models pstack uses, and run your first task. Setup is one command plus a short conversation. + +## Install the plugin + +In a Cursor chat, run: + +```text +/add-plugin pstack +``` + +Cursor confirms the plugin is installed. + +## Pick your models + +Run: + +```text +/setup-pstack +``` + +[`/setup-pstack`](../../skills/setup-pstack/SKILL.md) detects the models you have access to, asks for a reasoning budget, shows you each role (code delegates, judgment, the review panels), and asks what you want. Answer the questions. It writes `~/.cursor/rules/pstack-models.mdc`, a small rule every pstack skill reads. + +The defaults run at `xhigh` reasoning, the same as the `large` budget. `unlimited` lifts each model to its highest tier, up to `max`. Opus goes to `max`. Grok tops out at `xhigh`, so it stays there. `medium` and `small` lower the reasoning and spend fewer tokens. + +You only override what you care about. A role with no line in the rule keeps the skill's default. To restore a default, delete that role's line. A rerun of `/setup-pstack` keeps any role whose model differs from the default. When a default changes, a rule written before the change still pins the old default, so delete those role lines, or delete the file, then run `/setup-pstack` again. + +You might be wondering what happens if you use Auto. Set a role to `inherit-parent` or `auto` and pstack omits the subagent `model` field, so the subagent inherits your parent chat model. Both values mean the same thing, and neither is a model slug. For a panel role the value is a list, and one subagent runs per entry, so the list length sets the panel size. Setup also configures `swarm workers`, the default model for every `/swarm` worker unless a race names a model for each arm. + +## Accept the verification offer, or don't + +At the end of setup, `/setup-pstack` looks for a way to prove app behavior in your project, either a `verify-*` skill or an existing harness. If it finds neither, it offers once to generate one with [`/create-verification-skill`](../../skills/create-verification-skill/SKILL.md). + +Say yes and it writes `.cursor/skills/verify-/`, a project-local skill that teaches agents to drive your app the way a user does. It proves the skill works once before handing it over. Say no and setup moves on. You can run `/create-verification-skill` yourself any time. [Verify and ship](./06-verify-and-ship.md#create-a-project-verification-skill) covers it in depth. + +If you're new to pstack, say yes. An agent that can check its own work keeps going until the check passes. An agent that can't hands every result back to you to check by hand. Of everything in this guide, the verification skill pays off the most. + +After setup, start a new chat. The model rule applies to new sessions. + +## Keep the cost in check + +pstack spends extra tokens on subagents and review panels. That's the price of the rigor. To spend fewer: + +- Rerun `/setup-pstack` and pick a smaller reasoning budget or cheaper models. A strong model in the main chat with cheaper, faster models in the code roles is a good split. +- Set a role to `auto` or `inherit-parent` so it runs on the chat's own model. +- Shorten a panel list. Each entry runs one subagent. +- Save `/poteto-mode` for work that needs rigor. A small, obvious edit doesn't. + +## Run your first task + +Pick something real but small, and describe it the way you'd describe it to a colleague: + +```text +/poteto-mode add a --json flag to this command. text output stays byte-identical. verify both. +``` + +Watch the todo list. Its first items are the matched playbook's steps copied in, the Feature playbook for this prompt. If `/poteto-mode` skips a step, the step stays in the list with `skip: `, so you can see what it chose not to do. + +From here you can type normal follow-ups. To keep `/poteto-mode` on for the whole chat, pick it from the `/` menu with Option+Enter (Mac) or Alt+Enter (Windows) instead of Enter. That makes it a [Custom Mode](https://cursor.com/docs/skills), which stays in context on every turn until you exit it. Custom Modes are available in the Agents Window and the CLI. Plain Enter attaches the skill to one message, and it fades as the chat moves on. + +Next: [Route work through `/poteto-mode`](./02-poteto-mode.md). diff --git a/harness/pstack/claude-code/docs/guide/02-poteto-mode.md b/harness/pstack/claude-code/docs/guide/02-poteto-mode.md new file mode 100644 index 000000000..8341604ae --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/02-poteto-mode.md @@ -0,0 +1,131 @@ +# Route work through `/poteto-mode` + +`/poteto-mode` is the front door. You give it a goal, it matches one of twenty-three playbooks, copies that playbook's steps into the todo list, and calls the other skills as the steps need them. In this page you learn what a good prompt looks like, and how little of one you actually need. + +![A dispatcher pulls a switch lever to route robots on rail handcars toward lit gates, under a /poteto-mode departure board listing BUG FIX, FEATURE, and INVESTIGATION.](./images/router.jpg) + +## What happens to your prompt + +```mermaid +flowchart TD + A[Your prompt] --> B[poteto-mode] + B --> C[Read the Principles section] + C --> D{Match the task} + D -->|Read-only question| E[Investigation] + D -->|Defect| F[Bug fix] + D -->|New behavior| G[Feature] + D -->|Structure only| H[Refactoring] + D -->|Measured slowness| I[Perf issue] + D -->|Large work or no match| J[figure-it-out] + E --> K[Verify and report] + F --> K + G --> K + H --> K + I --> K + J --> K +``` + +The diagram shows the common routes. There are also playbooks for hillclimbing a metric, diagnosing runtime symptoms and captured traces, prototypes, visual parity, authoring and evaluating skills, autonomous runs, babysitting a PR or stack to merge-ready, shipping a verified stack, running a PR queue on autopilot, orchestrating project-scale programs, session pickup, pausing safely, multi-phase plans, and worktree cleanup. The [playbook directory](../../skills/poteto-mode/playbooks/) has the full set. + +## Say the goal, not the ceremony + +You don't write a spec. You say what's wrong or what you want, plus anything you already know that saves the agent time: + +```text +/poteto-mode users get two notifications after a retry. repro first, then fix and verify. +``` + +That's a Bug fix prompt. "repro first" is a real constraint, not politeness, and the playbook honors it. Watch the todo list fill with the Bug fix steps. A skipped step stays visible with `skip: `. + +## What goes in a prompt + +A useful prompt carries up to five things, and each one fits in a sentence: + +- **The goal.** Say what's wrong, or what you want. +- **The done check.** It must be able to pass or fail. "Make it better" and "work on it for an hour" aren't checks. +- **The proof you want to see.** Ask for the real command output, a video of the flow, the stored value, or a before-and-after number. +- **What you already know.** A symptom, a repro step, a log line, or a link saves the agent a search. +- **The real constraints.** "repro first", "don't change any code yet", "zero behavior change", and "let me review before proceeding" each change what the agent does. + +Here's one prompt with all five: + +```text +/poteto-mode the csv export drops its last row since yesterday's deploy. failing job id is 4812. repro first, then fix. done means the 60k-row fixture exports every row. show me the row counts before and after. +``` + +Two things are worth leaving out: + +- **The how.** Say what to achieve, and leave the agent room to find a better path than the one you'd pick. The same goes for a list of skills, covered in the pitfall below. +- **Your theory of the cause, at first.** A stated guess narrows the search to wherever you pointed. Let the agent restate the problem before you share your hunch. + +For a noisy report, such as a long thread or a vague bug, make the restatement the first step: + +```text +/poteto-mode read this thread. restate the underlying issue in your own words, in plain english. don't change any code yet. +``` + +A misreading shows up in the restatement, before any code exists. Correct it there, and it costs you one message instead of one wrong fix. + +## Follow up short + +When the conversation already carries the context, the prompt shrinks to almost nothing. All of these are enough: + +```text +/poteto-mode do it +``` + +```text +continue +``` + +```text +keep going until done +``` + +Short works because the playbook holds the structure, and a Custom Mode keeps `/poteto-mode` in context on every turn. [Set up pstack](./01-setup.md#run-your-first-task) shows how to start one. Your words carry the intent, and the skill carries the rigor. + +## Switch tasks with "new task" + +A long chat accumulates context from the last task. When you change subjects, say so: + +```text +/poteto-mode new task. figure out why the cache entry survives logout. don't change any code yet. +``` + +"new task" tells `/poteto-mode` to re-match rather than continue the prior playbook. "don't change any code yet" pins this one to Investigation. Without those two phrases, a mode mid-Feature tends to treat your question as the next feature step. + +## Give parallel work its own machine + +If you run several agents against one repository on one computer, they will fight over the working tree, the ports, and the build output. The cleanest isolation is a [cloud subagent](https://cursor.com/docs/subagents#cloud-subagents). Each one gets its own VM and branch, so it can install dependencies, run your app, and record video of the result without touching your machine. Type `/in-cloud` before the task, or ask the parent chat to hand work to cloud subagents. + +When the work has to stay local, ask for a worktree up front: + +```text +/poteto-mode new task. branch off in a fresh worktree, then port the parser change there. +``` + +Each task in its own branch and worktree means no agent stomps another's files. Worktrees cost disk and machine resources, so a laptop runs only a handful at once. The [Opening a PR playbook](../../skills/poteto-mode/playbooks/opening-a-pr.md) already works from a worktree for code changes, so mostly you only say this when a specific base or location matters. + +Worktrees accumulate. When disk gets tight, ask: + +```text +/poteto-mode what's eating my disk? prune the worktrees that are safe to prune. +``` + +The [Worktree cleanup playbook](../../skills/poteto-mode/playbooks/worktree-cleanup.md) classifies every worktree by merge state, uncommitted work, and which chats still touch it. It deletes only what that evidence clears and pauses for your call on anything holding uncommitted work. + +## Leave it running + +When you step away, say what done means and go: + +```text +/poteto-mode im stepping away. keep going until the migration check reports zero old callers. log your decisions. +``` + +Work you'll review later routes through [`/figure-it-out`](../../skills/figure-it-out/SKILL.md), which designs the run's phases and keeps a [`/show-me-your-work`](../../skills/show-me-your-work/SKILL.md) decision log. [Run work while you sleep](./07-overnight.md) covers the full overnight contract. + +**Pitfall:** don't enumerate skills in your prompt ("use /how, then /architect, then /arena..."). The playbook already sequences them, and a hand-written sequence usually reorders or drops steps the playbook would have kept. Name a skill only when you want to override a specific choice. + +Read [`poteto-mode`](../../skills/poteto-mode/SKILL.md) itself for the full routing rules. + +Next: [Understand the code](./03-understand.md). diff --git a/harness/pstack/claude-code/docs/guide/03-understand.md b/harness/pstack/claude-code/docs/guide/03-understand.md new file mode 100644 index 000000000..e15bea052 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/03-understand.md @@ -0,0 +1,79 @@ +# Understand the code before changing it + +Editing code you don't understand is how subtle regressions ship, and that's as true for the agent as for you. Agents usually fail in one of two ways. They misread what you want, or they don't have the context to do the work right. [What goes in a prompt](./02-poteto-mode.md#what-goes-in-a-prompt) handles the first. This page handles the second. + +pstack gives you four ways in. `/how` explains what the code does now. `/why` digs up the reasons it's shaped that way. `/teach` blends both into one explanation. `/recall` rebuilds your own recent context on a topic. Each one also makes the agent explain itself in words you can check. That's how you supervise an agent that may know the code better than you do. + +![A detective studies a machine blueprint with a magnifying glass while robots fetch case files; the evidence board behind her links clues under /how and /why.](./images/understanding.jpg) + +## Start with a read-only investigation + +When the cause is unclear, ask for findings, not a fix: + +```text +/poteto-mode investigate why background jobs time out every few hours. give me what we know, what data you used, and your best hypotheses. don't change any code yet. +``` + +"don't change any code yet" routes this to the [Investigation playbook](../../skills/poteto-mode/playbooks/investigation.md). It runs `/how`, adds `/why` for questions about motivation, and returns a cited explanation. For a choice between options, it returns a recommendation with a trade-offs table. Asking "what data you used" makes the agent separate its evidence from its guesses. When the findings point at a fix, start the fix as a new task. + +## Trace behavior with `/how` + +```text +/how do we dedupe notifications? is there an n+1 when we look up subscribers? +``` + +Ask the question you actually have. [`/how`](../../skills/how/SKILL.md) reads the code and answers at the level of a senior engineer onboarding you onto the subsystem, with the runtime flow, the key types, and the non-obvious parts. For a big subsystem it fans out two to four read-only explorers first. For a narrow question it just reads and explains. + +## Dig up history with `/why` + +```text +/why was the retry limit set to five? does the reason still hold? +``` + +[`/why`](../../skills/why/SKILL.md) works like a detective on a cold case. It starts from source control, then queries whatever evidence categories your MCPs expose, such as the issue tracker, long-form docs, team chat, observability, error tracking, and analytics, all in parallel. The report cites everything, separates direct evidence from inference, and says "appears to" when the record is thin. A null result gets reported too, because "nobody wrote down why" is itself an answer. + +The two compose naturally. `do why first then how` is a perfectly good prompt when you suspect the history explains the mess. + +## Actually understand it with `/teach` + +```text +/teach me how this PR changes retries. convince me it fixes the cause and not the symptom. +``` + +[`/teach`](../../skills/teach/SKILL.md) is for when a summary isn't enough. It runs `/how` and `/why`, for a small change maybe just one of them, and weaves the findings into a plain explanation that builds up diagram by diagram. The "convince me" framing is worth stealing. It turns the explanation into an argument you can poke at instead of a tour. + +It works on the agent's own choices too: + +```text +/teach me why you implemented it this way and not with a queue. what did you trade off, and why? +``` + +Teaching helps the agent as much as you. An agent that has to explain its work must read the code and back each claim with evidence, instead of stating it confidently and moving on. + +## Rebuild your own context with `/recall` + +```text +/recall catch me up on the export work from last week +``` + +[`/recall`](../../skills/recall/SKILL.md) mines your own recent chats plus the shared record (issues, prior fixes, errors still firing) and hands back a brief on where things stand and what's next. Your old chats hold context that a fresh agent lacks, so start new work on an old topic by loading it first, then hand over the new input: + +```text +/recall my work on the virtualized list from yesterday, then read this bug report. +``` + +If you want to resume one specific chat, that's the Session pickup playbook below, not `/recall`. + +## Take over prior work with Session pickup + +When another agent (or you, last week) left a branch mid-flight: + +```text +/poteto-mode take over this branch. read the decision log, figure out what's done, and continue from there. don't redo finished work. +``` + +The [Session pickup playbook](../../skills/poteto-mode/playbooks/session-pickup.md) treats the prior trail as authoritative. It reconstructs the branch state and decisions, names the resume point, and verifies inherited claims against the original goal instead of re-deriving everything from scratch. + +**Pitfall:** don't skip this page's skills because "the agent will read the code anyway." An agent that starts editing without a traced model tends to fix the symptom at the first plausible spot. `/how` first is cheaper than the second bug. + +Next: [Design the change](./04-design.md). diff --git a/harness/pstack/claude-code/docs/guide/04-design.md b/harness/pstack/claude-code/docs/guide/04-design.md new file mode 100644 index 000000000..61d5bbb59 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/04-design.md @@ -0,0 +1,133 @@ +# Design before you write code + +One attempt at a hard design locks in the first shape the model thought of. `/architect` settles types and boundaries before implementation. `/arena` runs several attempts at the same brief and merges the best parts. `/interrogate` has other models try to break the result. When the job is coverage rather than design synthesis, `/swarm` fans out slices or races and aggregates their results. + +The two most common design mistakes are taking the agent's first design and polishing a plan that no code has tested. This page fixes both. You plan through code: prototypes answer the open questions, a README or tutorial sets the target, and the written plan comes last. + +![Three robots draft competing bridge models at their own tables under /architect, /arena, and /interrogate panels, while a judge robot with a clipboard inspects skeptically.](./images/design.jpg) + +## Settle the shape with `/architect` + +```text +/architect design the import pipeline before writing any code. i care most about how callers use it. +``` + +[`/architect`](../../skills/architect/SKILL.md) grounds itself first, running `/how` over the code the design touches and `/why` when it moves ownership or layers. Then it runs `/arena` to produce competing design sketches, with the caller's usage written first in each, followed by types, signatures, and a module map. + +By default it proceeds straight from the synthesized design into implementation. If you want to see the design first, say so: + +```text +/architect with checkpoint. stop and show me before implementing. +``` + +The design isn't sacred once code starts. If implementation shows the same workaround in unrelated places, or types that only compile with `any` or forced casts, `/architect` treats that as proof the design is wrong. It scraps the sketch and starts over instead of patching around it. + +## Fan out attempts with `/arena` + +```text +/arena take my prompt to the arena verbatim. i want to compare their proposals with yours. +``` + +[`/arena`](../../skills/arena/SKILL.md) is the general tool underneath. N subagents attempt the same design or code brief in parallel, each writing to its own worktree or directory. A read-only judge, on a different model family when your configuration allows one, scores every candidate against a rubric. The coordinator reads each candidate end to end, picks a base, grafts in the best ideas from the losers, and verifies the result. + +```mermaid +flowchart LR + A[One task] --> B[Configured panel] + B --> C[Candidate 1] + B --> D[Candidate 2] + B --> E[Candidate N] + C --> F[Cross-judge] + D --> F + E --> F + F --> G[Pick a base] + G --> H[Graft the best parts] + H --> I[Verify] +``` + +The panel comes from your [`/setup-pstack`](../../skills/setup-pstack/SKILL.md) configuration, and you can adjust it per task. Ask for more candidates when the decision matters, fewer when it doesn't: + +```text +/arena this, 5 candidates. the cache key format is expensive to change later. +``` + +## Cover slices and races with `/swarm` + +```text +/swarm check every package under packages/ against its check.sh. one worker per package. one report. +``` + +[`/swarm`](../../skills/swarm/SKILL.md) fans N workers across independent slices, coverage matrices, gauntlet lanes, exploration partitions, or declared race arms. Each worker gets its own scope and check, then reports `PASS`, `ISSUES`, or `BLOCKED`. The parent waits for the workers and returns one compact report with any gaps or dropouts. + +Reach for it when parallelism buys coverage or lets independent checks race. `/arena` gives every worker the same design or code brief, then picks a base and grafts the best parts. `/swarm` covers slices or runs a race with a selection rule declared up front. It does not use the base-selection and grafting ceremony. + +## Break it with `/interrogate` + +```text +/interrogate the whole branch, but skeptically. no nitpicks unless it's an actual bug or regression. +``` + +[`/interrogate`](../../skills/interrogate/SKILL.md) sends the same diff, intent, and rubric to reviewers on different model families. Model diversity is the point. Different models have different blind spots, so a finding two models raise independently is high-confidence signal. The lead sorts everything into `Act on`, `Consider`, `Noted`, and `Dismissed`, with a reason for each dismissal, and applies nothing automatically. + +Read the dismissals too. The lead is a pragmatic senior engineer, not an oracle, and you can override it. + +## Prototype instead of debating + +Never take the first design. Ask for a few, and pick from evidence you can see: + +```text +/poteto-mode prototype a few options for the new dropdown menu. take screenshots or videos for me to compare. +``` + +The [Prototype playbook](../../skills/poteto-mode/playbooks/prototype.md) builds throwaway sketches in a scratch directory, puts the variants behind one switcher, drives each one, and captures screenshots or timings. It also works for behavior and algorithms, not just UI. Prototypes are planning with code. They let the agent answer its own open questions by running something instead of asking you, and they leave room for an option you wouldn't have thought of. + +The same idea scales up to a real design. Pair `/architect` with prototypes and keep a review gate: + +```text +/poteto-mode we need rate limiting for external webhooks. /architect it first, and answer open questions with prototypes. let me review before proceeding. +``` + +Don't spend reviewers on an abstract plan. `/interrogate` belongs on a diff. Point adversarial review at a plan with no code behind it and the reviewers invent theoretical risks and edge cases that will never happen. Let prototypes settle the questions, then review what got built. + +## Write the README first for shared code + +For a package or API that other code will use, start with the doc a user would read: + +```text +/poteto-mode write a tutorial for how i would use the new config package first. then /teach me why it beats the current one. +``` + +Writing the tutorial first forces the caller's view. You describe the API to a hypothetical user and work back to the implementation. The doc also becomes a concrete target the agent checks its own work against. Name [`/technical-writing`](../../skills/technical-writing/SKILL.md) when the doc itself matters, so a tutorial stays a tutorial instead of drifting into reference and explanation at once. + +## Plan after the design settles + +pstack has no planning skill, on purpose. When you do want a written plan, ask for it once the design is settled: + +```text +/poteto-mode turn this design into a plan. small verifiable PRs, each with its own verification steps. +``` + +The [Multi-phase plan playbook](../../skills/poteto-mode/playbooks/multi-phase-plan.md) settles any remaining open questions by prototype, then writes one section per PR, each ending in proof that the change works. A passing test suite alone doesn't count as that proof. The plan is the deliverable. The playbook doesn't implement it, and it names which execution playbook should run it next. + +For a migration, state the bar in the prompt: + +```text +/poteto-mode plan the migration of our ui library to the new styling system. small verifiable PRs, each with visual regression checks. the result must match the original exactly, bugs included. +``` + +"bugs included" keeps the migration from quietly fixing things on the way, which would make the old and new output impossible to compare. For a project that spans many days, you can commit the plan to the repo for a while so other agents see the work in progress. Delete it when the work lands. + +## How much design work does a task deserve? + +You might be wondering whether every change needs this. No. Most changes need none of it. A rough ladder: + +- A small, finished change you're unsure about needs `/interrogate` alone. +- A change that crosses function boundaries or moves ownership earns `/architect`, which brings `/arena` with it. +- A standalone decision where independent attempts would help, like naming, formats, or an algorithm, is `/arena` directly. +- A coverage matrix, set of parallel checks, or race with declared arms is `/swarm`. +- An open question you could answer by running something, like a layout, a timing, or an approach, gets a prototype, not a debate. +- A contested design that's expensive to reverse gets `/architect`, then `/interrogate` before shipping. +- Work that spans several PRs gets a plan, written after the design settles. + +`/poteto-mode` already applies this ladder. Boundary-crossing work triggers `/architect` on its own, so you reach for these directly mainly when you want more or less scrutiny than the default. + +Next: [Build and clean the change](./05-build-and-clean.md). diff --git a/harness/pstack/claude-code/docs/guide/05-build-and-clean.md b/harness/pstack/claude-code/docs/guide/05-build-and-clean.md new file mode 100644 index 000000000..fc48a46df --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/05-build-and-clean.md @@ -0,0 +1,83 @@ +# Build the change and clean the diff + +The build playbooks share one discipline. Say what you observed, let the playbook demand the evidence. This page shows what to put in the prompt for each common build task, then the cleanup habit that keeps diffs reviewable. + +## Prompt each build playbook with what you know + +A bug prompt states the symptom and asks for a reproduction first: + +```text +/poteto-mode this command emits two records after a retry. repro first, then fix and verify. +``` + +A feature prompt states the behavior and what must not change: + +```text +/poteto-mode add a --json flag. text output stays byte-identical. verify both forms. +``` + +A refactoring prompt pins behavior before structure moves: + +```text +/poteto-mode move parsing into one module, zero behavior change. record the current output first and prove it's unchanged after. +``` + +A perf prompt states the measurement, not a vibe: + +```text +/poteto-mode startup takes 1.8s on this fixture. trace it, fix the measured cause, show me before and after. +``` + +Each of these routes to its playbook ([Bug fix](../../skills/poteto-mode/playbooks/bug-fix.md), [Feature](../../skills/poteto-mode/playbooks/feature.md), [Refactoring](../../skills/poteto-mode/playbooks/refactoring.md), [Perf issue](../../skills/poteto-mode/playbooks/perf-issue.md)), and the playbook supplies the steps you didn't type: reproduce before fixing, name the data shape before implementing, pin behavior before restructuring, profile before optimizing. + +For sustained improvement of one number, there's the [Hillclimb playbook](../../skills/poteto-mode/playbooks/hillclimb.md). Give it the metric, a target, and a floor on attempts, and it loops one hypothesis at a time with a frozen measurement harness. It keeps wins and reverts everything else. + +Both perf playbooks run [`/benchmark-checklist`](../../skills/benchmark-checklist/SKILL.md) on their numbers. Perf issue vets its baseline and every number after it, and Hillclimb vets its harness before freezing it. [Verify and ship](./06-verify-and-ship.md#vet-a-measured-number-with-benchmark-checklist) shows when to type it yourself. + +Sometimes you want the cause before any fix. For a live symptom, such as a leak, an idle CPU spin, or a visual glitch, the [Runtime forensics playbook](../../skills/poteto-mode/playbooks/runtime-forensics.md) instruments the running process. For a profile you already captured, the [Trace forensics playbook](../../skills/poteto-mode/playbooks/trace-forensics.md) reads the artifact and maps the hot frame to source. Both return a diagnosis, not a fix: + +```text +/poteto-mode here's a cpuprofile from the slow startup. tell me where the time goes and which source lines own it. no fix yet. +``` + +## Write the failing test first with `/tdd` + +When a bug has a cheap local test path, the whole prompt can be two words: + +```text +/tdd implement +``` + +In context, that's enough. [`/tdd`](../../skills/tdd/SKILL.md) writes the smallest test that fails for the intended reason, then the fix, then reruns the test. If a test would need broad harness setup or brittle mocks, the skill says so and uses the closest executable check instead. Don't force a test where a real command is stronger evidence. + +## Load the TypeScript rules by name + +[`typescript-best-practices`](../../skills/typescript-best-practices/SKILL.md) turns the type-system principles into concrete rules: discriminated unions, `unknown` at boundaries, exhaustive variants, schema-derived types. It doesn't load on its own, so type `/typescript-best-practices` when a task touches `.ts` or `.tsx` files. + +## Clean before you commit + +The [Opening a PR playbook](../../skills/poteto-mode/playbooks/opening-a-pr.md) runs `/deslop` on the diff before each commit and applies [`/unslop`](../../skills/unslop/SKILL.md) to the PR description and commit bodies. `/deslop` ships in the `cursor-team-kit` plugin, not in pstack. If you don't have it, ask for the same outcome in plain words: remove narrating comments, unsupported guards, dead compatibility paths, and unrelated edits. + +For prose, `/unslop` takes a target and any extra rules you have: + +```text +/unslop the readme changes, no emdashes +``` + +You'll develop your own shorthand. The skill reads intent fine from terse prompts like `unslop that, tighten it`. + +## Strip the comments with `/no-comments` + +Comments need their own pass, and not from the agent that wrote them. An author defends its comments the way you'd defend yours. So before review, hand them to fresh eyes: + +```text +/no-comments the diff +``` + +[`/no-comments`](../../skills/no-comments/SKILL.md) spawns [Comment Sicko](../../agents/comment-sicko.md), a read-only reviewer with a short keep list: license headers, doc comments on a public API, links that explain what code can't, behavior forced by an external dependency you can't reshape. Everything else goes. A surprise in your own code gets no such pass. The comment comes back as a refactor flag, and `/no-comments` fixes the flags it accepts at the root cause. When a comment claims a constraint, "do not remove", the skill offers to encode the claim as a type, test, or lint. Either way, the comment comes out. + +The division of labor is worth keeping straight. `/deslop` cleans slop out of the code, `/unslop` cleans it out of prose, and `/no-comments` hands the comments to a reviewer who didn't write them. + +**Pitfall:** cleanup is not optional polish. A diff with narrating comments and defensive dead weight reads as unfinished to reviewers, and the extra code is where the next bug hides. If the diff feels padded, say `deslop it` before you commit, not after review calls it out. + +Next: [Verify and ship](./06-verify-and-ship.md). diff --git a/harness/pstack/claude-code/docs/guide/06-verify-and-ship.md b/harness/pstack/claude-code/docs/guide/06-verify-and-ship.md new file mode 100644 index 000000000..007ea2cab --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/06-verify-and-ship.md @@ -0,0 +1,130 @@ +# Verify the result and open a PR + +"It compiles" is not evidence. The [Prove It Works principle](../../skills/principle-prove-it-works/SKILL.md) makes the agent check the real artifact before it reports success, and your job is to make "the real artifact" checkable. This page covers stating a finish condition, vetting a measured number, generating a verification skill for your app, opening the PR, and driving it to merged. + +Verification is the slowest step in most agent work, because it's the step that usually waits on a human. Make the agent able to do it, and you stop being the bottleneck. Skip it, and running more agents only gets you more unchecked work to review. + +![A prototype plane flies a real test course while she times it with a stopwatch and robots film and checklist the run; the terminal reads verify: pass, evidence: captured.](./images/verification.jpg) + +## State the finish condition up front + +Put what done means in the first prompt, in whatever words fit: + +```text +/poteto-mode add json output to this command. text output stays byte-identical, the json parses, both run against the sample project. show me the evidence. +``` + +Now the agent has three checks it can run, not a mood to satisfy. When the reply comes back, it should carry the exact commands and outputs. If a check couldn't run, a good reply says "inconclusive", and you should treat a confident reply without evidence as a red flag. + +Match the check to the change: + +- A CLI change runs the real command. +- A UI change walks the changed flow in the running app. When it must match a reference pixel for pixel, the [Visual parity playbook](../../skills/poteto-mode/playbooks/visual-parity.md) diffs screenshots against a frozen baseline instead of judging by eye. +- A parser or migration replays a saved input. +- A perf change compares before and after profiles. +- A storage change reads back the written value. + +Ask for the proof as an artifact you can inspect yourself: the failing test and then the passing one, a before-and-after video, the trace, the screenshot. If the fix already merged, ask for the same check again on main. An artifact beats a plausible explanation, because you can challenge it without replaying the whole run. + +For a small diff you don't fully trust, [`/blast-radius`](../../skills/blast-radius/SKILL.md) finds what it could break elsewhere. It picks the one fact the change is safe because of and proves it by running code instead of writing an essay about it. + +## Vet a measured number with `/benchmark-checklist` + +A before-and-after number is the easiest evidence to get wrong by accident. A warm cache, a debug build on one side, or work that never ran inside the timed region can each produce a convincing speedup. Before you report or act on a number, type: + +```text +/benchmark-checklist vet the export speedup before it goes in the pr +``` + +[`/benchmark-checklist`](../../skills/benchmark-checklist/SKILL.md) asks seven questions and wants evidence from a run for each: + +1. What limits the number, and why isn't it double? +2. Did every side run tuned the way production runs? +3. Does the result break a physical limit, like disk bandwidth or core count? +4. Did anything error or return wrong output? +5. Does it reproduce over alternating runs, with a median and a range? +6. Does it matter end to end, on the path a user waits on? +7. Did the work actually happen inside the timed region? + +The verdict comes back as faster, slower, no measurable difference, or inconclusive, with the run count, range, and limiter. It says inconclusive when it can't name the limiter or a side ran untuned. `/poteto-mode` already runs the checklist inside the Perf issue and Hillclimb playbooks, so you type it yourself when you measured something outside them, or when someone else's number looks too good. It's the working form of the [Explain the Number principle](../../skills/principle-explain-the-number/SKILL.md). + +## Create a project verification skill + +The UI bullet above hides a real requirement. The agent needs a scripted way to drive your app. If your project has one, great. If not, run: + +```text +/create-verification-skill +``` + +[`/create-verification-skill`](../../skills/create-verification-skill/SKILL.md) interviews the repository, not you. It works out what a user touches, how the app launches locally, what can drive it (an existing harness first, otherwise browser and CDP, a PTY, or plain HTTP), what evidence proves behavior, and whether two instances can run side by side. It asks you only what the code can't answer. + +It writes `.cursor/skills/verify-/`, agent-facing instructions with exact Launch, Doctor, Drive, Evidence, and Cleanup sections, plus a feature map under `features/` that indexes what the app does and what result proves each feature works. The skill ships a [worked feature-map example](../../skills/create-verification-skill/references/feature-map-example/) with a README index and one file per feature using the four required H2s. Before handing it over, the generator proves the skill once end to end: launch, doctor check, drive one feature, capture evidence, clean up. If that proof fails, don't use the output. + +From then on, "verify it in the app" is a step any agent can execute, in this repo, with no setup conversation. Name it in the prompt when you want the proof in a specific form: + +```text +/poteto-mode build the bulk-archive action. use /verify- to verify your changes and show me a video and screenshots as proof. +``` + +```text +/poteto-mode repro this with /verify-. if it repros on main, fix it and show me a video as proof. +``` + +Once the verify skill works, a [`/swarm`](../../skills/swarm/SKILL.md) can split a full pass by feature-map entry and aggregate the results. A swarm of verifiers also confirms a perf win over a big enough sample, or fuzzes the app for regressions before a PR ships. + +Treat the verification skill as infrastructure, not a one-off. Commit it, so every person and every agent on the team drives the app the same way. Then [build the lever](../../skills/principle-build-the-lever/SKILL.md). When agents keep writing throwaway scripts to click through the app, ask for a small control CLI that the skill calls instead. Agents spend fewer tokens, and every run becomes repeatable. A CLI that agents use well has these traits: + +- A few composable commands, each doing real work, rather than many thin ones. +- A `--dry-run` option on anything destructive. +- Subcommands that reveal features gradually instead of all at once. +- Error messages that say what to do instead. +- Rich `--help` text. +- Machine-readable output, such as JSON. + +While you're there, make the dev setup repeatable too: seeded data, test users, and one command that brings the environment up the same way every time. + +## Keep the verification skill honest + +Apps change and feature maps rot. Run this at least once a day, ideally from a scheduled automation so nobody has to remember: + +```text +/maintain-verification-skill +``` + +[`/maintain-verification-skill`](../../skills/maintain-verification-skill/SKILL.md) audits the generated skill: one read-only source reader per feature in parallel, then one live pass that drives every mapped feature. It ends in exactly one of three outcomes. `clean` means full coverage and nothing to ship. `changed` means one PR of proven corrections, confined to the verification skill's own directory. `blocked` names the blocker. It never edits product code. If the live pass catches a product regression, it reports the regression instead of papering over it in docs. + +## Open the PR + +```text +/poteto-mode open the pr. small ordered commits, evidence in the description. +``` + +The [Opening a PR playbook](../../skills/poteto-mode/playbooks/opening-a-pr.md) works from a worktree, rebases the work into small ordered commits, cleans the diff, unslops the prose, and returns the PR link. Five narrow PRs beat one fat one, and stacked follow-ups beat a growing branch. + +## Drive the PR to merge-ready with Babysit + +An open PR starts collecting blockers immediately. Checks fail, reviewers comment, trunk moves. Hand that churn to the [Babysit playbook](../../skills/poteto-mode/playbooks/babysit.md): + +```text +/poteto-mode babysit this pr. get it green. +``` + +Babysit watches the PR with a bundled watcher and takes blockers in order: conflicts, then review threads, then CI. Every known fix batches into one push, so the checks restart once instead of after every fix. The comment triage is skeptical, because humans and bots file real catches and noise in the same list. A real finding gets a fix, and noise gets dismissed with the disproof posted on the thread. When all you want is status, ask smaller and Babysit answers without starting the loop: + +```text +/poteto-mode check on pr 123. anything outstanding? +``` + +Babysit stops at merge-ready. It never merges, even with everything green, because merging is a different decision. + +## Land the stack with Shipping + +Green is not the same as safe. When you're ready to land, say so: + +```text +/poteto-mode land the stack. +``` + +The [Shipping playbook](../../skills/poteto-mode/playbooks/shipping.md) verifies each PR independently before it arms anything. One fresh agent per PR proves the behavior live, and the agent that judges a change is never the one that wrote it. Then Shipping lands only the contiguous verified run from the bottom, one PR at a time through GitHub by default or Origin when its CLI is available, and reports the first PR that breaks the chain. A verified PR sitting above an unverified one waits, because merging it would pull the gap in underneath. + +Next: [Run work while you sleep](./07-overnight.md). diff --git a/harness/pstack/claude-code/docs/guide/07-overnight.md b/harness/pstack/claude-code/docs/guide/07-overnight.md new file mode 100644 index 000000000..623cff349 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/07-overnight.md @@ -0,0 +1,120 @@ +# Run work while you sleep + +This is the payoff for everything before it. An agent you can trust to verify its own work is an agent you can leave alone with a hard task. What makes that safe isn't hope. It's a checkable finish condition, an isolated worktree or cloud agent, and a decision log you audit in the morning. + +![She waves goodnight from the door while robots keep the factory running, one updating a DECISION LOG wall board under a BUILD LOOP ACTIVE sign.](./images/overnight.jpg) + +## Earn the trust before the loop + +A loop you don't trust just produces unchecked work faster, and the mess compounds with every iteration. Before you leave one running, check that it has earned it: + +- You've done the task once by hand, or watched an agent do it, so you know what good looks like. +- The agent has the tools and signals you'd use yourself: the verification skill, the profiler, the logs. +- Every stage proves its work and can stop the line when the work misses the bar. +- You've read a few transcripts and turned the repeated failures into tools, skills, or checks. + +Make the loop autonomous only after all four hold. Until then, run it while you watch. + +## The overnight contract + +A good handoff has the goal, the finish condition, permissions, and an escape hatch. It doesn't need to be long: + +```text +/poteto-mode im going to bed. migrate every caller to the new parser in a fresh worktree off . +done means zero old callers, all parser fixtures pass, old api deleted. +keep a decision log. don't ask me before committing. +/loop until done. if you're truly stuck after a few hours, stop and write up why. +``` + +Walk through what each line buys you: + +- "im going to bed" is a session override. The agent stops asking and keeps going. +- "done means..." turns the goal into checks every iteration can run. +- "fresh worktree off ``" keeps the run from colliding with anything else you have open. +- "don't ask me before committing" pre-answers the permission the agent would otherwise block on. +- `/loop` is Cursor's built-in wake mechanism, not a pstack skill. The [Autonomous run playbook](../../skills/poteto-mode/playbooks/autonomous-run.md) uses it to re-check the finish condition on events or a heartbeat. +- The escape hatch lets it stop at a genuine dead end and write up why, which beats eight hours of creative goal reinterpretation. + +Because you'll review this work after stepping away, `/poteto-mode` routes it through [`/figure-it-out`](../../skills/figure-it-out/SKILL.md), which designs the run's phases before any code and wires in the decision log. + +To stop a run on purpose, tell the agent to pause, or that you're about to go offline or restart Cursor. The [Pause safely playbook](../../skills/poteto-mode/playbooks/pause-safely.md) finishes or backs out of the current step, commits a work-in-progress checkpoint, and writes a resume note. A fresh chat picks the work up from that note through the Session pickup playbook. Saying "keep going" never triggers a pause. + +## What the loop does all night + +```mermaid +flowchart TD + A[Check the finish condition] --> B[Make the smallest justified change] + B --> C[Verify against the real artifact] + C --> D{Progress?} + D -->|Yes| E[Commit] + D -->|No| F[Discard] + E --> G[Log one decision row] + F --> G + G --> A +``` + +One change, one check, one log row, every iteration. Changes that didn't help get discarded, not left to ride. A plateau means pivot, not stop, and the finish condition never quietly relaxes to declare victory. + +## The morning audit + +[`/show-me-your-work`](../../skills/show-me-your-work/SKILL.md) is what makes the run reviewable. Each row records the time, phase, decision, reason, an evidence pointer, and the result, in a TSV at `decisions.tsv` (or `.audit/.tsv` when several runs share a directory). It stays local by default. Commit it when the work is ambitious enough that a reviewer needs the trail to trust the result. + +When you're back, ask for the run in review form: + +```text +/show-me-your-work catch me up on what you did last night +``` + +Before the skill hands back its summary, it spawns a reviewer on a different model family to read the trail and the transcript, and the reply ends with an Attention section listing what deserves your scrutiny. Read that section first, then the log rows it points at. You're auditing decisions, not re-reading the whole night. + +## When the night holds a queue, not a task + +The contract above drives one task to one finish condition. Some nights hold more, a queue of independent changes or a whole program. Three playbooks scale the same trust up. + +[Autopilot-full](../../skills/poteto-mode/playbooks/autopilot-full.md) runs a queue of independent PRs to merged. Each PR gets one owner agent that carries it from build through merge, and no owner merges on its own verdict. A swarm of fresh verifiers starts a round at the owner's code-ready head and again at every later push that changes the patch. Only a clean verdict on the patch that merges authorizes the merge: + +```text +/poteto-mode full autopilot on this queue. each item is independent. i want them merged by morning. +``` + +[Autopilot-stack](../../skills/poteto-mode/playbooks/autopilot-stack.md) runs the same owner loop but ships nothing. You wake up to one linear base-branch stack with a verifier's verdict on every link, and you review and land it yourself. Pick it over Autopilot-full when the changes are coupled, or when you want your own eyes on the work before anything merges: + +```text +/poteto-mode autopilot these five changes but stack them, don't ship. i'll land the stack in the morning. +``` + +[Orchestrate](../../skills/poteto-mode/playbooks/orchestrate.md) is for a program that outlives any single agent: multi-day, many stacked PRs, fleets of subagents under one standing coordinator chat. The coordinator authors briefs, collects what its subagents finish, keeps the lowest unmerged PR green, and never writes code itself. It's deliberately heavy machinery. If one agent could finish the work in a session, the playbook itself routes you back to the overnight contract above: + +```text +/poteto-mode orchestrate the store migration. own it until every package is converted and merged. i'll check in twice a day. +``` + +## Run many projects in parallel + +A [Cursor Project](https://cursor.com/blog/projects) gives one coordinator agent a persistent thread. The coordinator doesn't write code. It directs subagents, which run in the cloud by default, so the work continues when your laptop is closed. That's the shape the Orchestrate playbook expects. Start your prompts to the coordinator with `/poteto-mode`, and the subagents it spawns follow the playbooks. + +A few habits help: + +- Give each body of work its own Project, such as a feature, a migration, a perf push, or a tech-debt cleanup. Several can run side by side. +- Drag related chats into the Project, finished ones included. They become context for every agent in it. +- Give each PR a verification swarm before it merges, and let Autopilot-stack or Autopilot-full carry the queue. +- Ask the coordinator for a plan backed by data, and have it answer open questions with prototypes before it asks you. + +One prompt can carry a whole Project, from research through execution: + +```text +/poteto-mode refactor this repo so its architecture is more agent friendly. use /correct and /architect on past commits and review comments to find the mistakes agents make most here. use /recall for context from past chats. answer open questions with prototypes instead of asking me. come back with a plan backed by real data. once i approve it, run it with autopilot-stack or autopilot-full, and ask me which. +``` + +## Let loops start themselves + +Every loop above still waits for you to start it. A scheduled or event-driven automation removes that step. Software maintenance splits into stages that suit this well: triage a report, reproduce it, fix it, verify the fix. Two rules keep such a line trustworthy: + +- Every stage can stop the line. Triage can decide the report is expected behavior, repro can fail to reproduce it, and the fixer can judge the change too risky. Each of those outcomes is useful, because it keeps bad work from reaching the next stage, where it costs more to undo. +- Every stage hands over evidence. Repro attaches screenshots and video of the broken state, and the fix attaches before-and-after proof. A human can then check that the agent fixed the right thing before reading a line of code. + +pstack ships this as a dormant [automation pack](https://github.com/cursor/plugins/blob/main/pstack/automations/benny/README.md) for Slack issue reports. One automation triages each report. The other reproduces confirmed bugs and may prepare a small draft fix. Point an agent at its [`FOR_AGENTS.md`](https://github.com/cursor/plugins/blob/main/pstack/automations/benny/FOR_AGENTS.md) and name the target repository to set it up. + +**Pitfall:** a duration is not a finish condition. "work on this for 4 hours" gives the agent nothing to check, and you'll wake up to four hours of motion instead of a result. Give `/loop` a predicate that can pass or fail. + +Next: [Steer with principle names](./08-principles.md). diff --git a/harness/pstack/claude-code/docs/guide/08-principles.md b/harness/pstack/claude-code/docs/guide/08-principles.md new file mode 100644 index 000000000..5b17980e7 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/08-principles.md @@ -0,0 +1,72 @@ +# Steer with principle names + +pstack ships 24 principles as individual skills. `/poteto-mode` reads their index at the start of every multi-step task, applies the ones the task triggers, and names each applied principle in its reply along with the decision it changed. + +You don't invoke principles. You use their names to steer. Each name points at a complete rule the agent has already read, so one phrase redirects the work more precisely than a paragraph of instructions. + +## Steering in practice + +Say the agent is about to bolt a new adapter onto three existing ones: + +```text +use subtract before you add. delete the obsolete adapters first, then design what's left. +``` + +Say it claims success because the build passed: + +```text +apply prove it works. run the real import flow and show me the written records. +``` + +Say two parallel attempts are about to write to the same branch: + +```text +separate before serializing shared state. give each attempt its own worktree, no locks. +``` + +Each phrase lands because the rule behind it is specific. The agent still has to say, in its reply, which decision the rule changed. A principle citation with no decision behind it is the tell that it name-dropped instead of applying. + +## The 24, briefly + +The core principles decide how much to build and when to rethink the design: + +- [Laziness Protocol](../../skills/principle-laziness-protocol/SKILL.md) prefers deletion and the smallest change that solves the problem. +- [Foundational Thinking](../../skills/principle-foundational-thinking/SKILL.md) chooses the core data structures before writing logic. +- [Redesign from First Principles](../../skills/principle-redesign-from-first-principles/SKILL.md) integrates a new requirement as if it had been there from day one. +- [Attack the Premise](../../skills/principle-attack-the-premise/SKILL.md) writes down the premise that two or more failed fixes shared and tests it directly before the next fix. +- [Subtract Before You Add](../../skills/principle-subtract-before-you-add/SKILL.md) removes dead weight before building on top of it. +- [Minimize Reader Load](../../skills/principle-minimize-reader-load/SKILL.md) collapses layers and hidden state a reader must hold in their head. +- [Outcome-Oriented Execution](../../skills/principle-outcome-oriented-execution/SKILL.md) converges rewrites on the target design instead of preserving throwaway compatibility states. +- [Experience First](../../skills/principle-experience-first/SKILL.md) chooses the user's result over implementation convenience. +- [Exhaust the Design Space](../../skills/principle-exhaust-the-design-space/SKILL.md) builds two or three competing prototypes when there's no precedent. +- [Build the Lever](../../skills/principle-build-the-lever/SKILL.md) builds the script that does or proves the work, so a reviewer can rerun it. When an agent keeps doing the same thing by hand, have it write the tool or skill it wishes it had. If a script can do a step the same way every time, use the script, and save agents for the judgment calls. + +The architecture principles decide where state, validation, and compatibility live: + +- [Model the Domain](../../skills/principle-model-the-domain/SKILL.md) encodes repeated rules in one structure, not scattered conditionals. +- [Boundary Discipline](../../skills/principle-boundary-discipline/SKILL.md) validates at the boundary and trusts internal types. +- [Type System Discipline](../../skills/principle-type-system-discipline/SKILL.md) makes illegal states unrepresentable. +- [Make Operations Idempotent](../../skills/principle-make-operations-idempotent/SKILL.md) converges retries on the same end state. +- [Migrate Callers Then Delete Legacy APIs](../../skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md) migrates and deletes in one wave. +- [Separate Before Serializing Shared State](../../skills/principle-separate-before-serializing-shared-state/SKILL.md) removes the sharing before adding coordination. + +The verification principles define what counts as proof: + +- [Prove It Works](../../skills/principle-prove-it-works/SKILL.md) verifies the real artifact, not a proxy. +- [Fix Root Causes](../../skills/principle-fix-root-causes/SKILL.md) reproduces and traces to the cause before changing code. +- [Sequence Work into Verifiable Units](../../skills/principle-sequence-verifiable-units/SKILL.md) ends each small unit in a check before starting the next. +- [Test Behavior, Not Implementation](../../skills/principle-test-behavior-not-implementation/SKILL.md) asserts what the code's users can observe, so a test fails when that behavior breaks and survives a change to the internals. +- [Explain the Number](../../skills/principle-explain-the-number/SKILL.md) names what limits a measured number and rules out that it measured something else, before anyone trusts or reports it. [`/benchmark-checklist`](../../skills/benchmark-checklist/SKILL.md) turns it into seven questions you answer from real runs. + +The delegation principles keep parallel work sane: + +- [Guard the Context Window](../../skills/principle-guard-the-context-window/SKILL.md) routes bulk reading to subagents and keeps findings in the main chat. +- [Never Block on the Human](../../skills/principle-never-block-on-the-human/SKILL.md) proceeds on reversible work and presents the result. + +And one meta principle: + +- [Encode Lessons in Structure](../../skills/principle-encode-lessons-in-structure/SKILL.md) turns advice you've repeated twice into a lint, check, or script. [`/correct`](../../skills/correct/SKILL.md) applies it to a whole repo, as shown in [Make it yours](./09-make-it-yours.md#fix-the-environment-with-correct). + +Don't memorize the list. Skim it now, then come back when you catch the agent doing something a name here would have prevented. That's how the vocabulary sticks. + +Next: [Make it yours](./09-make-it-yours.md). diff --git a/harness/pstack/claude-code/docs/guide/09-make-it-yours.md b/harness/pstack/claude-code/docs/guide/09-make-it-yours.md new file mode 100644 index 000000000..321caaf91 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/09-make-it-yours.md @@ -0,0 +1,100 @@ +# Make it yours + +poteto-mode is one person's style. The machinery underneath, playbooks, routing, model roles, works just as well wearing yours. This page covers generating a personal mode, capturing lessons from a session, fixing the repo so agents stop repeating mistakes, authoring a focused skill, and testing a skill change before you trust it. + +Start smaller than you think. You don't need many skills on day one, or even this whole plugin. Prompt plainly, watch where agents fail, and add a skill or a check when the same failure shows up twice. + +## Generate your own mode with `/automate-me` + +```text +/automate-me +``` + +You don't describe your style, because [`/automate-me`](../../skills/automate-me/SKILL.md) reads it out of your history. It mines your recent transcripts in the active workspace for repeated preferences, in how you like replies, delegation, verification, code, prose, and process, then asks you which patterns are really you. It drafts `.cursor/skills/-mode/SKILL.md` through Cursor's built-in `create-skill` flow, runs the draft through [`/unslop`](../../skills/unslop/SKILL.md), and opens a PR from a worktree so you review it like any other change. + +Run it again whenever your habits drift: + +```text +/automate-me update my mode skill with everything since its last edit +``` + +Update mode mines only the history since the skill last changed. It keeps rules you haven't contradicted, revises the ones with new evidence, and adds sections only for genuinely new patterns. + +## Capture a session's lessons with `/reflect` + +Right after a task that taught you something, run: + +```text +/reflect that took way too long. capture what we learned so the next run doesn't repeat it. +``` + +[`/reflect`](../../skills/reflect/SKILL.md) sends the transcript to three parallel reviewers, then a synthesizer sorts the proposals into `Accepted`, `Rejected`, and `Backlog` and waits for your approval before any skill changes. Approve a proposal only if it would change a future decision. One weird session is an anecdote, not a rule. + +## Fix the environment with `/correct` + +When you correct agents for the same mistake again and again, the fix belongs in the repo, not in your next prompt. Rank the options by how well they hold: + +1. Make the mistake impossible with architecture or a better data structure. +2. Block it with types, or with a lint or CI check whose error names the fix. +3. Catch it with a test. +4. Write it down as a doc or agent rule. Nothing fails when an agent skips a rule, so this comes last. + +Human review isn't on the list. A reviewer who must catch the same mistake on every PR is the problem this fixes. [`/correct`](../../skills/correct/SKILL.md) does the work: + +```text +/correct agents keep calling the database client directly instead of going through the repository layer +``` + +It reads recent commits, reverts, review comments, and comments that explain workarounds, then groups the mistakes into classes. A class counts once it has happened twice. It fixes the most frequent classes one commit each, at the highest level that works, and proves each new check fails on a real past mistake. It also keeps a table in the agent instruction file that pairs each rule with what enforces it, so a rule that nothing enforces shows up as a repeat. The reply lists each class with its evidence, the level chosen, and why a higher level didn't work. + +Run it with no argument and it finds the classes from history on its own. `/reflect` and `/correct` split the work. `/reflect` improves skills from one session. `/correct` changes the repo so a mistake class can't come back. Pair it with `/architect` when the fix is a new boundary. [Run many projects in parallel](./07-overnight.md#run-many-projects-in-parallel) has a prompt that does both across a whole repo. + +## Author a focused skill + +When you already know the workflow you want to capture: + +```text +/poteto-mode write a skill for verifying database migrations in this repo +``` + +Writing a skill matches the [Authoring or modifying a skill playbook](../../skills/poteto-mode/playbooks/authoring-a-skill.md), which routes through Cursor's built-in `create-skill`, validates the frontmatter and links, and ships the result through the Opening a PR playbook. Agent-facing prose has a higher bar than human prose, because an unhelpful sentence becomes an instruction some future agent follows. Let the playbook hold that bar rather than writing a `SKILL.md` freehand. + +One special case has its own generator. A skill that must drive your app and prove behavior is a verification skill, so use [`/create-verification-skill`](../../skills/create-verification-skill/SKILL.md) and [`/maintain-verification-skill`](../../skills/maintain-verification-skill/SKILL.md) instead. [Verify and ship](./06-verify-and-ship.md#create-a-project-verification-skill) covers both. + +## Write docs to a standard with `/technical-writing` + +Skills aren't the only prose you ship. For docs, RFCs, readmes, PR descriptions, and commit messages: + +```text +/technical-writing review the readme changes +``` + +[`/technical-writing`](../../skills/technical-writing/SKILL.md) applies a layered standard with one goal, prose a tired engineer understands on the first read. It picks the document's mode first (tutorial, how-to, reference, or explanation), then works sentence by sentence: who does what, one thought per sentence, nothing readable two ways. Use it to review what you or an agent just wrote, or name it up front when you ask for a doc. + +## Test a skill change blind + +A skill edit affects every future session, so test it like the experiment it is. The same goes for adopting someone else's skill. Check that it makes the agent better on your work before you keep it. + +```text +/poteto-mode run the eval playbook on this skill change. same task for both variants, candidates stay blind. +``` + +When a skill keeps missing and you know what it should do, change and test it in one task: + +```text +/poteto-mode update the review skill so it flags missing migrations, and eval the change. +``` + +Asking for the eval up front keeps the edit honest. A fix written from one bad session tends to overfit that session, and over many edits the skill drifts. The eval catches the drift before it ships. + +The [Eval playbook](../../skills/poteto-mode/playbooks/eval.md) is built around one failure mode, the observer effect. An agent that knows it's being evaluated behaves differently. So candidate agents get an organic-looking task in sanitized directories, never the words "eval" or "candidate", and never each other's existence. One judge scores all outputs under neutral labels, and chain-following gets graded from which files each candidate actually read, not from what it claims. + +Read every output yourself before accepting the verdict. If you disagree with the judge, suspect the rubric before you suspect your judgment. + +## Build a bot UI with `/make-bot-ui` + +One situational skill is for Grok Bot users. [`/make-bot-ui`](../../skills/make-bot-ui/SKILL.md) builds a small page whose buttons wake a bot over a webhook routine. For example, you could swipe through a review queue and have each swipe ask the bot to act on that item. A server on your machine holds the webhook's sender key, so the key never reaches the browser or the chat. The skill also covers exposing the page on Tailscale. + +**Pitfall:** don't edit a skill mid-task because it's misbehaving. Fix it in its own PR and keep the task moving. A skill edit that ships tangled into feature work is invisible to review and impossible to evaluate. + +Next: [Recipes and pitfalls](./10-recipes-and-pitfalls.md). diff --git a/harness/pstack/claude-code/docs/guide/10-recipes-and-pitfalls.md b/harness/pstack/claude-code/docs/guide/10-recipes-and-pitfalls.md new file mode 100644 index 000000000..68751e7c0 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/10-recipes-and-pitfalls.md @@ -0,0 +1,156 @@ +# Recipes and pitfalls + +Prompts worth copying, then the mistakes everyone makes once. Swap in your own paths and finish conditions. The recipes are deliberately informal. That's how they get typed in practice, and the skills read intent fine. + +![She tastes a finished dish while robots cook from a recipe box, with pinned cards reading /how, /tdd, and /loop above the counter.](./images/recipes.jpg) + +## Understand an unfamiliar subsystem + +```text +use /how first to understand how this initialization works. then use /why to figure out why it broke recently. +``` + +Mechanics first, history second. Each skill's report tells you which sources it searched, so you know what the answer is grounded in. + +## Restate a noisy report before touching code + +```text +/poteto-mode read this thread. restate the underlying issue in your own words, in plain english. don't change any code yet. +``` + +A misreading shows up in the restatement, where it costs one message to correct. Keep your own theory to yourself until the agent has stated its own. + +## Prototype before you pick + +```text +/poteto-mode prototype a few options for the settings layout. put them behind a switcher and send me screenshots of each. +``` + +You pick from things that run, not from descriptions. The agent answers its own layout and timing questions along the way. + +## Turn a settled design into a plan + +```text +/poteto-mode turn this design into a plan. small verifiable PRs, each with its own proof. +``` + +Ask only after the design settles. The plan is the deliverable, and it names the playbook that will execute it. + +## Get a second opinion on a design + +```text +ask /arena for a second opinion on this thread and our approach +``` + +Your current design becomes one candidate among several, and the synthesis tells you whether the panel found something better or confirmed what you had. Cheap insurance before a costly commitment. + +## Check independent slices in parallel + +```text +/swarm check every package under packages/ against its check.sh. one worker per package. one report. +``` + +Each worker owns one package. The parent waits for every slice and returns one `PASS`, `ISSUES`, or `BLOCKED` report instead of raw worker dumps. + +## Review a branch skeptically + +```text +/interrogate the whole branch, but skeptically. don't change anything yet. no nitpicks unless it's an actual bug or regression in behavior. +``` + +The qualifiers do real work. "don't change anything yet" keeps it read-only, and the nitpick rule pre-filters the noise so `Act on` findings are worth your time. + +## Fix a bug through a failing test + +```text +/poteto-mode repro the duplicate write first. if there's a cheap test path, /tdd it. then fix and rerun. +``` + +"if there's a cheap test path" matters. Forcing a test through brittle mocks proves less than running the real command, and the playbook is allowed to say so. + +## Repro and fix a report with proof + +```text +/poteto-mode repro this with /verify-. if it repros on main, fix it and show me a video as proof. +``` + +"if it repros on main" lets the run stop early when the bug is already gone. The video lets you check the fix before you read the diff. + +## Vet a number before you post it + +```text +/benchmark-checklist vet this 40% speedup before it goes in the pr description +``` + +You get faster, slower, no measurable difference, or inconclusive, with the run count, the range, and what limits the number. + +## Stop correcting the same mistake + +```text +/correct agents keep adding new config flags without registering them in the schema +``` + +The fix lands in the repo as architecture, a type, a lint, or a test, so the next agent can't make the mistake. + +## Ask how without starting the work + +```text +/poteto-help how do i get poteto-mode to stay on every turn? +``` + +You get an answer, a prompt to send, and a link to the source. Nothing runs until you send that prompt. + +## Keep a run honest while you're away + +```text +im going to bed, keep going autonomously until every fixture passes. do not stop. keep a decision log i can audit in the morning. +``` + +The full contract is on the [overnight page](./07-overnight.md). The short form works once the task and finish condition are already in the conversation. + +## Redirect a drifting run + +Steering prompts are one line: + +```text +i said the goal is to repro. i did not ask for a fix yet. +``` + +```text +apply prove it works. show me the real output, not the build log. +``` + +```text +/unslop that, no emdashes +``` + +You rarely need more words. You need the right name, and [the principles page](./08-principles.md) is the vocabulary. + +## Get the reply in plain words + +```text +/bro +``` + +That's the whole prompt. [`/bro`](../../skills/bro/SKILL.md) restates the last message like one human talking to another, no jargon, shorter. Use it when a reply is technically thorough and you still don't know what it said. + +## The pitfalls + +- **Enumerating skills in the prompt.** "use /how then /architect then /arena" reorders steps the playbook already sequences. State the goal and constraints. Name a skill only to override a default. +- **A vague finish condition.** "make it better" gives `/loop` nothing to check. Give a command or artifact that can pass or fail. +- **Leading with your theory of the cause.** The agent searches wherever you pointed. Ask it to restate the problem first, then share your hunch. +- **Taking the first design.** One attempt locks in the first shape the model thought of. Ask for prototypes or `/architect` and pick from evidence. +- **Polishing an abstract plan.** Adversarial review of a plan with no code behind it invents risks that will never happen. Settle the open questions with prototypes, then review what got built. +- **Parallel agents in one worktree.** They overwrite each other and the diff becomes archaeology. Run them as cloud agents, or say "own worktree per attempt". +- **Looping before you trust the loop.** A loop that can't verify its own work only makes unchecked work faster. Get the verification skill working first. +- **Trusting an unvetted number.** A warm cache or a skipped code path can fake a speedup. Run `/benchmark-checklist` before the number goes anywhere. +- **Correcting the same mistake by hand.** A correction in chat helps one run. `/correct` fixes the repo so no later run repeats it. +- **Using `/arena` for coverage.** `/arena` repeats one design or code brief, then picks a base and grafts the best parts. `/swarm` partitions slices or declared race arms and aggregates one report. +- **Accepting every review comment.** Bots and humans both file real catches and noise in one list. `/interrogate` sorts findings into act-on and dismissed buckets with reasons, and you can override either way. +- **Treating `auto` as a model slug.** `auto` and `inherit-parent` mean "omit the model field so the subagent inherits the parent chat model." [Setup](./01-setup.md) covers the roles. +- **Reporting success off a green build.** A build proves it compiles. Ask for the real command, flow, stored value, or profile, and expect the evidence in the reply. +- **Writing a `SKILL.md` freehand.** Route it through the [Authoring or modifying a skill playbook](../../skills/poteto-mode/playbooks/authoring-a-skill.md) so validation and review happen. + +That's the guide. If you skipped ahead, go back to [setup](./01-setup.md) and run one real task. The habits stick from use, not from reading. + +Back to the [guide index](./README.md). diff --git a/harness/pstack/claude-code/docs/guide/README.md b/harness/pstack/claude-code/docs/guide/README.md new file mode 100644 index 000000000..627bfb222 --- /dev/null +++ b/harness/pstack/claude-code/docs/guide/README.md @@ -0,0 +1,38 @@ +# The pstack guide + +pstack works best when you stop micromanaging the agent. You describe what you want and how you'll know it's done. `/poteto-mode` picks the playbook, runs the other skills as the steps need them, and shows you the evidence. This guide teaches that habit with realistic prompts. + +Here's what you'll learn: + +1. [Set up pstack](./01-setup.md). Install the plugin and pick your models. +2. [Route work through `/poteto-mode`](./02-poteto-mode.md). Give it a goal and watch it pick a playbook. +3. [Understand the code](./03-understand.md). A read-only investigation, then `/how`, `/why`, `/teach`, and `/recall` before you edit anything. +4. [Design the change](./04-design.md). `/architect`, `/arena`, `/swarm`, `/interrogate`, prototypes, and plans before code locks in a shape. +5. [Build and clean the change](./05-build-and-clean.md). The build playbooks, `/tdd`, `/unslop`, and `/no-comments`. +6. [Verify and ship](./06-verify-and-ship.md). Prove behavior on the real app, vet numbers with `/benchmark-checklist`, then open a focused PR and drive it to merged. +7. [Run work while you sleep](./07-overnight.md). Trust before loops, an overnight contract, a decision log you can audit, and Projects and automations that scale past one agent. +8. [Steer with principle names](./08-principles.md). The 24 names that redirect an agent mid-task. +9. [Make it yours](./09-make-it-yours.md). Your own mode, `/correct` for repeated mistakes, and how to test a skill change. +10. [Recipes and pitfalls](./10-recipes-and-pitfalls.md). Prompts to copy and mistakes to skip. + +Read the pages in order the first time. After that, each page stands alone. + +When you're stuck, or can't tell which skill fits, type [`/poteto-help`](../../skills/poteto-help/SKILL.md) with your question: + +```text +/poteto-help which skill should i use to review this branch? +``` + +It answers, hands you a prompt to send, and links the skill or guide page the answer came from. It doesn't start the work, because a pstack run spends real tokens, so you send the prompt when you're ready. It runs only when you type it. + +## If you only remember one thing + +Give the agent a goal and a way to check it, in your own words: + +```text +/poteto-mode the export writes duplicate rows when a retry lands mid-run. repro first, then fix and verify. +``` + +You don't need to name a playbook or list skills. "repro first" and a checkable outcome are all the routing signal `/poteto-mode` needs. It matches the Bug fix playbook, copies the steps into a todo list, and calls the right skills as each step fires. + +Next: [Set up pstack](./01-setup.md). diff --git a/harness/pstack/claude-code/docs/guide/images/design.jpg b/harness/pstack/claude-code/docs/guide/images/design.jpg new file mode 100644 index 000000000..f86909437 Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/design.jpg differ diff --git a/harness/pstack/claude-code/docs/guide/images/overnight.jpg b/harness/pstack/claude-code/docs/guide/images/overnight.jpg new file mode 100644 index 000000000..d64e1c630 Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/overnight.jpg differ diff --git a/harness/pstack/claude-code/docs/guide/images/recipes.jpg b/harness/pstack/claude-code/docs/guide/images/recipes.jpg new file mode 100644 index 000000000..69fe992fd Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/recipes.jpg differ diff --git a/harness/pstack/claude-code/docs/guide/images/router.jpg b/harness/pstack/claude-code/docs/guide/images/router.jpg new file mode 100644 index 000000000..c8fba6a26 Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/router.jpg differ diff --git a/harness/pstack/claude-code/docs/guide/images/understanding.jpg b/harness/pstack/claude-code/docs/guide/images/understanding.jpg new file mode 100644 index 000000000..bb1b1ac15 Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/understanding.jpg differ diff --git a/harness/pstack/claude-code/docs/guide/images/verification.jpg b/harness/pstack/claude-code/docs/guide/images/verification.jpg new file mode 100644 index 000000000..a252ae0b5 Binary files /dev/null and b/harness/pstack/claude-code/docs/guide/images/verification.jpg differ diff --git a/harness/pstack/claude-code/docs/harness/claude-code.md b/harness/pstack/claude-code/docs/harness/claude-code.md index 012a54f21..bf154e646 100644 --- a/harness/pstack/claude-code/docs/harness/claude-code.md +++ b/harness/pstack/claude-code/docs/harness/claude-code.md @@ -34,7 +34,16 @@ pstack skills use Cursor names. In Claude Code, read this file once per session, | `claude---[-fast]`, such as `claude-opus-5-5-xhigh` | `model: "opus"` and `effort: "xhigh"`. `model` takes only `opus`, `sonnet`, `haiku`, `fable`. Drop `-fast`. | | A `grok-*`, `gpt-*`, or other non-Claude slug | Omit `model` so the agent runs on the session model, and say so. | | `auto` or `inherit-parent` | Omit `model`. | -| The `pstack-models.mdc` rule | Claude Code does not load it. Use the skill's default slug and map it with these rows. `setup-pstack` has nothing to write, so say so and stop. Never put its role lines in `CLAUDE.md` or `AGENTS.md`. | +| The `pstack-models.mdc` rule, `~/.cursor/rules/pstack-models.mdc` | `~/.claude/rules/pstack-models.md`. Claude Code loads it into every new session, so its role lines are already in context. If they are not, read the file. If the file or the role's line is missing, use the skill's default slug. | +| A role value ` `, such as `opus high` | `model: "opus"` and `effort: "high"`. | + +## setup-pstack + +Claude Code loads every `.md` file in `~/.claude/rules/` into each new session, so `setup-pstack` writes its rule there. Follow its steps with these changes: + +- Detect. The detected models are the `model` values that the `Agent` tool schema lists, each with an effort from its `effort` values. Write a real model as ` `, such as `opus xhigh`. The effort is the last token, so the budget step works as written. +- Defaults. Map each default slug with the rows above: `claude-opus-5-5-xhigh` is `opus xhigh`, and `grok-4.7-xhigh-fast` is `inherit-parent`. +- Write. Write `~/.claude/rules/pstack-models.md` with no frontmatter, then the comment lines, the `# budget` line, and one line per role from step 5. Overwrite the whole file. Never put the role lines in `CLAUDE.md` or `AGENTS.md`. ## Paths @@ -42,9 +51,17 @@ pstack skills use Cursor names. In Claude Code, read this file once per session, | --- | --- | | `.cursor/skills/`, `~/.cursor/skills/` | `.claude/skills/`, `~/.claude/skills/` | | `~/.cursor/plugins/`, `.cursor-plugin/plugin.json` | `~/.claude/plugins/`, `.claude-plugin/plugin.json` | -| `.cursor/rules/*.mdc`, always-applied rules | `CLAUDE.md`, or `AGENTS.md` when no `CLAUDE.md` exists. Claude Code never reads `.mdc` files. | +| `.cursor/rules/*.mdc`, always-applied rules | `CLAUDE.md`, or `AGENTS.md` when no `CLAUDE.md` exists. Claude Code never reads `.mdc` files. The model rule is the exception. See Models. | +| `https://github.com/cursor/plugins/blob/main/pstack/` | `/` when that file exists. The plugin ships the skills, `docs/guide/`, and `README.md`. Read the local copy and never fetch it. Give the user the URL when they need a link. | | Transcripts in `~/.cursor/projects//agent-transcripts/` | `~/.claude/projects//.jsonl`. The slug is the workspace path with each `/` and `.` changed to `-`, so `/Users/you/proj` is `-Users-you-proj`. The newest `.jsonl` directly in that folder is the current session. Its `/subagents/` folder holds subagent transcripts. Read only this workspace's folder. | ## Cursor-only features -Automations, Bugbot, Cursor cloud agents, and Cursor's pull request tool have no Claude Code equivalent. Say so, skip that step, and continue. +Claude Code has no Cursor Automations, Bugbot, Cursor cloud agents, or built-in PR tool. When a step needs one, put one line in your reply, `Skipped in Claude Code: . .`, then go on to the next step. Do not stop, ask, or retry. When a later step needs what the skipped step made, such as a URL or a key, leave a placeholder and name it in the line. + +| Cursor | Claude Code | +| --- | --- | +| Cursor Automations: routines, `update_state` routine calls, `api2.cursor.sh/automations` webhooks, routine wakes, and `SendToUser` secret requests | Skip with the line. | +| Bugbot | Bugbot comments on a GitHub PR are ordinary review threads, so triage them with the forge command that the step gives. Skip a step that starts, waits for, or configures Bugbot when the PR has no Bugbot check or comment. | +| Cursor cloud agents | `environment: "cloud"` maps to a worktree, as in Subagent fields. Skip a step that needs the cloud agent itself, such as its dashboard status or its own machine. | +| A built-in PR tool | Use the forge command that the step gives, such as `gh pr create`. That is not a skip, so write no line. | diff --git a/harness/pstack/claude-code/skills/poteto-help/SKILL.md b/harness/pstack/claude-code/skills/poteto-help/SKILL.md index 4c9818fd3..04a5c3e5d 100644 --- a/harness/pstack/claude-code/skills/poteto-help/SKILL.md +++ b/harness/pstack/claude-code/skills/poteto-help/SKILL.md @@ -40,7 +40,7 @@ When the model rule is missing and it matters, ask whether the user wants to pic 2. Run [`/setup-pstack`](../setup-pstack/SKILL.md). It asks for a reasoning budget, maps a model to each role, and writes a rule. The rule applies to new chats. 3. Start a real task with `/poteto-mode`, a goal, and a check that can pass or fail. -Installing changes nothing until the user invokes a skill. Only `/setup-pstack` loads from the user's words. The [README](https://github.com/cursor/plugins/blob/main/pstack/README.md) and [guide page 1](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/01-setup.md) have the details. Offer to word their first prompt with them, per [`references/prompting.md`](references/prompting.md). +Installing changes nothing until the user invokes a skill. Only `/setup-pstack` loads from the user's words. The [README](../../README.md) and [guide page 1](../../docs/guide/01-setup.md) have the details. Offer to word their first prompt with them, per [`references/prompting.md`](references/prompting.md). If cost is the worry, say where the tokens go and how to spend fewer. pstack spends extra tokens on subagents and review panels. Rerun `/setup-pstack` and pick a smaller budget or cheaper models. A role set to `auto` or `inherit-parent` runs on the chat's model, which saves tokens when the chat runs on Auto or a cheaper model. A shorter panel list runs fewer subagents, one for each entry. Save `/poteto-mode` for work that needs rigor. @@ -48,7 +48,7 @@ pstack is built for Cursor. Its skills use the Agent Skills format, so other too ## Start a task with `/poteto-mode` -`/poteto-mode` matches the task to a playbook, copies the playbook's steps into the todo list, and runs the other skills as the steps need them. A step it skips stays in the list as `skip: `. A good prompt states the goal and how to tell it's done. It doesn't list skills, because a hand-written sequence tends to drop or reorder steps the playbook would keep. Read [`references/prompting.md`](references/prompting.md) before you help word one. [Guide page 2](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/02-poteto-mode.md) has examples. +`/poteto-mode` matches the task to a playbook, copies the playbook's steps into the todo list, and runs the other skills as the steps need them. A step it skips stays in the list as `skip: `. A good prompt states the goal and how to tell it's done. It doesn't list skills, because a hand-written sequence tends to drop or reorder steps the playbook would keep. Read [`references/prompting.md`](references/prompting.md) before you help word one. [Guide page 2](../../docs/guide/02-poteto-mode.md) has examples. Whether `/poteto-mode` stays on depends on how the user starts it: @@ -123,11 +123,11 @@ Playbooks are step lists inside `/poteto-mode`, not skills, so they have no slas - "full autopilot on this queue" runs Autopilot-full. "stack them, don't ship" runs Autopilot-stack. - "run the eval playbook" runs Eval. -Without `/poteto-mode`, a phrase such as "babysit this pr" can start Cursor's own skill for the same job instead. The Playbooks section of [`poteto-mode`](../poteto-mode/SKILL.md) lists every playbook and when it applies. [Guide page 6](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/06-verify-and-ship.md) covers opening, babysitting, and landing a PR. +Without `/poteto-mode`, a phrase such as "babysit this pr" can start Cursor's own skill for the same job instead. The Playbooks section of [`poteto-mode`](../poteto-mode/SKILL.md) lists every playbook and when it applies. [Guide page 6](../../docs/guide/06-verify-and-ship.md) covers opening, babysitting, and landing a PR. pstack has no planning skill. Cursor's Plan Mode works alongside it. For work that spans phases or stacked PRs, asking `/poteto-mode` for a plan runs the [Multi-phase plan playbook](../poteto-mode/playbooks/multi-phase-plan.md), which writes the plan and doesn't implement it. For a design question, the Prototype playbook or `/architect` settles it in code first. -Principles are one-rule skills that `/poteto-mode` reads and cites in its replies. The user rarely invokes one. They steer with the names instead, as in "apply prove it works. show me the real output." Typing `/principle-` still loads one on demand. [Guide page 8](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/08-principles.md) lists them. +Principles are one-rule skills that `/poteto-mode` reads and cites in its replies. The user rarely invokes one. They steer with the names instead, as in "apply prove it works. show me the real output." Typing `/principle-` still loads one on demand. [Guide page 8](../../docs/guide/08-principles.md) lists them. ## Fix a run that went wrong @@ -139,10 +139,10 @@ Principles are one-rule skills that `/poteto-mode` reads and cites in its replie | Runs cost more than expected | See the cost paragraph under Get set up. | | A skill didn't load on its own | Only `/setup-pstack` loads from the user's words. The others load when the user types them or when `/poteto-mode` runs them, and it doesn't run every skill. | | Parallel agents overwrote each other | Give each agent its own worktree, or run them as cloud agents, which each get their own machine. | -| An overnight run moved but finished nothing | `/loop` needs a check that can pass or fail, not a duration. See [guide page 7](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/07-overnight.md). | +| An overnight run moved but finished nothing | `/loop` needs a check that can pass or fail, not a duration. See [guide page 7](../../docs/guide/07-overnight.md). | | The reply claims success from a green build | Ask for the real command, flow, stored value, or profile. That's the prove-it-works principle. | -For a run that drifts, [`references/prompting.md`](references/prompting.md) has one-line steers. [Guide page 10](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/10-recipes-and-pitfalls.md) has more pitfalls and the recipes worth copying. +For a run that drifts, [`references/prompting.md`](references/prompting.md) has one-line steers. [Guide page 10](../../docs/guide/10-recipes-and-pitfalls.md) has more pitfalls and the recipes worth copying. ## Make pstack my own @@ -151,7 +151,7 @@ For a run that drifts, [`references/prompting.md`](references/prompting.md) has - `/poteto-mode write a skill for ` runs the authoring playbook. The eval playbook tests a skill change blind. - Fix a misbehaving skill in its own PR, not inside the feature work where it went wrong. -[Guide page 9](https://github.com/cursor/plugins/blob/main/pstack/docs/guide/09-make-it-yours.md) covers each of these. +[Guide page 9](../../docs/guide/09-make-it-yours.md) covers each of these. ## Reply diff --git a/pstack/README.md b/pstack/README.md index b26dfdd21..8a5c5e804 100644 --- a/pstack/README.md +++ b/pstack/README.md @@ -25,9 +25,9 @@ in claude code: /plugin install pstack@cursor-plugins ``` -claude code prefixes plugin commands and agents, so `/poteto-mode` is `/pstack:poteto-mode`. the [claude code adapter](./docs/harness/claude-code.md) maps every other cursor name. +claude code prefixes plugin commands and agents, so `/poteto-mode` is `/pstack:poteto-mode`. the [claude code adapter](./docs/harness/claude-code.md) maps every other cursor name. in claude code, `/pstack:setup-pstack` writes your model choices to `~/.claude/rules/pstack-models.md`, and a step that needs a cursor-only feature, such as bugbot or automations, is skipped with a one-line note. -claude code installs a generated copy of pstack from [`harness/pstack/`](https://github.com/cursor/plugins/tree/main/harness/pstack) at the repository root. after changing `skills/`, `agents/`, `docs/harness/claude-code.md`, or `plugin.json`, run `node scripts/generate-pstack-harness-trees.mjs` from the repository root and commit the result. ci fails until you do. +claude code installs a generated copy of pstack from [`harness/pstack/`](https://github.com/cursor/plugins/tree/main/harness/pstack) at the repository root. after changing `skills/`, `agents/`, `docs/guide/`, `docs/harness/claude-code.md`, this readme, or `plugin.json`, run `node scripts/generate-pstack-harness-trees.mjs` from the repository root and commit the result. ci fails until you do. ## get started diff --git a/pstack/docs/harness/claude-code.md b/pstack/docs/harness/claude-code.md index 012a54f21..bf154e646 100644 --- a/pstack/docs/harness/claude-code.md +++ b/pstack/docs/harness/claude-code.md @@ -34,7 +34,16 @@ pstack skills use Cursor names. In Claude Code, read this file once per session, | `claude---[-fast]`, such as `claude-opus-5-5-xhigh` | `model: "opus"` and `effort: "xhigh"`. `model` takes only `opus`, `sonnet`, `haiku`, `fable`. Drop `-fast`. | | A `grok-*`, `gpt-*`, or other non-Claude slug | Omit `model` so the agent runs on the session model, and say so. | | `auto` or `inherit-parent` | Omit `model`. | -| The `pstack-models.mdc` rule | Claude Code does not load it. Use the skill's default slug and map it with these rows. `setup-pstack` has nothing to write, so say so and stop. Never put its role lines in `CLAUDE.md` or `AGENTS.md`. | +| The `pstack-models.mdc` rule, `~/.cursor/rules/pstack-models.mdc` | `~/.claude/rules/pstack-models.md`. Claude Code loads it into every new session, so its role lines are already in context. If they are not, read the file. If the file or the role's line is missing, use the skill's default slug. | +| A role value ` `, such as `opus high` | `model: "opus"` and `effort: "high"`. | + +## setup-pstack + +Claude Code loads every `.md` file in `~/.claude/rules/` into each new session, so `setup-pstack` writes its rule there. Follow its steps with these changes: + +- Detect. The detected models are the `model` values that the `Agent` tool schema lists, each with an effort from its `effort` values. Write a real model as ` `, such as `opus xhigh`. The effort is the last token, so the budget step works as written. +- Defaults. Map each default slug with the rows above: `claude-opus-5-5-xhigh` is `opus xhigh`, and `grok-4.7-xhigh-fast` is `inherit-parent`. +- Write. Write `~/.claude/rules/pstack-models.md` with no frontmatter, then the comment lines, the `# budget` line, and one line per role from step 5. Overwrite the whole file. Never put the role lines in `CLAUDE.md` or `AGENTS.md`. ## Paths @@ -42,9 +51,17 @@ pstack skills use Cursor names. In Claude Code, read this file once per session, | --- | --- | | `.cursor/skills/`, `~/.cursor/skills/` | `.claude/skills/`, `~/.claude/skills/` | | `~/.cursor/plugins/`, `.cursor-plugin/plugin.json` | `~/.claude/plugins/`, `.claude-plugin/plugin.json` | -| `.cursor/rules/*.mdc`, always-applied rules | `CLAUDE.md`, or `AGENTS.md` when no `CLAUDE.md` exists. Claude Code never reads `.mdc` files. | +| `.cursor/rules/*.mdc`, always-applied rules | `CLAUDE.md`, or `AGENTS.md` when no `CLAUDE.md` exists. Claude Code never reads `.mdc` files. The model rule is the exception. See Models. | +| `https://github.com/cursor/plugins/blob/main/pstack/` | `/` when that file exists. The plugin ships the skills, `docs/guide/`, and `README.md`. Read the local copy and never fetch it. Give the user the URL when they need a link. | | Transcripts in `~/.cursor/projects//agent-transcripts/` | `~/.claude/projects//.jsonl`. The slug is the workspace path with each `/` and `.` changed to `-`, so `/Users/you/proj` is `-Users-you-proj`. The newest `.jsonl` directly in that folder is the current session. Its `/subagents/` folder holds subagent transcripts. Read only this workspace's folder. | ## Cursor-only features -Automations, Bugbot, Cursor cloud agents, and Cursor's pull request tool have no Claude Code equivalent. Say so, skip that step, and continue. +Claude Code has no Cursor Automations, Bugbot, Cursor cloud agents, or built-in PR tool. When a step needs one, put one line in your reply, `Skipped in Claude Code: . .`, then go on to the next step. Do not stop, ask, or retry. When a later step needs what the skipped step made, such as a URL or a key, leave a placeholder and name it in the line. + +| Cursor | Claude Code | +| --- | --- | +| Cursor Automations: routines, `update_state` routine calls, `api2.cursor.sh/automations` webhooks, routine wakes, and `SendToUser` secret requests | Skip with the line. | +| Bugbot | Bugbot comments on a GitHub PR are ordinary review threads, so triage them with the forge command that the step gives. Skip a step that starts, waits for, or configures Bugbot when the PR has no Bugbot check or comment. | +| Cursor cloud agents | `environment: "cloud"` maps to a worktree, as in Subagent fields. Skip a step that needs the cloud agent itself, such as its dashboard status or its own machine. | +| A built-in PR tool | Use the forge command that the step gives, such as `gh pr create`. That is not a skip, so write no line. | diff --git a/scripts/generate-pstack-harness-trees.mjs b/scripts/generate-pstack-harness-trees.mjs index a3ae88e7f..83335a116 100644 --- a/scripts/generate-pstack-harness-trees.mjs +++ b/scripts/generate-pstack-harness-trees.mjs @@ -11,15 +11,16 @@ const SKILLS = join(PSTACK, "skills"); const OUT = join(ROOT, "harness", "pstack"); const TREE = "claude-code"; const ADAPTER = "docs/harness/claude-code.md"; +const GUIDE = "docs/guide"; const MANIFESTS = ["plugin.json", ".claude-plugin/plugin.json"]; const COMMAND = "node scripts/generate-pstack-harness-trees.mjs"; const GITHUB = "https://github.com/cursor/plugins"; const LINK = /\]\(([^)\s]+)\)/g; const README = `# pstack harness tree -This folder is generated from \`pstack/skills\`, \`pstack/agents\`, \`pstack/${ADAPTER}\`, \`pstack/LICENSE\`, and \`pstack/plugin.json\`. Do not edit it by hand. +This folder is generated from \`pstack/skills\`, \`pstack/agents\`, \`pstack/${GUIDE}\`, \`pstack/${ADAPTER}\`, \`pstack/README.md\`, \`pstack/LICENSE\`, and \`pstack/plugin.json\`. Do not edit it by hand. -Cursor uses \`pstack/\` directly, and Claude Code installs \`${TREE}/\`. The tree leaves out the rest of \`pstack/docs\` and \`pstack/README.md\`. A relative link to a pstack file that the tree leaves out points at that file on GitHub \`main\` instead. +Cursor uses \`pstack/\` directly, and Claude Code installs \`${TREE}/\`. The tree leaves out the rest of \`pstack/\`, such as \`pstack/automations\` and \`pstack/assets\`. A relative link to a pstack file that the tree leaves out points at that file on GitHub \`main\` instead. After editing those sources, run \`${COMMAND}\` from the repository root and commit the result. `; @@ -46,7 +47,7 @@ const TERMS = [ { key: "~/.cursor/plugins/", re: /\.cursor\/plugins|\.cursor-plugin/ }, { key: ".cursor/rules/", re: /\.cursor\/rules|always-applied rule/ }, { key: "agent-transcripts", re: /agent-transcripts|\.cursor\/projects/ }, - { key: "Cursor-only features", re: /Bugbot|Cursor [Aa]utomation|cursor\.(sh|com)\/automations|[Cc]loud [Aa]gent/ }, + { key: "Cursor-only features", re: /Bugbot|Cursor [Aa]utomation|cursor\.(sh|com)\/automations|[Cc]loud [Aa]gent|built-in PR tool/ }, ]; const ROUTE_KEY = "Run another pstack skill"; const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/; @@ -115,8 +116,14 @@ function has(files, path) { } function render() { - // Skills read the adapter at runtime. The guide and the README stay on GitHub. - const copies = [...walk(SKILLS), ...walk(join(PSTACK, "agents")), join(PSTACK, ADAPTER)]; + // Skills read the adapter, the guide, and the README at runtime, so Claude Code never fetches them. + const copies = [ + ...walk(SKILLS), + ...walk(join(PSTACK, "agents")), + ...walk(join(PSTACK, GUIDE)), + join(PSTACK, ADAPTER), + join(PSTACK, "README.md"), + ]; const files = new Map(copies.map((path) => [relative(PSTACK, path), file(path)])); const line = `In Claude Code, read [the Claude Code adapter](../../${ADAPTER}) once per session before you follow this skill. ` +