From 5bcc9946bcb1d1b8805169d21c17c2bd5833ed25 Mon Sep 17 00:00:00 2001 From: Negrescu Alexandru Date: Mon, 16 Nov 2026 11:18:34 +0200 Subject: [PATCH 1/2] sync: upstream pstack bf0c7cd (0.15.42) - Move the pin from c742dd6 (0.15.36) to bf0c7cd (0.15.42). RELEASE resets to 0, so the catalog publishes 0.15.4200. - Rewrite rules 83, 92, 142-144, 147 and 175 for upstream's new default models and the arena vendor test, and rule 118 for the one-explainer how. - Add a recall investigator rule and Claude-fast and Gemini slug tiers. - Exempt 16 rules whose text upstream removed with the multi-agent how and why, and re-reason 7 exemptions that pointed at those rules. - Record the new swallow spans for rules 19, 20, 36, 71, 91, 92, 143 and 144, carrying the three-runner panel default and the vendor judge into the replacements. - Drop the stale gpt-4 allowlist entry; upstream replaced that example. --- .omp-plugin/marketplace.json | 6 +- omp-port/RELEASE | 2 +- omp-port/UPSTREAM | 2 +- omp-port/rules.sed | 31 +++-- omp-port/slug-allowlist.txt | 1 - omp-port/stale-exempt.tsv | 34 +++-- omp-port/swallow.tsv | 18 +-- plugins/pstack/agents/comment-sicko.md | 2 +- plugins/pstack/package.json | 2 +- plugins/pstack/skills/architect/SKILL.md | 4 +- plugins/pstack/skills/arena/SKILL.md | 4 +- plugins/pstack/skills/blast-radius/SKILL.md | 4 +- plugins/pstack/skills/how/SKILL.md | 27 +--- .../skills/how/references/explainer-prompt.md | 55 -------- .../skills/how/references/explorer-prompt.md | 35 ----- plugins/pstack/skills/no-comments/SKILL.md | 2 +- plugins/pstack/skills/poteto-mode/SKILL.md | 3 +- .../skills/poteto-mode/playbooks/bug-fix.md | 2 +- .../skills/poteto-mode/playbooks/feature.md | 2 +- .../skills/poteto-mode/playbooks/hillclimb.md | 2 +- .../poteto-mode/playbooks/investigation.md | 4 +- .../poteto-mode/playbooks/multi-phase-plan.md | 2 +- .../poteto-mode/playbooks/perf-issue.md | 2 +- .../poteto-mode/playbooks/refactoring.md | 2 +- plugins/pstack/skills/recall/SKILL.md | 4 +- .../skills/reflect/references/synthesizer.md | 2 +- plugins/pstack/skills/sharpen/SKILL.md | 2 +- .../statechart/scripts/backends/mermaid.ts | 58 +++++++- .../pstack/skills/statechart/scripts/run.ts | 35 ++++- .../statechart/scripts/test/chart.test.ts | 43 ++++++ .../statechart/scripts/test/cli.test.ts | 41 +++--- .../statechart/scripts/test/corpus.test.ts | 38 ++++++ .../scripts/test/corpus/Login/chart.mmd | 3 +- .../skills/statechart/scripts/test/drawn.ts | 20 +++ .../skills/statechart/scripts/test/labels.ts | 27 ++-- .../statechart/scripts/test/render.test.ts | 64 +++++++++ plugins/pstack/skills/teach/SKILL.md | 2 +- plugins/pstack/skills/why/SKILL.md | 93 +------------ .../skills/why/references/epistemics.md | 71 ---------- .../why/references/investigator-prompt.md | 84 ------------ .../skills/why/references/source-playbook.md | 17 --- .../references/sources/code-archaeology.md | 51 ------- .../why/references/sources/databricks.md | 70 ---------- .../skills/why/references/sources/datadog.md | 97 ------------- .../references/sources/incident-postmortem.md | 5 - .../skills/why/references/sources/linear.md | 48 ------- .../skills/why/references/sources/notion.md | 55 -------- .../skills/why/references/sources/sentry.md | 66 --------- .../skills/why/references/sources/slack.md | 17 --- .../why/references/synthesizer-prompt.md | 129 ------------------ 50 files changed, 374 insertions(+), 1016 deletions(-) delete mode 100644 plugins/pstack/skills/how/references/explainer-prompt.md delete mode 100644 plugins/pstack/skills/how/references/explorer-prompt.md create mode 100644 plugins/pstack/skills/statechart/scripts/test/drawn.ts delete mode 100644 plugins/pstack/skills/why/references/epistemics.md delete mode 100644 plugins/pstack/skills/why/references/investigator-prompt.md delete mode 100644 plugins/pstack/skills/why/references/source-playbook.md delete mode 100644 plugins/pstack/skills/why/references/sources/code-archaeology.md delete mode 100644 plugins/pstack/skills/why/references/sources/databricks.md delete mode 100644 plugins/pstack/skills/why/references/sources/datadog.md delete mode 100644 plugins/pstack/skills/why/references/sources/incident-postmortem.md delete mode 100644 plugins/pstack/skills/why/references/sources/linear.md delete mode 100644 plugins/pstack/skills/why/references/sources/notion.md delete mode 100644 plugins/pstack/skills/why/references/sources/sentry.md delete mode 100644 plugins/pstack/skills/why/references/sources/slack.md delete mode 100644 plugins/pstack/skills/why/references/synthesizer-prompt.md diff --git a/.omp-plugin/marketplace.json b/.omp-plugin/marketplace.json index 48cd852..f6cf74c 100644 --- a/.omp-plugin/marketplace.json +++ b/.omp-plugin/marketplace.json @@ -5,13 +5,13 @@ }, "metadata": { "description": "pstack, poteto's engineering methodology for Cursor, ported to oh-my-pi. Model and provider agnostic.", - "version": "0.15.3601" + "version": "0.15.4200" }, "plugins": [ { "name": "pstack", - "description": "59 skills, 23 playbooks, 24 principles, the poteto-mode pin, and two agents. Upstream cursor/plugins pstack 0.15.36 at c742dd6.", - "version": "0.15.3601", + "description": "59 skills, 23 playbooks, 24 principles, the poteto-mode pin, and two agents. Upstream cursor/plugins pstack 0.15.42 at bf0c7cd.", + "version": "0.15.4200", "category": "development", "license": "MIT", "source": "./plugins/pstack" diff --git a/omp-port/RELEASE b/omp-port/RELEASE index d00491f..573541a 100644 --- a/omp-port/RELEASE +++ b/omp-port/RELEASE @@ -1 +1 @@ -1 +0 diff --git a/omp-port/UPSTREAM b/omp-port/UPSTREAM index 05798bc..bfc3ba6 100644 --- a/omp-port/UPSTREAM +++ b/omp-port/UPSTREAM @@ -1 +1 @@ -c742dd61706fbacc1b95f1a20b7b988cf096ce6c +bf0c7cd80abdbf7fe47b634978a7d1b4071f71a7 diff --git a/omp-port/rules.sed b/omp-port/rules.sed index e13574a..32aede0 100644 --- a/omp-port/rules.sed +++ b/omp-port/rules.sed @@ -79,8 +79,9 @@ s#^Other tools can read the skills, because they use the Agent Skills format.*$# # rewriting the left-hand side rather than by adding an exemption, because the translation it # carries is still wanted and the replacement text was already sitting unused below. s#So `small` turns `claude-[a-z0-9.-]+` into `claude-[a-z0-9.-]+`, and `grok-[a-z0-9.-]+` into `grok-[a-z0-9.-]+`\.#So `small` takes the lowest-effort selector in the same family that `omp models` reports, and marks the role as needing a choice when that family offers none.# -# Cursor names the judgment slug twice in one clause; omp names the capability once. -s#go to your strongest judgment model \(`claude-[a-z0-9.-]+`\)#go to your strongest judgment model# +# Cursor names the hardest-tasks role line and its default slug in one clause; omp names the +# capability once. +s#go to your `hardest tasks` model \(default `claude-[a-z0-9.-]+`\)#go to your strongest judgment model# # Cursor reads the playbook from trunk because it is vendored there; omp reads the install. s#Read these from trunk at program start\. Re-read them at every tick\.#Read these at program start and re-read them at every tick. The install on disk is authoritative, not a remote ref.# # Router prose that used Cursor's local links or per-call model paragraph. @@ -89,7 +90,7 @@ s#\*\*Babysit\*\* playbook \(`playbooks/babysit\.md`\)#**Babysit** playbook (`sk s#\*\*Shipping\*\* playbook \(`playbooks/shipping\.md`\)#**Shipping** playbook (`skill://poteto-mode/playbooks/shipping.md`)# s#`references/bugbot-triage\.md`#`skill://poteto-mode/references/bugbot-triage.md`# s#^\*\*Use `subagent_type: "poteto-agent"` for any subagent you spawn inside a playbook step\*\*.*$#`poteto-mode` selects the playbook, step order, canonical role, and lifecycle protocol. `skill://pstack-omp` is authoritative for every delegation instruction in this catalog, including imported task-shaped examples. Resolve roles against the live roster; bundled agent names are optional, never mandatory. Only pass fields exposed by the current tool schema.# -s#^\*\*Defaults for every `Task` call\.\*\* `run_in_background: true`.*Prose and judgment read `judgment and prose`\.$#Batch genuinely independent work when supported. Give each participant a standalone brief and explicit write ownership. The root starts additional participants and independent reviewers; ordinary workers do not start children. Runtime role configuration selects models. Preserve required independent contexts and report unavailable model diversity honestly. Do not change operator configuration merely to satisfy a skill example.\n\nModel selection belongs to `task.agentModelOverrides` and agent frontmatter, not to routed-skill task fields.# +s#^\*\*Defaults for every `Task` call\.\*\* `run_in_background: true`.*Keep honoring its lines, and tell the user once per session to rerun `/setup-pstack`\.$#Batch genuinely independent work when supported. Give each participant a standalone brief and explicit write ownership. The root starts additional participants and independent reviewers; ordinary workers do not start children. Runtime role configuration selects models. Review and design panels default to three runners, each on a different configured model family when the roster supplies one. Preserve required independent contexts and report unavailable model diversity honestly. Do not change operator configuration merely to satisfy a skill example.\n\nModel selection belongs to `task.agentModelOverrides` and agent frontmatter, not to routed-skill task fields.# # Autonomous run's exact post-Cursor workflow. s#^\*\*You own the exit condition\. Define done, then drive to it without stopping\.\*\*$#**You own the exit condition. Define done, then drive to it without stopping.** For "going to bed", "run until done", or "continue until X".# s#^1\. State the exit condition as a checkable predicate before the first iteration \(tests green, repro fixed, all N PRs merged, pixel-diff zero\)\.$#1. State the exit condition as a checkable predicate before the first iteration (tests green, repro fixed, all N PRs merged, pixel-diff zero). A vague goal stalls; a predicate lets you stop.# @@ -115,7 +116,7 @@ s#^- `readonly`: `false` \(agent mode\)\. \*\*Do not use readonly/Ask mode\.\*\* s#^- `readonly`: `false` \(agent mode\)\. The synthesizer's quality check spot-verifies citations, which can require MCP access\. Readonly/Ask mode strips MCPs and defeats that\.$## s#Work like a careful, cautious, precise investigator\.#Work like a careful, cautious, precise investigator. This investigation is read-only: do not write files, change git state, commit, push, open pull requests, or mutate any external system. Use only read-only operations exposed by your agent and assigned source.# # One-item calls still use the live batch shape and required shared context. -s#Spawn one Task subagent that explores and explains in one pass:#Start one direct explainer in one `task` call with one item in `tasks[]` and the required shared `context`:# +s#Spawn one Task subagent with `subagent_type: generalPurpose` and `readonly: true` that explores and explains in one pass\.#Start one explainer in one `task` call with one item in `tasks[]` and the required shared `context`. Use an exact discovered explainer agent when the live roster has one; otherwise omit `agent` for the default worker. It explores and explains in one pass, and its brief carries read-only posture, since there is no task `readonly` field.# s#Once all explorers have returned, spawn one Task subagent to synthesize their findings into one explanation:#After all explorers have returned, start the synthesis in one `task` call with one item in `tasks[]` and the required shared `context`, using Step 2b's explainer routing:# s#Spawn one synthesizer subagent:#Start one synthesizer in one `task` call with one item in `tasks[]`, the required shared `context`, and an exact discovered full-access worker:# s#Spawn all explorers in a single message,#Start all explorers in one `task` call with the required shared `context` and all independent items in `tasks[]`,# @@ -139,12 +140,12 @@ s#^\| Tooling \| `reflect tooling` \| `[^`]+` \| `references/tooling-reviewer\.m s#^\| Divergent \| `reflect judgment, divergent, synthesizer` \| `[^`]+` \| `references/divergent-reviewer\.md` \|$#| Divergent | discovered divergent agent | `references/divergent-reviewer.md` |# s#The synthesizer returns a structured Accepted / Rejected / Backlog list\.#Pass this explicit `outputSchema` when the live task schema exposes it:\n\n```json\n{"type":"object","required":["Accepted","Rejected","Backlog"],"properties":{"Accepted":{"type":"array","items":{"type":"object","required":["Problem","Proposal","Routing"],"properties":{"Problem":{"type":"string"},"Proposal":{"type":"string"},"Routing":{"type":"string"}}}},"Rejected":{"type":"array","items":{"type":"object","required":["Principle","Reason"],"properties":{"Principle":{"type":"string"},"Reason":{"type":"string"}}}},"Backlog":{"type":"array","items":{"type":"object","required":["Pattern","Hit","Mechanism"],"properties":{"Pattern":{"type":"string"},"Hit":{"type":"string"},"Mechanism":{"type":"string"}}}}}}\n```# # These model-map sentences must match raw upstream before slug and path token rewrites. -s#^Take the runners from the `architect runners` line in the `pstack-models\.mdc` rule, in place of the `arena runners` line\. If the rule or that line is missing, use `claude-opus-[^`]+` and `grok-[^`]+`\. Alias and rejected entries follow the runner rules in the \*\*arena\*\* skill's Phase A\.$#Use the same exact discovered runner agents as Arena, with the architect role in each brief. Each agent's frontmatter or `task.agentModelOverrides[]` selects its model; the task item has no `model` field.# -s#^3\. Pick the runners\. Use the `arena runners` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, default to one each on `claude-opus-[^`]+` and `grok-[^`]+`\. An `auto` or `inherit-parent` entry in this line( or the cross-judge line)? means the parent model, so omit `model` for it\. If the Task tool rejects a configured entry, run that seat on its family's default and say so\. Families go by prefix: `claude-\*`, and `grok-\*` with `cursor-grok-\*` and `composer-\*`\. A refused `composer-\*` entry runs on `grok-[^`]+`\..* (Spawn more runners when )#3. Pick the runners. Resolve exact discovered agent names and inspect each agent's frontmatter or `task.agentModelOverrides[]`. Prefer distinct configured model families when the roster supplies them; otherwise keep the independent contexts and report weaker model diversity. A model override cannot create an agent. \2# -s#After all Phase B candidates complete, choose one model from the `arena cross-judge pool` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, choose from `claude-opus-[^`]+` and `grok-[^`]+`\. Spawn one readonly judge subagent\..*and say that the family check did not run\.#After all Phase B candidates complete, choose an exact discovered judge agent whose configured model is from a different family than the parent's. An agent with no override and no frontmatter model inherits the parent's model, so it never judges. Start the judge in one `task` call with one item in `tasks[]`, the required shared `context`, and that exact agent name. Its frontmatter or `task.agentModelOverrides[]` selects the model; the task item has no `model` field. The brief carries read-only posture and forbids writes; there is no task `readonly` field. If no judge from another family can run, skip the cross-judge, pick the base alone in Phase D, and say so. If you do not know the parent's model, choose a judge whose model its frontmatter or exact override sets, and say that the family check did not run.# +s#^Take the runners from the `architect runners` line in the `pstack-models\.mdc` rule, in place of the `arena runners` line\. If the rule or that line is missing, use `[^`]+`, `[^`]+`, and `[^`]+`\. Alias and rejected entries follow the runner rules in the \*\*arena\*\* skill's Phase A\.$#Use the same exact discovered runner agents as Arena, with the architect role in each brief. Each agent's frontmatter or `task.agentModelOverrides[]` selects its model; the task item has no `model` field.# +s#^3\. Pick the runners\. Use the `arena runners` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, default to one each on `[^`]+`, `[^`]+`, and `[^`]+`\. An `auto` or `inherit-parent` entry in this line( or the cross-judge line)? means the parent model, so omit `model` for it\. If the Task tool rejects a configured entry, run that seat on its family's default and say so\. Families go by prefix, and the longest matching prefix wins:.* (Spawn more runners when )#3. Pick the runners. Run three by default, and never fewer than two. Resolve exact discovered agent names and inspect each agent's frontmatter or `task.agentModelOverrides[]`. Prefer distinct configured model families when the roster supplies them; otherwise keep the independent contexts and report weaker model diversity. A model override cannot create an agent. \2# +s#After all Phase B candidates complete, choose one model from the `arena cross-judge pool` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, choose from `[^`]+`, `[^`]+`, and `[^`]+`\. Spawn one readonly judge subagent\..*and say that the vendor check did not run\.#After all Phase B candidates complete, choose an exact discovered judge agent whose configured model is from a different vendor than the parent's. Two model families from one vendor, such as two Claude lines, count as one vendor. An agent with no override and no frontmatter model inherits the parent's model, so it never judges. Start the judge in one `task` call with one item in `tasks[]`, the required shared `context`, and that exact agent name. Its frontmatter or `task.agentModelOverrides[]` selects the model; the task item has no `model` field. The brief carries read-only posture and forbids writes; there is no task `readonly` field. If no judge from another vendor can run, skip the cross-judge, pick the base alone in Phase D, and say so. If you do not know the parent's model, choose a judge whose model its frontmatter or exact override sets, and say that the vendor check did not run.# s#^- `model`: the configured `interrogate reviewers` entry, or the table default with no configured line\. For an `auto` or `inherit-parent` entry, omit `model` so that reviewer runs on the parent model\.$#- `agent`: an exact discovered reviewer agent name. Its frontmatter or `task.agentModelOverrides[]` selects the model; the task item has no `model` field# s#If the Task tool rejects a configured entry, run that reviewer on its family's table default and say so\. Families go by prefix: `claude-\*`, and `grok-\*` with `cursor-grok-\*` and `composer-\*`\. A refused `composer-\*` entry runs on Reviewer B's default\. With no family match, use Reviewer A's default\. If it rejects a table default, spawn with the closest equivalent from the valid slugs in its error message \(prefer the same family and reasoning tier\), and open a separate PR to update the default table\. Do not block the review on the slug issue\. Never treat an alias entry as a rejected slug or apply either fallback to it\.#If the requested exact reviewer is absent, use another discovered reviewer with the same brief and report the missing model diversity. A model override cannot create an agent.# -s#^([0-9]+)\. Pick the worker model from the `swarm workers` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, use `grok-[^`]+`\. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model\. If the Task tool rejects a slug, use the default and say so\. If it rejects the default, use the closest valid slug of the same family from its error message\. For a model race, name each arm's model up front\.#\1. Pick exact discovered agent names. Inspect each agent's frontmatter or `task.agentModelOverrides[]` for its model. A model race needs one loaded agent file and one exact override entry per arm; overrides cannot create agents.# +s#^([0-9]+)\. Pick the worker model from the `swarm workers` line in `~/\.cursor/rules/pstack-models\.mdc`\. If the rule or that line is missing, use `[^`]+`\. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model\. If the Task tool rejects a slug, use the default and say so\. If it rejects the default, use the closest valid slug of the same family from its error message\. For a model race, name each arm's model up front\.#\1. Pick exact discovered agent names. Inspect each agent's frontmatter or `task.agentModelOverrides[]` for its model. A model race needs one loaded agent file and one exact override entry per arm; overrides cannot create agents.# # The Cursor wire fields, as tokens rather than as sentences. The sentence rules above carry the # meaning; this net is what keeps a Cursor field out of the tree when upstream rewords the # sentence those rules anchor on, which it does routinely. Each left side is a field name that @@ -172,7 +173,7 @@ s#Spawn one synthesizer\.#Start one synthesizer in one `task` call with one item # Inline selectors that survive into patch context are exact values, not a Markdown catch-all. s#Shape: one or two questions with 4-6 options each, `allow_multiple: true` for category questions\.#Shape: one or two questions with 4-6 options each. Put `multi: true` on each category question object.# # Plan lanes and the checker name an exact discovered worker agent, never a model-map role label. -s#per the \*\*swarm\*\* skill, on the `swarm workers` model \(default `grok-[^`]+`\)#per the **swarm** skill, using exact discovered worker agents. Inspect each agent's frontmatter or `task.agentModelOverrides[]` for its model# +s#per the \*\*swarm\*\* skill, on the `swarm workers` model \(default `[^`]+`\)#per the **swarm** skill, using exact discovered worker agents. Inspect each agent's frontmatter or `task.agentModelOverrides[]` for its model# s###g s#with the model filled in#with the exact discovered agent name filled in#g # Cursor's per-item pseudo-spawns become real batches or one-item calls. @@ -181,6 +182,8 @@ s#^Spawn one investigator per category that has a matching MCP\.#Assign one inve s#An event to watch \(CI, a merge, a ref advancing\) gets a watcher subagent that wakes you on the event,#For an event to watch (CI, a merge, a ref advancing), start one watcher in one `task` call with one item in `tasks[]`, the required shared `context`, and an exact discovered watcher agent; omit `agent` for the default worker with the watcher role when no specialist is discovered. It wakes you on the event,# s#^- \[ \] Spawn one owner per PR with the full lifecycle the execution playbook names\.#- [ ] Start all owners in one `task` call with all items in `tasks[]`, the required shared `context`, and one exact discovered owner agent per independent PR; omit `agent` for the default worker with the owner role when no specialist is discovered. Give each owner the full lifecycle the execution playbook names.# s#One subagent per PR, not batched, each a Cursor cloud agent, each exercising the real surface#Start all PR verifiers in one `task` call with all items in `tasks[]` and the required shared `context`; each item uses an exact discovered reviewer agent, or omits `agent` for the default worker with the reviewer role, and requests an isolated subagent. Each verifier exercises the real surface# +# Recall's shared-record sweep spawns its own investigators now that why has none to hand it. +s#Spawn one investigator subagent per source, in agent mode because readonly strips MCP access, and ask each#Start one investigator per source in one `task` call with all items in `tasks[]` and the required shared `context`. Each needs its source's MCP tools, which omp task agents inherit, so pick workers that expose them. Ask each# ## 2. Model slugs. Tiered by capability first, then a catch-all for anything upstream adds later. @@ -194,8 +197,12 @@ s#`gpt-[0-9.]+-sol-[a-z]+`#your strongest instruction-following model#g s#`grok-[0-9.]+-([a-z]+-)?fast(-[a-z]+)?`#your fast code model#g # The same family under Cursor's provider prefix, effort token in the middle. s#`cursor-grok-[0-9.]+-([a-z]+-)?fast`#your fast code model#g -# Catch-all for a slug no tier above knows. Two hyphen groups required, so an illustrative -# `gpt-4` rename example is not a prescription and survives. omp-port reports what this rewrote. +# Cursor's fast slug in a Claude family, effort token in the middle -> the fast code capability. +s#`claude-[a-z]+-[0-9.-]+-([a-z]+-)?fast`#your fast code model#g +# Cursor's third-vendor panel slug -> the capability a panel uses it for. +s#`gemini-[0-9.]+-[a-z]+-[a-z]+`#your strongest model from another vendor#g +# Catch-all for a slug no tier above knows. Two hyphen groups required, so a short illustrative +# name such as `gpt-4` is not read as a prescription. omp-port reports what this rewrote. s#`(claude|gpt|grok|gemini|opus)-[a-z0-9.]+-[a-z0-9.-]+`#your configured model for this role#g ## 3. Remaining exact task text and generated frontmatter. @@ -567,8 +574,6 @@ s#the system prompt names (the|this) path#`history://` is the documented sur # omp discovers skills one level under the root; the nested shape this prescribes is explicitly # not discovered, so the skill it produces silently never registers. -# The `how` skill has no modes. It branches on Step 2a Explore / Step 2b Direct Explain. - # Unqualified force-push blocks the port's own rebase flow, which `pstackpolicy` explicitly permits # and `autopilot-stack` prescribes. Scope the pause the way the rest of the port scopes it. s#force-push, delete production data, send external messages#force-push to a shared or trunk branch, delete production data, send external messages# diff --git a/omp-port/slug-allowlist.txt b/omp-port/slug-allowlist.txt index c110ce8..2d02f3e 100644 --- a/omp-port/slug-allowlist.txt +++ b/omp-port/slug-allowlist.txt @@ -2,4 +2,3 @@ # The pattern name is slug, caps, or residue. An entry covers that one pattern on that one line. # A slug belongs here only when it is illustrative prose, never a model prescription. # Line numbers are the built tree's, so re-point them whenever rules.sed changes a line count. -skills/reflect/references/synthesizer.md:28 slug example of a code-change description, not a model choice diff --git a/omp-port/stale-exempt.tsv b/omp-port/stale-exempt.tsv index 7f505ba..28d3d92 100644 --- a/omp-port/stale-exempt.tsv +++ b/omp-port/stale-exempt.tsv @@ -4,7 +4,7 @@ # rule above it and an exemption that silently stops applying turns the gate green for a reason # nobody can reconstruct. # -# Re-checked at: c742dd6 (pin). Every rule below was applied in isolation to the raw upstream +# Re-checked at: bf0c7cd (pin). Every rule below was applied in isolation to the raw upstream # extract and confirmed to change nothing. That is the intersection that distinguishes stale from # merely shadowed. `d`, `a` and addressed rules are probed on their address the same way. # @@ -20,11 +20,10 @@ So `small` turns `claude-[a-z0-9.-]+` into `claude-[a-z0-9 forward-compat net: t ^- `readonly`: `true`$ forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. ^- `readonly`: `false` \(agent mode\)\. \*\*Do not use rea forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. ^- `readonly`: `false` \(agent mode\)\. The synthesizer's forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. -Work like a careful, cautious, precise investigator\. superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -Spawn one Task subagent that explores and explains in one superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -Once all explorers have returned, spawn one Task subagent superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -Spawn one synthesizer subagent: superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -Launch all matching investigators in a single message so t superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. +Work like a careful, cautious, precise investigator\. upstream removed why's investigator prompt at bf0c7cd; retain the read-only brief if that sentence returns. +Once all explorers have returned, spawn one Task subagent upstream removed how's explorer synthesis at bf0c7cd; retain the one-item call translation if that sentence returns. +Spawn one synthesizer subagent: upstream removed why's synthesizer step at bf0c7cd; retain the one-item call translation if that sentence returns. +Launch all matching investigators in a single message so t upstream removed why's investigator fan-out at bf0c7cd; retain the one-call batch translation if that sentence returns. ^Spawn one reviewer per configured model to adversarially forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. Spawn all N subagents in one message with `run_in_backgrou forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. Reviewers need MCP access for context lookups \(tickets, c superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. @@ -33,9 +32,8 @@ there is no task `readonly` field\. Use forward-compat net: the left side is a The synthesizer returns a structured Accepted / Rejected / superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. ^- `model`: the configured `interrogate reviewers` entry, forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. `subagent_type`: `([^`]+)` forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. -^Spawn one investigator per category that has a matching M superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. +^Spawn one investigator per category that has a matching M upstream removed why's investigator fan-out at bf0c7cd; retain the assignment translation if that sentence returns. One subagent per PR, not batched, each a Cursor cloud agen superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -`claude-fable-[0-9.-]+(-(thinking-)?[a-z]+)?` forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. `gpt-[0-9.]+-sol-[a-z]+` forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. `cursor-grok-[0-9.]+-([a-z]+-)?fast` forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. One Cursor cloud agent superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. @@ -61,12 +59,12 @@ the `arena cross-judge pool` line in the `pstack-models\.m forward-compat net: t the `swarm workers` model and speed \(your fast code model forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. the `interrogate reviewers` line in the `pstack-models\.md forward-compat net: the left side is a Cursor wire token or path that upstream does not emit today. The rule earns its place by not firing, because it is the only thing standing between that text and a Cursor API in the tree. the `architect runners` line in the `task\.agentModelOverr superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -`agent`: an exact discovered (how explorer|how explainer) superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. +`agent`: an exact discovered (how explorer|how explainer) upstream removed the how explorer and explainer role lines at bf0c7cd; retain the second-order rewrite if either line returns. re-read this playbook from trunk with `git show origin/mai superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. Re-read the execution playbook from trunk and the armed /g superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. - `Read` tool calls against any superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. - `Task` prompts that name a skill path superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. -Use Glob to find directories and files, Grep to find key s superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. +Use Glob to find directories and files, Grep to find key s upstream removed how's explorer prompt at bf0c7cd; retain the lowercase tool names if that sentence returns. If the bottom PR is mergeable now, squash it with superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. push with `--force-with-lease` only after an `ls-remote` c superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. 4\. \*\*Prepare only the bottom PR\.\*\* Fetch current tru superseded: upstream reworded this sentence and a different rule now covers the current phrasing. Kept because the reword is cheap for upstream to undo. @@ -100,3 +98,19 @@ irreversible actions \(force-push to shared branches, deploys, deletions, closin PR closes and retargets go through the stacker only\. upstream removed Orchestrate's stacker routing sentence at c742dd6; retain the consent clause if that sentence returns. s#the full Task schema#the live `task` schema#g upstream removed every "the full Task schema" phrase at c742dd6; retain the lowercase `task` translation if that phrase returns. /^- `subagent_type`: `generalPurpose`$/d forward-compat net: deletes the Cursor role bullet the how and why skills carried, which upstream does not emit today. If it returns, the `subagent_type` token rules would otherwise turn it into an `agent`: `generalPurpose` line naming an agent omp does not have. +Every spawn is a Task subagent with `subagent_type: generalPurpose` upstream removed how's spawn-contract paragraph at bf0c7cd, when how became one explainer; retain the one-call translation if that paragraph returns. +Every spawn is `generalPurpose` with `readonly: false` upstream removed why's spawn-contract paragraph at bf0c7cd, when why became one paragraph; retain the MCP-inheritance translation if that paragraph returns. +`why investigators` line, default `[^`]+`\. upstream removed why's inline investigator model at bf0c7cd; retain the exact-agent translation if that sentence returns. +`why synthesizer` line, default `[^`]+`\. upstream removed why's inline synthesizer model at bf0c7cd; retain the exact-agent translation if that sentence returns. +Each spawn below names a role line in the `pstack-models upstream removed why's per-spawn model paragraph at bf0c7cd; retain the live-roster translation if that paragraph returns. +Spawn all explorers in a single message, upstream removed how's explorer fan-out at bf0c7cd; retain the one-call batch translation if that sentence returns. +`model`: the `([^`]+)` line#`agent` upstream removed the last `model`: the line field, in why, at bf0c7cd; retain the token net if that field returns. +matching MCP, all in a single message upstream removed why's investigator fan-out at bf0c7cd; retain the one-call batch translation if that sentence returns. +Spawn one synthesizer\.# upstream removed why's synthesizer step at bf0c7cd; retain the one-item call translation if that sentence returns. +`grok-[0-9.]+-([a-z]+-)?fast(-[a-z]+)?` upstream replaced every grok default with Claude and Gemini slugs at bf0c7cd; retain the fast-code tier if a grok slug returns. +list the available MCPs from the Cursor environment upstream removed why's MCP discovery step at bf0c7cd; retain the mcp.json translation if that sentence returns. +the `how (explorer|explainer)` line upstream removed the how explorer and explainer role lines at bf0c7cd; retain the exact-agent translation if either line returns. +(Spawn one explainer that explores and explains in one pass, built from upstream removed how's simple path at bf0c7cd; retain the one-item call translation if that sentence returns. +(spawn one explainer with `references/explainer-prompt upstream removed how's explorer synthesis at bf0c7cd; retain the one-item call translation if that sentence returns. +Use Read, Grep, and Glob as needed upstream removed how's explainer prompt at bf0c7cd; retain the lowercase tool names if that sentence returns. +open files, recent edits, cursor location, what was just discussed upstream removed why's vague-target step at bf0c7cd; retain the editor-free context list if that sentence returns. diff --git a/omp-port/swallow.tsv b/omp-port/swallow.tsv index b64b08a..3095892 100644 --- a/omp-port/swallow.tsv +++ b/omp-port/swallow.tsv @@ -6,13 +6,13 @@ # rule or record the new hash with why dropping it is right. The fragment is matched as a literal # substring of the rule's own line, as in stale-exempt.tsv. # -# Reviewed at: c742dd6 (pin). +# Reviewed at: bf0c7cd (pin). s#^1\. Spawn `Task` with `subagent_type: "comment-sicko"`\. eb4ea6b2a22965ff2a04bc18af39e26e6ddf2eddcee544738f4ac57d47687ff4 no-comments' one-line spawn step. Its scope, its reasoning source, and its "do not restate the rules" each reappear in the replacement in omp terms; the rest is Cursor's `Task` and `subagent_type`. -s#^Every spawn is a Task subagent with `subagent_type: generalPurpose` e4ddbfe1af2dc3c5562c26353c4912cf72560fc1e6c20174cc226ace95cf3e95 how's spawn contract is Cursor model plumbing end to end: `subagent_type`, `readonly`, the per-role model lines, and the slug fallback. The replacement is omp's whole contract for the same spawns. -s#^Every spawn is `generalPurpose` with `readonly: false` 3701c9bd247551ee595db114a1f24002d3ba5fb2ecf2174c2bc44c3fdbde3b99 why's spawn contract: Cursor's agent mode and why readonly strips MCP. On omp MCP tools are inherited and posture lives in the brief, which the replacement says, keeping "investigators write nothing". +s#^Every spawn is a Task subagent with `subagent_type: generalPurpose` e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 matches nothing since bf0c7cd removed how's spawn-contract paragraph; stale-exempt.tsv keeps the rule as a net. The empty hash makes its return a review, not a silent drop. +s#^Every spawn is `generalPurpose` with `readonly: false` e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 matches nothing since bf0c7cd removed why's spawn-contract paragraph; stale-exempt.tsv keeps the rule as a net. The empty hash makes its return a review, not a silent drop. s#^Each reviewer gets `subagent_type: generalPurpose`, `readonly: true`, and `model` set to its configured entry, e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 matches nothing since ab1f702 removed the sentence; stale-exempt.tsv keeps the rule as a net. The empty hash makes its return a review, not a silent drop. -s#^\*\*Match the model to the job\.\*\* 801f64a121262c1e05986d6ad25efbd4a2b414b22531bfa5469fd273359065c9 the router's per-spawn slug tuning. c742dd6 added six sentences on rejected slugs and fallbacks. omp's task item takes no model, so there is no slug to reject; the replacement keeps the one omp lever, a per-spawn `effort` where the schema has it. +s#^\*\*Match the model to the job\.\*\* 91ab9054b42a63bc2746c85246b17719454d6654b884a159510239593a62c174 the router's per-spawn slug tuning. c742dd6 added six sentences on rejected slugs and fallbacks. bf0c7cd added Cursor's slug ladder: high as a default level, max for `hardest tasks`, Fable as its own family, and which levels and fast variants Gemini and Fable 5.2 lack. omp's task item takes no model, so there is no slug to tune or reject; the replacement keeps the one omp lever, a per-spawn `effort` where the schema has it. s#^2\. Run \[`/setup-pstack`\] 4b08daf74512955b83a4bdcfe0a1cfcf8b8430fae65a2669bd61acf2ececcde2 poteto-help's setup step describes Cursor's rule file and new-chat activation. setup-pstack is excluded, so the replacement says models need no configuration, links the omp-mechanics model note, and keeps both verification-skill offers. s#^- No `~/\.cursor/rules/pstack-models\.mdc` means 01bb794d2319efc4873978ecbbd68ec87f8680e523c82858af06d9eceb7d3649 one bullet whose only claim is about Cursor's rule file. The replacement says what a missing override means on omp. s#^If cost is the worry, say where the tokens go and how to spend fewer\. 48ba7e30ee8918b4cfd4a03e24bd26f16007ccfa68b77d496baf2b1a71c059e8 poteto-help's cost answer. The replacement keeps panels cost tokens, cheaper models through the omp-mechanics model note, unset overrides inherit, and save the router for rigor. It drops the shorter panel list, which was a setup-pstack setting. @@ -24,14 +24,14 @@ s#^\| The mode stopped applying after a few turns \| 3d0b3d44d05cce8834189811e41 s#^\| A new model choice had no effect \| d55bbd9e357ccf440a0e3eb4148e99f170bffa05a496621c3bda632ef76f9cee troubleshooting row about Cursor's rule applying to new chats. The replacement checks the exact override and the loaded agent, and keeps the new-session step. s#^\| A skill didn't load on its own \| 9f05aa9e3a0b89320e71962276e9fc0c43f05e9395627e4024100ad5cdb57c83 troubleshooting row about Cursor's word-triggered loading. The replacement describes /skill: invocation and the per-turn index. s#^Without `/poteto-mode`, a phrase such as 8a16ef1b3f73471269fe965c53193679ada5931ce9172f24adf5af4168ccd208 names Cursor's own babysit skill as the competing route. The replacement keeps the Playbooks pointer and the guide link, marked as upstream background. -s#^Other tools can read the skills, because they use the Agent Skills format 1d2685690b6f21fcaf444a6ebd0d6423458bcc00ee1fdbcb936f0e62b85a8b0e portability caveat about Cursor subagents, Custom Modes and /loop. On omp those parts run, and the replacement says which skills map them. -s#^\*\*Use `subagent_type: "poteto-agent"` for any subagent you spawn inside a playbook step\*\* 7991e819c6e27a06bf9f0070a9252685c689b462a9a47a8d2ab660ea984c1f4a the router's poteto-agent spawn rule and its `subagent_type` deference. The replacement is the omp delegation contract, where bundled agent names are optional. -s#^\*\*Defaults for every `Task` call\.\*\* `run_in_background: true` 72d0bb18be01463dae5f89dcfe0c51dc1251ad1beac0c89e8c12a5a93a27e6cc Cursor's per-call Task defaults and model tiers. c742dd6 added "(a steer or resume of a running agent too, because a foreground call holds your turn while other reports wait)". omp's task has no background flag and `write agent://` never blocks, so that clause has nothing to act on; every other sentence is a Cursor field or slug the replacement maps to frontmatter and task.agentModelOverrides. +s#^Other tools can read the skills, because they use the Agent Skills format 768b85e605e9fc434b48812a3509c75c1e89221bb69dc6e939d429b2df9ee714 portability caveat about Cursor subagents, Custom Modes and /loop. bf0c7cd dropped `/why` from its list and narrowed per-role models to some skills. On omp those parts run, and the replacement says which skills map them. +s#^\*\*Use `subagent_type: "poteto-agent"` for any subagent you spawn inside a playbook step\*\* 739de985d3ee7f62601bae462b182ac9159e9fd16470a1ed5c7039e8f9cc08ca the router's poteto-agent spawn rule and its `subagent_type` deference. bf0c7cd dropped `how` and `why` from the deferring skills, which no longer spawn diverse reviewers. The replacement is the omp delegation contract, where bundled agent names are optional and names no skill list. +s#^\*\*Defaults for every `Task` call\.\*\* `run_in_background: true` 88a024599eb737b3b5db8ada1c96a52f9a5b6104e0965bc58c4b311aab199045 Cursor's per-call Task defaults and model tiers. c742dd6 added "(a steer or resume of a running agent too, because a foreground call holds your turn while other reports wait)". omp's task has no background flag and `write agent://` never blocks, so that clause has nothing to act on. bf0c7cd moved every default to Claude and Gemini slugs, named the `hardest tasks` and `swarm workers` lines as the tiers, and added two sentences: review and design panels default to one runner on each of three families, which the replacement carries as three runners on distinct configured families; and a setup rule without `# defaults: 2` came from an older `/setup-pstack`, which has no omp counterpart because setup-pstack is excluded and omp has no rule file to version. Every other sentence is a Cursor field or slug the replacement maps to frontmatter and task.agentModelOverrides. s#^4\. Mid-run discoveries( that support the goal)? are yours\. ab11dc7947ebfb6ff92b9cae04ef9c28c773288baed215a1a411269d6ef1f90e autonomous-run step 4, restated sentence for sentence with "open a user question" for Cursor's `AskQuestion`. s#^One message, three `Task` calls, `subagent_type: generalPurpose` 0653ed978a05cc476f0ac6b0cc1e96b4f177b80f42437420dcc64d251335d0c4 reflect's three-reviewer spawn line and why readonly strips MCP. The replacement starts the three lenses in one call and keeps read-only MCP citation checks. s#^One `Task` call, `subagent_type: generalPurpose`, `model` from the `reflect judgment 917e984161e8a5d79021185891f1f9649cef384af1b978f555e3bdd47b3eb3ed reflect's synthesizer spawn. The replacement keeps the spot-check, the pass-verbatim instruction and the Accepted / Rejected / Backlog return; only Cursor's fields and slug go. -s#^3\. Pick the runners\. Use the `arena runners` line e98b0f239c70cdd68d1dec4b37a1b59589a210a4f7c763a16f5f20082543a084 arena's runner selection by Cursor slug, family prefix and seat fallback, up to "Spawn more runners when", which the rule keeps. The replacement picks exact discovered agents and reports weaker diversity. -s#After all Phase B candidates complete, choose one model from the `arena cross-judge pool` 6702ac211319ba1442359331236ccc5c8be0719cca9970e486301274728a72bd arena's cross-judge pool by Cursor slug. The replacement keeps the other-family judge, the skip-and-say-so fallback, and the unknown-parent case. +s#^3\. Pick the runners\. Use the `arena runners` line 1954e06ec8114b8172d3fd8d099ebf88f7c626d8f525b31bbb774453af25113d arena's runner selection by Cursor slug, family prefix and seat fallback, up to "Spawn more runners when", which the rule keeps. bf0c7cd raised the default to three runners, made families longest-prefix with `claude-fable-*` apart from `claude-*`, and kept the two-runner floor. The replacement carries three by default and never fewer than two, picks exact discovered agents, and reports weaker diversity; prefix parsing and slug fallback have no omp counterpart. +s#After all Phase B candidates complete, choose one model from the `arena cross-judge pool` 2939e6fe7316653a72b0bd0946772a73f841d5d6beaf119c551f1525352b6ca7 arena's cross-judge pool by Cursor slug. bf0c7cd changed the judge test from family to vendor, where `claude-fable-*` and `claude-*` are one vendor. The replacement carries the vendor test with the Claude example, the skip-and-say-so fallback, and the unknown-parent case, now the vendor check; the per-slug pool order and default-pool retry are Cursor slugs. s#^Before fanning out, find this conversation's transcript in the `agent-transcripts/` directory e2e15be3f3a92fdcdede0da60ba3132d6fb575d5cfb1fe9a1739e087bbb26165 reflect's locate step names Cursor's transcript directory. The replacement routes through the session-store reference and keeps "never unrelated workspace chats". s#^ls -t / f19dc3aba071e9eeb50b6222a982d208ea954f2c489f6822be79b1fa791906bc a listing over Cursor's three transcript layouts. omp has one layout, and the replacement globs it. s#^That covers the legacy flat \(`\.jsonl`\) 69006b8af954c9f258f0d118ef570c1b2312d80f222eab1e18218cf566024fd6 Cursor's layouts and first-line prompt check. omp's first lines are a title slot and a session header, which the replacement handles, keeping the digest fallback. diff --git a/plugins/pstack/agents/comment-sicko.md b/plugins/pstack/agents/comment-sicko.md index 5d17d8c..a368bf1 100644 --- a/plugins/pstack/agents/comment-sicko.md +++ b/plugins/pstack/agents/comment-sicko.md @@ -23,7 +23,7 @@ That list is my only leash. When I am not sure a keep clause applies, the commen `eslint-disable`, `@ts-ignore`, `@ts-expect-error`, and similar suppressions stink. Look up the rule. If it catches real bugs or protects correctness or safety, kill the suppression and mark the exact guilty symbol `MUST KILL`. -`IMPORTANT`, `do not remove`, `too risky`, `fine for now`, and long justifications are scent, not conviction. Before judging, I read nearby code. If its claim is not obvious there, I run `/skill:how`, `/skill:why`, or both from the **how** and **why** skills on the named symbol or call. Only a foreign keep-list gotcha proven true today on a live path crawls away. Our-code surprises die with the reshape flag above. Doubt after the hunt is meat. +`IMPORTANT`, `do not remove`, `too risky`, `fine for now`, and long justifications are scent, not conviction. Before judging, I read nearby code. If its claim is not obvious there, I trace the named symbol or call, run `/skill:why` from the **why** skill on it, or both. Only a foreign keep-list gotcha proven true today on a live path crawls away. Our-code surprises die with the reshape flag above. Doubt after the hunt is meat. A long justification without a proven keep-list exception is a confession. Kill it. Never polish meat into a shorter alibi. Mark the exact guilty symbol `MUST KILL`. My kill ends there. I do not touch the code. diff --git a/plugins/pstack/package.json b/plugins/pstack/package.json index e66f3f3..066609c 100644 --- a/plugins/pstack/package.json +++ b/plugins/pstack/package.json @@ -1,6 +1,6 @@ { "name": "pstack", - "version": "0.15.3601", + "version": "0.15.4200", "license": "MIT", "omp": { "extensions": [ diff --git a/plugins/pstack/skills/architect/SKILL.md b/plugins/pstack/skills/architect/SKILL.md index fd95ff9..ce8100a 100644 --- a/plugins/pstack/skills/architect/SKILL.md +++ b/plugins/pstack/skills/architect/SKILL.md @@ -20,7 +20,7 @@ Open a todolist with one entry per phase before starting. ## Phase A: Ground the problem -Build a real mental model of every system the new code touches. Run the **how** skill over the relevant subsystems. Naming a file isn't grounding. Produce the architectural explanation `how` prescribes. If the design redefines ownership or layering, also run the **why** skill on the existing shape so the rationale becomes a constraint, not a guess. +Build a real mental model of every system the new code touches. Trace the relevant subsystems. Naming a file isn't grounding. Write an architectural explanation of each. If the design redefines ownership or layering, also run the **why** skill on the existing shape so the rationale becomes a constraint, not a guess. Skip Phase A only when the work is genuinely greenfield with no surrounding system to integrate. @@ -69,7 +69,7 @@ Use judgment. A few edge cases don't condemn an architecture. Some problems are When you scrap: -1. Re-run the **how** skill over what's been built. +1. Trace what's been built. 2. Redesign as if the new constraints had been day-one assumptions, per redesign-from-first-principles. 3. Subtract before adding, per the **subtract-before-you-add** principle skill. The new sketch should be smaller than the old one before it grows. 4. Return to Phase B and re-run arena. diff --git a/plugins/pstack/skills/arena/SKILL.md b/plugins/pstack/skills/arena/SKILL.md index 59fc306..aac5223 100644 --- a/plugins/pstack/skills/arena/SKILL.md +++ b/plugins/pstack/skills/arena/SKILL.md @@ -14,7 +14,7 @@ Every candidate gets the same prompt, so the prompt is the contract. 1. State the artifact each candidate is producing. 2. Derive the rubric, 3-6 concrete gradeable criteria for what success looks like on *this* task. It is the picker's tool in Phase D. Candidates only see the task. -3. Pick the runners. Resolve exact discovered agent names and inspect each agent's frontmatter or `task.agentModelOverrides[]`. Prefer distinct configured model families when the roster supplies them; otherwise keep the independent contexts and report weaker model diversity. A model override cannot create an agent. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Use the reasoning and speed already selected by agent frontmatter or exact `task.agentModelOverrides` entries. Do not change operator configuration to satisfy a skill example. +3. Pick the runners. Run three by default, and never fewer than two. Resolve exact discovered agent names and inspect each agent's frontmatter or `task.agentModelOverrides[]`. Prefer distinct configured model families when the roster supplies them; otherwise keep the independent contexts and report weaker model diversity. A model override cannot create an agent. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Use the reasoning and speed already selected by agent frontmatter or exact `task.agentModelOverrides` entries. Do not change operator configuration to satisfy a skill example. 4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-/candidate-/`), per the **separate-before-serializing-shared-state** principle skill. ## Phase B: Fan out @@ -25,7 +25,7 @@ If a candidate produces no output, proceed with N-1 and note the dropout. ## Phase C: Cross-judge -After all Phase B candidates complete, choose an exact discovered judge agent whose configured model is from a different family than the parent's. An agent with no override and no frontmatter model inherits the parent's model, so it never judges. Start the judge in one `task` call with one item in `tasks[]`, the required shared `context`, and that exact agent name. Its frontmatter or `task.agentModelOverrides[]` selects the model; the task item has no `model` field. The brief carries read-only posture and forbids writes; there is no task `readonly` field. If no judge from another family can run, skip the cross-judge, pick the base alone in Phase D, and say so. If you do not know the parent's model, choose a judge whose model its frontmatter or exact override sets, and say that the family check did not run. The judge sees the rubric and the candidates by path label, scores each criterion, and recommends a base with rationale. It runs in parallel with your reading in Phase D. Don't spawn it while candidates are still writing. +After all Phase B candidates complete, choose an exact discovered judge agent whose configured model is from a different vendor than the parent's. Two model families from one vendor, such as two Claude lines, count as one vendor. An agent with no override and no frontmatter model inherits the parent's model, so it never judges. Start the judge in one `task` call with one item in `tasks[]`, the required shared `context`, and that exact agent name. Its frontmatter or `task.agentModelOverrides[]` selects the model; the task item has no `model` field. The brief carries read-only posture and forbids writes; there is no task `readonly` field. If no judge from another vendor can run, skip the cross-judge, pick the base alone in Phase D, and say so. If you do not know the parent's model, choose a judge whose model its frontmatter or exact override sets, and say that the vendor check did not run. The judge sees the rubric and the candidates by path label, scores each criterion, and recommends a base with rationale. It runs in parallel with your reading in Phase D. Don't spawn it while candidates are still writing. ## Phase D: Pick a base diff --git a/plugins/pstack/skills/blast-radius/SKILL.md b/plugins/pstack/skills/blast-radius/SKILL.md index b296cce..1f5c951 100644 --- a/plugins/pstack/skills/blast-radius/SKILL.md +++ b/plugins/pstack/skills/blast-radius/SKILL.md @@ -30,10 +30,10 @@ Step 4 is usually one small script that imports the same library the app ships a ## Steps -1. Read the change. The diff, the symbols it adds, changes, and deletes, and what it now does differently, including the part the diff doesn't spell out. Use `why` step 2 to pull the PR and commits. +1. Read the change. The diff, the symbols it adds, changes, and deletes, and what it now does differently, including the part the diff doesn't spell out. Pull the PR and its commits. 2. Find the one fact it's safe because of. Most changes that look risky are safe because of a single fact, like "this call only drops already-dead cache entries and does nothing else". Find that fact. If it holds, most risky cases are cleared at once. Spend your time here, not on a long list of maybes. 3. Look where grep stops. Read the source of the library you call, and check its pinned version and any local patch. Work out when things run: microtasks, unmount and teardown, Solid versus React. Follow what a symbol search misses: the JSON an API returns, a DB column, a wire format, another language reading the same bytes, a feature flag, code three hops downstream. -4. Be honest about each risk. Give it a real chance of happening and a real cost if it does. Keep the risks you confirmed. List the ones you checked and cleared separately. Same rules as `why`. Cite a real `file:line`, a search that finds nothing is still an answer, and never make up a caller or an API. +4. Be honest about each risk. Give it a real chance of happening and a real cost if it does. Keep the risks you confirmed. List the ones you checked and cleared separately. Cite a real `file:line`, a search that finds nothing is still an answer, and never make up a caller or an API. 5. Prove the one fact. Write a script or test that runs the real code, run it, and paste what happened. 6. For a big or wide change, run it as an `arena`. Ask more than one model the same question and merge the answers. Different models catch different real bugs. diff --git a/plugins/pstack/skills/how/SKILL.md b/plugins/pstack/skills/how/SKILL.md index b1cccab..f187258 100644 --- a/plugins/pstack/skills/how/SKILL.md +++ b/plugins/pstack/skills/how/SKILL.md @@ -6,31 +6,16 @@ disable-model-invocation: true # How -Explore the codebase to answer "how does X work?" questions. Produce architectural explanations at the level of a senior engineer onboarding onto a subsystem, enough to build a working mental model, not so much that it reads like annotated source code. - -Every delegation uses one `task` call with the required shared `context` and all independent items in `tasks[]`. Resolve exact agent names against the live roster, not configuration keys. Repository explorers use a discovered `scout`; explainers use a discovered explainer or omit `agent` for the default worker with the explainer brief. Each item's `task` is standalone and carries its angle and prompt template. All work is read-only. Models, reasoning, and speed come from agent frontmatter or `task.agentModelOverrides[]`, never per-call model fields or family fallbacks. Overrides cannot create agents. - -## 1. Assess complexity +Explore the codebase to answer "how does X work?" questions. If the scope is ambiguous, state your interpretation and explore. The user can redirect. -- **Simple** (a single module, a small utility, a narrow question such as "how does function X work"): no explorers. Spawn one explainer that explores and explains in one pass, built from `references/explainer-prompt.md` without the explorer-findings section. Start it in one `task` call with one item in `tasks[]` and the required shared `context`. Go to step 4. -- **Complex** (a subsystem spanning multiple files or services, a cross-cutting feature, a full architectural overview): go to step 2. - -When in doubt, take the simple path. - -## 2. Explore (complex only) - -Decompose the question into 2 to 4 angles, each a distinct slice of the subsystem. Start all explorers in one `task` call with the required shared `context` and all independent items in `tasks[]`, each with `references/explorer-prompt.md` and its angle filled in. - -## 3. Synthesize (complex only) - -Once all explorers have returned, spawn one explainer with `references/explainer-prompt.md` and every explorer's findings filled in. Start it in one `task` call with one item in `tasks[]` and the required shared `context`. +## 1. Explain -## 4. Present +Start one explainer in one `task` call with one item in `tasks[]` and the required shared `context`. Use an exact discovered explainer agent when the live roster has one; otherwise omit `agent` for the default worker. It explores and explains in one pass, and its brief carries read-only posture, since there is no task `readonly` field. Give it the user's question and this brief: -Present the explainer's output. Light edits for clarity or context from the conversation are fine. Do not substantially rewrite it. +> You are writing an architectural explanation for a senior engineer. Explore the codebase and write an explanation that a senior engineer unfamiliar with this area could read and walk away with a solid mental model. They should understand the architecture well enough to start working in it confidently. You have read-only access to the codebase. -## Output format +## 2. Present -The explanation uses the sections defined in `references/explainer-prompt.md`, dropping any that do not apply: Overview, Key Concepts, How It Works, Where Things Live, Gotchas. +Present the subagent's output. Light edits for clarity or context from the conversation are fine. Do not substantially rewrite it. diff --git a/plugins/pstack/skills/how/references/explainer-prompt.md b/plugins/pstack/skills/how/references/explainer-prompt.md deleted file mode 100644 index f975bee..0000000 --- a/plugins/pstack/skills/how/references/explainer-prompt.md +++ /dev/null @@ -1,55 +0,0 @@ -# Explainer Prompt Template - -Build the explainer subagent's prompt from this template. Fill in the placeholders. - ---- - -You are writing an architectural explanation for a senior engineer. Multiple explorer agents have traced different slices of the codebase in parallel and gathered findings. Synthesize their findings into one coherent, well-structured explanation. - -## Original Question - -> {QUESTION} - -## Explorer Findings - -{EXPLORER_FINDINGS_ALL} - -## Instructions - -The explorers each investigated a different angle of the same subsystem. Their findings will overlap in places and may occasionally contradict. Reconcile them. Merge overlapping descriptions, resolve contradictions by checking the code yourself, and combine the separate slices into a unified picture. - -Write an explanation a senior engineer unfamiliar with this area could read and walk away with a solid mental model, understanding the architecture well enough to start working in it confidently. - -You have read-only access to the codebase to check anything, clarify a detail, or fill a gap. Use `read`, `grep`, and `glob` as needed. The explorers did the work, so you shouldn't need to re-explore from scratch. - -## Output Format - -Use this structure, adapted to what makes sense for the question. Not every section is needed for every question. - -### Overview -1-2 paragraphs. What is this thing, what does it do, why does it exist. Someone should be able to read just this and decide whether to keep reading. - -### Key Concepts -The important types, services, or abstractions needed to follow the rest. Brief definitions, not exhaustive. - -### How It Works -The core of the explanation, and the longest section. Walk through the flow: what triggers it, what happens step by step, where data goes, what the decision points are. - -Use prose, not pseudocode. Reference specific files and functions so the reader knows where to look, but don't dump large code blocks unless a snippet is essential to a point. - -When the flow involves multiple components talking to each other, or data transforming through stages, include a diagram. Use mermaid (```mermaid) for structured flows (sequence diagrams, flowcharts, component graphs) or ASCII art for simpler relationships where mermaid would be overkill. Use your judgment. A diagram should clarify, not decorate. If prose covers the flow, skip the diagram. - -### Where Things Live -A brief file/directory map. Just the ones someone would need to start working here. - -### Gotchas -Non-obvious things, surprising behavior, historical context, pitfalls. Skip this section if there's nothing worth calling out. - -## Communication Style - -- Use concrete language, not abstractions-about-abstractions -- Say "the `UserService` calls `AuthClient.refresh()`" not "the service delegates to the client" -- When something is complex, explain why it's complex. Don't just describe the complexity -- When something is simple, don't pad it out -- If there's a helpful analogy, use it. If there isn't, don't force one -- If the explorers flagged open questions or gaps, acknowledge them rather than hiding them diff --git a/plugins/pstack/skills/how/references/explorer-prompt.md b/plugins/pstack/skills/how/references/explorer-prompt.md deleted file mode 100644 index 724bacf..0000000 --- a/plugins/pstack/skills/how/references/explorer-prompt.md +++ /dev/null @@ -1,35 +0,0 @@ -# Explorer Prompt Template - -Build each explorer subagent's prompt from this template. Fill in the placeholders. - ---- - -Other explorers are investigating different slices of the same subsystem in parallel. Don't try to cover everything. Focus on your assigned angle and go deep. - -## Question - -> {QUESTION} - -## Your Exploration Angle - -{EXPLORATION_ANGLE} - -## Output - -### Components Found -The key types, services, classes, and abstractions. For each: name, file path, and a one-sentence description of what it does. - -### Flow -The execution flow step by step. For each step: what function/method runs, what file it's in, what it does, what it calls next. Include the data that flows between steps. - -### Files Read -Every file you read during exploration, so the explainer can reference them. - -### Boundaries -Where this subsystem connects to other parts of the codebase. The inputs and outputs. - -### Non-Obvious Things -Anything surprising, historically motivated, or easy to get wrong. Things that look like they should work one way but work another. - -### Open Questions -Anything you couldn't fully trace or understand. Be honest about gaps. diff --git a/plugins/pstack/skills/no-comments/SKILL.md b/plugins/pstack/skills/no-comments/SKILL.md index d3ac3ea..41e3a6d 100644 --- a/plugins/pstack/skills/no-comments/SKILL.md +++ b/plugins/pstack/skills/no-comments/SKILL.md @@ -17,7 +17,7 @@ Use the caller's files or diff. Otherwise use the current diff against the base ## Steps 1. Start one `task` call with one item in `tasks[]` and the required shared `context`. Use the exact discovered `comment-sicko` agent when present; otherwise omit `agent` for the default worker. Resolve the loaded `skill://no-comments` path to its plugin root and put the comment-reviewer role, scope, and absolute `/agents/comment-sicko.md` pointer in the brief. Agent frontmatter or its exact override selects reasoning and speed. Do not restate the reviewer's rules. -2. Inspect its report and diff. Reject application-code edits, scope escapes, exception-protected deletions, misstated `MUST KILL` reasons, and flags that treat kept intentional code as guilty. Reshape flags on our-code surprises stay actionable. Do not restore those comments. A keep survives only with proof it is about something we cannot change. Audit missed scoped lint and TypeScript suppressions. Correctness or safety suppressions stay actionable `MUST KILL`s. Restore deletions only with exact exceptions and scoped proof. Before accepting thin `IMPORTANT` or `do not remove` kills or keeps, run `/skill:how` or `/skill:why` on their symbol. If a kill is ambiguous, do not restore. If a keep is refuted or still ambiguous, delete it. Revert and rerun one rejected report with the failure named. Reject a second, report it open, and fail `/skill:no-comments`. +2. Inspect its report and diff. Reject application-code edits, scope escapes, exception-protected deletions, misstated `MUST KILL` reasons, and flags that treat kept intentional code as guilty. Reshape flags on our-code surprises stay actionable. Do not restore those comments. A keep survives only with proof it is about something we cannot change. Audit missed scoped lint and TypeScript suppressions. Correctness or safety suppressions stay actionable `MUST KILL`s. Restore deletions only with exact exceptions and scoped proof. Before accepting thin `IMPORTANT` or `do not remove` kills or keeps, trace their symbol or run `/skill:why` on it. If a kill is ambiguous, do not restore. If a keep is refuted or still ambiguous, delete it. Revert and rerun one rejected report with the failure named. Reject a second, report it open, and fail `/skill:no-comments`. 3. Fix trivial accepted flags directly by deleting a dead path, dropping a parameter, or using the real API. If any fix needs a shape, run `/skill:architect` once for the accepted set and surrounding code. Stop at the sketch. Architect shapes. Step 4 implements. 4. Implement the smallest root-cause fix in scope. Remove every named workaround. If the root cause is out of scope, land the smallest in-scope fix and report the rest open. The **principle-fix-root-causes** and **principle-redesign-from-first-principles** skills guide intent only. Neither authorizes widening the fence nor fixing instances outside it. Never bolt on symptom guards. 5. Constraint comments say `do not remove`, `do not change wording`, or `talk to X before changing`. Leave keeps about things we cannot change. Offer the cheapest in-scope type, runtime, test, or CI lint. Wait for interactive approval. Unattended and eval require caller pre-approval. If approved, encode then delete. Otherwise delete, report the constraint open, and sketch out-of-scope work. diff --git a/plugins/pstack/skills/poteto-mode/SKILL.md b/plugins/pstack/skills/poteto-mode/SKILL.md index d795c6b..079b2cf 100644 --- a/plugins/pstack/skills/poteto-mode/SKILL.md +++ b/plugins/pstack/skills/poteto-mode/SKILL.md @@ -19,7 +19,6 @@ The Principles section below grounds every trigger. In your reply, name each pri Remaining triggers: - Your first message on a task → tell the user, in your own words, their goal, the problem they are solving, and, if the task ships a change, the smallest change you expect to meet it. Don't wait for confirmation. If the evidence rules out the change the user asked for, show it and stop. Restate the user's goal in each subagent brief, and open each PR's `## Why` with it. Open each final report with it too, your final reply included, except after a fully specified one-line edit. -- Nontrivial change, architecture decision, or "are we sure?" → the **how** skill. - About to `ask` on a "which approach", "how should I", or "what should this do" fork → classify it before you ask. If the answer is a fact you could observe by running something (behavior, timing, layout, output, perf, even whether an eval separates), it is not the human's to answer. Sketch it via the Prototype playbook (`skill://poteto-mode/playbooks/prototype.md`) and let the result decide. If the task is a read-only Investigation whose deliverable is a cited answer, stay in it and answer from the evidence rather than building a sketch. Reserve the question for a genuine product or preference call no experiment can settle. Under a full-autonomy grant, decide a call the grant covers, act on it, and report it, with no reply word and no offer. Under the grant, for a call only the operator can make, apply a default, report it with a full explanation, and say in plain words what the operator could tell you to do instead. The operator answers in their own words. Never give a shorthand token to type back. Gates the operator named and the Always-pause list in Autonomy still need the operator. - Any code → name the data shape first, and choose its organizing structure per **principle-model-the-domain**. - Code crossing a function boundary → the **architect** skill, parallel design exploration before implementing. @@ -95,7 +94,7 @@ Read the leaf skill in full for any principle you apply. Each entry names when i `poteto-mode` selects the playbook, step order, canonical role, and lifecycle protocol. `skill://pstack-omp` is authoritative for every delegation instruction in this catalog, including imported task-shaped examples. Resolve roles against the live roster; bundled agent names are optional, never mandatory. Only pass fields exposed by the current tool schema. -Batch genuinely independent work when supported. Give each participant a standalone brief and explicit write ownership. The root starts additional participants and independent reviewers; ordinary workers do not start children. Runtime role configuration selects models. Preserve required independent contexts and report unavailable model diversity honestly. Do not change operator configuration merely to satisfy a skill example. +Batch genuinely independent work when supported. Give each participant a standalone brief and explicit write ownership. The root starts additional participants and independent reviewers; ordinary workers do not start children. Runtime role configuration selects models. Review and design panels default to three runners, each on a different configured model family when the roster supplies one. Preserve required independent contexts and report unavailable model diversity honestly. Do not change operator configuration merely to satisfy a skill example. Model selection belongs to `task.agentModelOverrides` and agent frontmatter, not to routed-skill task fields. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/bug-fix.md b/plugins/pstack/skills/poteto-mode/playbooks/bug-fix.md index 54659c8..d298ec4 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/bug-fix.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/bug-fix.md @@ -5,7 +5,7 @@ Be scientific. Every shipped line traces to runtime evidence. Belt-and-suspenders that "might help" is a hypothesis, not a fix. It does not ship. When evidence refutes a hypothesis, revert what it motivated. The smallest change the evidence justifies ships, nothing more. 1. Reproduce it yourself on the matching surface via the control skill (Non-negotiables), even when a debug or instrumentation protocol says to ask the user to reproduce. Ask the user only with a stated, specific reason the control surface cannot reach the target, and only after driving it as far as it goes. If it won't reproduce directly, synthesize the trigger, tighten conditions, or instrument until it fires. -2. Binary-search the cause. Form the candidate hypotheses, then rule them out until one survives. Seed them with `how` over the affected subsystem and the **why** skill for regression history. Each pass, take the split that cuts the most remaining problem space, get runtime evidence, eliminate. When program state is unclear, add instrumentation or logging and read it as the code runs. Don't guess. Drive a long or stubborn hunt with omp's `/loop`, which re-submits the same prompt after every yield. State the exit condition as a shell command and pass it as `--until ''`, which gates each iteration on that command's exit status. Confirm the surviving *mechanism* with runtime evidence before the step-3 architect/interrogate fan-out. +2. Binary-search the cause. Form the candidate hypotheses, then rule them out until one survives. Seed them with a trace of the affected subsystem and the **why** skill for regression history. Each pass, take the split that cuts the most remaining problem space, get runtime evidence, eliminate. When program state is unclear, add instrumentation or logging and read it as the code runs. Don't guess. Drive a long or stubborn hunt with omp's `/loop`, which re-submits the same prompt after every yield. State the exit condition as a shell command and pass it as `--until ''`, which gates each iteration on that command's exit status. Confirm the surviving *mechanism* with runtime evidence before the step-3 architect/interrogate fan-out. 3. Plan the fix. If it crosses a function boundary, `architect` first. Delegate implementation to exact discovered writable implementer agents whose frontmatter or `task.agentModelOverrides[]` selects each model. The task item has no `model` field. Prefer distinct configured model families only when the operator's model policy and roster supply them; otherwise keep the exact agents and report weaker model diversity, with a specific scope. 4. Verify on the same surface. The original repro now passes. "Inconclusive" or wrong-surface is not a pass. Flag it. Unit tests show branch behavior, not bug absence. 5. Stage the commits so the failing repro lands before the fix in git history. See the **tdd** skill for the failing-test-first cadence when the bug has a cheap local test path. Skip it when the test would be expensive, integration-heavy, or unclear. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/feature.md b/plugins/pstack/skills/poteto-mode/playbooks/feature.md index 84aec3c..b76ea6d 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/feature.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/feature.md @@ -2,7 +2,7 @@ **You own the design. Plan, review, verify.** Delegate implementation. Stay in the lead. -1. `how` over the affected subsystem. +1. Trace the affected subsystem. 2. `architect` for parallel design exploration. 3. Write the throughput checkpoint as four todo items. A dimension that genuinely does not apply (single file, no fan-out) keeps its item with `n/a: ` rather than being dropped: - **Blocking first steps.** Gates run before fan-out. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/hillclimb.md b/plugins/pstack/skills/poteto-mode/playbooks/hillclimb.md index bed7ea0..72fe333 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/hillclimb.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/hillclimb.md @@ -4,7 +4,7 @@ Core discipline: one change, one measurement, keep or revert. Never stack untested changes, and never claim a win from code inspection (the **prove-it-works** principle skill). -1. Ground the workload and architecture before choosing the metric. Run the **how** skill over the target, name the realistic workload dimensions that can move the result (data size, history, state, concurrency), and select a case that reproduces the user's complaint. If no case reproduces it, fix the repro instead of hillclimbing. Then fix one metric, the direction that counts as better, and a checkable stop predicate that pairs a target with a floor on attempts so a lucky early win can't end the run (the example "at least 50% better than baseline and at least 10 iterations" is this shape). Use the user's numbers when given, otherwise agree them. +1. Ground the workload and architecture before choosing the metric. Trace the target, name the realistic workload dimensions that can move the result (data size, history, state, concurrency), and select a case that reproduces the user's complaint. If no case reproduces it, fix the repro instead of hillclimbing. Then fix one metric, the direction that counts as better, and a checkable stop predicate that pairs a target with a floor on attempts so a lucky early win can't end the run (the example "at least 50% better than baseline and at least 10 iterations" is this shape). Use the user's numbers when given, otherwise agree them. 2. Build the measurement harness, prove its sensitivity, then freeze it (the **build-the-lever** principle skill). Run contrasting realistic workloads and confirm the target case reproduces the symptom while easier cases separate as expected. If the harness cannot distinguish them, revise the workload or metric. Vet the harness with the **benchmark-checklist** skill before you freeze it, and make it print its error count and a count of the work done. Once frozen, one repeatable command emits the metric, sampled enough to clear the noise (median of N, not a single run). Record the baseline metric and a green run of the regression gate (the tests that must keep passing) before any change. 3. Open the decision log via the **show-me-your-work** skill. A `decision.tsv`, one row per attempt: id, hypothesis, change, before, after, delta, tests, verdict (kept or reverted), note. Read it before each attempt. Keep it out of the tree (gitignored). 4. Ground each hypothesis in the architecture model from step 1, so it names a specific mechanism ("defer X off the boot path because it blocks first paint"), not "try memoizing something". For a perf metric, order hypotheses by the performance mantras in step 2 of the Perf issue playbook (`playbooks/perf-issue.md`). Borrow only their order, not that step's stop rule. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/investigation.md b/plugins/pstack/skills/poteto-mode/playbooks/investigation.md index cd119f0..854d56f 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/investigation.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/investigation.md @@ -4,9 +4,9 @@ Investigation requests are read-only. They produce a cited explanation or a recommendation, not a code change. -1. Route through the **how** skill. For motivation questions, also route through the **why** skill. +1. Trace the code the question is about. For motivation questions, also route through the **why** skill. 2. Throughput checkpoint stays one line: `throughput checkpoint: n/a, read-only investigation`. -3. Produce the `how`-shaped output (Overview / Key Concepts / How It Works / Where Things Live / Gotchas), or a recommendation with a tradeoffs table if the request is a decision between alternatives. +3. Produce the output (Overview / Key Concepts / How It Works / Where Things Live / Gotchas), or a recommendation with a tradeoffs table if the request is a decision between alternatives. 4. Apply the **unslop** skill to the reply. No PR, no babysit, no `architect` unless the investigation precedes a code change. If it does, hand back to the user and re-route to Bug fix or Feature. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/multi-phase-plan.md b/plugins/pstack/skills/poteto-mode/playbooks/multi-phase-plan.md index e364884..bc88273 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/multi-phase-plan.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/multi-phase-plan.md @@ -150,7 +150,7 @@ Each live lane runs in its own subagent at the PR head, asking for a private wor ## Appendix D. Links and reading list - + ```` **Reply:** the plan path, the PR ids with their dependencies and the review-gated set, what the prototypes proved and what stays unproven, and the check script's output. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/perf-issue.md b/plugins/pstack/skills/poteto-mode/playbooks/perf-issue.md index 0193fd6..d1709fe 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/perf-issue.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/perf-issue.md @@ -3,7 +3,7 @@ **You own the measurement story. Plan, review, verify the numbers.** Tie every fix to a measurement, don't read source instead of measuring. 1. Capture a baseline trace via the matching control skill. Vet the baseline, and each later number, with the **benchmark-checklist** skill. -2. `how` to ground hypotheses. Don't claim a perf ceiling without running it first. +2. Trace the code to ground hypotheses. Don't claim a perf ceiling without running it first. Try the performance mantras in order, cheapest first: 1. Don't do it. Stop work whose result nothing uses rather than cheapening it. 2. Do it, but don't do it again. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/refactoring.md b/plugins/pstack/skills/poteto-mode/playbooks/refactoring.md index ac379f2..c8ff1f7 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/refactoring.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/refactoring.md @@ -4,7 +4,7 @@ If the cleanup reveals a missing feature or a real bug, split it out and ship the structural change first against the pinned contract. A redesign is allowed, but name it and route to Feature. Large or cross-cutting structural work belongs to the **figure-it-out** skill. This playbook is the focused-to-medium change. -1. Pin the behavior contract first. Run the **how** skill over the affected subsystem to learn the contract, then write a characterization test, snapshot, or equivalence harness that captures current behavior before any structure moves. If the area has no coverage, write the pin before touching structure. Type check and lint are not a pin. +1. Pin the behavior contract first. Trace the affected subsystem to learn the contract, then write a characterization test, snapshot, or equivalence harness that captures current behavior before any structure moves. If the area has no coverage, write the pin before touching structure. Type check and lint are not a pin. 2. Name the structure the code is missing per **principle-model-the-domain**. Boring code stays when the shape is already clear and local. The reshape must delete branches or invalid states, not add indirection. 3. Name the target shape. State what the module layout, types, and call graph should be if built today (**principle-foundational-thinking**, **principle-redesign-from-first-principles**). If the target crosses a function boundary, run the **architect** skill for parallel design exploration of the shape before the move. 4. Subtract before you add. Delete dead code, collapse one-caller wrappers, drop redundant validators, and remove orphan references before introducing the new shape (**principle-subtract-before-you-add**). The smallest change that reaches the target shape ships (**principle-laziness-protocol**). A speculative cleanup that "might help" gets reverted. diff --git a/plugins/pstack/skills/recall/SKILL.md b/plugins/pstack/skills/recall/SKILL.md index 2c01291..5b3470f 100644 --- a/plugins/pstack/skills/recall/SKILL.md +++ b/plugins/pstack/skills/recall/SKILL.md @@ -10,14 +10,14 @@ disable-model-invocation: true Keep it tight and on-topic. Read only what the in-scope threads need, then stop. -Your context lives in two records. Your own chat history holds what you did and decided. The shared record holds everything that happened around the same code under other names: the symptoms users keep reporting, the fixes that shipped and got reverted, the errors still firing in prod. That second record is what the **why** skill searches, across source control, the issue tracker, chat and issue channels, long-form docs, and error tracking. A feature with a long bug tail keeps most of its story there, so don't reconstruct it from your transcripts alone. +Your context lives in two records. Your own chat history holds what you did and decided. The shared record holds everything that happened around the same code under other names: the symptoms users keep reporting, the fixes that shipped and got reverted, the errors still firing in prod. That second record lives in source control, the issue tracker, chat and issue channels, long-form docs, and error tracking. A feature with a long bug tail keeps most of its story there, so don't reconstruct it from your transcripts alone. Transcripts live at the session store, by default `~/.omp/agent/sessions//_.jsonl`, where `` is the cwd with $HOME stripped and each "/" turned into "-" (so `~/proj` becomes `-proj`). Every line is one JSON object. The first is a fixed-width `type:title` slot, the second a `type:session` header, and the rest messages whose roles are camelCase (`toolResult`, not `tool_result`). 1. Classify, then route. One specific prior chat to resume is the `session-pickup` playbook, not this. Turning habits into a durable skill is `automate-me`. A human-readable summary of your work is a different task. Recall loads working context across recent chats before you act. If the user already gave you a full state capsule (paths, branch, the change), use it and skip the mining. 2. Lock the scope before searching. Pin the window ("recent" is a real range, default the last 7 days), the topic if named, and the workspace (default the active one. Never read another project's transcripts without being asked). State the scope back. Never quietly turn "all" into "recent N". 3. Fan out across your chat history. Spawn parallel subagents on a fast, cheap model, each taking a slice of the corpus. Tell every subagent to order candidates by real modification time (`ls -t`) and never by UUID name, grep the topic first and then read only the matching chats and only their relevant regions, and skip the current chat plus obvious noise (subagent, eval, and test chats). Each returns the same schema, one block per chat: topic, the user's goal, decisions, open threads, struggles and corrections, and artifacts (PRs, tickets, branches), each citing the chat UUID. For one or two chats, skip the fan-out and search directly. The raw transcripts stay in the subagents. The main thread gets only their findings. Use the reasoning and speed already selected by agent frontmatter or exact `task.agentModelOverrides` entries. Do not change operator configuration to satisfy a skill example. -4. Sweep the shared record whenever the topic names a feature, file, subsystem, area, or bug. This is the default, not a judgment call, and "my work on X" does not exempt it. Hand it to the **why** skill's source investigators, but steer their question from "why was this built this way" to "what's the current state, what's been tried and didn't hold, and what are users still reporting". Reuse its per-source playbooks, run the investigators in parallel with the chat-history mining, and inherit its posture: one investigator per source, null results are findings, skip an unavailable MCP and say so. Fold what comes back into the brief. Skip this step only for pure activity recall with no named target ("what did I do this week"), where your own history and live state are the entire answer. +4. Sweep the shared record whenever the topic names a feature, file, subsystem, area, or bug. This is the default, not a judgment call, and "my work on X" does not exempt it. Start one investigator per source in one `task` call with all items in `tasks[]` and the required shared `context`. Each needs its source's MCP tools, which omp task agents inherit, so pick workers that expose them. Ask each "what's the current state, what's been tried and didn't hold, and what are users still reporting". Run them in parallel with the chat-history mining. Null results are findings. Skip an unavailable MCP and say so. Fold what comes back into the brief. Skip this step only for pure activity recall with no named target ("what did I do this week"), where your own history and live state are the entire answer. 5. Verify against live state. Take the PRs, branches, and tickets that the mining and the sweep surfaced and check them with `git` and `gh`. When the answer hinges on what an agent actually did (the tools it ran, files it read, errors it hit), read the full transcript, not just a trimmed local copy. 6. Write the brief to the contract below. Group by thread. Stay on the named topic. diff --git a/plugins/pstack/skills/reflect/references/synthesizer.md b/plugins/pstack/skills/reflect/references/synthesizer.md index 1bb37ee..402dccc 100644 --- a/plugins/pstack/skills/reflect/references/synthesizer.md +++ b/plugins/pstack/skills/reflect/references/synthesizer.md @@ -25,7 +25,7 @@ Drop (implementation details that drift): - "linter at SHA `bd91aa7` uses chars/4 heuristic" - "`` has 175 tokens at limit 80" - "Bugbot flagged regex backtracking on May 2" -- "we renamed `gpt-4` to `gpt-4o` in `encodingForModel`" +- "we renamed `parseConfig` to `loadConfig` in `settings.ts`" Keep (durable patterns): - "closed regex enums for trigger detection are brittle. Prefer schema-validated structures" diff --git a/plugins/pstack/skills/sharpen/SKILL.md b/plugins/pstack/skills/sharpen/SKILL.md index a74e95d..d28cd07 100644 --- a/plugins/pstack/skills/sharpen/SKILL.md +++ b/plugins/pstack/skills/sharpen/SKILL.md @@ -13,4 +13,4 @@ I want a deeper version of this task, not a bigger one. Before rewriting it, do Then rewrite my prompt to ask for exactly that. -Leave choices that are mine to make open instead of deciding them. +Have the rewritten prompt ask the agent to prototype any choice an experiment can settle and recommend an option based on what it observed. Leave product or preference choices that no experiment can settle for me to make. diff --git a/plugins/pstack/skills/statechart/scripts/backends/mermaid.ts b/plugins/pstack/skills/statechart/scripts/backends/mermaid.ts index 327220c..21ad39c 100644 --- a/plugins/pstack/skills/statechart/scripts/backends/mermaid.ts +++ b/plugins/pstack/skills/statechart/scripts/backends/mermaid.ts @@ -93,6 +93,52 @@ const esc = (s: string, quoted = false) => { const or = (names: Iterable) => [...names].sort(byText).join(" or "); +type Edge = { from: string[]; start: boolean; to: string[]; label: string | undefined }; + +const within = (parent: string[], path: string[]) => + path.length >= parent.length && parent.every((p, i) => path[i] === p); +const wayIn = (e: Edge) => tupleKey([e.start, e.from]); + +export function drawnEdges(r: Region): Edge[] { + let out: Edge[] = []; + for (const s of r.states) + if (s.start) out.push({ from: [], start: true, to: s.path, label: undefined }); + for (const s of r.steps) + out.push({ + from: s.from, + start: false, + to: s.to, + label: s.label + (s.when ? ` [${s.when}]` : ""), + }); + const parents = new Map(); + for (const s of r.states) + for (let i = 1; i < s.path.length; i++) { + const prefix = s.path.slice(0, i); + parents.set(tupleKey(prefix), prefix); + } + for (const parent of [...parents.values()].sort((a, b) => a.length - b.length)) { + const into = out.filter( + (e) => e.to.length > parent.length && within(parent, e.to) && !within(parent, e.from), + ); + if (!into.length || into.some((e) => wayIn(e) !== wayIn(into[0]))) continue; + const one = into.length === 1; + const at = out.indexOf(into[0]); + out = out.filter((e) => !into.includes(e)); + out.splice( + at, + 0, + { ...into[0], to: parent, label: one ? into[0].label : undefined }, + ...into.map((e) => ({ + from: parent, + start: true, + to: e.to, + label: one ? undefined : e.label, + })), + ); + } + return out; +} + const MARK_STYLES = { breaks: "fill:#ffecee,stroke:#e72e3b,stroke-width:2.5px,color:#cd2834", mayBreak: "fill:#fff3e6,stroke:#e8730c,stroke-width:2.5px,color:#b85a06", @@ -121,6 +167,9 @@ export function mermaidLines(chart: Chart) { if (s === undefined) known.set(path, (s = id(path))); return s; }; + const drawn = drawnEdges(r); + const line = (e: Edge, indent: string) => + `${indent}${e.start ? "[*]" : idOf(e.from)} --> ${idOf(e.to)}${e.label === undefined ? "" : `: ${esc(e.label)}`}`; const tree = (prefix: string[], indent: string, below: ChartState[]) => { const heads = new Map(); for (const s of below) append(heads, s.path[prefix.length], s); @@ -134,6 +183,9 @@ export function mermaidLines(chart: Chart) { if (inner.length) { out.push(`${indent}state "${esc(head, true)}" as ${id(path)} {`); tree(path, indent + " ", inner); + const key = tupleKey(path); + for (const e of drawn) + if (e.start && tupleKey(e.from) === key) out.push(line(e, `${indent} `)); out.push(`${indent}}`); } else if (leaf) { const sid = idOf(leaf.path); @@ -153,11 +205,7 @@ export function mermaidLines(chart: Chart) { } }; tree([], " ", r.states); - for (const s of r.states) if (s.start) out.push(` [*] --> ${idOf(s.path)}`); - for (const s of r.steps) - out.push( - ` ${idOf(s.from)} --> ${idOf(s.to)}: ${esc(s.label + (s.when ? ` [${s.when}]` : ""))}`, - ); + for (const e of drawn) if (!e.start || !e.from.length) out.push(line(e, " ")); return out; }; let body: string[]; diff --git a/plugins/pstack/skills/statechart/scripts/run.ts b/plugins/pstack/skills/statechart/scripts/run.ts index 4efd368..017684f 100644 --- a/plugins/pstack/skills/statechart/scripts/run.ts +++ b/plugins/pstack/skills/statechart/scripts/run.ts @@ -68,6 +68,7 @@ const TLC_TOOL = "http:tla2tools[url=https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar,checksum=sha256:936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88]@1.7.4"; const JAVA_TOOL = "java@temurin-25"; export const PINNED_FLAGS = ["-workers", "1", "-fp", "0", "-lncheck", "final"]; +const SANY_ERRORS = /^\*\*\* ?(?:Errors|Abort messages|Parse Error)/m; type ChildResult = { status: number | null; @@ -227,6 +228,12 @@ const tail = (r: FileResult) => { return kept.join("").trim().split("\n").slice(-30).join("\n"); }; +const firstLines = (text: string) => { + const lines = text.trim().split("\n"); + if (lines.length > 40) lines.splice(40, Infinity, `... ${lines.length - 40} more lines`); + return lines.join("\n"); +}; + const stopOf = (r: FileResult): Stop => { const errors: Part[] = []; for (const m of r.error ? [] : messagesOf(r.output)) @@ -238,9 +245,14 @@ const stopOf = (r: FileResult): Stop => { ) errors.push(m); if (!errors.length) return { status: r.status, message: tail(r) }; - const lines = [...plainText(errors)].join("").trim().split("\n"); - if (lines.length > 40) lines.splice(40, Infinity, `... ${lines.length - 40} more lines`); - return { status: r.status, message: lines.join("\n") }; + return { status: r.status, message: firstLines([...plainText(errors)].join("")) }; +}; + +const sanyErrors = (r: FileResult) => { + if (r.error) return undefined; + const text = [...plainText(messagesOf(r.output))].join(""); + const at = text.search(SANY_ERRORS); + return at === -1 ? undefined : firstLines(text.slice(at)); }; const names = (rules: Rule[], kind: Rule["kind"]) => { @@ -305,8 +317,21 @@ export async function check(specFile: string, configFile: string): Promise path.join(here, "corpus", name, file); @@ -693,6 +694,48 @@ test("a step that leaves every child of a parent the same way is one arrow from assert.deepEqual(quits, [[open, closed]]); }); +test("a parent's only way in ends at the parent, and its start marker goes on to each state with that step's label", () => { + const graph = graphOf( + [ + ["ask", { at: "Asking" }, true], + ["flat", { at: "Layout.Flat" }], + ["parents", { at: "Layout.Parents" }], + ["drawn", { at: "Done.Drawn" }], + ], + [ + ["ask", "flat", "String"], + ["ask", "parents", "Array"], + ["flat", "drawn", "Draw"], + ], + ); + const { chart } = draw(graph, { state: (v) => String(v.at).split(".") }); + assert.deepEqual(drawn(chart).arrows.sort(), [ + "Asking --> Layout", + "Done start --> Drawn", + "Flat --> Done: Draw", + "Layout start --> Flat: String", + "Layout start --> Parents: Array", + ]); +}); + +test("a parent that two states lead into keeps an arrow from each, since one start marker cannot say where each came from", () => { + const graph = graphOf( + [ + ["a", { at: "A" }, true], + ["b", { at: "B" }], + ["p", { at: "P.p" }], + ["q", { at: "P.q" }], + ], + [ + ["a", "b", "Go"], + ["a", "p", "Left"], + ["b", "q", "Right"], + ], + ); + const { chart } = draw(graph, { state: (v) => String(v.at).split(".") }); + assert.deepEqual(drawn(chart).arrows.sort(), ["A --> B: Go", "A --> p: Left", "B --> q: Right"]); +}); + test("a label codes only the characters that Mermaid reads as syntax, so TLA+ values stay as TLC prints them", () => { const graph = graphOf( [ diff --git a/plugins/pstack/skills/statechart/scripts/test/cli.test.ts b/plugins/pstack/skills/statechart/scripts/test/cli.test.ts index 97b71c3..11f06a6 100644 --- a/plugins/pstack/skills/statechart/scripts/test/cli.test.ts +++ b/plugins/pstack/skills/statechart/scripts/test/cli.test.ts @@ -9,6 +9,7 @@ import { setTimeout as sleep } from "node:timers/promises"; import { fileURLToPath, pathToFileURL } from "node:url"; import { plainText } from "../backends/plain-text.ts"; import { readMessages } from "../frontends/messages.ts"; +import { drawn } from "./drawn.ts"; const here = path.dirname(fileURLToPath(import.meta.url)); const corpus = path.join(here, "corpus"); @@ -881,18 +882,6 @@ test("a view with a group in a theme color draws that color and names the group assert.match(chart, new RegExp(`^ {2}class ${legend} teal$`, "m")); }); -const shown = (text: string) => text.replace(/#(\d+);/g, (_, n) => String.fromCodePoint(Number(n))); - -const drawn = (chart: string) => { - const names = new Map(); - for (const m of chart.matchAll(/^ *(?:state "(.*)" as (s\d+) \{|(s\d+): (.*))$/gm)) - names.set(m[2] ?? m[3], shown(m[1] ?? m[4])); - const arrows: string[] = []; - for (const [, from, to, text] of chart.matchAll(/^ *(s\d+) --> (s\d+): (.*)$/gm)) - arrows.push(`${names.get(from)} --> ${names.get(to)}: ${shown(text)}`); - return { states: [...names.values()], arrows }; -}; - const byX = (labels: unknown[]) => `export const state = (v) => ${JSON.stringify(labels)}[v.x];\n`; const fanOut = (n: number) => { @@ -926,7 +915,7 @@ for (const [what, c] of [ view: byX([["a\0b"], ["a", "b"], ["c"], ["d"]]), status: 0, states: ["ab", "a", "b", "c", "d"], - arrows: ["ab --> b: Inc", "b --> c: Inc", "c --> d: Inc"], + arrows: ["a start --> b", "ab --> a: Inc", "b --> c: Inc", "c --> d: Inc"], says: /^TLC reached 4 states and 3 steps\. The chart draws 4 states and 3 arrows\.$/m, }, ], @@ -942,7 +931,14 @@ for (const [what, c] of [ ]), status: 0, states: ["R f", "S p", "R ab", "S q", "R a", "R b", "S r"], - arrows: ["S p --> S q: Inc", "S p --> S r: Inc"], + arrows: [ + "R f start --> S p", + "R ab start --> S q", + "R b start --> S r", + "R a start --> R b", + "S p --> R ab: Inc", + "S p --> R a: Inc", + ], says: /^The regions chart lets R f, S p go to R a\0b, S r by Inc, which the model never does\. So the chart draws parent states in place of regions\.$/m, }, ], @@ -964,7 +960,7 @@ for (const [what, c] of [ view: byX([["a\u0001b"], ["a", "b"], ["c"], ["d"]]), status: 0, states: ["a\u0001b", "a", "b", "c", "d"], - arrows: ["a\u0001b --> b: Inc", "b --> c: Inc", "c --> d: Inc"], + arrows: ["a start --> b", "a\u0001b --> a: Inc", "b --> c: Inc", "c --> d: Inc"], says: /^TLC reached 4 states and 3 steps\. The chart draws 4 states and 3 arrows\.$/m, }, ], @@ -1002,7 +998,7 @@ for (const [what, c] of [ view: byX([["a"], ["P", "b\u0002c"], ["d"], ["e"]]), status: 1, states: ["a", "P", "b\u0002c", "d", "e"], - arrows: ["a --> b\u0002c: Next", "b\u0002c --> d: Next", "d --> e: Next"], + arrows: ["P start --> b\u0002c", "a --> P: Next", "b\u0002c --> d: Next", "d --> e: Next"], says: /^## NotOne breaks\nThe shortest path has 1 step:\n0\. a\n1\. Next: P \/ b\cBc$/m, }, ], @@ -1039,10 +1035,15 @@ for (const [what, c] of [ status: 0, states: ["R f", "S p", "R a", "S r", "R b", "S q", "R X\u0003a", "S q", "R X\u0003b", "S r"], arrows: [ - "S p --> S r: Go\u0003X", - "S p --> S q: Go\u0003X", - "S p --> S q: Go", - "S p --> S r: Go", + "R f start --> S p", + "R a start --> S r", + "R b start --> S q", + "R X\u0003a start --> S q", + "R X\u0003b start --> S r", + "S p --> R a: Go\u0003X", + "S p --> R b: Go\u0003X", + "S p --> R X\u0003a: Go", + "S p --> R X\u0003b: Go", ], says: /^The regions chart lets R f, S p go to R a, S q by Go\cCX, which the model never does\. So the chart draws parent states in place of regions\.$/m, }, diff --git a/plugins/pstack/skills/statechart/scripts/test/corpus.test.ts b/plugins/pstack/skills/statechart/scripts/test/corpus.test.ts index 8934373..90a4104 100644 --- a/plugins/pstack/skills/statechart/scripts/test/corpus.test.ts +++ b/plugins/pstack/skills/statechart/scripts/test/corpus.test.ts @@ -383,6 +383,44 @@ for (const [width, height, config, status, drawn, chart, header] of [ }, ); +for (const [what, tla, where] of [ + [ + "an unknown name", + ["---- MODULE Broken ----", "VARIABLE x", "Init == x = 0", "Next == x' = y", "===="], + /^line 4, col 14 to line 4, col 14 of module Broken\n+Unknown operator: `y'\.$/m, + ], + [ + "a parse error", + ["---- MODULE Broken ----", "VARIABLE x", "Init == x = = 0", "Next == x' = x", "===="], + /^Encountered "0" at line 3, column 15/m, + ], + [ + "twelve unknown names", + [ + "---- MODULE Broken ----", + "VARIABLE x", + "Init == x = 0", + ...Array.from({ length: 12 }, (_, i) => `D${i} == u${i}`), + "Next == x' = x", + "====", + ], + /^\*\*\* Errors: 12\n+line 4, col 7 to line 4, col 8 of module Broken\n+Unknown operator: `u0'\.$/m, + ], +] as const) + test( + `a spec with ${what} gets SANY's line and column, not a Java stack trace`, + { skip }, + async () => { + const base = writeSpec("Broken", [...tla], "INIT Init\nNEXT Next\n"); + await assert.rejects(check(`${base}.tla`, `${base}.cfg`), (error: Error) => { + assert.match(error.message, /^SANY could not read .*Broken\.tla \(exit 1\):\n/); + assert.match(error.message, where); + assert.doesNotMatch(error.message, /^\s+at tla2sany\./m); + return true; + }); + }, + ); + test( "check() leaves no statechart- folder in the temp dir when it returns and when it throws", { skip }, diff --git a/plugins/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd b/plugins/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd index 9733b21..547bd3e 100644 --- a/plugins/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd +++ b/plugins/pstack/skills/statechart/scripts/test/corpus/Login/chart.mmd @@ -6,12 +6,13 @@ stateDiagram-v2 s4: Checking second try s5: Wrong password, 1 try left s6: Checking last try + [*] --> s2 } s7: Reset email sent s8: Signed in s9: Locked out [*] --> s0 - s0 --> s2: YouSubmitAPassword + s0 --> s1: YouSubmitAPassword s2 --> s8: ThePasswordIsRight s2 --> s3: ThePasswordIsWrong s7 --> s0: YouSetANewPassword diff --git a/plugins/pstack/skills/statechart/scripts/test/drawn.ts b/plugins/pstack/skills/statechart/scripts/test/drawn.ts new file mode 100644 index 0000000..1290403 --- /dev/null +++ b/plugins/pstack/skills/statechart/scripts/test/drawn.ts @@ -0,0 +1,20 @@ +const shown = (text: string) => text.replace(/#(\d+);/g, (_, n) => String.fromCodePoint(Number(n))); + +export const drawn = (chart: string) => { + const names = new Map(); + for (const m of chart.matchAll(/^ *(?:state "(.*)" as (s\d+) \{|(s\d+): (.*))$/gm)) + names.set(m[2] ?? m[3], shown(m[1] ?? m[4])); + const arrows: string[] = []; + const blocks: string[] = []; + for (const line of chart.split("\n")) { + const block = line.match(/^ *state ".*" as (\w+) \{$/); + if (block) blocks.push(block[1]); + if (/^ *\}$/.test(line)) blocks.pop(); + const m = line.match(/^ *(s\d+|\[\*\]) --> (s\d+)(?:: (.*))?$/); + const parent = names.get(blocks.at(-1) ?? ""); + if (!m || (m[1] === "[*]" && parent === undefined)) continue; + const from = m[1] === "[*]" ? `${parent} start` : names.get(m[1]); + arrows.push(`${from} --> ${names.get(m[2])}${m[3] === undefined ? "" : `: ${shown(m[3])}`}`); + } + return { states: [...names.values()], arrows }; +}; diff --git a/plugins/pstack/skills/statechart/scripts/test/labels.ts b/plugins/pstack/skills/statechart/scripts/test/labels.ts index a3d1499..8249724 100644 --- a/plugins/pstack/skills/statechart/scripts/test/labels.ts +++ b/plugins/pstack/skills/statechart/scripts/test/labels.ts @@ -1,5 +1,5 @@ import { inspect } from "node:util"; -import { mermaid as chartText } from "../backends/mermaid.ts"; +import { drawnEdges, mermaid as chartText } from "../backends/mermaid.ts"; import { checkView } from "../frontends/view.ts"; import type { Chart, ChartState, State, Step, View } from "../ir.ts"; import { walk } from "../passes/reach.ts"; @@ -398,6 +398,7 @@ function expected(chart: Chart): Want { const region = chart.regions[i]; const wrap = multi ? `r${i}` : null; if (wrap) nodes.set(wrap, { text: region.name, parent: "all", group: true }); + const drawn = drawnEdges(region); const tree = (prefix: string[], parent: string | null, below: ChartState[]) => { const heads = new Map(); for (const s of below) { @@ -413,19 +414,23 @@ function expected(chart: Chart): Want { else leaf = s; const node = id(region.name, path); nodes.set(node, { text: head, parent, group: inner.length > 0 }); - if (inner.length) tree(path, node, inner); - else if (leaf?.group !== undefined) used.add(chart.colors[String(leaf.group)]); + if (inner.length) { + tree(path, node, inner); + const key = JSON.stringify(path); + for (const e of drawn) + if (e.start && JSON.stringify(e.from) === key) + edges.push([`${node}_start`, id(region.name, e.to), e.label ?? ""]); + } else if (leaf?.group !== undefined) used.add(chart.colors[String(leaf.group)]); } }; tree([], wrap, region.states); - for (const s of region.states) - if (s.start) edges.push([`${wrap ?? "root"}_start`, id(region.name, s.path), ""]); - for (const s of region.steps) - edges.push([ - id(region.name, s.from), - id(region.name, s.to), - s.label + (s.when ? ` [${s.when}]` : ""), - ]); + for (const e of drawn) + if (!e.start || !e.from.length) + edges.push([ + e.start ? `${wrap ?? "root"}_start` : id(region.name, e.from), + id(region.name, e.to), + e.label ?? "", + ]); } let legend = 0; for (const [text, cls] of Object.entries(chart.colors)) diff --git a/plugins/pstack/skills/statechart/scripts/test/render.test.ts b/plugins/pstack/skills/statechart/scripts/test/render.test.ts index 5309a92..57ff41e 100644 --- a/plugins/pstack/skills/statechart/scripts/test/render.test.ts +++ b/plugins/pstack/skills/statechart/scripts/test/render.test.ts @@ -6,6 +6,10 @@ import os from "node:os"; import path from "node:path"; import { before, test } from "node:test"; import { fileURLToPath, pathToFileURL } from "node:url"; +import { mermaid as chartText } from "../backends/mermaid.ts"; +import type { Graph } from "../ir.ts"; +import { walk } from "../passes/reach.ts"; +import { project } from "../pipeline.ts"; import { fuzz, type Html, type Mermaid, type Render } from "./labels.ts"; const here = path.dirname(fileURLToPath(import.meta.url)); @@ -75,6 +79,66 @@ test("random labels and colors keep their text and the chart's shape in Mermaid assert.ok(drawn > 400 && refused > 20, `${drawn} charts drawn, ${refused} refused`); }); +const pathPoints = (d: string) => { + const points: number[][] = []; + let [ax, ay] = [0, 0]; + for (const [, cmd, args] of d.matchAll(/([MLC])([^MLC]*)/g)) { + const n = args.split(/[ ,]/).filter(Boolean).map(Number); + const [x, y] = n.slice(-2); + if (cmd !== "M") + for (let t = 0; t <= 1; t += 1 / 64) { + const u = 1 - t; + points.push( + cmd === "L" + ? [ax + (x - ax) * t, ay + (y - ay) * t] + : [ + u ** 3 * ax + 3 * u * u * t * n[0] + 3 * u * t * t * n[2] + t ** 3 * x, + u ** 3 * ay + 3 * u * u * t * n[1] + 3 * u * t * t * n[3] + t ** 3 * y, + ], + ); + } + [ax, ay] = [x, y]; + } + return points; +}; + +test("an arrow into a parent from its only way in stays out of the parent's title bar in Pele 1.9.0", () => { + const graph: Graph = { states: new Map(), steps: [] }; + for (const [id, at] of [ + ["ask", "Asking your view for labels"], + ["flat", "Laying out the chart/Flat"], + ["parents", "Laying out the chart/Parent states"], + ["regions", "Laying out the chart/Regions"], + ]) + graph.states.set(id, { vars: { at }, start: id === "ask", breaks: [] }); + for (const [to, action] of [ + ["flat", "String"], + ["parents", "Array"], + ["regions", "Object"], + ]) + graph.steps.push({ from: "ask", to, action }); + const { chart } = project(graph, walk(graph), { state: (v) => String(v.at).split("/") }, []); + const { svg } = render(chartText(chart)); + const bars = [ + ...svg.matchAll( + /]*\/> x > bar.left && x < bar.right && y > bar.top && y < bar.bottom, + ) + ) + crossings.push(`${id} crosses the title bar of ${bar.id}`); + assert.deepEqual(crossings, []); +}); + test("the theme in references/render.md colors each class that the charts use", () => { assert.ok(classes.size > 0); for (const name of classes) assert.match(theme, new RegExp(`\\.pele \\.${name} rect \\{`), name); diff --git a/plugins/pstack/skills/teach/SKILL.md b/plugins/pstack/skills/teach/SKILL.md index 25369f3..6146b65 100644 --- a/plugins/pstack/skills/teach/SKILL.md +++ b/plugins/pstack/skills/teach/SKILL.md @@ -11,7 +11,7 @@ disable-model-invocation: true Teach sits on top of `how` and `why`. Get your bearings on what the work is and what it touches, then run `how` for how it works and `why` for why it's that way. Those are real skill invocations that do their own digging. Blend what they find into one plain explanation, lead with what matters to the person, and go deeper when they ask. Reword freely for teaching, with one exception. Keep `why`'s confidence language intact (its hedges are findings, not style). 1. Decide the few things they should walk away understanding. Choose them from why they're asking (about to change it, reviewing it, debugging it, new to it) and what they already know, both read from the conversation, not quizzed out of them. Skip what they plainly already know. Put the depth where their question is. -2. Let `how` and `why` do the work, don't redo it. Read the code yourself to get oriented, then run `how` for how it works and `why` for why. Run them in parallel and combine the results. Match the size to the question. Run both for a subsystem, maybe one is enough for a small change. Keep `why` narrow by default since its full sweep is slow. Put the narrowing in the ask itself (a scoped question, git plus a source or two) so `why` records the skipped categories per its own contract, and widen it only when the reasons are the point. +2. Let `how` and `why` do the work, don't redo it. Read the code yourself to get oriented, then run `how` for how it works and `why` for why. Run them in parallel and combine the results. Match the size to the question. Run both for a subsystem, maybe one is enough for a small change. 3. Start with a plain definition. Name the thing and say what it is in general terms, the way a senior engineer would say it out loud, with its common name if it has one. Then tie it to the case in front of you ("in X, we use this to ...") and build from there: how it works, the deeper reasons, the edge cases. For each part, explain the idea so it clicks: the problem it solves and how it actually works. Walk through what happens as the person does the thing (opens a long chat, scrolls up) when that is what makes it land. Listing functions and constants is reference, not teaching. Don't print framing labels ("the one idea to hold onto", "the thing to walk away with", "the key insight", "at its core", "TL;DR"). Give the smallest complete answer first, a sentence or two, not a dense paragraph, then stop. Add layers when they ask. Never a wall of text. 4. Keep it a conversation, not a lecture or a performance. Offer to go deeper or move on, and follow their lead. No quizzes. No pacing theater. Don't print "Pause", don't ask them to say it back, don't announce "the sentence to nail", and don't flag a part as important or hard ("here is the part worth slowing down on", "this is the tricky part", "here is where it gets interesting"). Just say it. When you would pause, stop and let them respond. Running one-shot with no live human, deliver it cleanly and put any offer to go deeper at the end. 5. Show, don't only tell, and build the picture up diagram by diagram. Open the diff, the code, or the debugger when that is the fastest way to land it. Draw when a picture lands faster than words. For anything with three or more moving parts, do not draw one diagram with all of them at once. Draw a short series instead, where each diagram redraws the last and adds a single part, so the reader watches the system assemble. A single all-at-once diagram, especially one saved for the end, is a reference, not teaching. Concretely, to teach a flow from A to B to C, draw it three times. First A to B. Then redraw and add C. Then redraw and add the return edge or the next piece. Match the medium to the idea, and use both kinds when both help. A mermaid diagram fits a flow or structure where the labels carry the meaning. When the idea is spatial, like layout, overlap, scroll position, or a before and after, reach for the image-generation tool and draw it marker-on-whiteboard style with a few short labels, since image models garble long text. Generate that picture, don't settle for describing it in words. The build-up rule holds for generated images too. A single simple point needs no figure. diff --git a/plugins/pstack/skills/why/SKILL.md b/plugins/pstack/skills/why/SKILL.md index 4b4416a..9939783 100644 --- a/plugins/pstack/skills/why/SKILL.md +++ b/plugins/pstack/skills/why/SKILL.md @@ -1,98 +1,9 @@ --- name: why -description: "Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior." +description: "Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Returns a cited read on decisions and tradeoffs. Use how for runtime behavior." disable-model-invocation: true --- # Why -Investigate the motivation and intent behind code. The companion `how` skill answers what the code does and how it works. `why` answers what forces led to its shape. - -Resolve agents against the live roster. Use an exact preferred agent only when it is present; otherwise follow the workflow's default-worker fallback. Each agent's frontmatter or `task.agentModelOverrides[]` selects its model; the task item has no `model` field. Use the reasoning and speed already selected by agent frontmatter or exact `task.agentModelOverrides` entries. Do not change operator configuration to satisfy a skill example. - -Use exact discovered investigators and a synthesizer from the live roster. Omit `agent` for the default worker when no matching specialist is loaded. MCP tools are inherited, including by `scout`; choose a worker whose exposed tools cover the assigned evidence source. Carry read-only posture in each brief: no file writes, git mutations, commits, pushes, PRs, or external mutations. There is no task `readonly` field. - -## Operating Posture - -Operate as a **careful, cautious, and precise investigator**. Be honest about what you know vs what you're inferring. Read `references/epistemics.md` for the full confidence framework and phrasing guide. The synthesizer must follow it. - -## Step 1. Understand the Target and the Question - -The **target** is usually a chunk of code, a pattern, a feature, or a named design decision. The **question** is usually a design rationale, a tradeoff, a motivating edge case, an external constraint, dead code, or a broad history sweep. - -If the target is vague ("why do we do it this way?" with no clear referent), make your best guess from conversation context (open files, recent edits, what was just discussed). State your interpretation briefly so the user can redirect if you're off, then proceed. - -## Step 2. Establish the Code Anchor - -Before spawning investigators, build the seed context inline: file paths and line ranges, key symbols (functions, classes, constants), the last few commits touching the target, PR numbers from merge commits (pattern `(#1234)` in the subject line), and any linked ticket IDs. Run `git blame -L , ` for last-touch commits, `git log --follow -p -- ` for full history with patches through renames, `git log --oneline -20 -- ` for recent commits with PR numbers visible, and `git log -1 --format=%B ` to extract PR numbers. Then pull the PR bodies and discussion for any substantive commit: `gh pr view --json title,body,author,createdAt,mergedAt,labels,closingIssuesReferences,comments,reviews`. This anchor goes to every investigator and to the synthesizer. - -## Step 3. Spawn Parallel Investigators - -**Default to the full parallel investigation.** The goal is a complete coverage map, not a minimal one. Document the null, don't skip the search. - -### Discovery - -Before spawning investigators, list the available MCPs from the session environment. Use the available-tools map when present. Otherwise read `~/.omp/agent/mcp.json` for enabled MCP servers. - -Map each available MCP to one evidence category: - -1. Source control history -2. Issue / ticket tracker -3. Long-form documents -4. Real-time team chat -5. Infrastructure observability -6. Error / exception tracking -7. Product analytics warehouse - -Source control is always available through git and `gh`. For the other six, classify using the MCP name, server instructions, tool names, and resource descriptors. If an MCP could fit more than one category, choose the one matching its primary evidence. Record ambiguous cases in the coverage map. - -Assign one investigator to each category that has a matching MCP, in one `task` call with all items in `tasks[]` and the required shared `context` so they run concurrently, each owning exactly one tool or MCP. Don't ask one agent to cover multiple MCPs. Use an exact discovered investigator agent; its frontmatter or `task.agentModelOverrides[]` selects the model. - -Each investigator's prompt is `references/investigator-prompt.md` filled in, plus: -- the category playbook `references/sources/.md` for the selected MCP, adapted from the examples in `references/source-playbook.md` -- `references/sources/incident-postmortem.md` **if the target code looks defensive** (null checks, retry logic, timeout handling, rate limiting, feature flags, egress guards, OOM handlers) -- the code anchor and the user's original question - -### Investigator roster, one per available evidence category - -Each category below is uniquely positioned to surface one shape of "why", shown after "Best at". Use it to know what to expect back, to name a gap when a category returns empty, and, only in the rare provably-irrelevant case, to justify a skip. - -1. **Source control** (git history, `gh` for PRs, code comments, tests). Always spawn, the only guaranteed source. Best at *implementation-time rationale captured during review*. -2. **Issue / ticket tracker** (e.g. Linear, Jira, GitHub Issues, Plane, Shortcut MCP). Best at *the product or business forcing function*. Strongest when the why is external to engineering. -3. **Long-form documents** (e.g. Notion, Confluence, Google Docs, Coda MCP). Best at *long-form design rationale*, written out before it becomes code. -4. **Real-time team chat** (e.g. Slack, Discord, Microsoft Teams, Mattermost MCP). Best at *real-time deliberation that never reached a doc*. Especially important when the source control, ticket, and doc paper trail is thin. -5. **Infrastructure observability** (e.g. Datadog, New Relic, Honeycomb, Grafana, Splunk MCP). Best at *infrastructure and runtime reality that motivated the code*. Strongest when the target reacts to an infra signal (timeouts, retries, rate limits, circuit breakers). -6. **Error / exception tracking** (e.g. Sentry, Rollbar, Bugsnag, Airbrake MCP). Best at *the specific exceptions and error trajectories that motivated defensive or corrective code*. Strongest for catch blocks, null guards, type checks, retries, and other defenses. -7. **Product analytics warehouse** (e.g. Databricks, Snowflake, BigQuery, ClickHouse, dbt, Redshift MCP). Best at *product and data reality that shaped the code*. Strongest for flag-gated code, experiment-driven ships, data migrations, and "where did this number come from" questions. - -### When to skip an investigator - -Only with an **explicit, written justification** that goes in the final Sources Consulted. Two valid reasons: - -- **No MCP is available for that category** in this environment. Flag it as a gap, not a choice: "Real-time team chat skipped. No matching MCP available, so the conversational record was not searchable." -- **The source is provably irrelevant**, not just "probably irrelevant." A high bar: "Error / exception tracking skipped. Target is a build-time script with no runtime code path." - -If your scope assessment suggests a single-commit trivial target where the PR description already contains the complete answer, you may answer inline **only after** confirming all seven available category searches would be redundant. Say so explicitly. This should be rare. - -## Step 4. Synthesize - -Start one synthesizer in one `task` call with one item in `tasks[]` and the required shared `context`. Use an exact discovered synthesizer or omit `agent` for the default worker with the synthesizer brief. Its frontmatter or exact override selects the model. It gets: -1. The investigator findings, including any null results and any categories skipped with justification -2. The code anchor -3. The user's original question -4. The epistemics framework from `references/epistemics.md` -5. The synthesizer prompt template from `references/synthesizer-prompt.md` - -## Step 5. Present - -Present the synthesizer's output to the user. You may lightly edit for clarity or add context from the conversation, but **do not rewrite the confidence language**. - -## Output Format - -The structure is the one in `references/synthesizer-prompt.md`: The Question, The Code in Question, What We Found, What We Can Reasonably Infer, Competing Hypotheses, What We Don't Know, Sources Consulted, Confidence Summary. Adapt as needed, but keep the confidence separation intact, and keep Sources Consulted as one line per investigator, including the ones that returned nothing or were skipped, with the reason. - -After Sources Consulted, if the user's `why` question is a precursor to changing this code, convert the lineage findings into a Preserve / Change / Avoid / Risk constraint set for planning the change. - -## Common Failure Modes to Avoid - -- **Recency bias**. Assuming the most recent commit is authoritative. The current shape is often the accretion of many earlier decisions. Trace back. +Answer from the record, not the code: read the commits and PR discussions that introduced the target and each later change, and other sources if the trail is thin. Cite what the authors wrote, mark your own inferences as inferences, and say what the record does not answer. diff --git a/plugins/pstack/skills/why/references/epistemics.md b/plugins/pstack/skills/why/references/epistemics.md deleted file mode 100644 index b18abf4..0000000 --- a/plugins/pstack/skills/why/references/epistemics.md +++ /dev/null @@ -1,71 +0,0 @@ -# Epistemics - -How to reason about confidence when evidence is historical, fragmentary, and sometimes contradictory, and how to tell the user without flattening it into false certainty. Code shows what it does, not *why it exists*. The why lives in commits, PRs, tickets, docs, and conversations, all incomplete, biased, and sometimes missing. Pretending otherwise produces confident-sounding guesses that mislead the user. - -## Confidence Tiers - -Every claim in the output must sit in one tier. The tier sets its section and its phrasing. - -### 1. Direct - -An explicit, textual citation answers the question: something an author actually *wrote* that says why, not "the code does X so the author must have wanted X." For example, a PR description "this fixes the bug where users with >1000 items couldn't paginate", a ticket "we're adding this because customer Acme requested it in their security review", a code comment "// clamp to 100 because the upstream API rejects larger values", a design doc "we chose option A over option B because we need persistence across restarts", or a chat message from the author "switching to this approach since the old one was flaky in tests". - -Phrasing: confident, present tense, cited. "This exists because X." - -### 2. Supported - -Multiple pieces of indirect evidence converge on one conclusion. No single source states it explicitly, but the pattern across sources makes it likely. For example, the PR title says "improve performance", the ticket is labeled "perf", and the surrounding commits all touch the same hot path. Or several tests added with the change all exercise very large inputs. Or the author's other PRs from the same week all name the same incident. - -Phrasing: confident but clearly derived, citing each item. "The evidence points strongly to X: [the specific pieces]." - -### 3. Inferred - -A reasonable reading of the context that nothing explicitly supports. It is *your interpretation*, not a fact from the record. For example, the PR doesn't say why, but the error was happening in production (per the incident channel timing) and the fix was rushed (merged the same day), so it was likely a hotfix. Or the function name suggests retry logic, and its retry count of 3 matches the team's 3-retry convention elsewhere in the codebase. - -Phrasing: hedged, with the chain explicit. "Given A and B, C seems likely because D." - -### 4. Speculative - -A plausible hypothesis on thin evidence, where other explanations fit equally well. Worth presenting, since the user may know which is right, but mark it as a guess. For example, "This might be a workaround for a browser bug that's since been fixed, but we found no contemporary evidence of that", or "It's possible this threshold was chosen to match an SLA commitment, but no SLA doc references it." - -Phrasing: "One possibility is X, but we have no direct evidence." Usually lives in Competing Hypotheses, alongside other possibilities. - -### 5. Unknown - -You looked and couldn't find out. A valid, important outcome. Document it. - -Phrasing: "We searched X, Y, and Z and found no evidence of why." Be specific about *what* you searched. "We couldn't find out" is less useful than "We searched the ticket tracker with keywords A and B, scanned the 6 PRs that touched this file since 2023, and grep'd the repo for string literals matching the threshold. None surfaced a rationale." - -## Phrasing Guide - -**Confidence words** imply Direct or Supported evidence and need a citation immediately adjacent. Never use them for inferences: "because", "the reason is", "was designed to" (claims author intent), "fixes" / "addresses" / "solves" (claims the change achieved its goal), "the team decided" (claims a group decision happened). - -**Hedges** signal interpretation, not report. Use them liberally in What We Can Reasonably Infer: "appears to", "seems to", "likely", "suggests", "is consistent with", "one reading is", "plausibly", "may have been", "the evidence points toward". - -**Words to avoid:** - -- "obviously". If it were obvious, the user wouldn't be asking -- "clearly". Almost always precedes a claim that isn't clear -- "of course". Same -- "just" (as in "it's just X for performance"). Dismissive and usually hides uncertainty -- "I think" / "I believe". You're synthesizing evidence, not giving a personal opinion. Use "the evidence suggests" instead. - -## Avoid Rationalization - -Code that "makes sense" today may have been written for reasons that no longer apply, or that were wrong at the time. Don't retrofit a clean rationale onto messy history. Don't assume the author did the "right" thing and work backward to justify it. Don't assume a consistent pattern was intentional when it might be copy-paste. Don't turn an absence of evidence into evidence of absence ("no one mentioned security concerns, so it must not have been a concern"). - -## The Sycophancy Trap - -Users often embed a hypothesis: "Why do we do it this way, I assume it's for performance?" Don't simply confirm it. The guess is a prompt for investigation, not a conclusion to validate. Treat it as one candidate among others and check the evidence independently. If the evidence supports it, say so with citations. If not, say so, and present what the evidence *does* support. - -## When Evidence Contradicts - -Surface both sources in the output, with citations. Don't pick the one that fits a tidier narrative. For example, the ticket says "we need this for customer X's compliance requirement" and the PR says "cleaning up tech debt in this area". Both may be true (the ticket motivated the work, the PR gave the author's framing), or one may be wrong. Let the user make the call. - -## When Evidence Is Missing - -An honest "we don't know" is one of the most valuable outputs. The user learns the answer isn't in the obvious places, that they'll need to ask a human (the original author, the product owner, the team lead), or that they can decide the question isn't worth pursuing further. Failing to mark a gap, and instead filling it with a confident guess, actively harms the user, because they'll act on the guess. Name each gap concretely: the question, the sources searched, what you searched for in each, and what you found (nothing, or only tangential material). - -## Before Finalizing - -Before the synthesizer delivers the output, it checks every claim in "What We Found" and "What We Can Reasonably Infer". Each claim has a citation or moves to Inferred or Hypotheses. Its phrasing matches its tier. It doesn't treat code as evidence for its own intent (if it does, remove or reclassify it). The output has a "What We Don't Know" section. If no gaps are mentioned, that's suspicious. Either the evidence was unusually complete or something is being swept under the rug. diff --git a/plugins/pstack/skills/why/references/investigator-prompt.md b/plugins/pstack/skills/why/references/investigator-prompt.md deleted file mode 100644 index e1c2bbf..0000000 --- a/plugins/pstack/skills/why/references/investigator-prompt.md +++ /dev/null @@ -1,84 +0,0 @@ -# Investigator Prompt Template - -Fill in the placeholders. Append the one category playbook `sources/.md` for this investigator's evidence category (index: `source-playbook.md`). If the target code looks defensive (null checks, retry logic, timeout handling, rate limiting, feature flags, egress guards, OOM handlers), also append `sources/incident-postmortem.md` so the investigator runs incident-flavored queries inside its own source. - ---- - -You are investigating the historical context and motivation behind a piece of code. Other investigators search other sources in parallel, and a separate synthesizer combines all findings into the final answer. Go deep on your assigned source only. Gather evidence accurately rather than writing prose. - -Work like a **careful, cautious, and precise investigator**. Surface evidence and describe it accurately, including the parts that don't fit a tidy story. Boring and exact beats plausible. One verbatim quote with a precise citation is worth more than a paragraph of summary. - -## The Question - -> {QUESTION} - -## The Code Anchor - -**Target files:** {FILES_WITH_LINE_RANGES} - -**Key symbols:** {SYMBOLS} - -**Initial commits touching this code (most recent first):** -{COMMIT_LIST} - -**PR numbers extracted from commit messages:** {PR_NUMBERS} - -**Ticket IDs mentioned in commits or PR bodies (if any):** {TICKET_IDS} - -## Your Assigned Source - -{SOURCE_NAME} - -{SOURCE_PLAYBOOK_SECTION} - -## Investigation Loop - -1. **Cast a wide net first** so you don't miss related context. Only then narrow in on specific items. -2. **Read the whole thing.** Read each PR, ticket, doc, or thread fully, not just the title or summary. The key evidence is often in a comment, a subtask, or a follow-up. -3. **Follow links within your source only.** Pull the PR or commit a PR references, the parent or sibling of a ticket, the doc a doc links. Do NOT chase a cross-source reference. Record it under Additional Leads for that source's investigator. The one-investigator-per-category design depends on this. Chasing it duplicates work and confuses scope. -4. **Quote verbatim**, with the exact location (PR number, ticket ID, URL, commit hash, file:line), so the reader can confirm the claim in seconds. -5. **Record what you searched, not just what you found.** Write queries verbatim. An empty search is a finding. -6. **Resist the story.** If two items in your source disagree, record both. Don't suppress the inconvenient one. If three items line up and a fourth contradicts them, the contradiction is the most interesting finding. - -Before reporting a finding as strong, ask whether you would expect to find it if your current reading were wrong, and how the evidence would differ. **Never invent.** If you're tempted to round a partial finding up into a confident statement, stop and label it partial. The synthesizer counts on your output being accurate. - -## Epistemic Discipline - -- **Mechanics are not motivation.** A commit changing `limit = 50` to `limit = 100` shows the change, not necessarily why. Look for the reason in the commit message, PR description, linked ticket, or review comments. -- **No intent from code behavior or style.** You may read code to learn what the target *is*. "The author chose a functional approach" is an observation about code, not evidence of intent. Claim intent only where the author stated it. -- **Preserve uncertainty.** Say when evidence is ambiguous, or when one reading is more plausible but not certain. Don't collapse ambiguity to look decisive. -- **No silent substitutions.** If the question is about feature X and you only find evidence about feature Y, don't present Y's evidence as if it answers X. -- **Gather, don't conclude.** Collect the raw material honestly and completely. Don't answer the question, form a final opinion on "the why", or pick sides in contradictions. Don't speculate beyond what the evidence supports. A hunch with no evidence isn't evidence. The synthesizer does the reasoning. - -## Output Format - -Return your findings in this structure. The synthesizer reads it directly. - -### Source -Which source you investigated (source control, issue / ticket tracker, long-form documents, real-time team chat, infrastructure observability, error / exception tracking, product analytics warehouse, code comments, etc.). - -### What I Searched -The queries you ran, items you opened, and places you looked. Be specific. This shows how thorough the search was and what is still unsearched. - -### Direct Evidence Found -For each item that explicitly addresses the question: -- **What it says**: verbatim quote or accurate paraphrase -- **Where it's from**: PR #123, ticket ID, doc URL, chat permalink, commit hash, or file:line -- **Author and date** (if available) -- **Relevance**: one sentence on how it bears on the question - -### Indirect / Circumstantial Evidence -For each item that bears on the question without answering it: -- **What it is**: brief description -- **Where it's from**: location -- **What it suggests**: what a careful reader might infer, and the inference chain -- **Alternative readings**: if the same evidence could support a different interpretation, note it - -### Contradictions -Items that disagree with each other, with both citations. - -### Gaps -What you searched for and didn't find, specifically: "Searched the issue tracker for [query] across [time range]. No matching issues." - -### Additional Leads -Anything that suggests further investigation in a different source, for its investigator or a follow-up pass. For example, a chat thread that a PR mentions. diff --git a/plugins/pstack/skills/why/references/source-playbook.md b/plugins/pstack/skills/why/references/source-playbook.md deleted file mode 100644 index aa3d877..0000000 --- a/plugins/pstack/skills/why/references/source-playbook.md +++ /dev/null @@ -1,17 +0,0 @@ -# Source playbooks - -The why skill spawns one investigator per available evidence category, each reading a single source-specific playbook below. The playbooks are concrete examples for common MCPs. Adapt them for a different MCP in the same category. - -| Category | Playbook | Example MCP it documents | -|---|---|---| -| Source control history | [`code-archaeology.md`](./sources/code-archaeology.md) | git, `gh` | -| Issue / ticket tracker | [`linear.md`](./sources/linear.md) | Linear (adapt for Jira, GitHub Issues, Plane, Shortcut) | -| Long-form documents | [`notion.md`](./sources/notion.md) | Notion (adapt for Confluence, Google Docs, Coda) | -| Real-time team chat | [`slack.md`](./sources/slack.md) | Slack (adapt for Discord, Microsoft Teams, Mattermost) | -| Infrastructure observability | [`datadog.md`](./sources/datadog.md) | Datadog (adapt for New Relic, Honeycomb, Grafana, Splunk) | -| Error / exception tracking | [`sentry.md`](./sources/sentry.md) | Sentry (adapt for Rollbar, Bugsnag, Airbrake) | -| Product analytics warehouse | [`databricks.md`](./sources/databricks.md) | Databricks SQL (adapt for Snowflake, BigQuery, ClickHouse, dbt) | - -Cross-cutting: - -- [`incident-postmortem.md`](./sources/incident-postmortem.md). Add this if the target code looks defensive (null checks, retry, timeout, rate limit, feature flag, egress guard, OOM handler). diff --git a/plugins/pstack/skills/why/references/sources/code-archaeology.md b/plugins/pstack/skills/why/references/sources/code-archaeology.md deleted file mode 100644 index e3555f8..0000000 --- a/plugins/pstack/skills/why/references/sources/code-archaeology.md +++ /dev/null @@ -1,51 +0,0 @@ -# Code Archaeology (git + in-repo) - -## What this source contains - -- Commit history (messages, dates, authors, diffs) -- PR descriptions, review comments, and discussion threads (via `gh`) -- Inline code comments, TODOs, FIXMEs, deprecation notes -- ADRs (architectural decision records) if the repo keeps them -- Tests, whose names and assertions often encode the edge cases that motivated a change -- Related files modified in the same commits (co-change signal) -- CHANGELOG entries and release notes in the repo -- Issue/ticket IDs in commit messages and PR bodies - -The most trustworthy source, tied directly to the code, and the most complete. Everything that went through the repo should be here. - -## How to search it - -Expand the seed commit list: - -```bash -# History through renames -git log --follow --oneline -- - -# Pickaxe: commits that added or removed this exact text -git log -S '' -- - -# Or for patterns: -git log -G '' -- - -# Who wrote each line and when -git blame -L , - -# One commit's full diff -git show - -# Commits between two points affecting this file -git log .. -p -- -``` - -Look for out-of-band docs: - -```bash -# ADRs often live in docs/adr/ or similar -rg -l -i 'architecture.decision' --glob '*.md' - -# TODOs and FIXMEs near the target -rg -n -C2 '(TODO|FIXME|HACK|XXX|NOTE)' - -# Related tests -rg -l '' --glob '*test*' -``` diff --git a/plugins/pstack/skills/why/references/sources/databricks.md b/plugins/pstack/skills/why/references/sources/databricks.md deleted file mode 100644 index 2770763..0000000 --- a/plugins/pstack/skills/why/references/sources/databricks.md +++ /dev/null @@ -1,70 +0,0 @@ -# Databricks Analytics & System Tables - -## What this source contains - -Databricks is the product-analytics, data-pipeline, and warehouse-telemetry layer. It complements Datadog. Datadog is the *infra/runtime* view, Databricks is the *product/data* view (what users did, which experiments ran, how feature usage evolved, where a threshold constant came from). - -- **Product analytics events.** `your_warehouse.events.analytics_track_event` (raw) and typed, deduplicated per-event dbt models in `..`. User behavior: feature invocations, clicks, accepts/rejects, submissions, client-reported errors. -- **Usage & billing events.** `your_warehouse.events.usage_event` / `..stg_usage_events`, `your_warehouse.events.raw_model_event` / `..stg_raw_model_events`. For cost- or volume-driven decisions. -- **Experiment / feature-flag data.** Exposure and outcome tables. **Schema is company-specific.** Probe with `SHOW TABLES` before assuming names. -- **System tables.** `system.query.history`, `system.compute.warehouses`, `system.billing.*`, `system.access.audit`. Answer "was this query expensive?", "how often did anyone run this?", "when did warehouse load spike?" -- **dbt lineage.** Models in `.` reveal what pipelines depend on a table/field. Upstream changes frequently motivate consumer-code changes. -- **Databricks notebooks.** Exploratory analyses engineers wrote before code changes. **Not queryable via the SQL MCP.** If you suspect the rationale lives in a notebook, name it as a gap. - -## How to search it - -Use the Databricks SQL MCP. Primary tool: `execute_sql_read_only`. If it returns a `statement_id`, poll with `poll_sql_result` rather than re-running. - -**Orient before querying.** Schemas are company-specific. Probe before trusting a table name: - -```sql -SHOW TABLES IN . LIKE '**'; -DESCRIBE TABLE ..stg_; -``` - -**Time-bound every query.** These tables are huge and unconstrained scans time out. Filter on `_timestamp` (events) or `start_time` (`system.query.history`) with a window bracketing the ship date, typically ~30 days before and after, wider only for strong reason. - -**Prefer typed dbt models over the raw table.** `..
` is deduplicated, typed, and liquid-clustered. `your_warehouse.events.analytics_track_event` has duplicates and untyped `properties_json`. Model-name pattern: `stg__`, where `` is `app`, `backend`, `website`, or `cli`. Confirm the exact model name with `SHOW TABLES` when the pattern alone doesn't resolve it. Drop to the raw table only when there's no dbt model yet, or you need events from inside the dbt refresh lag. - -**Column conventions on the typed dbt models** (knowing these avoids a `DESCRIBE` round-trip): - -- `_timestamp`, `_id`, `_auth_id`, `_request_id`, `event_name`. Standard on every model -- `properties_`. Typed, underscore-cased event properties (`properties_entrypoint`, `properties_size_bytes`, …) -- `context_team_id`, `context_client_version`, `context_country`, `context_client_os`. Pre-extracted client context - -### Investigation patterns that tend to pay off - -Pick the table + column combination that matches the target: - -1. **Event usage trajectory.** Daily counts on the relevant `stg_*` model across a ±30d window around the PR merge. A step function from zero to steady volume within a day or two of the merge is strong circumstantial evidence the PR launched the feature. A decay to zero suggests a deprecation or deletion. -2. **Guard-rail / defensive-check origin.** Distribution (median / p99 / max) of the relevant `properties_` column in the 14 days *before* the PR. A p99 that matches the target's threshold constant suggests the number was chosen from data. -3. **Experiment / feature-flag lookup.** `SHOW TABLES ... LIKE '*experiment*'` to find the exposure table, then pull exposure counts by variant for the relevant flag key near the PR date. -4. **Query-history evidence for migrations, backfills, or perf rewrites.** `system.query.history` filtered by `statement_text ILIKE '%%'` with a tight `start_time` window surfaces the expensive queries that likely motivated the change (sort by `total_duration_ms` or aggregate `SUM(read_bytes)`, `COUNT(*)`). -5. **dbt lineage.** If the target reads from or writes into a `.` model, the model's own git history (in this repo) often carries the rationale. Hand that lead back to the git investigator rather than chasing it yourself. - -## What good evidence looks like here - -Beyond the pattern shapes above: - -- An error-classifying event's count drops to near zero in the days after a defensive-code PR. Suggests the PR resolved that error class -- An exposure table row names the target's feature-flag key with a "shipped" / "concluded" decision around the PR ship date - -## Common pitfalls - -- **Instrumented ≠ caused.** An event's existence means someone cared enough to log it, not that the target code exists *because* of it. Pair with a PR/commit citation from the git investigator before claiming causation. -- **Silent instrumentation changes.** A step function in event volume may mean a new event started being logged, not that user behavior changed. Check for instrumentation PRs in the same window before reading the ramp as a feature-launch signal. -- **Schema drift.** Event properties evolve. A column on the typed dbt model today may not have existed when the target was written. Older data may carry the property only inside raw `properties_json`. -- **dbt refresh lag.** `..*` is rebuilt on a schedule (often hourly/daily). For events from the last few hours, fall back to `your_warehouse.events.*` and deduplicate by `_id`. -- **Company-specific tables.** Experiment, feature-flag, billing, and usage tables vary. Reporting a result from a table whose existence you never confirmed is a classic failure mode. Probe with `SHOW TABLES` / `DESCRIBE TABLE` first. -- **Retention cliff.** If the relevant window predates the table's retention or the dbt model's creation date, that's a *gap*, not a null result. Name it explicitly so the synthesizer doesn't read "no results" as "no activity." -- **Notebooks aren't queryable.** The SQL MCP can't see Databricks notebooks. If you suspect the rationale lives in one, return a gap. - -## What to return - -For each relevant finding: -- Type (product event / experiment exposure / usage or billing event / system-table row / dbt model) -- Fully-qualified table name and the exact query you ran -- Time window queried -- Compact numeric summary (counts, percentiles, first/last-seen timestamps). **Don't dump raw rows.** -- Temporal correlation with the target's ship date (e.g., "first row 2024-08-15, PR #49074 merged 2024-08-14") -- Relevance + strength: direct / circumstantial / weak diff --git a/plugins/pstack/skills/why/references/sources/datadog.md b/plugins/pstack/skills/why/references/sources/datadog.md deleted file mode 100644 index 536466d..0000000 --- a/plugins/pstack/skills/why/references/sources/datadog.md +++ /dev/null @@ -1,97 +0,0 @@ -# Datadog Telemetry - -## What this source contains - -Datadog holds the runtime record, what actually happened in production, as opposed to what was planned or discussed. - -- **Metrics.** Counters, gauges, histograms instrumented by the team. A metric's *presence* is itself evidence that someone thought the number worth watching. -- **Monitors & alerts.** Conditions the team decided warranted waking someone up. A monitor firing on `rate_limit_hit > 10/min` is direct evidence the team worried about that threshold. -- **Dashboards.** Curated views of what the team considers important for a subsystem. -- **APM traces & spans.** Request-level runtime data, for "why is this slow" / "why is there a timeout here" questions. -- **Logs.** High-volume event records, often holding the error conditions that motivated defensive code. -- **Incidents.** Formal incident records with timelines and linked postmortems. -- **Notebooks.** The team's exploratory investigations, often with hypotheses and analyses. - -## How to search it - -Use the Datadog MCP. Start broad, then narrow. - -1. **Identify the owning service(s).** - - ``` - search_datadog_services (filter by name or team) - search_datadog_service_dependencies (see upstream/downstream) - ``` - -2. **Dashboards and monitors first.** - - ``` - search_datadog_dashboards (query: feature name, service name, symbol) - search_datadog_monitors (same queries) - ``` - - When a dashboard or monitor covers the target, note its queries and watched thresholds. The threshold is frequently the answer to "why is this clamped at N?" - -3. **Metrics around the target.** - - ``` - search_datadog_metrics (by name pattern, e.g., the feature or symbol) - get_datadog_metric_context (metadata: description, units, tags) - get_datadog_metric (timeseries; "was there a spike around the PR date?") - ``` - - Correlating a metric's trajectory with the target's add/change date is strong supporting evidence: "the `payment_timeout` metric spiked 2023-11-03, and the retry logic merged 2023-11-06." - -4. **Logs. Narrow, don't dump.** - - ``` - search_datadog_logs (raw log patterns near the target, set use_log_patterns=true) - analyze_datadog_logs (SQL-style aggregations, only when you need counts) - ``` - - Search with symbols, error strings, or feature names. **Strongly prefer time-bounded queries** (e.g., 30 days before/after the change). - -5. **APM spans and traces.** - - ``` - aggregate_spans (stats: "how often does this endpoint fail?") - search_datadog_spans (inspect individual spans) - get_datadog_trace (a specific trace ID) - ``` - - Useful for timeouts, retries, slow paths, and cross-service behavior. - -6. **Incidents.** - - ``` - search_datadog_incidents (by title, team, date range) - get_datadog_incident (full detail for a specific incident) - ``` - - If the target looks defensive, search for incidents around the time it was added. An incident whose timeline includes "added defensive check for X" is near-direct evidence. - -## What good evidence looks like here - -- A monitor whose query and threshold match the constraint the code enforces (code clamps to 100, monitor alerts when requests exceed 100/min) -- A dashboard created by the target's author, with widgets that correspond to what the code measures or guards against -- A metric showing a production spike immediately before the code was merged, and stable values after -- An incident record referencing the target code, the same symbols, or the same error strings -- Logs showing a specific error pattern the defensive code would prevent, timestamped in the window before the change - -## Common pitfalls - -- **Correlation is not causation.** A spike before a PR and stabilization after is suggestive, not definitive, since other changes may have landed in the same window. Check neighboring PRs. -- **Overfitting to the chart you found.** A chart reflects its maker's framing. A chart named "retry success rate" is evidence the team cared about retry success, not that it's why a specific line of code exists. -- **Vanished telemetry.** Metrics can be renamed, deleted, or have short retention. If you can't find data from the relevant window, that's a gap, not a null result. -- **Noise at scale.** Narrow log searches by service, tag, and time window aggressively. Use `analyze_datadog_logs` to aggregate rather than dumping raw logs. -- **Instrumented != caused.** A metric shows someone cared enough to measure something, not that the code was added *because* of it. Cross-reference with commit/PR dates. - -## What to return - -For each relevant item: -- Type (dashboard / monitor / metric / log pattern / trace / incident / notebook) -- Title or name -- Link or identifier (dashboard ID, monitor ID, metric name, incident ID) -- Owner/author and created/modified date -- The specific condition, query, or quote that bears on the question (verbatim where possible) -- Relevance: what this suggests about the target code, and how strong the connection is diff --git a/plugins/pstack/skills/why/references/sources/incident-postmortem.md b/plugins/pstack/skills/why/references/sources/incident-postmortem.md deleted file mode 100644 index e7397e7..0000000 --- a/plugins/pstack/skills/why/references/sources/incident-postmortem.md +++ /dev/null @@ -1,5 +0,0 @@ -# Incident & Postmortem Context - -- **Linear**: look for tickets labeled `incident`, `sev-*`, `postmortem-action-item`, `reliability` -- **Slack**: search `#sev-*` and `#incident-*` channels around the dates the target code was added -- **Git**: commits with messages like "fix for incident", "add defensive check", "revert" followed by "re-apply with..." are strong signals diff --git a/plugins/pstack/skills/why/references/sources/linear.md b/plugins/pstack/skills/why/references/sources/linear.md deleted file mode 100644 index 899c643..0000000 --- a/plugins/pstack/skills/why/references/sources/linear.md +++ /dev/null @@ -1,48 +0,0 @@ -# Linear Tickets - -## What this source contains - -- Issues describing features, bugs, and their motivation -- Project docs attached to issues (often PRDs or specs) -- Parent/sub-issue relationships (broader initiative → specific tickets) -- Comments on issues (clarifications, scope changes, "why we're doing this" rationale) -- Labels (e.g., `compliance`, `customer-request`, `perf`) that signal the type of motivation -- Status updates that explain scope changes -- Attachments and linked GitHub PRs - -Linear is where the product/business context often lives: the "we're doing this because customer X asked" or "this is for the Q3 compliance initiative" layer. - -## How to search it - -Use the Linear MCP. - -1. **Start with linked tickets.** If the seed commits or PRs reference ticket IDs (e.g., `ENG-1234`, `[BUG-567]`), fetch those first with `get_issue`. Read the full issue including comments. -2. **List related issues by keyword.** Use `list_issues` with text search for the feature name, key symbol, or business term. Try multiple phrasings. -3. **Walk the issue tree.** If you land on a sub-issue, fetch its parent. Sub-issues are tactical. Parents often carry the "why." -4. **Read project docs.** If the issue belongs to a project, use `get_project` and check attached docs. Project-level documents are where specs and rationale are most often captured. -5. **Check labels and milestones.** Labels hint at the category of motivation (customer-request, incident-followup, compliance). Milestones tie work to deadlines, which often reveal motivation. - -## What good evidence looks like here - -- An issue description stating the business problem: "Customer Acme needs X because of their SOC2 audit" -- A comment recording a decision: "We decided to go with approach B because approach A would require touching the billing service" -- A parent issue titled like an initiative: "Q3 Enterprise Readiness" or "Reduce Payment Failures" -- An attached PRD or spec -- Labels like `customer:acme`, `incident-followup`, `compliance`, `perf-regression` - -## Common pitfalls - -- **Scope drift.** The ticket the PR references may have been closed and reopened with a different scope. Read the whole history. -- **Mechanical templates.** Some teams require "Why" sections but fill them with boilerplate. Generic text ("improve user experience") is probably not a real answer. -- **Stale tickets.** Old tickets often reflect a version of the plan that changed. Check dates and cross-reference with the code's ship date. -- **Closed-as-duplicate chains.** Follow the duplicate-of relationships back to the canonical ticket. -- **Private workspace content.** If you can't access an issue, note that as a gap rather than guessing. - -## What to return - -For each relevant ticket: -- Ticket ID and title -- The problem/motivation quoted from the description or comments (not paraphrased. The synthesizer needs the exact text to cite) -- Labels, parent issue, project -- Author, created date, closed date -- Link to the ticket if available diff --git a/plugins/pstack/skills/why/references/sources/notion.md b/plugins/pstack/skills/why/references/sources/notion.md deleted file mode 100644 index d16230a..0000000 --- a/plugins/pstack/skills/why/references/sources/notion.md +++ /dev/null @@ -1,55 +0,0 @@ -# Notion Docs - -## What this source contains - -- PRDs (product requirement documents) -- Technical specs and RFCs -- Architectural decision records (ADRs) -- Meeting notes from design reviews -- Team pages with domain context -- Postmortems from incidents -- Runbooks that may explain defensive code -- Strategy documents that set priorities - -Notion is where "why" often lives in long-form before it becomes code. A significant feature usually has a doc. - -## How to search it - -Use the Notion MCP. - -1. **Keyword searches with `notion-search`.** Try: - - The feature name - - Key symbols / class names from the target code - - Author handles (design docs are often authored before the code lands) - - Error strings or user-visible terms - - Time-bounded queries if you know when the code shipped -2. **Fetch candidate pages with `notion-fetch`.** Read the full content, not the preview. Rationale is often buried mid-document. -3. **Follow backlinks and child pages.** Design docs often have sub-pages for alternatives considered, appendices, or implementation notes. -4. **Check related databases.** `notion-query-data-sources` and `notion-query-meeting-notes` can surface meeting notes that discussed the decision. -5. **Search author-specific spaces.** If the PR author has a personal notebook (common at some companies), it may hold exploratory thinking that preceded the code. - -## What good evidence looks like here - -- A PRD with a "Problem statement" or "Motivation" section that matches the target code's purpose -- An "Alternatives considered" or "Rejected approaches" section -- A postmortem that names the target code as the fix for a specific incident -- Meeting notes that record "we decided X because Y" and tie to the same author/date range as the PR -- An ADR template filled out non-trivially (status, context, decision, consequences) - -## Common pitfalls - -- **Outdated docs.** Specs are often written before implementation and not updated. The doc may describe a plan that changed. Cross-check against the actual PR. -- **Doc vs. reality drift.** A spec may say "we'll do X" but the code actually does Y. Flag the divergence. The synthesizer will surface the contradiction. -- **Boilerplate templates.** Some orgs require a "Why" section that gets filled with fluff. Look for specificity. -- **Unlinked docs.** The most relevant doc may not be linked from anywhere. Broad keyword searches help. -- **Multiple drafts.** If a topic has multiple docs, find the one that was finalized or most recently updated. Check dates. -- **Access-restricted pages.** If you can't access a page, note it as a gap. - -## What to return - -For each relevant doc: -- Title and URL -- Authors and last-updated date -- The motivation text (verbatim quote), with page/section location -- Relevant linked pages (so the synthesizer can cite them) -- Whether the doc was finalized or draft diff --git a/plugins/pstack/skills/why/references/sources/sentry.md b/plugins/pstack/skills/why/references/sources/sentry.md deleted file mode 100644 index 8200fd9..0000000 --- a/plugins/pstack/skills/why/references/sources/sentry.md +++ /dev/null @@ -1,66 +0,0 @@ -# Sentry Error History - -## How to search it - -Use the Sentry MCP. - -1. **Orient.** If you don't know the project slug and organization: - - ``` - find_organizations - find_projects - ``` - -2. **Search for issues related to the target.** - - ``` - search_issues (natural language, e.g., "errors in PaymentService timeout", "unhandled exceptions in uploadFile") - ``` - - Build queries from the exception class names the target handles, its function or class name, the error message strings it checks for, and its file path. - -3. **Narrow by release and time window.** - - ``` - search_issue_events (filter by release, time, environment, trace ID, tags) - get_issue_tag_values (for an issue, see distribution across versions, users, environments) - ``` - - For a suspected issue, check **first seen** and **last seen** (does the stop line up with the target's ship date?), the **affected releases** (which saw it, and which was the fix?), and the **frequency trajectory** (did it spike, then get resolved?). - -4. **Pull the full event for context.** - - ``` - get_sentry_resource (pass a Sentry URL or type+ID) - ``` - - Does the stack trace pass through the target code? Do the tags and breadcrumbs match the conditions the target defends against? - -5. **Check releases that landed near the target.** - - ``` - find_releases (around the commit date of the target) - ``` - - Cross-reference release version with the PR's merge date. - -6. **Use Seer sparingly.** - - ``` - analyze_issue_with_seer - ``` - - Seer's AI root-cause analyses are a hypothesis generator. Treat them as inference, not authoritative. The actual events and stack traces are the primary evidence. - -## What to return - -For each relevant issue: -- Issue ID and title -- Project and organization -- First seen / last seen timestamps -- Event count (and sampling rate if known) -- Affected releases -- A representative stack trace snippet showing relevance to the target (verbatim excerpt, not summary) -- First/last-seen correlation with the target's ship date -- Link to the issue -- Any author comments or resolution notes diff --git a/plugins/pstack/skills/why/references/sources/slack.md b/plugins/pstack/skills/why/references/sources/slack.md deleted file mode 100644 index cadd561..0000000 --- a/plugins/pstack/skills/why/references/sources/slack.md +++ /dev/null @@ -1,17 +0,0 @@ -# Slack Conversations - -## How to search it - -Slack MCP tools vary. Check which Slack MCP is available and inspect its tool schema first. It may require `mcp_auth`. If authentication fails, stop and report the gap. - -1. **Author-bounded search.** Messages from the PR author around the PR merge date. Limits scope dramatically and often hits gold. -3. **PR URL search.** Slack often links PRs when they're reviewed or discussed. Search for the PR URL (or just `/pull/`). -4. **Error string search.** If the code handles a specific error, search for the error string. Incident threads often surface. - -## Common pitfalls - -- **Channel archaeology limits.** Very old messages may be gone due to retention policies. If you can't find anything before a certain date, note the retention cliff. -- **Unsearched DMs.** Many decisions happen in DMs that aren't searchable. You'll miss them. That's a known limitation. -- **Speculative jokes as "decisions."** Slack is casual. "Lol just do the thing" isn't a decision, even if it preceded the commit. Look for considered discussion. -- **Context collapse in single messages.** Without the thread, a single message often reads differently than in context. Always fetch threads. -- **Auth failures.** If the MCP isn't authenticated, stop. Don't make up findings. Report that Slack wasn't searchable. diff --git a/plugins/pstack/skills/why/references/synthesizer-prompt.md b/plugins/pstack/skills/why/references/synthesizer-prompt.md deleted file mode 100644 index 287a350..0000000 --- a/plugins/pstack/skills/why/references/synthesizer-prompt.md +++ /dev/null @@ -1,129 +0,0 @@ -# Synthesizer Prompt Template - -Fill in the placeholders. - ---- - -You are answering a "why" question about a piece of code by synthesizing findings from investigators who searched different historical sources (source control, issue / ticket tracker, long-form documents, real-time team chat, infrastructure observability, error / exception tracking, product analytics warehouse, and code comments). Produce a confidence-weighted, evidence-cited narrative that says honestly what the evidence supports, and just as honestly what it doesn't. - -## The Question - -> {QUESTION} - -## The Code Anchor - -**Target files:** {FILES_WITH_LINE_RANGES} - -**Key symbols:** {SYMBOLS} - -## Investigator Findings - -{ALL_INVESTIGATOR_FINDINGS} - -## Sources That Weren't Searched - -{SKIPPED_SOURCES_WITH_REASONS} - -## Epistemics Framework - -You MUST follow `references/epistemics.md`. Read it in full before writing. The key rules: - -1. Every claim must sit in one tier: **Direct**, **Supported**, **Inferred**, **Speculative**, **Unknown**. The tier sets its section and its phrasing. -2. Every Direct/Supported claim must have a citation (PR #, ticket ID, doc URL, chat permalink, commit hash, or file:line). -3. Inferred and Speculative claims must use hedged language ("appears to", "likely", "suggests", "one possibility is"). -4. Never cite code as evidence for its own intent. -5. Document gaps. Don't fill them with plausible-sounding guesses. -6. Treat a hypothesis embedded in the user's question as a candidate, not a conclusion. Check it independently. - -## Instructions - -1. **Read all investigator findings** and weigh the evidence yourself. Investigators gathered raw evidence, not conclusions. -2. **Merge overlaps.** When several investigators cite the same PR, ticket, or doc, give it one authoritative reference. -3. **Surface contradictions.** When two items disagree, show both. Don't pick one. -4. **Calibrate each claim.** Find its evidence and tier. Direct: cite it and state it plainly. Inferred: hedge it and show the inference. Speculative: mark it. No evidence: put it in the gaps. -5. **Verify citations by spot-checking.** If you're uncertain a cited item exists or says what the investigator claims, check it by reading the codebase or calling MCP tools. Don't propagate errors. Do not write files, commit, or modify external state. -6. **Don't overreach.** The user will act on this. Leave an open question open rather than fill it with a confident guess. - -## Output Format - -Write for the user, in this exact structure: - ---- - -### The Question - -Restate the user's question in one or two sentences. - -### The Code in Question - -File paths, line ranges, key symbols. Two or three lines to orient a cold reader. - -### What We Found - -Claims with textual evidence, each quoted or paraphrased and cited precisely: - -- **[Direct]** {Claim}. Source: [PR #123](url) / ticket ID / file:line. {Brief quote or paraphrase.} -- **[Supported]** {Claim}. Evidence: {list of items and what each contributes}. - -`[Direct]` is single-source, explicit evidence. `[Supported]` is multiple indirect items converging on a conclusion. - -### What We Can Reasonably Infer - -Claims stated nowhere but well-supported by indirect evidence. Each bullet must make the inference chain visible ("Given A and B, it's likely that C") and must use hedged language ("appears to", "likely", "suggests", "is consistent with"): - -- **[Inferred]** {Hedged claim}. Reasoning: {the specific evidence and the inference step}. - -Skip this section if there's nothing to infer. - -### Competing Hypotheses - -If the evidence fits multiple stories, present each. Don't force a winner the record doesn't support. For each hypothesis: - -- **Hypothesis:** {one-sentence statement} -- **Evidence for:** {specific items} -- **Evidence against or missing:** {what would need to be true but isn't, or what counter-signals exist} - -Skip this section if there's a single clear answer. - -### What We Don't Know - -Specific gaps: "We searched the issue tracker for [query1], [query2], [query3] and found no issue discussing the rate-limit threshold", not "We don't know why." Include: - -- Questions that went unanswered -- Searches that returned nothing -- Sources that were unavailable, and why (such as a missing real-time team chat MCP) -- People who would likely know but whom you can't ask - -### Sources Consulted - -What was actually searched, so the user can judge coverage and redirect: - -- **Source control history**: {file paths}, {number of commits reviewed}, PRs #{numbers}, and code comments searched. Or "Not searched. This should not happen because git and `gh` are always expected." -- **Issue / ticket tracker**: {ticket IDs and keyword searches}. Or "Not searched. No matching MCP available in this environment." -- **Long-form documents**: {page titles and search queries}. Or "Not searched. No matching MCP available in this environment." -- **Real-time team chat**: {channels searched, date ranges, queries}. Or "Not searched. No matching MCP available in this environment." -- **Infrastructure observability**: {dashboards, monitors, metrics, logs, traces, or incidents searched}. Or "Not searched. No matching MCP available in this environment." -- **Error / exception tracking**: {issues, events, or releases searched}. Or "Not searched. No matching MCP available in this environment." -- **Product analytics warehouse**: {fully-qualified tables queried, the time windows, and the numeric summaries (counts, percentiles, first/last-seen timestamps) that bore on the question}. Or "Not searched. No matching MCP available in this environment." - -### Confidence Summary - -One or two sentences on overall confidence, e.g.: - -> "The core rationale (A) is well-supported by direct PR and ticket evidence. The specific threshold value (100) is inferred from the surrounding context but not explicitly documented. The question of whether this was driven by a customer request could not be answered. No relevant issue tracker or long-form doc content surfaced, and real-time team chat search was unavailable." - ---- - -## Quality Check Before Returning - -Revise if any item fails: - -1. Does every claim in "What We Found" have a citation? If not, add one or move it to "Inferred" or "Hypotheses." -2. Is the phrasing tier-appropriate? (Direct claims can use "because". Inferred claims cannot.) -3. Did you surface every contradiction you noticed, or quietly pick one? -4. Does "What We Don't Know" name specific gaps? If it's empty or missing, be suspicious. Historical investigations almost always have gaps. -5. Did you check any hypothesis embedded in the question against the evidence rather than rubber-stamp it? -6. Did you cite code as evidence for its own intent? Remove it. Code is mechanics, not motivation. -7. Is the tone calibrated? A confident-sounding answer on weak evidence is the exact failure this skill exists to prevent. - -The value of this output is its honesty, not its authority. A reader who takes it to the original author, an engineering lead, or a product manager should know what's known, what's inferred, and what's missing, so they can ask the right follow-up questions. Optimize for being useful, not for looking decisive. From 254e34c3627f74902b1f6c06e98dcc4ff9272866 Mon Sep 17 00:00:00 2001 From: Negrescu Alexandru Date: Mon, 16 Nov 2026 11:39:36 +0200 Subject: [PATCH 2/2] fix(port): map effort-less Claude fast slugs to the fast code tier --- omp-port/rules.sed | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/omp-port/rules.sed b/omp-port/rules.sed index 32aede0..8cc5898 100644 --- a/omp-port/rules.sed +++ b/omp-port/rules.sed @@ -187,6 +187,8 @@ s#Spawn one investigator subagent per source, in agent mode because readonly str ## 2. Model slugs. Tiered by capability first, then a catch-all for anything upstream adds later. +# Cursor's fast slug in a Claude family, effort token in the middle -> the fast code capability. +s#`claude-[a-z]+-[0-9.-]+-([a-z]+-)?fast`#your fast code model#g # Cursor's strongest reasoning slug -> the judgment capability the operator binds. s#`claude-fable-[0-9.-]+(-(thinking-)?[a-z]+)?`#your strongest judgment model#g # Cursor's second reasoning family -> the same judgment capability. @@ -197,8 +199,6 @@ s#`gpt-[0-9.]+-sol-[a-z]+`#your strongest instruction-following model#g s#`grok-[0-9.]+-([a-z]+-)?fast(-[a-z]+)?`#your fast code model#g # The same family under Cursor's provider prefix, effort token in the middle. s#`cursor-grok-[0-9.]+-([a-z]+-)?fast`#your fast code model#g -# Cursor's fast slug in a Claude family, effort token in the middle -> the fast code capability. -s#`claude-[a-z]+-[0-9.-]+-([a-z]+-)?fast`#your fast code model#g # Cursor's third-vendor panel slug -> the capability a panel uses it for. s#`gemini-[0-9.]+-[a-z]+-[a-z]+`#your strongest model from another vendor#g # Catch-all for a slug no tier above knows. Two hyphen groups required, so a short illustrative