关于 setup-pstack
用于按角色配置 pstack 模型的设置技能,支持 Cursor 和其他 harness。它检测可用模型 slug,按选定的推理预算调整映射,经确认后写入相应设置文件。
主要功能
- 01检测可用模型 slug
- 02设置推理预算
- 03按角色映射模型
- 04验证模型是否可用
- 05写入对应 harness 设置
适用场景
- 01为新 harness 配置 pstack
- 02按预算调整角色模型
- 03更新现有模型设置
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ q-qp-p/ pstack --skill setup-pstack安装后在 Claude Code 中输入/setup-pstack确认已加载。
详细介绍
设置 pstack
为 pstack 编写模型设置,每个角色指定一个模型:
- Cursor:
~/.cursor/rules/pstack-models.mdc,一条始终应用的规则。 - 所有其他运行环境(Claude Code、Codex、Pi、OpenCode 等):
~/.agents/pstack-models.md。这些运行环境不会加载 Cursor 规则,因此 pstack 技能会在选择模型时读取此文件。
下文中的“设置文件”指你所用运行环境对应的文件。读取时,检查这两个路径,并使用存在的那个。
步骤
1. 检测可用模型
枚举本次会话中可传给子 Agent 的模型 slug(Cursor Task、Claude Code Agent、OpenCode task、Codex spawn_agent)。这是可靠的信息来源。如果你的运行环境还提供列出用户模型的命令,为确保完整性,请优先使用该命令(例如 opencode models 或 pi --list-models)。如果无法检测到任何模型,请让用户粘贴他们有权使用的 slug。绝不要写入尚未确认可用的真实 slug。别名 inherit-parent 和 auto 始终有效,即使它们不是检测到的 slug。
2. 加载当前状态
默认的角色到模型映射采用下方步骤 5 所示的规则格式。如果设置文件已存在,请读取其中的 # budget 行和各角色的值,并将它们视为当前选择。否则,从这些默认值开始。不属于步骤 5 中角色的行(例如 how critics)属于已弃用角色,应删除。
3. 预算、映射并确认
(a) 询问预算。 优先使用结构化提问工具(Cursor 中的 AskQuestion、Claude Code 中的 AskUserQuestion、OpenCode 中的 question),而非自由文本。提供以下四个选项,标签必须完全一致;如果规则中记录了当前预算,还要指出当前预算。没有规则时,说明 large 与技能默认值相符。
unlimited — max reasoninglarge — xhigh reasoningmedium — high reasoningsmall — medium reasoning
(b) 应用预算。 根据技能默认值构建工作表;重新运行时,保留你按系列、列表或别名(inherit-parent、auto)更改过的角色。unlimited、large、medium 和 small 会将每个真实 slug(包括面板条目)的努力级别标记分别设为 max、xhigh、high 或 medium。努力级别标记是最后一个标记,或末尾 fast 前面的标记;级别依次为 max > xhigh > high > medium > low。如果结果不是检测到的 slug,就使用同一系列中努力级别不高于目标值且级别最高的检测到的 slug;若没有,则将该角色标记为需要选择。inherit-parent 和 auto 不变。因此,unlimited 会将 claude-opus-5-5-xhigh 变为 claude-opus-5-5-max。Grok slug 的最高级别为 xhigh,因此在 unlimited 下,回退规则会将 Grok 设为 xhigh,并保持 grok-4.7-xhigh-fast 不变。large 会保留这两个默认值。small 会将它们变为 claude-opus-5-5-medium 和 grok-4.7-medium-fast。
(c) 显示角色并确认。 显示每个角色及其模型,并将任何不在检测集合中的真实 slug 标记为需要选择。还要列出步骤 2 删除的每一行。询问用户是接受当前设置,还是要更改特定角色,并提供检测到的模型以及 inherit-parent 和 auto 作为选项(两者都表示:该角色使用父级对话模型运行,这也是 Auto 用户继续使用 Auto 的方式)。优先使用结构化提问工具,而非自由文本。对于面板角色(竞技场运行器、架构师运行器、审查评审员),其值是一个列表,每个条目都会运行一个子 Agent,别名条目也包括在内,因此列表长度决定运行数量。arena cross-judge pool 也是一个列表,但 Arena 会从中选择一个模型系列尽可能不同于父级模型的值。swarm workers 是每个工作 Agent 的默认模型,除非竞赛或比较为每个分支分配了其他模型。
4. 验证
写入的每个真实 slug 都必须属于检测集合。inherit-parent 和 auto 始终通过验证。如果所选真实 slug 不可用,请停止并重新询问。
5. 编写规则
写入设置文件:添加一行 # budget,包含所选标签及其目标 effort;然后每个角色各占一行,使用 poteto-mode 使用的相同标签。在 Cursor 中,添加以下 frontmatter,并设置 alwaysApply: true。在其他 harness 中,不添加 frontmatter,直接写入 ~/.agents/pstack-models.md(从第一个 # 行开始)。覆盖整个文件,确保重复运行时结果一致。格式如下:
---
description: pstack per-role model choices (overrides skill defaults)
alwaysApply: true
---
# pstack model configuration. One line per role. Delete a line to fall back to the skill default.
# `inherit-parent` or `auto` as a value: the role runs on the parent chat model (omit the subagent `model`). Alias entries in a panel list still count toward its fan-out.
# budget: large (xhigh)
feature, refactoring: grok-4.7-xhigh-fast
bug-fix: grok-4.7-xhigh-fast
perf-issue: grok-4.7-xhigh-fast
hillclimb: grok-4.7-xhigh-fast
judgment and prose: claude-opus-5-5-xhigh
hardest tasks: claude-opus-5-5-xhigh
how explorer: grok-4.7-xhigh-fast
how explainer: claude-opus-5-5-xhigh
why investigators: grok-4.7-xhigh-fast
why synthesizer: claude-opus-5-5-xhigh
reflect tooling: grok-4.7-xhigh-fast
reflect judgment, divergent, synthesizer: claude-opus-5-5-xhigh
arena runners: claude-opus-5-5-xhigh, grok-4.7-xhigh-fast
arena cross-judge pool: claude-opus-5-5-xhigh, grok-4.7-xhigh-fast
swarm workers: grok-4.7-xhigh-fast
architect runners: claude-opus-5-5-xhigh, grok-4.7-xhigh-fast
interrogate reviewers: claude-opus-5-5-xhigh, grok-4.7-xhigh-fast
6. 确认
告知用户写入了哪个文件。在 Cursor 中,该规则适用于新会话。在其他 harness 中,pstack 技能会在选择模型时读取 ~/.agents/pstack-models.md。再次运行此技能会更新该文件。
7. 提供验证技能(可选)
检查项目是否有用于驱动真实应用以验证结果的方式(例如 verify-* 技能或现有 harness)。如果没有,只询问一次:“想要一个项目本地的验证技能吗?这样 Agent 就能像用户一样驱动应用,并证明更改有效。我可以用 /create-verification-skill 生成一个。”如果用户同意,调用 /create-verification-skill(会在 pstack 的安装位置解析:工作区、用户目录或插件)。如果用户拒绝,则继续,不要施压。