关于 setup-pstack
Setup pstack 用于为不同运行环境中的 pstack 角色配置模型。它会检测可用模型、按推理预算调整选择,并写入 Cursor、Claude Code 或其他环境对应的设置文件。
主要功能
- 01检测可用的子 Agent 模型
- 02按角色配置模型
- 03应用推理预算设置
- 04写入对应环境的设置文件
- 05写入前确认角色配置
适用场景
- 01为新的运行环境配置 pstack
- 02更新角色与模型的对应关系
- 03按推理预算调整模型选择
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ backnotprop/ pstack --skill setup-pstack安装后在 Claude Code 中输入/setup-pstack确认已加载。
详细介绍
设置 pstack
填写 pstack 的模型设置,每个角色使用一个模型:
- Cursor:
~/.cursor/rules/pstack-models.mdc,一条始终应用的规则。 - Claude Code:
~/.claude/rules/pstack-models.md。Claude Code 会在每个新会话中加载~/.claude/rules/里的所有文件。 - 所有其他 harness(Codex、Pi、OpenCode 等):
~/.agents/pstack-models.md。这些 harness 不会自行加载该文件,因此 pstack 技能会在选择模型时读取此文件。
下文中的“设置文件”指你的 harness 对应的文件。在 Claude Code 中,如果该文件不存在,请改为读取 ~/.agents/pstack-models.md;此技能的旧版本会将设置写入该文件。
步骤
1. 检测可用模型
枚举本会话中可传递给子 Agent 的模型 slug(Cursor Task、Claude Code Agent、OpenCode task、Codex spawn_agent)。这是可靠的数据来源。如果你的 harness 还有列出用户模型的命令,请优先使用该命令以确保完整性(例如 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)。优先使用结构化提问工具,而不是自由文本。对于面板角色(arena runners、architect runners、interrogate reviewers),值是一个列表,每个条目都会运行一个子 Agent,别名条目也包括在内,因此列表长度决定数量。arena cross-judge pool 也是一个列表,但 Arena 会从中选择一个与父级模型系列不同的值(如有可能)。swarm workers 是所有 worker 的默认模型,除非某场竞赛或比较为每个参赛方指定了其他模型。
4. 验证
所有实际写入的 slug 都必须属于检测到的集合。inherit-parent 和 auto 始终通过。如果所选的实际 slug 不可用,请停止并再次询问。
5. 编写规则
编写设置文件,其中包含一行 # budget,写入所选标签及其目标 effort,并为每个角色各写一行,使用与 poteto-mode 相同的标签。在 Cursor 中,包含以下 frontmatter,并设置 alwaysApply: true。在其他运行环境中,编写不带 frontmatter 的设置文件(从第一行 # 开始)。覆盖整个文件,确保重复运行时结果保持幂等。格式:
---
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 和 Claude Code 中,设置会应用于新会话。在其他运行环境中,pstack 技能会在选择模型时读取 ~/.agents/pstack-models.md。重新运行此技能会更新该文件。
7. 提供验证技能(可选)
检查项目是否有办法驱动真实应用来验证效果(verify-* 技能或现有测试框架)。如果没有,只询问一次:“想要一个项目本地的验证技能,让 Agent 能像用户一样操作应用并证明改动有效吗?我可以用 /create-verification-skill 为你生成。”如果用户同意,则调用 /create-verification-skill(从 pstack 的安装位置解析:工作区、用户目录或插件)。如果不同意,则继续,不要强推。
8. 提供形式化验证技能(可选)
检查项目是否已有形式化验证技能(可针对代码运行模型检查器、证明或其他验证器的项目技能)。如果没有,只询问一次:“想要一个形式化验证技能,让 Agent 能证明代码的某项关键属性在适用范围内的所有情况下都成立,而不只是测试覆盖到的情况吗?我可以用 /create-formal-verification-skill 为你生成。”如果用户同意,则调用 /create-formal-verification-skill(从 pstack 的安装位置解析:工作区、用户目录或插件)。如果不同意,则继续,不要强推。