diff --git a/docs/guide/02-poteto-mode.md b/docs/guide/02-poteto-mode.md index 92545b3..64d27e4 100644 --- a/docs/guide/02-poteto-mode.md +++ b/docs/guide/02-poteto-mode.md @@ -25,7 +25,7 @@ flowchart TD 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. +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 or a stack 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 diff --git a/docs/guide/03-understand.md b/docs/guide/03-understand.md index e15bea0..e26661f 100644 --- a/docs/guide/03-understand.md +++ b/docs/guide/03-understand.md @@ -30,9 +30,9 @@ Ask the question you actually have. [`/how`](../../skills/how/SKILL.md) reads th /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. +[`/why`](../../skills/why/SKILL.md) 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. +The two compose naturally. `do why first then how` is a good prompt when you suspect the history explains the mess. ## Actually understand it with `/teach` @@ -40,7 +40,7 @@ The two compose naturally. `do why first then how` is a perfectly good prompt wh /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. +[`/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 reusing. It turns the explanation into an argument you can test instead of a tour. It works on the agent's own choices too: diff --git a/docs/guide/04-design.md b/docs/guide/04-design.md index 61d5bbb..6586208 100644 --- a/docs/guide/04-design.md +++ b/docs/guide/04-design.md @@ -2,7 +2,7 @@ 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. +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) diff --git a/docs/guide/05-build-and-clean.md b/docs/guide/05-build-and-clean.md index fa4db86..4f471f2 100644 --- a/docs/guide/05-build-and-clean.md +++ b/docs/guide/05-build-and-clean.md @@ -1,6 +1,6 @@ # 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. +The build playbooks share one discipline. Say what you observed, and 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 @@ -22,7 +22,7 @@ A refactoring prompt pins behavior before structure moves: /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: +A perf prompt states the measurement, not an impression: ```text /poteto-mode startup takes 1.8s on this fixture. trace it, fix the measured cause, show me before and after. diff --git a/docs/guide/06-verify-and-ship.md b/docs/guide/06-verify-and-ship.md index 0aa4e36..84b8afb 100644 --- a/docs/guide/06-verify-and-ship.md +++ b/docs/guide/06-verify-and-ship.md @@ -14,7 +14,7 @@ Put what done means in the first prompt, in whatever words fit: /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. +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". A confident reply without evidence is a warning sign. Match the check to the change: @@ -26,7 +26,7 @@ Match the check to the change: 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. +For a small diff you don't fully trust, [`/blast-radius`](../../skills/blast-radius/SKILL.md) finds what it could break elsewhere. It finds the one fact that makes the change safe and proves that fact by running code, not by arguing for it. ## Vet a measured number with `/benchmark-checklist` @@ -85,13 +85,13 @@ While you're there, make the dev setup repeatable too: seeded data, test users, ## 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: +Apps change, and feature maps go out of date. 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. +[`/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 hiding it with a doc edit. ## Open the PR diff --git a/docs/guide/07-overnight.md b/docs/guide/07-overnight.md index cb0abb8..ad374b8 100644 --- a/docs/guide/07-overnight.md +++ b/docs/guide/07-overnight.md @@ -71,7 +71,7 @@ Before the skill hands back its summary, it spawns a reviewer on a different mod 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: +[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 checks the owner's code-ready head. A later rebase or minor fix gets one fresh verifier, and only new behavior or a large new diff calls the full swarm again. 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. diff --git a/docs/guide/08-principles.md b/docs/guide/08-principles.md index 5b17980..d292150 100644 --- a/docs/guide/08-principles.md +++ b/docs/guide/08-principles.md @@ -24,7 +24,7 @@ Say two parallel attempts are about to write to the same branch: 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. +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 means the agent named the rule without applying it. ## The 24, briefly diff --git a/docs/guide/09-make-it-yours.md b/docs/guide/09-make-it-yours.md index 3f73fb8..dcd42f8 100644 --- a/docs/guide/09-make-it-yours.md +++ b/docs/guide/09-make-it-yours.md @@ -1,6 +1,6 @@ # 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. +poteto-mode is one person's style. The playbooks, routing, and model roles underneath it work just as well with 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. @@ -18,7 +18,7 @@ Run it again whenever your habits drift: /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. +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 new patterns. ## Capture a session's lessons with `/reflect` @@ -69,7 +69,7 @@ Skills aren't the only prose you ship. For docs, RFCs, readmes, PR descriptions, /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. +[`/technical-writing`](../../skills/technical-writing/SKILL.md) applies a layered standard. Its goal is prose that 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 diff --git a/docs/guide/10-recipes-and-pitfalls.md b/docs/guide/10-recipes-and-pitfalls.md index 8e2c9e4..7c6509b 100644 --- a/docs/guide/10-recipes-and-pitfalls.md +++ b/docs/guide/10-recipes-and-pitfalls.md @@ -42,7 +42,7 @@ Ask only after the design settles. The plan is the deliverable, and it names the 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. +Your current design becomes one candidate among several, and the synthesis tells you whether the panel found something better or confirmed what you had. It costs little next to a design that is expensive to reverse. ## Check independent slices in parallel @@ -141,7 +141,7 @@ That's the whole prompt. [`/bro`](../../skills/bro/SKILL.md) restates the last m - **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. Give each agent its own worktree and run them as background subagents, or say "own worktree per attempt". +- **Parallel agents in one worktree.** They overwrite each other, and nobody can tell which agent changed what. Give each agent its own worktree and run them as background subagents, 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. diff --git a/docs/harness/claude-code.md b/docs/harness/claude-code.md new file mode 100644 index 0000000..bf154e6 --- /dev/null +++ b/docs/harness/claude-code.md @@ -0,0 +1,67 @@ +# pstack in Claude Code + +pstack skills use Cursor names. In Claude Code, read this file once per session, then map each Cursor name in a skill with the tables below. `` means the folder that holds `skills/` and `docs/`. If a Cursor field has no row, drop it and say so. Never pass a field or value the tool schema rejects. + +## Tools + +| Cursor | Claude Code | +| --- | --- | +| `Task` | `Agent` | +| `AskQuestion` | `AskUserQuestion`. In `-p` mode it is absent, so ask in plain text. | +| Open a todolist | Use `TodoWrite` if the session offers it. Otherwise keep the list in your reply and update it at each phase. | +| Run another pstack skill (`/name` or "the **name** skill") | `Read` `/skills//SKILL.md` and follow it. The `Skill` tool refuses most pstack skills. When you tell the user to type it, write `/pstack:`. | +| `Grep`, `Glob` | `Bash` with `rg` when the session has no `Grep` or `Glob`. | + +## Subagent fields + +| Cursor | Claude Code | +| --- | --- | +| `subagent_type: generalPurpose` | `subagent_type: "general-purpose"` | +| `poteto-agent`, `comment-sicko` | `pstack:poteto-agent`, `pstack:comment-sicko` | +| `readonly: true` | `subagent_type: "Explore"`. It keeps `Bash`, so the brief also says "do not edit files", and you check `git status` afterward. | +| `readonly: false` | `general-purpose`. It keeps the session's MCP servers. | +| `environment: "cloud"` | `isolation: "worktree"`. Name the branch or commit the worker checks out. | +| `environment: "local"` | Omit. | +| `cloud_base_branch: ` | Tell the worker to check out `` first. | +| `run_in_background: true` | Omit. Subagents run in the background by default and notify you when they finish. | +| `resume` | Spawn a new agent and paste the earlier result into its brief. | +| `file_attachments` | List the paths in the brief. | + +## Models + +| Cursor | Claude Code | +| --- | --- | +| `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, `~/.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 + +| Cursor | Claude Code | +| --- | --- | +| `.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. 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 + +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/skills/typescript-best-practices/SKILL.md b/skills/typescript-best-practices/SKILL.md index 2c0279d..e1e5aa7 100644 --- a/skills/typescript-best-practices/SKILL.md +++ b/skills/typescript-best-practices/SKILL.md @@ -12,7 +12,7 @@ Apply the **type-system-discipline** principle skill first. | Rule | Summary | |------|---------| | Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. | -| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. | +| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. A brand comes from a verifying type guard (`input is AgentId`), never from `as`. | | Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. | | Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty` only where the loose type forces `!`, a cast, or a "should never happen" throw. | | `unknown` over `any` | External data is `unknown`. | diff --git a/skills/typescript-best-practices/references/patterns.md b/skills/typescript-best-practices/references/patterns.md index c21d876..f8dd99b 100644 --- a/skills/typescript-best-practices/references/patterns.md +++ b/skills/typescript-best-practices/references/patterns.md @@ -9,9 +9,13 @@ Brand primitives so they can't be mixed up. Validate once at the boundary. Downs ```ts type AgentId = string & { readonly __brand: "AgentId" }; +function isAgentId(input: string): input is AgentId { + return isUUID(input); +} + function parseAgentId(input: string): AgentId { - if (!isUUID(input)) throw new Error(`Invalid agent id: ${input}`); - return input as AgentId; + if (!isAgentId(input)) throw new Error(`Invalid agent id: ${input}`); + return input; } function focusAgent(id: AgentId): void {